The Tree Cross Quad Impostor Generator is a Unity Editor tool designed to create optimized cross-quad impostors for tree or vegetation models. It generates a texture atlas with four snapshots (front, back, left, and right views), maps them onto cross-aligned quads, and optionally integrates an LOD system for enhanced rendering performance.
TREES in this demo were created using this generator.
-
Input and Configuration:
- Select a source tree (GameObject).
- Choose the desired texture atlas resolution (e.g., 512x512).
- Optionally, adjust the positioning of each quad for fine-tuning.
-
Snapshot Generation:
- The tool captures four directional views (front, back, left, and right) using a temporary orthographic camera.
- These views are baked into a single texture atlas.
-
Mesh and Material Creation:
- A cross-quad mesh is created with UVs corresponding to each snapshot.
- A material using the ImpostorCross.shader is applied, supporting features like transparency and efficient instancing.
-
LOD Integration:
- If enabled, the tool sets up an LOD group with the original tree at the highest level and the impostor at the lower level, ensuring smooth transitions.
-
Output:
- A prefab containing the impostor is generated and saved (in Project Files), including its mesh, material, and texture atlas in proper folders.
- Texture Atlas Generation: Creates a 2x2 texture atlas with snapshots of four sides.
- Quad Adjustment: Fine-tune the position of each quad for accurate representation.
- LOD Support: Seamlessly integrates with Unity's LOD system.
- Batching Friendly: Impostor quads are static-batchable, reducing draw calls.
- Performance Optimization: Reduces polygon count drastically compared to original models.
- Preview Mode: Real-time visualization of impostors before finalizing.
- Four-Sided Representation: Unlike traditional billboards that rely on a single plane, cross-quad impostors provide a better 3D illusion with four directional snapshots.
- Static Batching: Can be efficiently static-batched, reducing runtime overhead.
- Better Depth Perception: Maintains visual fidelity from multiple angles.
- Customizable: Each quad's offset can be adjusted for a fine-tuned appearance.
- **Can be combined. For exmaple using my other tool : https://github.com/roundyyy/intelligent_mesh_combiner
The ImpostorCross.shader renders the impostor's cross quads using the generated texture atlas. It supports transparency, customizable cutoff values, and instancing for optimal performance in vegetation-heavy scenes.
- Open the tool via the Unity Editor:
Tools > Roundy > Tree Cross Quad Impostor Generator
. - Assign a tree model to the
Source Tree
field. - Configure the settings:
- Select
Atlas Texture Size
. - Enable
Create LOD
if desired and setLOD Transition Height
. - Adjust the offsets for each quad (front, back, left, and right).
- Select
- Click Preview Impostor to visualize the impostor.
- Click Generate Final Impostor to bake the impostor and save it as a prefab.
Note on Lighting: While the tool comes with an optimized unlit shader, you can easily add lighting to your impostors:
- Use any cutout-capable shader (Standard, URP/Lit, or custom)
- Simply change the shader on the generated material
- All the impostor functionality will remain intact
- Useful when impostors are viewed from closer distances or need to match lit scenes
- Unity 2020.3 or later
- URP/BIRP compatible
- Download the latest release package from the Releases page.
- Import the package into your Unity project.
- The tool will be available under
Tools/Roundy/Tree Cross Quad Impostor Generator
.
Each quad's position can be fine-tuned using the sliders provided in the tool. Adjust these to ensure alignment with your source tree.
Define the transition height for the LOD system to balance performance and visual fidelity.
IF you have many various trees, you can atlas them later easily with my other tool : https://github.com/roundyyy/LODOptimizer This way you can static batch them together, even though impostors have different materials.
Contributions are welcome! Please fork the repository and submit a pull request with your improvements.
This project is licensed under the MIT License. See the LICENSE
file for details.