All Questions
4,110
questions
72
votes
6
answers
53k
views
How can I debug GLSL shaders?
When writing non-trivial shaders (just as when writing any other piece of non-trivial code), people make mistakes.[citation needed] However, I can't just debug it like any other code - you can't just ...
67
votes
10
answers
48k
views
Should new graphics programmers be learning Vulkan instead of OpenGL? [closed]
From the wiki: "the Vulkan API was initially referred to as the 'next generation OpenGL initiative' by Khrono", and that it is "a grounds-up redesign effort to unify OpenGL and OpenGL ES into one ...
63
votes
3
answers
37k
views
When is a compute shader more efficient than a pixel shader for image filtering?
Image filtering operations such as blurs, SSAO, bloom and so forth are usually done using pixel shaders and "gather" operations, where each pixel shader invocation issues a number of texture fetches ...
56
votes
5
answers
40k
views
Albedo vs Diffuse
Every time I think I understand the relationship between the two terms, I get more information that confuses me. I thought they were synonymous, but now I'm not sure.
What is the difference between "...
54
votes
5
answers
27k
views
Sharp Corners with Signed Distance Fields Fonts
Signed Distance Fields (SDFs) was presented as a fast solution to achieve resolution independent font rendering by Valve in this paper.
I already have the Valve solution working but I'd like to ...
52
votes
5
answers
78k
views
How is Gaussian Blur Implemented?
I've read that blur is done in real time graphics by doing it on one axis and then the other.
I've done a bit of convolution in 1D in the past but I am not super comfortable with it, nor know what to ...
44
votes
2
answers
14k
views
What is Importance Sampling?
What is importance sampling? Every article I read about it mentions 'PDF' what is that as well?
From what I gather, importance sampling is a technique to only sample areas on a hemisphere that matter ...
43
votes
2
answers
49k
views
What is Ray Marching? Is Sphere Tracing the same thing?
A lot of ShaderToy demos share the Ray Marching algorithm to render the scene, but they are often written with a very compact style and i can't find any straightforward examples or explanation.
So ...
41
votes
2
answers
24k
views
How can virtual texturing actually be efficient?
For reference, what I'm referring to is the "generic name" for the technique first(I believe) introduced with idTech 5's MegaTexture technology. See the video here for a quick glance on how it works.
...
40
votes
3
answers
21k
views
What is a stencil buffer?
Wikipedia states that a stencil buffer is some arbitrary buffer a shader can use.
However, it hints that it's used for clipping, or otherwise "tightly binding" the depth and pixel buffers, slightly ...
40
votes
4
answers
24k
views
Sharing code between multiple GLSL shaders
I often find myself copy-pasting code between several shaders. This includes both certain computations or data shared between all shaders in a single pipeline, and common computations which all of my ...
38
votes
4
answers
2k
views
Are there common materials that aren't represented well by RGB?
In graphics we use RGB and other color spaces as an approximation to the full spectrum of light wavelengths. This evidently works pretty well in general, but are there any reasonably common objects/...
37
votes
2
answers
14k
views
What is the cost of changing state?
Programmers are supposed to have a fairly good idea of the cost of certain operations: for example the cost of an instruction on CPU, the cost of a L1, L2, or L3 cache miss, the cost of a LHS.
When ...
36
votes
2
answers
19k
views
DirectX / OpenGL(Vulkan) concepts mapping chart
Often a similar hardware feature is exposed via DirectX and OpenGL using different terminology.
For example:
Constant Buffer / Uniform Buffer Object
RWBuffer / SSBO
I am looking for an exhaustive ...
36
votes
2
answers
7k
views
How physically-based is the diffuse and specular distinction?
The classical way of shading surfaces in real-time computer graphics is a combination of a (Lambertian) diffuse term and a specular term, most likely Phong or Blinn-Phong.
Now with the trend going ...
36
votes
3
answers
15k
views
Why does monte carlo ray tracing perform better than distributed ray tracing?
I've heard that the quality of a monte carlo ray tracer (based on path tracing algorithms) is much more realistic than a distributed (stochastic) engine. I try to understand why, but I'm just at the ...
35
votes
2
answers
14k
views
Why is the transposed inverse of the model view matrix used to transform the normal vectors?
When rendering 3D scenes with transformations applied to the objects, normals have to be transformed with the transposed inverse of the model view matrix. So, with a normal $n$, modelViewMatrix $M$, ...
32
votes
2
answers
25k
views
What is the simplest way to compute principal curvature for a mesh triangle?
I have a mesh and in the region around each triangle, I want to compute an estimate of the principal curvature directions. I have never done this sort of thing before and Wikipedia does not help a lot....
32
votes
1
answer
4k
views
Does the original Perlin noise ever have any advantage over Simplex noise?
Perlin noise is one of the most popular procedural noise functions. Perlin later developed Simplex noise which improves on some of the shortcomings of Perlin noise, notably its inefficiency in higher ...
32
votes
3
answers
7k
views
Avoiding z-fighting with coincident surfaces
When rendering two overlapping co-planar surfaces, a common issue is "z-fighting", where the renderer can't decide which of the two surfaces is closer to the camera, giving visual artifacts in the ...
31
votes
2
answers
7k
views
Path tracing the Cook-Torrance BRDF
-- Sorry for the long post, but I prefer to do that way because "Devil is in the details." :)
I am writing a path tracer from the scratch and it is working nicely for perfectly diffuse (Lambertian) ...
28
votes
5
answers
13k
views
Does a sphere projected into 2D space always result in an ellipse?
My intuition has always been that when any sphere is projected into 2D space that the result will always mathematically be an ellipse (or a circle in degenerate cases).
In the past when I was ...
28
votes
2
answers
20k
views
What is fwidth and how does it work?
The OpenGL documentation states that fwidth returns the sum of the absolute value of derivatives in x and y.
What does this mean in less mathematical terms, and is ...
27
votes
2
answers
45k
views
GLSL. Can someone explain why gl_FragCoord.xy / screenSize is performed and for what reason?
I'm new to shaders and know that you can color pixels with gl_FragColor but sometimes there is this thing:
...
27
votes
4
answers
9k
views
Why do T-junctions in meshes result in cracks?
I have heard from many sources that having T-junctions in 3D meshes is a bad idea because it could result in cracks during rendering. Can someone explain why that happens, and what one can do to avoid ...
27
votes
2
answers
12k
views
How is a light probe different than an environmental cube map?
Looking at a light probe texture, it looks like a blurry environment map.
What's the difference between the two, how is a light probe made, and what is the benefit of it being blurry?
26
votes
3
answers
11k
views
Is Russian Roulette really the answer?
I have seen that in some implementations of Path Tracing, an approach called Russian Roulette is used to cull some of the paths and share their contribution among the other paths.
I understand that ...
26
votes
1
answer
11k
views
What does "st" mean in the context of OpenGL?
I've seen the term st come up a few times when looking at other OpenGL fragment shaders. However, I don't know what it stands for or what it's used for. Here's an ...
26
votes
1
answer
12k
views
What are Affine Transformations?
What are Affine Tranformations? Do they apply just to points or to other shapes as well? What does it mean that they can be "composed"?
25
votes
5
answers
29k
views
Why are quads used in filmmaking and triangle in gaming?
In film school, in the classes of 3D modeling, I was told that when we model something for films we maintain topology of 4 edged polygons. Any polygon which has more or less than 4 edge/vertex is ...
25
votes
1
answer
4k
views
Anti-aliasing / Filtering in Ray Tracing
In ray tracing / path tracing, one of the simplest way to anti-alias the image is to supersample the pixel values and average the results. IE. instead of shooting every sample through the center of ...
25
votes
1
answer
962
views
Is my perspective math correct?
I've got a homework in which I have to calculate and plot some points using a pespective transformation, but I'm not sure my results are correct, since the 3d plot using Camera coordinates looks very ...
24
votes
3
answers
27k
views
What is the difference between radiance and irradiance in BRDF
Currently I am reading the BRDF section from Real Time Rendering and I am having a hard time to visually understand the definition of this function. BRDF is the ratio between the radiance in outgoing ...
24
votes
1
answer
24k
views
World coordinates, Normalised device coordinates and device coordinates
Can I get to know the difference between the three? A good example would add up too.
24
votes
1
answer
26k
views
Get vector length with GLM
I am quite confused over how GLM library is behaving or I am using it improperly.
glm::vec2 testVec(6,-4);
float len = testVec.length();
I get the value ...
23
votes
4
answers
26k
views
What does GPU assembly look like?
I have played around with CPU assembly programming like Nasm, Tasm or Masm, but I'm really curious to know how GPU works now.
However, i'm quite confused when I look on internet. I've heard about Cuda ...
23
votes
3
answers
1k
views
Why is thread safety such a huge deal for Graphics APIs?
Both Vulkan and DirectX12 are claimed to be usable in a thread-safe manner. People seem to be excited about that.
Why is this considered such a huge feature? The "real" processing gets thrown over ...
23
votes
2
answers
8k
views
How to properly combine the diffuse and specular terms?
As far as I understand, in a BRDF the Fresnel term is telling us the probability for a photon to be reflected or refracted when it hits a surface.
The reflected photons will contribute to the ...
22
votes
7
answers
5k
views
How to raytrace Bezier surfaces?
I tried this question on math.SE and surprisingly, the answer was "the equations are too nasty, just feed the function it to a numerical root-finder". But if you consider yourself "a graphics guy" ...
22
votes
3
answers
4k
views
Performance of vector graphics versus bitmap or raster graphics
Sometimes I use vector graphics, simply because they look just slightly nicer in some cases, and other times, I use bitmap/raster graphics.
I was wondering, are there any significant performance ...
22
votes
1
answer
4k
views
Why does my Perlin Noise look "blocky"?
I tried to implement Perlin Noise by myself using just the theory (following flafla2.github.io/2014/08/09/perlinnoise.html). Unfortunately I was unable to achieve the look of the "original" Perlin ...
22
votes
1
answer
3k
views
Why is this conditional in my fragment shader so slow?
I have set up some FPS-measuring code in WebGL (based on this SO answer) and have discovered some oddities with the performance of my fragment shader. The code just renders a single quad (or rather ...
22
votes
2
answers
4k
views
What is Illustrator's vector rasterization process?
I am currently trying to understand a few things about vector graphics rasterization and the different ways it is implemented in various application types.
I tested and compared a few programs and ...
21
votes
2
answers
800
views
How do correlated samples influence the behavior of a Monte Carlo renderer?
Most descriptions of Monte Carlo rendering methods, such as path tracing or bidirectional path tracing, assume that samples are generated independently; that is, a standard random number generator is ...
20
votes
3
answers
15k
views
What are Spherical Harmonics & Light Probes?
What are Spherical Harmonics & Light Probes? How useful are they in computer graphics? What exactly do they do? I've heard the word spherical harmonics & Light Probes everywhere, from siggraph ...
20
votes
2
answers
17k
views
What is Tessellation in computer graphics
In recent games I have noticed something called Tessellation, Turning the thing ON destroys my frame rate.
I have noticed that it when turned on it looks like Anti - Aliasing.
Can someone give me ...
20
votes
2
answers
3k
views
What is the "dipole approximation" for subsurface scattering?
If you read papers about subsurface scattering, you'll frequently come across references to something called the "dipole approximation". This term seems to go back to the paper A Practical Model for ...
19
votes
2
answers
21k
views
Why are normal maps blue and purple in color?
I am learning about normal mapping. I understood that RGB values are converted into XYZ, but my question is how is it converted and why is the normal map blue and purple in color?
19
votes
4
answers
4k
views
How is VR different from a monitor
Apparently Macintosh computers cannot handle the Oculus Rift, because of their 'inferior' graphics cards. But should VR not just be like an external monitor? And concerning computer graphics, how are ...
19
votes
1
answer
9k
views
What does "makeContextCurrent" do exactly?
I am pretty confused about that function. GLFW Context reference says as follow:
This function makes the OpenGL or OpenGL ES context of the specified
window current on the calling thread. A ...