# Tag Info

Accepted

### What does "makeContextCurrent" do exactly?

OpenGL is a state machine. An OpenGL context holds that state. The state contains information such as which textures are bound to which texture units, which attachments the current FBO has, and things ...
• 3,331

### Get vector length with GLM

Sorry folks for posting such a trivial issue! The issue is solved. I was using the wrong function. Here goes the correct one: ...
• 1,029

### DirectX12 CbvHeap

In DX12, a descriptor is a small record, basically a pointer, that tells the GPU where to find some data such as a constant buffer. Since each object is going to have its own constant buffer data with ...
• 24k
Accepted

### Ray casting in fan configuration produces point cloud with curvature, how to eliminate curvature?

The direction vectors start at +15 degrees on the YZ plane, and continue in increments of -2 degrees down to -15. There's your problem—by generating the rays that way, you're doing something more ...
• 24k
Accepted

### Modern way of light sources in OpenGL?

Why are they deprecated? Those functions are deprecated because the OpenGL API moved in favor of a programmable pipeline in contrast with the old fixed pipeline. The programmable pipeline allows the ...
• 516
Accepted

### Role of PDF of Uniform Random Sampling in a path tracer

Firstly, as @trichoplax correctly pointed out, your randomPoint function calculates a point in a cube, then uses rejection sampling to return all points that are inside a unit sphere. In order to ...
• 3,562
Accepted

### Generate this kind of 2d burst or pulse algorithm?

Rather than using an image, I would suggest doing this kind of effect using a shader. I'm not familiar with Cocos2d-x, but some quick googling suggests that it can work with shaders. You'd use a pixel ...
• 24k
Accepted

### Archimedean spiral in C++

Figured it out :) The dominos are now being placed along the X and Y coordinates generated by the function. The original code in the question was plotting a wave of points outwards from the centre ...
• 283
Accepted

### Projected grid water horizon detail

I believe a common solution is to split the camera transform used to project the grid from the camera transform that is used to render the grid. At perspectives close to top-down, the two cameras ...
• 2,535

### How can I utilize all cores of CPU In my ray tracer with std::thread?

This is not really a CG issue but you appear to have an integer division problem. Assuming mMaxThreads is an integer, ...
• 1,575
Accepted

### How do I create a Win32 window with a Vulkan context?

There's no such thing as a Vulkan context, the way there is with OpenGL. This is because Vulkan is a lower level API and an OpenGL context ties together a number of concepts that are distinct in the ...
• 511

### Projected grid water horizon detail

You can be both realistical and real-time. the secret is to change representation each time the information get under the Shannon-Nyquist (i.e. grid) scale: from geometry to normal maps to shading ...
• 1,289
Accepted

### How to convert a thread ID into Screen Space Coord in an OpenGL Compute Shader?

The problem is actually in your fragment shader: color_out = texture(source_image, gl_FragCoord.xy); The texture() function accepts normalized coordinates which ...
• 336
Accepted

### Type conversion to GL-types

Practically speaking, probably not - try printing the size of each type using sizeof. Probably GLuint is 32 bits and size_t is 64 bits - so 32 bits are thrown out; but float and GLfloat are probably ...
• 1,261
Accepted

Your if condition makes me suspicious. You should include the diffuse and specular shading if the intersection test didn't hit an object; that is, if ...
• 6,510
Accepted

### Path tracer not rendering shadows

The problem appears to be unintentionally transparent surfaces Although the image is grainy, it is sufficiently clear to estimate that all of the darker regions are due to surfaces facing away from ...
• 5,902
Accepted

### Open GL Shader Storage Buffer Objects to replace Vertex Attributes

The counter you want is built in the shader as gl_VertexID. However you have 16 attributes of 4 components each to work with. Take 2 components for the texture ...
• 5,830
Accepted

### Artifacts when gamma correcting

Short answer, set the precision of the image to a higher value. Long answer, When looking at a gamma correction curve, you can see that the lower values get changed much more, this means that the ...
• 1,575

### How to handle a parametric equation in raytracing?

Many years ago I worked on a ray tracer that handled parametric surfaces, so this is unlikely to be state of the art, but, IIRC, I used a combination of interval arithmetic with (binary?) subdivision ...
• 3,996

### Resulting Probabilty Density in Path Tracer for paths using Next Event Estimation

I don't have any experience with Gradient Domain Path Tracing, but here are my thoughts: There seems to be a different problem If you look carefully at the little spikes of distortion in the final ...
• 5,902

### Path tracer not rendering shadows

is it correct having such a big light? I don't see any problem with having a big area light. That said, it also depends on the scale of your scene. If the light is large compared to it, shadows will ...
• 4,250

### How to compensate low amount of rays reaching the light in a Path Tracer

A note first From the look of your screen capture, I suspect there might still be a bug in your code. Noise is to be expected with only 16 spp, but your picture still looks surprisingly dark to me. ...
• 4,250

### The meaning of early ray termination and front-to-back traversal in ray tracing

Front-to-back traversal is the idea that when traversing a ray through the acceleration structure, we want to examine nodes that are in front, i.e. closer to the camera, before other nodes. If you ...
• 24k
Accepted

### How should I generate the view position for a light at infinity when creating depth maps?

Instead of using a perspective projection you would use a orthographic projection. Then the trick is to position the bounding box to in front of the normal camera. An additional option is to add a ...
• 5,830
Accepted

### Angle between two points in Cartesian coordinate system C++

The parametric equation for a spiral is:  \begin{eqnarray} \begin{aligned} x &= &(a + b \theta) \times \cos(\theta)\\ z &= &(a + b \theta) \times \sin(\theta) \end{aligned} \...
• 8,189
Accepted

### Dx12 Vertex Buffer incorrect

Vector has a few different semantics from static arrays. For one it's a struct containing a pointer a capacity and a length (at the very least). That means that ...
• 5,830
Accepted

### Swap buffers twice does not show the first scene

If you swap buffers, you have a triangle in your screen and a empty color buffer in the other side. No, you do not. Buffer swapping does not necessarily mean that the current contents of the front ...
• 8,554
Accepted

### Strange behaviour in vertex shader with divisions

The vertex shader only runs per vertex, not for every point in the square. So the four vertices are mapped to (±2, ±2), and then the GPU draws a polygon between those vertices, which does cross the ...
• 24k