Hot answers tagged

27 votes
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 ...
user avatar
  • 3,321
22 votes

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: ...
user avatar
  • 1,019
10 votes

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 ...
user avatar
  • 23.7k
9 votes
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 ...
user avatar
  • 23.7k
9 votes
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 ...
user avatar
  • 516
7 votes
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 ...
user avatar
  • 3,502
7 votes
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 ...
user avatar
  • 23.7k
7 votes
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 ...
user avatar
  • 283
7 votes
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 ...
user avatar
7 votes

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, ...
user avatar
  • 1,575
7 votes
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 ...
user avatar
  • 501
6 votes

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 ...
user avatar
6 votes
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 ...
user avatar
6 votes
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 ...
user avatar
6 votes
Accepted

Shadow rays in Raytracing

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 ...
user avatar
  • 6,440
6 votes
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 ...
user avatar
  • 5,872
6 votes
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 ...
user avatar
6 votes
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 ...
user avatar
  • 1,555
6 votes

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 ...
user avatar
  • 3,941
5 votes

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 ...
user avatar
  • 5,872
5 votes

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 ...
user avatar
5 votes

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. ...
user avatar
5 votes

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 ...
user avatar
  • 23.7k
5 votes
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 ...
user avatar
5 votes
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} \...
user avatar
  • 8,159
5 votes
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 ...
user avatar
5 votes
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 ...
user avatar
  • 8,101
5 votes
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 ...
user avatar
  • 23.7k
5 votes

How to use multithreading in 3D software renderer to speed up fetching texture values

It could be that you have to overcome a different bottleneck first. Have you ever read Jim Blinn's "The Truth About Texture Mapping"? (I had a quick search to see if I could find a non-paywalled ...
user avatar
  • 3,941
5 votes
Accepted

This function syntax is confusing me

The signature of glfwGetProcAddress is: GLFWglproc glfwGetProcAddress(const char *); It's a function that takes a string and ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible