Shadows do not cast on different render layers

Godot Version

4.4 Beta 3

Question

I have a FPS game in which the player’s viewmodel is rendered on a separate camera layer. Layer 1 is the game world, and Layer 2 is the viewmodel only. I have set it up so lights and shadows cast on Layer 1 and 2. The problem with this setup is that shadows cast from objects on Layer 1 have no effect on anything in Layer 2. So the mesh being rendered on Layer 2 always looks like it is in the Directional Light of the scene. Spot Lights also light up the mesh on Layer 2 with no regard for shadows on Layer 1.

Is there anyway to make it so the shadows cast in Layer 1 show on the object in Layer 2?

I’ve attached two images below, the top one shows what I am currently dealing with, and the bottom one is what it should look like. The top image has the scene’s Directional Light lighting the viewmodel on Layer 2 without considering the meshes in Layer 1.


1 Like

Looked around the engine some more but I have had no luck in finding out any way to fix this. I assume there is something I am just missing, since this has to be an issue someone has solved before. Using a separate render layer for viewmodels in first person games has been done for probably the last 20 years at least. Is this just something Godot can’t handle?

Do you have any updates on this?

From what I looked up, it was something that worked in Godot 3, but has not worked in Godot 4 since release.

I haven’t bothered loading Godot 3 to confirm this as of yet, to be honest I’d rather not lose everything else Godot 4 has over it just to get shadows on my viewmodels.

I have the same issue and i have found a pretty quick but not very good performance wise way for the shadows.
The solution is that you make a copy of the mesh and you render only shadows on the second layer by making the cast shadow in geometryInstance3d to shadows only.