godot-for-3d-open-worlds
godot-for-3d-open-worlds copied to clipboard
Logarithmic depth shadow casting
Need help, it is too hard.
Apparently, something has to be done with https://github.com/roalyr/godot-for-3d-open-worlds/blob/b5c1bd6c64ac88e90744584e261a042cd5014c0e/drivers/gles3/shaders/scene.glsl#L995 in places where depth is called upon (value read from buffer and then treated as normalized linear, while it should be normalized logarithmic instead?)
I also do not know exactly all the places that have to be modified in order to tweak shadow casting, so I will appreciate assistance with pointing them out to me.
I'm not sure if there is a difference between godot 4.x and 3.x in this regard, but in 4.x I get directional shadows to work fine simply by only using a logarithmic depth buffer for perspective projection matrices. See https://github.com/MoritzMaxeiner/godot/commit/c10940f499ddbb45f18f5a73660a0d4cddc84ea1#diff-61a6547ecc886f0afcfe98118933cdaab1795c40e22ba4c68be0e2c92a1dc41cR2203
I also recommend looking at the threejs discussion here: https://github.com/mrdoob/three.js/issues/17525#issuecomment-532969461
I suspect that shadows and other depth-related effects are different.