Unity-Interactive-Grass with Quad Tree

April 13, 2025 ยท View on GitHub

Using DrawMeshInstancedIndirect Draw 100000+ Grass

https://remoooo.com/en/unity-instanted-grass

https://remoooo.com/unity-instanted-grass

News

URP-With-New-Tool-v1.0 Branch.

  • Draw Grass Tool
  • URP project

Setup

  1. Create an empty object in your Unity scene. Name it Grass Generator - Holder.
  2. Place the GrassPainter.cs script into the Editor folder of your project. This is necessary for the script to function properly in the Unity Editor.
  3. Attach the GrassControl.cs script to the Grass Generator - Holder object you created in Step 1.
  4. Select the object(s) where you want to generate grass. With the object(s) selected, go to the GrassControl component on your Grass Generator - Holder object and click the Generate Grass to Selected Objects button.

Introduction

image image image image

Key code:

Graphics.DrawMeshInstancedIndirect(blade, 0, m_Material, m_LocalBounds, m_argsBuffer);

Reference:

  1. https://patreon.com/minionsart?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=creatorshare_fan&utm_content=join_link
  2. https://github.com/ColinLeung-NiloCat/UnityURP-MobileDrawMeshInstancedIndirectExample