r/GraphicsProgramming • u/xbelanch • Jun 12 '24
Why precision matters in global illumination renderers
8
u/fllr Jun 12 '24
Woah. What was the issue on the broken image? :O
5
Jun 12 '24
I bet wrong variables types used for some stuff and then some values get rounded or lose accuracy, just a guess tho
-29
u/xbelanch Jun 12 '24
float vs double
47
u/Lallis Jun 12 '24
No. You're doing something else wrong. Floats are easily sufficient for a rendering like that.
26
u/thejazzist Jun 12 '24 edited Jun 12 '24
Did you add an epsilon value to the ray's origin when ray tracing? Also drop samples that the dot product of the direction and surface normal is negative. There are tricks that can bypass the acne and self intersection without wasting resources and instruction cycles by switching to double precision
17
u/Necessary-Cap-3982 Jun 12 '24
Float should be perfectly fine here.
The only times I’ve gotten results even remotely like this due to precision issues have been in screen space applications when I accidentally sampled from an 8 bit depth buffer
2
u/_michaeljared Jun 13 '24
Typically double precision rendering issues only manifest with huge scales involved (think looking at earth's terrain from way above its surface).
I can't imagine why floating point precision would not work in this scene.
1
Jun 13 '24
Now I have to write my own renderer, got a reference to recommend?
1
u/Eklegoworldreal Jun 13 '24
If your goal is realism, mitsuba. Otherwise it's subjective
1
Jun 13 '24
Start with the real then break it. I have some weird light transport theories to test.
5
u/Eklegoworldreal Jun 13 '24
I don't think you realize how deep and complex true realism is. Most renderers are PBR, or physically based, and that's plenty fine. That's also what is mostly taught, then stylization can be done in any way as an exercise for the reader.
1
0
Jun 13 '24
Now looking at Mitsuba, I hadn't heard of differentiable rendering, but I was thinkin' just that lol, thank you.
0
0
u/S48GS Jun 13 '24
There many reasons for this behavior.
Maybe this is normals - since you use "cube" maybe your sides have perfect vec3(0,1,0) normals.
Try to rotate your cube-sides (to not be parallel) - make them as "plane" and rotate every one little bit to have normal vec3(0.03, 0.999, 0.03) like that - not 0 and not lower than 0.001 normal value.


59
u/eiffeloberon Jun 12 '24
Looks like ray epsilon issue? You shouldn’t need double precision, not for this kind of scene.