I have a Blueprint with a static mesh component that is translucent. I understand that translucent meshes don’t render to the scene depth, so I followed the advice in this post, but it doesn’t work.
The idea is to duplicate the static mesh, and then turn of Render in Main Pass and turn on Render CustomDepth pass on this duplicate mesh. That way you don’t see the duplicate mesh in game, but it will still render to the scene depth. However this appears to no longer work. The duplicate static mesh does not render into the scene depth buffer at all.
Is this a bug or is there a new way to do it now, considering that post was from 4 years ago.
I’ve seen that and already tried it too, but it doesn’t work. I have the feeling that both Render to CustomDepth Pass on the static mesh and Allow Custom Depth Writes on the material is for writing to the custom depth buffer. However it doesn’t write to the actual scene depth buffer.
So either it is not meant to write to the scene depth buffer and there is another way to do it, or it is a bug that should be reported.
I think the idea is to write to the actual depth buffer, rather than custom depth. As far as I know, effects like depth of field can only function based on the scene depth buffer, so if the goal is to apply depth of field to a translucent object (rather than whatever is behind it), this won’t work.
It is likely intended. If such functionality ever existed in past, it was and is undesired.
There are workarounds to get mesh to render only in depth buffer, but I have no idea how one could apply that, especially considering that it would happen during pre/base pass.
Thanks guys. I managed to solve the problem. It is actually possible to do what I wanted to do, just took a bit of experimentation and thinking outside the box.
Writing that you “solved it” and not posting the solution is a grave sin in the question/answer community Please update the thread with the solution or point others in the right direction. Thanks!
I found this thread while trying to find a way to get DoF to work with a translucent plane. My thought process was that if I had a second plane, rendering only to the scene depth, and put that plane beneath my translucent plane, I would be able to force the DoF code to use that second plane’s depth for the the translucency plane. It doesn’t work though because there’s no way to render to just the depth buffer that the DoF shader uses.
I did however get something working, but I’m not proud of it. Below is a screenshot. It’s a partially translucent plane (opaque on the white squares, translucent on the black), with some cubes underneath and above it. If you notice, depth of field appears to be working… the translucent plane blurs correctly, and also reveals the cubes underneath.
How is it done? A scene capture component on the pawn. And a hidden plane just underneath the translucent plane. The scene capture component ignores both planes. Then the render texture of the scene capture component gets projection-mapped onto the hidden plane. Like I said, not proud of it, but it seems to work ok. I’ve attached the scene files for anyone interested.
Hey Guys, i want to write my mesh to scene Depth so i can use GPU emitters collision which works on scene depth
i tried using the above technique but that does not work.
if wilberolive can post his solution that would be great.
Hey sorry guys. From memory the solution ended up being specific to my use case scenario, which is why I didn’t bother going into detail. However, I’ll go back and check what I did and see if I can revise it into a more general solution. Just give me some time.