I am aware this has been asked before, but I have not found a viable solution despite days of research. I want to render a first person gun model in front of everything to prevent it clipping inside world geometry. I have tried using custom depth and stencils, but can only achieve rendering a flat colour, not the original mesh material. I have also tried using a shader to scale the vertices of the mesh towards the camera which is the best solution I have found, however it presents an issue where parts of the mesh are rendered in front of other parts causing weird artifacts, the pictures attached show the effect with and without the shader
. I’ve been quite frustrated with how difficult it has been to do something that is trivial to do in another engine like Unity which just has separate render layers. Does anyone have a good solution for this problem? Thank you.
Hi @HappyGhetto! Welcome to the Forums!
I think I have found just the solution you are looking for! Here is a great Non-Epic affiliated third party video that explains the concept and shows you how to apply that effect by editing your specific materials to achieve it! Here is that video:
Unreal Engine 4 Tutorial - Fix Weapon Clipping and Object-specific FOV
I hope the above solution work for you!
Hi! Thank you, I appreciate the reply, but I have watched this video and this is actually the current solution I am using that produces the weird artifacts in the images I uploaded. Maybe it is something to do with my mesh? I’m not sure what I would change though.
Hey @HappyGhetto.
I see. Have you applied the change to the material to both the gun and the hands? Or just the gun? If it is applied to the gun only, the gun would appear in front of your hands.
Any additional info you can provide will be a big help in solving your problem.
I have applied it to both, and the hands look fine. Here is a video that might show the issue a little better.
This culling effect is lessened when I change the scale value in the custom fov shader (the same one from that video you linked) but then the gun mesh still clips into geometry more than I would like. There is no scale value that does not have this artifact as well as preventing mesh clipping.
This is the blueprint for the material function I am using.
And here is how I am applying the material function to my weapon material.
Bump, still can’t find an answer on this.
Facing similar issues here. Has anyone found any solution for this?