Announcement

Collapse
No announcement yet.

How do I use a Depth Map texture to control particle positions in Niagara?

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

    How do I use a Depth Map texture to control particle positions in Niagara?

    Trying to figure out how to use a depth map (https://imgur.com/leEkqMJ ) to offset the particle positions ( https://imgur.com/xvJILFI ) in Niagara.

    The Chris Murphy tutorial ( https://www.youtube.com/watch?v=etSfYfIIoSE) which gives me the exact effect I'm going for. However, the method in the tutorial is to uses depth embedded in the alpha, and struggling to figure out how to adapt it to use the R channel from an image without alpha.

    Pretty simple effect and I'm guessing this is probably super easy for someone with more experience.

    Would appreciate any insight on how to write the module.

    Thanks so much!

    #2
    I made something that works in a similar manner awhile back. Here's the project if you want to check it out. Still works in 4.24, probably 4.25 too, except you gotta uncheck "Render in Depth Pass" on all the (now black) objects, that are supposed to be invisible, to get it to behave like it does in the vid. Press C to update the render target.




    Mine doesn't use Niagara, or particles in general, but if you're using a Scene Capture Component that captures Final Color(LDR), and you're only interested in the depth, you can apply a post process material to it that remaps SceneTexture:SceneDepth to the R channel of Emissive Look for Rendering Features/Post Process Materials on the Scene Capture Component(mine's a child of the FirstPersonCharacter camera). I re-project from SceneTexture:CustomDepth and output WorldPosition as my Emissive in the post process material, and use that to drive my point cloud positions.

    Click image for larger version

Name:	customdepth.jpg
Views:	245
Size:	122.1 KB
ID:	1798034

    I seem to recall doing it that way because depth written to a single LDR channel didn't have as much precision as I wanted, but using all 3 channels for WorldPosition did. It also just might have been to avoid having to pass the scene capture position as an additional parameter to my point cloud material. Been awhile, idk.

    Comment


      #3
      Thanks so much for sharing.
      I opened it in 4.24.3, but not getting the effect (I did uncheck the render to depth option in details)
      Would love to check out the logic, any idea why it's not working for me?

      Comment


        #4
        Hmmm, I'm using 4.24.3 as well, and I just downloaded the project from the link I gave you.

        Here's what I see when I load the project, hit Play, click in the viewport and press C:
        Click image for larger version

Name:	DepthPass.png
Views:	185
Size:	553.3 KB
ID:	1798052
        Here's what I see when I uncheck Render in Depth Pass on EditorCube11, hit play, click in the viewport and press C:
        Click image for larger version

Name:	NoDepthPass.png
Views:	139
Size:	561.0 KB
ID:	1798053
        Here's the Details panel for EditorCube11
        Click image for larger version

Name:	Details.png
Views:	138
Size:	27.6 KB
ID:	1798054
        LidarRT should look something like this after you hit C.
        Click image for larger version

Name:	LidarRT.png
Views:	134
Size:	3.8 KB
ID:	1798055
        Other than that, are you using an AMD card? I recall them having issues rendering that particular version of the quadchain-2-20 mesh(flickering), but it should still put the polys in the right place. Is C still mapped to "Capture" for you in the Project Settings/Engine - Input/Action Mappings?

        Comment


          #5
          Ah, cool. C was indeed not mapped to capture.

          Comment

          Working...
          X