- Home /
How do I map VFX grass to a procedurally generated terrain in HDRP
So I made the move to HDRP and have spent the last 2 weeks trying to rework all my textures etc to work in the new environment. All I have left to fix now is the grass. I'm using MapMagic2 to procedurally generate terrain. I've tried creating a load of grass objects then combining their meshes but it wrecked the fps so now I'm giving unity vfx a shot. Because terrains are generated at runtime I can't just feed a mesh that has been converted to a pointmap into the "set position from map" node Instead my plan is this:
1) Create a flat plane mesh the same dimensions as the terrain tile and convert to pointmap
2) Map the grass objects to this pointmap
3) At runtime grab the terrain heightmap and use sample texture to get the y value of the grass at each vertex and add it using the "add position" node
4) Profit?
I did all these things but it acted weird, only pushing up a few of the grass pieces above the rest. I figured that maybe the dimensions of the heightmap texture were wrong so I divided the UV value put into the sample texture to extract a higher level of detail. like so: This seems to have mapped the grass to some sort of rolling terrain but it doesn't match up to the ground and now I'm stumped. I've fiddled around with the amount I divide the vector2 by a lot and it seems to be some sort of weird tiling effect but I can't make heads or tails of it.
Any ideas?
Looks like this at the moment:
Your answer
![](https://koobas.hobune.stream/wayback/20220613035745im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Grass gets cut off 2 Answers
How to make procedural lightning bolts? 1 Answer
visual effect graph prewarm 1 Answer
Procedural 2D frost VFX 0 Answers