Hi All, I am trying to render a series of mesh cubes with all of their materials (base color, metallic, roughness, specular) in front of a solid plane. The cubes exist behind the plane in 3d space but I want the cubes to always render on top of the plane. The plane will also have a base color texture, metallic, specular, etc. I am pretty new to creating these types of shaders so any examples or help would be greatly appreciated. I’ve attached my sample file. Please feel free to use it as an example. Thank You!
CubeAnimation.zip (10.3 MB)
You can easily do this using stencils, here is a bit more information about post process and stencils: Post Process Materials in Unreal Engine | Unreal Engine 5.1 Documentation
Scroll down until you find the topic CustomDepth Stencil to learn how you can do this. You can alternatively look at my Highlight Shader available on my website: Elias Wick | Highlight
Thank you for the information, and great shader! I’ve seen a bunch of shaders using the post process and stencils. However, all of the examples that I’ve seen function as a “highlighting” element with a solid color (similar to your shader). Instead of a solid color, I’m looking to display the original material that is applied to the mesh. Do you believe that this is possible to do?
Yes absolutely! You can simply create a mask that does that for you. Simply subtract the depth of the stencil with the depth pass and it should show the texture / original mesh in front of everything.
Thanks. If you have time, would it be possible to show me a sample material of how this would work? I’d greatly appreciate it.