I'm uncertain if this should be a feature proposal or not, but I seem to recall older versions of Godot supporting what I want to do here so I thought I would raise as a bug first.
A common solution to the "gun clipping" issue in FPS games is to use a separate camera to render the weapon mesh. This also allows us to modify the FOV of the player without distorting the look of the weapon mesh.
In Godot, we can accomplish this by having the gun mesh be on Render Layer 2, and having a separate "gun camera" which culls all render layers except Layer 2. However, with this setup, the gun mesh will not receive shadows correctly.
To illustrate this, I have set up a scene where the world is on Render Layer 1, and the weapon is on Render Layer 2.
Here's what it looks like with a single camera, culling no layers.
Here's what it looks like with the setup described above:
Steps to reproduce
Set up "world" meshes, and ensure they are drawn on Render Layer 1.
Add a directional light with shadow casting on.
Create another mesh on Render Layer 2. Position it so that it is in the shade casted by the "world" meshes from Step 1.
Add a camera to the scene so that everything is in view, and preview it
Note that culling Render Layer 1 removes all shadows from the mesh on Render Layer 2.
Tested versions
4.3.stable
System information
Windows 11
Issue description
I'm uncertain if this should be a feature proposal or not, but I seem to recall older versions of Godot supporting what I want to do here so I thought I would raise as a bug first.
A common solution to the "gun clipping" issue in FPS games is to use a separate camera to render the weapon mesh. This also allows us to modify the FOV of the player without distorting the look of the weapon mesh.
In Godot, we can accomplish this by having the gun mesh be on Render Layer 2, and having a separate "gun camera" which culls all render layers except Layer 2. However, with this setup, the gun mesh will not receive shadows correctly.
To illustrate this, I have set up a scene where the world is on Render Layer 1, and the weapon is on Render Layer 2. Here's what it looks like with a single camera, culling no layers.
Here's what it looks like with the setup described above:
Steps to reproduce
Minimal reproduction project (MRP)
test-viewport-shadows.zip