The Cube Impostor Generator is a simple yet useful Unity Editor tool designed to create cube-shaped impostors for 3D objects. It's particularly useful for optimizing Unity scenes with many cube-like structures such as buildings, especially for highest LOD levels or distant objects.
- Generates cube-shaped impostors from complex and multi-material 3D models in Unity
- Creates 1 atlas texture for all six faces of the cube
- Supports LOD (Level of Detail) integration
- Customizable texture size and trimming options
- Applies to prefabs for easy integration into existing Unity projects
- Can be static batched for improved performance
- Allows for further combination and atlasing
- Represents real geometry, avoiding angle-switching artifacts of shader-based impostors
- Can be lightmapped for better visual integration
- Limited to cube-shaped objects only (e.g., buildings, boxes)
- The tool captures six orthographic views of the source object (front, back, left, right, top, bottom).
- It generates an atlas texture containing all six views.
- A custom cube mesh is created with UVs mapped to the atlas.
- The resulting impostor can be integrated into the scene's LOD system.
- Open the Cube Impostor Generator window from
Tools > Roundy > Cube Impostor Generator
in Unity. - Assign the source object you want to create an impostor for.
- Adjust settings like texture size, trim amount, and shader.
- Click "Generate Impostor" to create the impostor.
- Optionally, apply changes to prefabs and adjust LOD settings.
- Source Object: The GameObject to create an impostor for.
- Atlas Texture Size: Size of the final atlas texture (higher values for better quality, larger file size).
- Trim Amount: Adjusts trimming of empty space around the impostor.
- Shader: Select the shader for the impostor material.
- Create LOD: Automatically sets up LOD with the original object and impostor.
- Apply to Prefab: Applies changes to the prefab if the source is a prefab instance.
- Mark as Static: Marks the impostor GameObject as static for batching.
- Best suited for cube-like objects such as buildings or containers in Unity scenes.
- Ideal for highest LOD levels or distant objects in your Unity project.
- Experiment with different texture sizes and trim amounts for optimal results.
- Use in combination with other Unity optimization techniques for best performance.
- Copy the
CubeImpostorGenerator.cs
script into your Unity project'sEditor
folder. - The tool will appear under
Tools > Roundy > Cube Impostor Generator
in the Unity menu.
Contributions are welcome! Please feel free to submit a Pull Request.