I’m working on a first person shooter game and I’m rendering a gun. However, when the character gets close to a wall, the gun clips through the wall.
If I render the gun in a different camera, the shadows cast from other objects don’t affect the gun.
If I scale the gun to make it really small, the shadows work but they work as a shadow would on a really small object…so if u go under a tree the shadows from the leaves look huge.
If I disable the depth buffer, the gun wont render right, as the gun has animations like reloading and theres models for the hands etc, so the z buffer is important for rendering the gun right.
I was wondering if it was somehow possible via a shader to clear the z buffer, or change the bias value of the zbuffer. Using the render queue I can make the gun be the last object rendered, if I could clear the z buffer it would fix this issue.
Thanks for reading.