Announcement

Collapse
No announcement yet.

Distance to Nearest Surface not working in procedural generated content

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

    Distance to Nearest Surface not working in procedural generated content

    Hi,

    I have static meshes dragged out from the content folder to the scene and tested to be working.


    Click image for larger version

Name:	distanceField.PNG
Views:	112
Size:	538.0 KB
ID:	1675581

    However, for the same world, i have procedurally generated a landscape of static meshes(HISMC) and expected the same meshes to generate distance field but it did not work.

    Click image for larger version

Name:	distanceField2a.jpg
Views:	88
Size:	32.1 KB
ID:	1675582

    And some other (few) meshes(HISMC) that were created procedurally as well, were generating the distance field. Is there a setting thingy that i need to do to get it working for all? Using unreal engine 4.22.3 .

    #2
    Just like for the static meshes you have to make sure the distance field checkbox is marked.

    In the end however I did away with the distance field and used a mapping of the terrain taken after basic generation as the underlying texture to shift colors.

    Its not quite the same, but writing 1 render texture and using it in absolute world position is a lot less intensive on the gpu.
    The downside is the pixelation, the max you get is a 4k texture to cover up the whole landscape, so the water material has to make use of a few smoothstep passes to refine the areas. Still less intensive then distance fields though (also because distance to nearest surface seems to be linked to camera proximity).

    Comment


      #3
      Thanks for the advice. I have tried it but cant get the camera settings to project it correctly via triplanar for multiple sea planes. And as you have mentioned it would appeared to be pixelated at far camera projection distance.
      Click image for larger version

Name:	distanceField3a.jpg
Views:	110
Size:	18.0 KB
ID:	1675674

      I have managed to solve my problem though. The issue was i have disabled the shadows for shore HISMCs which disabled the distance field (distance to nearest surface node in material). Enabling the shadows popped the distance field back.

      I will keep in mind on the approach that you have mentioned. Might be useful in future.

      Tips : for those trying to get distance field to work for static meshes. Make sure it is fully enclosed mesh.

      Comment

      Working...
      X