Announcement

Collapse
No announcement yet.

Water depth World Based

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

    Water depth World Based


    I'm stuck with this problem:
    I have 2 materials : a water material and a sand material.
    I'm trying to get the value of the water depth world based by the Z axis ( not camera based ).
    I tried a lot of node like depthfade ,WorldPositionBehindTranslucency , pixel/scene depth , ... that give me value like the green or the orange one but i'm looking for the black value.

    What i got : (If the camera don't see the sand under water the node don't give the height value)
    Camera based depth
    What i'm trying to do: (I want that even if the camera don't see the sand under the water the node give the height value )
    World Based Depth
    Last edited by ANT0_21; 08-03-2020, 05:55 AM.

    #2
    You can bake height map of the sand and read it from texture at water material.

    Comment


      #3
      Originally posted by Kalle_H View Post
      You can bake height map of the sand and read it from texture at water material.
      Is there a way to make it dynamic ?

      Comment


        #4
        Originally posted by ANT0_21 View Post

        Is there a way to make it dynamic ?
        Draw sand meshes with ortho camera with SceneCapture2d. Last time I tested depth rendering it didn't work with ortho projection so I would use special material for sand meshes and draw height to color target. This scene capture can follow the player so you only need to draw close by area.

        Comment


          #5
          Originally posted by Kalle_H View Post
          Last time I tested depth rendering it didn't work with ortho projection
          Works in 4.25, doing it one of my levels

          Comment


            #6
            ​DONE !
            Thanks for your help !
            Here is the result in my test world :

            Click image for larger version

Name:	Forum3.png
Views:	102
Size:	157.6 KB
ID:	1797908​​​

            Quick recap:
            I putted my sand mesh in the Scene Capture 2D BP, set Projection Type to Orthographic, adjusted the camera position and set the Texture target to a TextureRenderTarget
            In my material I imported texture and remapped the value to get float values between 0 and 1 and I got the mask i needed.

            Click image for larger version

Name:	Forum1.png
Views:	67
Size:	539.5 KB
ID:	1797909
            Click image for larger version

Name:	Forum2.png
Views:	67
Size:	417.3 KB
ID:	1797910

            Comment

            Working...
            X