Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Disable Depth Test - Opaques

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 crap graphics. Need a solution for this ASAP, any ideas?! Please??

alt text

Product Version: Not Selected
more ▼

asked Jan 26 '15 at 07:37 AM in Rendering

avatar image

996 31 17 36

avatar image Lovecraft_K ♦♦ STAFF Jan 26 '15 at 08:42 PM

Hey -

Just wanting to confirm exactly what you are looking for, You are wanting a solution to the clipping issue as illustrated below:


Thank You

Eric Ketchum

clipping.jpg (39.1 kB)
avatar image BrUnO XaVIeR Jan 26 '15 at 08:58 PM

Yes sir! Exactly.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

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.

alt text

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.

more ▼

answered Jul 23 '17 at 07:10 PM

avatar image

0 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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..

more ▼

answered Nov 18 '15 at 04:59 AM

avatar image

3 5 13 17

avatar image SlimeQ Nov 17 '17 at 08:53 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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."

Eric Ketchum

more ▼

answered Jan 27 '15 at 11:18 PM

avatar image

Lovecraft_K ♦♦ STAFF
36.7k 702 260 736

avatar image BrUnO XaVIeR Jan 28 '15 at 10:42 AM

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.

avatar image BrUnO XaVIeR Jan 28 '15 at 02:33 PM

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.

avatar image pottej May 16 '15 at 10:53 PM


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 :)


avatar image Rudankort Aug 16 '16 at 04:31 PM

Could you please bring more detailed approach related to the alternative solution?

avatar image BrUnO XaVIeR Aug 17 '16 at 11:45 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question