how to cast shadow inside

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gruen

i have an earth globus. on the same spot i have a sphere with a cloud-texture.
this sphere is transparent and only the clouds are visible.
the cloud sphere is just a little bit bigger than the earth globus and needs to cast an shadow on the globus. but just to enable “cast shadow” or “cast shadow double-sided” doesnt work.

![Enabled Shadow-cast][1] click
![Disabled Shadow-cast][3] click
![Textur-Setup][5] click
![Material - Setup][7] click

:bust_in_silhouette: Reply From: Zylann

If you convert your clouds texture to be transparent, you could switch your clouds material to use Depth Draw Mode = opaque pre-pass, which will project a shadow, but it might look bad because shadows don’t support half-transparency, unless you want cutout shadows. Also, reduce light max distance if your shadows are too blocky. Maybe that could be enough?

But one big problem with your planet is that clouds are extremely close to the sphere, and for that reason the shadow mapping might miss it, unless you reduce/nullify light bias.

If you are not afraid of shaders, there is a specific way to get a very good result which renders faster and better: since you have a planet and likely a texture on which you have your clouds, you could write a shader to modulate the globe’s texture color and recreate the shadows. That would also be a cheap way to get fake shadow transparency.

Thank you for your respond:

well i forgot to show my shaderMaterial:

Depth Draw is already on opaque

im not able to write anny shaders. so i try the visual shader thing.

gruen | 2019-04-17 21:39

Ah, your clouds are not transparent. My solution with opaque pre-pass only applies if the texture is transparent and rendered in mix blend mode. Although, if you go for my second solution, you can keep your texture as it is.

Zylann | 2019-04-17 21:42

i never wrote a shader. i dont have anne expirience with it.
ill try to change my clouds to mix blend mode.

im a absolute beginner (coming from game maker)

gruen | 2019-04-17 21:47