I would like to avoid z-Fighting of the ShadowOnlyMaterial with another WebGL context.
My first option was to use zOffset on a ShadowOnlyMaterial, but it seems like it is not part of the shader.
At least it is not working in this playground:
Now I hoped I could just copy the shadow material into my repo and try working with the shader, but it seems it needs to be compiled first.
Hi!
Is z-offset working for you in the provided playground?
I am rendering into the same canvas onto a maplibre background and would like to see shadows on it.
But my ground is mixing with the maplibre ground. And offsetting does not lead to good results so far.
Oh wow… you are right… sorry for wasting time! I am a bit confused, because I thought yesterday it was not working in my app. Probably I mistook the orange are as a z-fighting issue. Green is z-fighting. But orange is probably an area where the shadows is not being projected on.
Would you have an idea to deal with the green area besides using zOffset? Since I have to set it around -10 to avoid it.
Looks like I cannot open a PG at this moment for some reason but since seb figured zOffset is applied and working &…
&
My question would be: What did you set for the zOffset (units or factor?). Like what happens if you get closer or further with the cam?
You will eventually want to set both (units + factor) depending on the distance, size of scene and distance from cam.
Thanks for the hint!
It just does not seem to be easy to control the zOffset properly. Though zOffsetUnit might be better suitable if you look at the following playground. But both options change when camera is moving away from object. I guess that is because of the depth render precision?
Ok using zOffsetUnits seems to be the way to go! Thanks a lot, learned a lot again! The other zoffset explanation thread also gave some nice insights, that zOffsetUnits are better for decals. And my shadow is like one.