Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Best way to spawn particles based on a heightmap in VFX Graph?

Discussion in 'Graphics Experimental Previews' started by Cell-i-Zenit, Dec 31, 2019.

  1. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    Hi,

    I have a heightmap. What is the best way to spawn for example some grass on a hill, based on this texture?

    Currently i create two random values (x and z) via the random node for each particle and use these values as texture coords. I then use the texture lookup value to get the complete position of the particle.

    The problem is that this is not really "triplanar" friendly, as the points are evenly (randomly) distributed based on a 2d grid. Hills have now holes as the distance between two points is still not enough to cover the slopes.

    So i wonder if there is a better way of placing particles based on a texture.

    Another problem i have is that i dont really have a way to "not" spawn particles based on a value. Say that i want to only spawn these particles if the height goes > 0.5 ... i can only move them out of the way via flooring, but this seems wasteful.

    Anyone has an idea?
     
  2. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    I'm going to shamelessly necro this and ask how did you combine a given particles coordinate with it's height, for what i want it even the low height to coordinate resolution is acceptable but my solution only works on first line and all the rest are flat.

    Thanks