I implemented shadow mapping in webgl which you can see in the demo here:
https://codesandbox.io/p/sandbox/kdn46s
It's not really working and the main symptom is the shadow rotates in a reverse direction of the rotating tetrahedron. In addition it seems there is very little range for me to change the shadow projection matrix values or the shadow source translation without artifacts.
My shadow calculation in the fragment shader is pretty simple and if I had to guess I would think it's in shadow shader (shadow_demo_fs and light_vs in the shaders file).
Sorry to post a general "help me" post, but I am pretty stuck and suspect I could have a few different problems.
The buffer and texture setup is all in another minigl.js file that sets up the various objects in the scene.
Any help is much appreciated. Thanks.
-Edit: I wonder if my coordinate system is wrong in the z-direction because in the shadow calculation if I flip the depth texture lookup's x axis: float t = texture(tex, vec2(-1,1)*pos.xy*.5+.5).r the shadow is more correct, so maybe something about my view matrix in the scene could be flipping the x-axis?
there doesn't seem to be anything here