Hello… I’ve been waiting for many months now for a solution to this problem; FPS games NEED a way to control sorting of some opaque objects like guns, arms e etc. Will Epic help us to fix this issue or should I assume I have to ship a game ignoring the meshes clipping over character’s arms in my game because there’s really no solution to this?!
In Unity all I had to do was adding a second camera and tell it to render ONLY the FPS render layer where I assign the objects I wanted (arms, guns, 3d Hud)…
I also know Unreal 3 has something that works the same way. But UE4 doesn’t!
Someone said there would be a solution for this problem when we was at 4.2… 4.7 is around the corner and nothing to resolve this problem was spoken again. Please, I tried a lot of things already and nothing removes this problem. Doesn’t matter how good UE4 renderer is, if something like this happens to a character’s arms in player’s mind everything instantly turns into ■■■■ graphics. Need a solution for this ASAP, any ideas?! Please??
Just wanting to confirm exactly what you are looking for, You are wanting a solution to the clipping issue as illustrated below:
Hey BrUnO XaVIeR -
From our Developers:
"The best solution is to not require hacks. If your player collision is such that you will not intersect with world geometry you should be fine.
An alternative solution is to selectively clear depth. For example you can render the meshes at the end of the depth-only prepass with depth testing disabled and tagging those pixels in the stencil buffer. Then enable stencil test in the base pass to not touch those pixels. At the end of the base pass you turn off stencil test and render your foreground meshes with depth testing enabled to get their properties in the gbuffer."
Adjusting collision would require a capsule 3x larger. That makes no sense.
And, ‘selectively clear depth’… I have no idea how to do that without any kind of guidance/tutorial. I’m not a shader guru.
If is possible to mask meshes/skeletal meshes using a shader mask (rendering the actual object instead of an outline), even if the object has animated vertices, I would love to know how to do it.
I’ve built a workaround for this; would be great to have a proper fix, but for now what I did was to accept the issue and add code to the character to avoid it as much as possible.
My character now has ‘self-aware’ gear, kinda. They know when something is blocking their way and will hold fire or any other actions related to the gear until the way is free again. To do that I set a flag using Physics asset collisions; if that flag is set to true I play an animation to retract back the arms then I start firing a line to detect when there’s nothing blocking the way again and let the arm go forward again. Not the best solution, but works for flat walls at least.
Thank you for the help anyways Eric.
I have the same issue, I’d love some advice. Its true ideally the first person character wouldn’t leave their collision but for some animations it just looks better to allow it and render over the map geometry.
Eric: can you elaborate on the way to make this happen, assuming I am not a graphics programmer
Hi! This question’s old as hell, the real solution is to make the arms/gun really small and keep it close. just keep the position attached to the camera and you should be fine…
Could you please bring more detailed approach related to the alternative solution?
Had to make a semi “perception” to deal with this thing;
The character is aware of when there’s something to close blocking his arms and he will just bend his arms (animation) closer to his body a wait until the player moves farther away from the wall in a position where he can strain the arm again, only then he would stop blocking the player from shooting.
I know this thread is quite old by now, but I stumbled upon it while searching for a workaround or solution for this and I suspect I am not the only and/or last one who will end up in this thread.
Anyhow, I went with a workaround that works OK for what I am trying to achieve (trying to avoid my first person character’s mesh and weapon to clip through meshes in the game environment). It is very basic and probably something many have thought of, it’s not perfect but just fine for my project and hopefully helpful for others as well. Nonetheless, I am sure we all would prefer an official fix/solution from the UE4 dev team for this.
What I did was to simply move everything (camera, first person mesh, gun, arrow component etc) into the capsule collider so that the tip of the gun is at the very edge of the collider, thus it’ll never clip through any meshes in the environment. Also, In my particular case it was beneficial to get some distance from the camera and the “collider edge” as it prevented the player from getting too close to textures, making them look bad.
that’s not really a solution, they’ll disappear if you walk into a wall. unless they’re actually inside your capsule component, I guess.
just sort of messy
This appears to be the solution used by the character blueprint in UE5’s First-person template. I’d love to hear whether you or anyone else here came up with a better solution. In Godot, the typical solution is to render the viewmodel from a separate camera onto separate layer which you render on top of the screen.