goxel
goxel copied to clipboard
Glitchy shadows on top surfaces when light is directly above
Found this graphical glitch when Light is directly overhead (Pitch = 0), and shadows are turned up.

The effect completely goes away by moving the light just one degree away from vertical:

The artifacts also fade linearly with the intensity of shadow.
This is on Linux Mint 19, freshly built from master HEAD, GTX 1660, Nvidia driver 418.87.00
Thanks, I'll try to fix that.
I haven't looked at the source to pinpoint the bug, but I would speculate that its due to a dot product somewhere that's resulting in 0, and losing sign information, so shadows appear on the wrong side.
I had a closer issue while testing(Created a sphere, the upmost voxel was shaded). Did something like below. Worked. But could not go back. Maybe would fix for you too.
https://github.com/guillaumechereau/goxel/blob/f7c19623dee884582fb9e0f513daa6fbffdec28a/data/shaders/mesh.glsl#L275 As this was 0. it was creating a shadow.
https://github.com/guillaumechereau/goxel/blob/f7c19623dee884582fb9e0f513daa6fbffdec28a/data/shaders/mesh.glsl#L261
if this clamp is clamp(dot(N, L), 0.00001, 1.0); the wrong shadowing of mine was gone.
@thehans can you try and see if this works ?
Edit: just realized how old the post is :D Let me know if this issue is also still valid :D
Yes it is still an issue! I did take much time to work on Goxel recently.
What worked for me was to set a small minimum value to the bias in the shader shadow computation. I pushed this, let me know if you can recompile and if that works.
Yes it is still an issue! I did take much time to work on Goxel recently.
Haha great. Let me know actually if I can support anyhow.
What worked for me was to set a small minimum value to the bias in the shader shadow computation. I pushed this, let me know if you can recompile and if that works.
Would that be possible for you to create for example a sphere, and put the light to the top(pitch=0). I had 0.5 shadowing before for that. To see if it is reproducible ?
Sorry I meant: I didn't take much time to work on Goxel :( I got busy with other things. I sill hope I can start to work on it soon. It's already supporting the app to write bug report, thanks!
For the bug, I tested by creating a plane surface and then set the pitch to 0. In the current master version it works now on my machine.