Announcement

Collapse
No announcement yet.

Material slope/height mask for valleys only

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

    Material slope/height mask for valleys only

    Hi guys,
    I have been stuck on the same problems for a few days now. I created an Auto Landscape Material with slope based masks, and I need to add 1 more feature to it which is masking out valleys only, so I need to find all Concave angles, excluding Convex ones. Please see attached images:

    Click image for larger version

Name:	MaskExample_BEFORE.jpg
Views:	1
Size:	142.7 KB
ID:	1178902
    Click image for larger version

Name:	MaskExample_AFTER.jpg
Views:	1
Size:	139.4 KB
ID:	1178903

    Using a slope mask, how can I achieve this goal?
    Thanks!
    Stephane Roncada
    Lead Technical Artist | Environment Artist
    Rainbow Studios

    #2
    What you are trying to do is find the derivative or curvature of the surface and that requires sampling multiple points. I do not think it will be easily possible unless you have a texture of the heightmap (preferably a normal map too) of whatever geometry so that you can sample those offsets. You can basically check the cross products of the neighbor normals and check the Z sign of the result.

    You could attempt to do it using ddx,ddy...... but I have already lost more than a week of working on that particular problem and the result is quite noisy and unusable.

    Much better to run this kind of process offline and import a texture mask. or fake it using an elevation mask combined with it.
    Ryan Brucks
    Principal Technical Artist, Epic Games

    Comment


      #3
      Originally posted by RyanB View Post
      What you are trying to do is find the derivative or curvature of the surface and that requires sampling multiple points. I do not think it will be easily possible unless you have a texture of the heightmap (preferably a normal map too) of whatever geometry so that you can sample those offsets. You can basically check the cross products of the neighbor normals and check the Z sign of the result.

      You could attempt to do it using ddx,ddy...... but I have already lost more than a week of working on that particular problem and the result is quite noisy and unusable.

      Much better to run this kind of process offline and import a texture mask. or fake it using an elevation mask combined with it.
      Hey Ryan,
      I was afraid you'd say that

      My best result so far is to clamp the maximum height, like you suggested. It works pretty good on terrains with very little elevation like in my example, or on terrains where valleys are all at the same elevation level.

      I do have the initial heightmap used to generate the landscape, I could use it as an elevation mask. But I was wondering if it's possible to sample the landscape elevation values directly, since it's possible to export the landscape as a 16bit heightmap texture, can't I read it from within my material without having to sample that texture?

      Thanks a lot for your help!
      Stephane Roncada
      Lead Technical Artist | Environment Artist
      Rainbow Studios

      Comment


        #4
        Originally posted by Stephane Roncada View Post
        can't I read it from within my material without having to sample that texture?
        No, not currently. You have to make a float HDR texture. You need to be careful when making it since float HDR format has a limited range from around -65k to 65k.
        Ryan Brucks
        Principal Technical Artist, Epic Games

        Comment


          #5
          Originally posted by RyanB View Post
          No, not currently. You have to make a float HDR texture. You need to be careful when making it since float HDR format has a limited range from around -65k to 65k.
          Got it, thanks again for your help Ryan!
          Stephane Roncada
          Lead Technical Artist | Environment Artist
          Rainbow Studios

          Comment

          Working...
          X