Questions tagged [c++]
General-purpose programming language used widely in game development and CPU-intensive tasks.
202
questions
0
votes
0
answers
115
views
Path tracer -- How to debug erroneous behaviour?
Edit: I've pinpointed the problem. If I change:
local_colour *= (rayPayload.color.r*mask.r + rayPayload.color.g*mask.g + rayPayload.color.b*mask.b);
into
...
2
votes
1
answer
37
views
What is a smart way to fill in the 'next' pointer of a opposite half-edge of a boundary?
I was reading this question regarding half edges from 3 years ago and the selected answer seemed pretty smart to me. However, while actually implementing it I'm confused at the part where I have to ...
0
votes
0
answers
199
views
Vulkan backward-only path tracer with caustics
TL;DR -- who has discovered, in the past, a backward-only path tracer that generates caustics not needing extra convergence of any kind? I'm collecting similar algorithms, in order to fully understand ...
1
vote
1
answer
64
views
Vulkan Syscalls
I'm working on educating myself more about computer graphics, and the more I learn and play with the technology, the more I get frustrated by the dependencies on C++ (even though I know why it exists)....
-1
votes
1
answer
154
views
How to send data from a C# application to a C++ DLL?
I have a C++ graphics engine and I would like to build an editor for it in C#. I want to be able to send data from the editor to the engine such as what tool is being used and any user-defined ...
0
votes
1
answer
68
views
Triangle Rasterization Shaking Issues
I am making a Software renderer, and I noticed that there is a screen shaking like effect happening. shown in the first video:
I tried doing filling without clipping against the small square, and the ...
0
votes
0
answers
55
views
How would you represent a mesh with tris and quads?
My understanding is that, while subdivision algorithms like Catmull-Clark can work for any polygonal mesh (including triangles) it's preferable to start with a quad mesh.
Currently my rendering engine ...
1
vote
1
answer
67
views
convert right handed matrix into left handed forward/up/right vectors
I have an openGL style matrix (column major, right handed ) that needs to be converted into two vectors (forward and up)
I've managed to find, in a weird way, a solution that matches the the ...
0
votes
0
answers
25
views
DirectX 11 - 3D - VBO indexing per object's buffered attributes?
If I have a series of vertices positions:
(x1, y1, z1)
(x2, y2, z2)
(x3, y3, z3)
...
1
vote
1
answer
124
views
Converting points, vectors, normals between world and object space for a ray tracer gives weird results
I'm writing a ray tracer but having trouble converting rays and normals between world space and object space.
I am creating a Ray, then transforming it with transformation matrices, calculating ...
1
vote
1
answer
41
views
Why does my uniform only update once?
I have a work thread function which updates the value of a float called scale:
...
2
votes
1
answer
1k
views
OpenGL and GLUT in x64 on Windows (Visual C++ 2019)
I'm just starting to self-learn OpenGL. I have OpenGL A Primer (2nd edition) by Edward Angel and I found this useful site for setting up OpenGL with Visual Studio 2019 on Windows:
https://www....
0
votes
0
answers
104
views
PBRT: why normalize ray's direction
In PBRT Chapter Camera Model, when describing Camera::GenerateRay(), it writes
It is important that the direction component of the returned ray be normalized—many ...
-1
votes
1
answer
367
views
Is a line drawn using vectors, triangles or polygons within OpenGL? [closed]
Trying to understand how OpenGL generates what is seen as images & graphics and these questions come up.
Are 3D lines (which should be drawn using vectors) drawn using triangles or polygons? Or ...
1
vote
0
answers
68
views
parallelizing a software rasterizer algorithm using opencl
I've written a small software rasterizer using OpenCL and would like to optimize and parallelize it more, currently I'm scanning the whole screen and see if the triangle overlaps with the pixels..
I ...
0
votes
1
answer
174
views
Computing vertex normals in mesh triangle soup
I am using c++. I have to find vertex normal in mesh. The mesh is triangle soup. The winding order is inconsistent. I know that it is the sum of all faces normals arround the vertex. But I don't know ...
1
vote
0
answers
75
views
Perlin noise is mysteriously ignored when the pattern is rotated 45 degrees
I am creating different coloring patterns for my CPU raytracer, such as checker, gradient, ring, stripe pattern etc. The problems started when I tried to create a perturbation pattern (of a subpattern)...
0
votes
1
answer
200
views
Split a string of line segments into several other line segments
I have written a code to extend "n" points, constituting "n-1" lines ,to constitute more lines so you can map "m" data to "m" lines with m > n-1.
This is the ...
0
votes
0
answers
35
views
How do I make "attribute vec0.5" in GLSL. Sorry if it confuses
Is it possible, in OpenGL (specifically in WebGL), to use a single value from buffer for multiple shader iterations? Like to put the same element from buffer into shader attribute multiple times?
Like:...
0
votes
0
answers
69
views
How to make sure that triangles share edges (also not overlap each other) when rendering a quadrilateral?
Here is my simple scanline-based triangle rasterizer using pure integer arithmetic. I adapted the code from this Stack Overflow answer The below code attempts to render a coloured quadrilateral by ...
-1
votes
1
answer
668
views
Hosting OpenGL C++ Window in C# WPF
I am following this tutorial on how to host Win32 OpenGL windows in WPF. There is also a Microsoft walkthrough on how to Host a Win32 Control in WPF that is useful aswell. The original project is from ...
0
votes
1
answer
597
views
How to rotate and move group of objects in OpenGL?
What do I have now?
I have a cube consisting of 6 planes. All these planes I generate in XY coordinates and then place them by matrix transformations.
I need to rotate my cube along the global axis ...
0
votes
1
answer
97
views
How to give C++ GLUT project an Editor/UI?
I want to render my OpenGL GLUT project to a window/control in C# WPF. I have read articles online from Microsoft on how to do it but I am very confused.
Does anyone have any experience with this? ...
1
vote
2
answers
147
views
Why is there a straight line between my bezier paths?
I have created a bezier curve tool and each time I draw a bezier curve segment I get a straight line between each mouse click. I don't understand why this is happening and was wondering if someone ...
1
vote
1
answer
123
views
Defining the proper sdf for this structure
I am making a procedural sdf (just a bunch of cubes) based of an image. The idea is very simple. We have a stencil image:
Each texel in the image corresponds to a 3D cube. So to ray trace what I am ...
1
vote
1
answer
262
views
3D head mesh morphing from one mesh into another using coding
I have 2 3D head images and want to morph one into the other (animation) without using blender etc. I want to do it using coding preferably using C++, C# or python(libraries are ok). I have done 2D ...
0
votes
0
answers
91
views
How to delete a face using open mesh?
Pretty much the title I am trying to delete a few faces of a mesh using open mesh, like this:
...
0
votes
1
answer
99
views
Question about using glVertexAttribArray
After defining an attribute pointer, why can't I just reuse it? I have a VAO bound so shouldn't it just accept the AttributePointer I defined with the last VAO?
...
0
votes
0
answers
70
views
ray triangle mesh intersection triangles inverted
I'm trying to render a dodecahedron triangle mesh and the triangles seem flipped or mirrored somehow. The first picture is what I should be getting, the second picture is what I'm getting and the last ...
0
votes
0
answers
69
views
16 bit SNORM format not correctly storing Z component?
I generate a normal GBuffer in my engine, and I store it using a R16G16B16A16_SNORM format like this:
...
0
votes
1
answer
136
views
Passing non-interleaved data to glBufferStorage without using glBufferSubData
I would like to use glBufferStorage to load data once into the vertex buffer. However sometimes I want to pass non-interleaved data from separate arrays like shown ...
1
vote
1
answer
95
views
Stripping unnecessary data from C++ data structures before sending to GPU
I've recently been working on a particle system in my renderer and I've encountered a situation where my particle class on the C++ side has data I need to maintain my particle on that end, but that I ...
1
vote
1
answer
2k
views
What is the Viewport?
Can someone please explain to me what the Viewport is. I've read the OpenGL wiki and doc.gl but they give me a definition that I don't understand at all. The definition they gave me is "...
0
votes
1
answer
141
views
Understanding how gradient noise generation works
When attempting to compute the gradient noise derivatives I've seen the use of a function named "hash" and I don't understand its purpose (nor why they have commented that it should be ...
3
votes
1
answer
243
views
Problem when performing IFFT for Tessendorf's ocean waves
I am implementing Jerry Tessendorf's ocean waves as described in his paper in c++ and OpenGL.
I implemented two compute shaders, one for the h_tilde_0 and its conjugate, and one for the frequency ...
1
vote
2
answers
541
views
Reducing Cascaded Shadow Mapping Artifacts
I've been trying to get my cascaded shadow maps looking right for a while. I managed to fix the shimmering and most of the quantization artifacts, but for some reason the shadows still look really ...
0
votes
1
answer
509
views
1
vote
1
answer
221
views
How to use trackball for rotating an camera matrix in eye frame
I have a QOpenGLWidget where I use camera transformation matrix(4,4), FOV and vectors Position(4), Up(4), Forward(4). I also have an ArcBall which I can use. I managed to implement zoom and pan by ...
2
votes
1
answer
212
views
Environment map importance sampling (beginner)
beginner here.
I am implementing importance sampling for environment maps in Scotty3D, a CMU CS project (but I am not a student).
The task can be found here
I have a problem with the sample's pdf, it ...
1
vote
1
answer
513
views
Half-Edge Data Structure with holes
I am trying to implement next/prev of edges in half-edge data structure. But I ran into this question. If there are two holes with a common vertex, will the closed loop of the edges run as in the ...
0
votes
1
answer
410
views
My OpenGL program is not drawing filled polygons
I'm trying to learn OpenGL in c++ (I used it in Java) but I have a problem, I make a triangle, but it doesn't draw on GL_FILL and in GL_LINE it just draw a line, I can't find my mistake, I guess my ...
0
votes
0
answers
311
views
Weird PIX behavior with DXC
Recently I've switched from FXC to DXC to compile shader model 6.0. It compiles well without errors (and runs well) but I can't debug shaders because on my netbook PIX says "failed to load PDB ...
1
vote
1
answer
3k
views
Understanding fragment shader coordinate system
I'm trying to create an infinitely panable grid using fragment shaders (C++/OpenGL/GLSL), and I'm having a bit of difficulty understanding the coordinate system.
This is my fragment shader code, ...
0
votes
0
answers
46
views
Under what conditions does a mesh operation cause the mesh become non-manifold and how to avoid it?
I'm implementing some mesh operations (e.g. edge collapse, edge split, edge flip etc) and need to ensure applying such operations does not cause the mesh to become non-manifold. However, I'm not sure ...
0
votes
1
answer
59
views
Buggy behavior when applying specular reflection
I'm very new to computer graphics and trying to implement a raytracer based on the book Computer Graphics from Scratch. When I tried to add specular reflection, I don't get the output that look like ...
0
votes
1
answer
99
views
(Ray tracing) Trouble converting to screen coordinates, objects being stretched
I followed along with Ray Tracing in One Weekend and managed to get the final output but I wanted to understand more about creating a camera and "painting" the screen since he didn't go over ...
0
votes
0
answers
728
views
Using multiple textures in a shader
Background:
I am extracting the textures for a model with Assimp and sampling those textures in the fragment shader. I have multiple uniform sampler2D textureN ...
0
votes
1
answer
164
views
How to link Intel Open Image Denoise in Qt Creator and use it to denoise noisy Monte Carlo path tracing renderings?
I've been trying to link my the Intel Open Image Denoise libraries for about a week and still have no luck as of now. This could partly be because I am also novice in C++ stuff. So I need some help in ...
0
votes
1
answer
791
views
Spline interpolation library in cpp
Have been searching a lot for a good spline interpolation library in cpp, came across one, which is the famous Eigen library , having the unsupported counterpart for spline fitting.<Here>.
I ...
1
vote
1
answer
926
views
Vulkan clear color is wrong
I am following https://vulkan-tutorial.com/Introduction to get myself familiar with the Vulkan API. I have gotten to the point where my application is able to draw a triangle. But for some reason the ...