Most Popular
1500 questions
12
votes
2 answers
Why does graphics speak of "dielectrics" rather than insulators?
For example, Filament's documentation at https://google.github.io/filament/Filament.md.html uses the term "dielectrics" when contrasting nonconductors to conductors, which it calls "metallics". And here on stackexchange,…

learning graphics
- 123
- 4
12
votes
2 answers
Could a hexagonal pixel array store an image more efficiently?
Most computer monitors and televisions have a rectangular array of pixels arranged on a square (or nearly square) lattice. Would a hexagonal lattice give better image quality for the same number of pixels? In other words, would the same amount of…

trichoplax is on Codidact now
- 6,292
- 3
- 23
- 69
12
votes
1 answer
How is Depth of Field Implemented?
I know that depth of field involves blurring.
There's some great information about how to do a Gaussian blur in the question How is Gaussian Blur Implemented?
But, other than that, how is depth of field implemented?
What are the rules about how you…

Alan Wolfe
- 7,801
- 3
- 30
- 76
12
votes
3 answers
How can I concentrate points in areas of higher curvature?
How can I distribute points over an implicit surface, to concentrate them more densely in areas of higher curvature?
I've considered adding points randomly and rejecting points not required based on the curvature, but I'd like to know if there is a…

trichoplax is on Codidact now
- 6,292
- 3
- 23
- 69
12
votes
3 answers
Dynamic Array in GLSL
Is it possible to have a dynamic array in a GLSL shader? For instance, what if I have something like this in my GLSL Shader:
uniform int size;
uniform SceneLights lights[size];
void main()
{
for(int i = 0; i < size; i++) {
/* Do Some…

Archmede
- 481
- 2
- 7
- 21
12
votes
2 answers
Is it possible to find out how many fragments made it through the stencil test?
I have an OpenGL application which uses stencil tests quite extensively to render irregular shapes (a bit like a simple 2-D CSG). If I could find out how many fragments passed the stencil test and were actually rendered, this would be very helpful…

Martin Ender
- 2,730
- 4
- 23
- 45
12
votes
2 answers
What is the fundamental reasoning for anti aliasing using multiple random samples within a pixel?
In graphics, it's common to take multiple samples within the bounds of a pixel and combine them together (most commonly just doing an average) for a final sample pixel color. This has the effect of anti aliasing an image.
On one hand this makes…

Alan Wolfe
- 7,801
- 3
- 30
- 76
12
votes
1 answer
Is a cubic Lagrange interpolation tensor product the same as bicubic interpolation?
I just implemented some interpolated texture sampling by sampling the 4x4 nearest pixels then doing Lagrange interpolation across the x axis to get four values to use Lagrange interpolation on across the y axis.
Is this the same as bicubic…

Alan Wolfe
- 7,801
- 3
- 30
- 76
12
votes
2 answers
How is screen space ambient occlusion implemented?
I do not understand the explanation from wikipedia.
For every pixel on the screen, the pixel shader samples the depth values around the current pixel and tries to compute the amount of occlusion from each of the sampled points.
How can depth…

Joey
- 627
- 1
- 6
- 14
12
votes
1 answer
Using a LUT to speed up a trig heavy shader for mobile devices
I am trying to get this shader to run on a really old iDevice, as well as eventually Androids.
Even when I reduce the code down to 2 sine functions per fragment the shader runs at about 20fps.
I have considered taking a leaf out of the book of old…

J.Doe
- 1,445
- 12
- 23
12
votes
2 answers
Is there any reason to prefer Direct3D over OpenGL?
So I was reading this, I sort of got the reason why there are a lot more games on Microsoft windows than on any other OS. The main issue presented was that Direct3D is preferred over OpenGL.
What I don't understand is why would any developer…
user3437
12
votes
2 answers
Is using many texture maps bad for caching?
If I have many textures (say 5+ maps) bound to the same texture unit, does it work worse for cache than if I had only 2 or 3 textures?

Felipe Lira
- 1,246
- 1
- 11
- 16
12
votes
1 answer
Can I raytrace gravitational lensing using only a single point source of gravity?
I'd like to simulate the magnification of very distant objects by the lensing effect of a less distant galaxy. Will I need to model large numbers of point masses or can I get away with just a single average point mass?
I can see how to raytrace…

trichoplax is on Codidact now
- 6,292
- 3
- 23
- 69
12
votes
2 answers
Should JPEG encoding take into account gamma?
When an image is encoded using JPEG, the RGB pixels are first encoded into YUV, and then the UV channels are downsampled. Before actually doing the DCT and encoding the coefficients, JPEG doesn't gamma correct the Y channel. Is this correct?…

Mokosha
- 1,144
- 7
- 23
12
votes
4 answers
Does it matter whether I learn OpenGL or Direct3D?
Are the differences between these two APIs minor implementation details that mean once I have learned one I can use it for everything? Or are there reasons for learning one rather than the other if I want to be able to use it in general without…

trichoplax is on Codidact now
- 6,292
- 3
- 23
- 69