Closed markusmoenig closed 1 year ago
Hey :)
A roughness value of 0.0 requires special handling of the sampling routines due to the delta distribution that's involved.
I avoid this issue by clamping the min roughness value to 0.001 when bringing the material data into the shader here: https://github.com/knightcrawler25/GLSL-PathTracer/blob/e1069a5379ab4aaf9fe4fe8ad6d5ee402da0c652/src/shaders/common/pathtrace.glsl#L46 and here: https://github.com/knightcrawler25/GLSL-PathTracer/blob/e1069a5379ab4aaf9fe4fe8ad6d5ee402da0c652/src/shaders/common/pathtrace.glsl#L110-L111
Not doing that will cause the material to appear black as you describe:
This is with the clamped roughness:
Sorry. I should have clarified. I clamp the roughness but it's near black. Metals are also very dark. Have to have light sources with 100 emissions to see reflections. Somewhere something is wrong.
At first glance, one thing that seems to be missing is when the ray hits a light source by chance, power_heuristic should be used to combine the bsdf sample and the light sample for MIS. Its being done in direct_light() while sampling light sources but is missing in render()
This happens here in my code: https://github.com/knightcrawler25/GLSL-PathTracer/blob/e1069a5379ab4aaf9fe4fe8ad6d5ee402da0c652/src/shaders/common/pathtrace.glsl#L348-L363
I'm new to Rust so trying to figure my way through the code :D Will see if I can narrow it down further
Wow thanks for your effort!! Will look into it tomorrow. Already quite late here in TH…
I have implemented the missing light sampling and the call to power_heuristic.
Things look good now (I think). The example scene now looks like this. Thanks again for your help! Still need to implement some stuff (env_maps and I am not sure about mediums and how to render them for SDFs) but will do so as I need them for ForgedThoughts.
Glad to see that the issue is fixed now :)
Also, the Disney BSDF in your port is from an older version of the code which had some issues with interiors/backfaces as mentioned here: https://github.com/knightcrawler25/GLSL-PathTracer/issues/78
Depending on how you're mixing the transmission parameter, you might end up seeing similar problems in very specific scenarios. However, it's been fixed with the most recent commit.
Ok, will try to keep the code up to date and update it when new releases come out. Thanks for the pointer.
Closing this for now.
Hi,
I have ported your path tracer to Rust (https://github.com/markusmoenig/rust-pathtracer) so that I can use it in the 3D modeling programming language I am working on (forgedthoughts.com).
However there is (or are) bug(s) in the port. For example a value of 0.0 for roughness just creates black, non-reflective materials. I went over the whole port 1-2 times and couldn't find anything.
Do you have any pointers in the code where I should focus on for the above behavior ? Thanks!