Material for rendering occluded objects

Hey, I need to recreate a specific rendering effect. Here is a quick video of what I need. The box on the right is what I’m mostly interested in. Sadly the owner has refused to expose that particular material or how he achieved the effect.

Basically I need a material that renders normally when you can see it but renders differently when occluded by another model. I’m aware that custom depth can create similar effects (like outlines) and I could even use custom rendertextures but that isn’t really efficient enough. The best thing would be a one pass approach. Something like creating a transparent material, dissabling depth testing and handling drawing by comparing the current and scene depth, but with features of solid materials like shadow casting and reflections which do not work with transparent materials.

I hope you can help me with this.

Hi Chris,

If you follow the link in the YouTube video description you can see that he shares the material setup and how he did it. If you click on the link at the top of the “how he did it” post you can get the project that was used and alter it just like Satheesh did.

Here’s the link to the tutorial he made: Mini Tutorial on rendering occluded actors using Post-Process | Unreal X-Editor

Here’s the one to the project: Rendering occluded actors in UE4 | Unreal X-Editor

I followed the link and even downloaded the project, but the material setup on the site is just for the outline post process effect (which I already know how to do). What I need is the setup for the box on the right which has no outline effect but rather a custom material for the occluded areas. And that marerial is not present. If you scroll to the bottom on the first website you can see that he wrote he can’t share the setup for that material, which is why I’m asking here.

Ah, was not aware of that. Apologies for the confusion. Satheesh is one of our moderators here on AnswerHub and on the Forums. He’s fairly active on the forums. You may be able to message him @ Ryanjon2040.

I can look into this more when I have free time, but I’m not sure exactly when I would get to it. Hopefully he’ll be able to help, even if he can’t post something publicly.

Hey, this seems pretty straightforward to implement. Since the occluded custom depth is still rendered, you simply need to re-generate worldpositions from depth. That should be the “SceneTexture” node then select “CustomDepth”. Conveniently I just helped another person with exactly that problem and the code is:
WorldPosition = CameraPosition + CameraVector * CustomDepth.r / dot(CameraVector, CameraDirectionVector)

Making the scan lines should also be easy. Check out something sort of similar in an example I messed around with to show how text scan line materials could be made: