Announcement

Collapse
No announcement yet.

Render to SceneDepth only

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Render to SceneDepth only

    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.

    https://answers.unrealengine.com/que...t-objects.html

    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.

    #2
    You do not need to duplicate the mesh. Translucent objects can write to custom depth. There is a checkbox in material settings.

    Comment


      #3
      Originally posted by Deathrey View Post
      You do not need to duplicate the mesh. Translucent objects can write to custom depth. There is a checkbox in material settings.
      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.

      Comment


        #4
        Originally posted by Deathrey View Post
        You do not need to duplicate the mesh. Translucent objects can write to custom depth. There is a checkbox in material settings.
        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.

        Comment


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

          Comment


            #6
            Thanks anyway guys... surely someone knows how to do this. I can't be the first person that needed to render only to the scene depth buffer.

            Comment


              #7
              If I understand what you want, this definitely still works in 4.22. We use it for highlighting fully or partially translucent objects.

              + attach dupe static mesh with default world grid material (UStaticMeshComponent* proxy)
              + proxy->SetRenderInMainPass(false);
              + proxy->SetCastShadow(false);
              + proxy->SetCollisionEnabled(ECollisionEnabled::NoCollision);
              + proxy->SetRenderCustomDepth(true);

              One thing you might have forgot is swapping the material of the proxy to a non-translucent? We use the Unreal default world grid.

              Below is example of a translucent cube highlighted via CustomRenderDepth method.

              Click image for larger version  Name:	HighlightProxy.jpg Views:	1 Size:	194.2 KB ID:	1631257
              Last edited by Jocko Jonson; 06-14-2019, 10:22 AM.

              Comment


                #8
                Ohh hmm you want scene depth not custom depth. Will leave the above anyway in case someone searches this topic.

                Comment


                  #9
                  Well I sent a bug report in about it just in case, but turns out, no it is not a bug. I was told to post to answer hub, which I've done now.

                  https://answers.unrealengine.com/que...3454/view.html

                  Hopefully someone has done this before and notices my post.

                  Comment


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

                    Comment


                      #11
                      Can you post the solution for future google searches? Also just wondering but what is the use case for this?

                      Comment

                      Working...
                      X