Drawing first person hands over scene - like Resident Evil 7? (video ref)

I’ve been playing around with Resident Evil 7 and noticed the first person hands simultaneously exist in the world while drawing over everything else, and I was curious if anyone had any ideas on how they might be doing that and if something similar is achievable in UE4.

Attached is a video I took playing around with the effect and trying to break it to examine what they’re doing. The hands receive and cast shadows in the environment as one would expect standard geo to do (as opposed to a flat card rendering a separate capture from out in space). Interestingly, when positioned so they would be clipping through the world, they still draw on top of everything but receive shadows from the world as if they are clipping. The video explains it better than I can in text, but any time the hands would clip, they just receive the shadow of the object they’re passing through. This leads me to believe they are in the world but doing something tricky with the rendering to still cause them to otherwise draw in front.

One idea that occurred to me but doesn’t seem to technically work in UE4 would be to use have the hands draw to custom depth and use a pixel depth offset in the shaders for all world materials to push those pixels back. Obviously the issue there, though, is that opaque materials can’t read from scene textures like the custom depth pass.

Any ideas would be great. The effect isn’t necessary for anything at the moment, but I’ve wondered about doing something similar in the past and have seen a few threads before without anything definitive ever being posted.


The hands are also affected by the game’s translucent water shader when they intersect the water plane (skip to 4:00):

To me it just looks like they haven’t really done anything special or particular to achieve such an effect. They simply just did what any standard game does and applied animations to their character model, anything after that such as clipping or w.e. is entirely up to the engine or settings of physics. Pretty sure its also shown in the character shadows (i checked as well cause i was curious on it and I rly do love how they blurred the hands/guns etc which kinda changes the FP templates you see in games these days)
So in the case of unreal, you would have a character mesh -> player presses [Space Bar] -> Character performs hands in face animation.

The animations weren’t what I was talking about. I understand that fine. It’s the rendering and way the hands are always drawn on top of everything else in the scene even when they clip through the scene geometry. By and large they have pretty large collisions around objects to prevent the player from getting too close, but there are instances like the ones shown in the first video where the hands or other first person weapons penetrate the world geo. When that happens, the shadows from the world are still drawn on the hands, as if they were clipping, but you never see them penetrate or get hidden by the geometry from the scene. It’s a rendering issue that I’m interested in, not how to set up animations.

Not sure what style of renderer Resi 7 uses but if it’s deferred, then the likelihood is that they are rendered separately using a stencil buffer - and the final scene is composited from the two. Not something you can do easily in Unreal. There are tutorials for rendering things in the foreground with materials, which lets you put affects on things - but not for literally drawing an object on top of the scene.

Some games use Hand IK to stop culling through geometry, which is a nice approach if you can spare the time to make it work.

You can use Custom Depth to always render occluded objects.