Planar shadow -> possible to adjust distance at runtime?

Hey there.

Is it possible to adjust the planar shadow distance at runtime via code?

*(shadow map shadows gets blotchy/blocky, then disappear completely *
after a while with an endless runner style game.)

Thanks.

What do you mean shadow distance ? Shadow is projected on an existing plane.

In a runner game, you should have the light following your camera, and adjust the shadow settings (essentially shadow map size and ortho size) so that the shadow is clear and stable

https://docs.cocos.com/creator/3.0/manual/en/concepts/scene/shadow.html#shadowmap

There is a distance setting when planar shadows is enabled.
(Planar shadows give you the settings Normal and Distance)
You can set it to offset the shadow from the plane I believe.

So if this setting could be adjusted at runtime we could use planar shadows on
levels that change height. At least that was my thought process.

In a runner game, you should have the light following your camera, and adjust the shadow settings (essentially shadow map size and ortho size) so that the shadow is clear and stable

Ah, alright, thanks for the tip. Would still be nice to know if I can get to the distance setting
of the planar shadows via code, but that will do it as well of course.
(Basically, my problem is solved, but I still would like to know this.)

You can access to the planar shadow or shadow map setting via scene.globals

You can see shadows property in the SceneGlobal object

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.