ColinLeung-NiloCat / UnityURP-MobileDrawMeshInstancedIndirectExample

Example project to draw 1million grass instances on mobile
https://youtu.be/A7rav4tS88s
MIT License
1.56k stars 237 forks source link

Code question: how to draw grass over terrain of uneven height? #2

Open kevenson opened 3 years ago

kevenson commented 3 years ago

Hello,

Thanks so much for publishing this. I've tried so many different grass assets for Unity (for VR) and this is hands down the best I've found--and most of the others I've tried I had to pay for.

I'm trying to understand the code and I have two questions for you (I'm new to URP):

  1. how would you go about drawing grass over an uneven terrain, taking the y position into consideration?
  2. Could one integrate a terrain mask for this so that the grass would follow the player but only render in certain places on the terrain based on the mask (e.g. where the grass ground layer is painted)?

Thanks again! Kai