Setup

The whole package is contained in the Mirage folder resulting from the import but you can move it wherever you want.

What is an impostor

An impostor or imposter is a dynamically rendered billboard texture map used to stand in for geometry in the distance.

In Mirage context, you can have as many objects as you want in a single impostor, and all the the points of view are stored into an abedo map and an optional normal map atlas map per impostor. Smoothness, metallic or occlusion are not baked into textures but are still customizable on post baking options.

How to bake an impostor

Mirage consists in a single editor window. You can open it via Window->Mirage->Impostors. There are 5 category foldouts that that can expand or hide by clicking on their title. Even when hidden, they still provide basic information or controls on the right of the title. The following sections will provide detailed explaination of each of the categories.

Image 2024-02-06 164734156.png

Setup the target(s)

This category holds all the source object(s) information. Note that only one impostor can be baked at a time, so all the target will all be part of the same impostor. For a simple one-click impostor approach, drag and drop the common ancestor in the dedicated field. Note that if you want to bake only one object the common ancestor can be the object itself or its parent. When the common ancestor is set, Mirage will automatically detect all the mesh filters in its children, recursively. You can check which mesh filters are included by expanding the section as following. Null or invalid objects will be ignored.

Image 2024-02-06 170842562.png

You can also exclude some meshes or add some manually by dropping them into the area. If you change the mesh filters manually, the common ancestor will be updated accordingly. Note that a common ancestor is needed to bake an impostor.

Quality Settings

This category is crucial and will have a direct impact on the visual quality of the impostor. Provides full control over the baking topology. This section should be paired with the Information category that provides real-time visualization for an excellent and fast control over the baking topology.

Image 2024-02-06 172158522.png

Texture Size

As previously mentionned, Color Maps and Normal Maps are stored into square POT atlases. This field controls the resolution of these atlases, from 128x128 to 4096x4096. The Estimated Size label provides the size of the whole impostor prefab after baking (with DXT compression)

Sphere Type

  • UV sphere: The default choice. The UV sphere is based on a fixed number of longitude and latitude samples. The coverage is denser at the poles.The UV Sphere is a solid choice in many use cases, with more versatility regarding partial sphere baking.
  • Pseudo-Fibonacci sphere: at an experimental stage. Provides a homogeneous coverage. Not compatible with latitude interpolation in the impostor shader. Despite being homogeneous, the output impostor will look smooth near the equator, with more noticeable snaps or blur around the poles. Full sphere baking only.

Longitude Samples

UV Sphere only. Holds the number of longitudinal samples. The higher the better for smooth horizontal rotation, at a cost of higher POV number thus resolution/POV in the atlas. All samples are equally spread around the 360 degrees.

Latitude Samples

UV Sphere only. Holds half of the number of latitudinal samples (equator excluded). This means that a 0 value will just bake around the equator. 1 will bake an additionnal sample on each side of the equator, and so on.

The higher the better for smooth vertical rotation, at a cost of higher POV number thus resolution/POV in the atlas.

Laatitude Offset

UV Sphere only. Shifts the equator sample. Useful for partial spheres.

Latitude Step

UV Sphere only. Holds angular offset between two latitudinal samples. A small value will increase smoothness of vertical rotation, but may limit the global latitudinal range.

Density

Pseudo-Fibonacci sphere only. Controls the density of the sphere. The higher the better for smooth rotations in any direction, at a cost of higher POV number thus resolution/POV in the atlas.

Lighting Method

  1. Normal EstimationComputes a dedicated normal map atlas to get physically correct light reflections on the impostor. The recommended method. The baked impostor will use a lit surface shader.
  2. Use Scene Sun SourceAdds the sun source of the opened scene in the baking context. Can provide better results on single lit scenes, especially with intricate metallic/smoothness/self shading objects. The baked impostor will use an unlit shader.

Presets

You can add/load presets easily with the dedicated buttons. Gives an additional degree of freedom to match your workflow. A few relevant presets are already included such as 1-POV-billboard or different hemispheres.

Information

The whole information foldout is readonly. and provides useful visual feedback to help tweaking the previous category fileds.

Image 2024-02-06 180549368.png

On the left column, some metrics are displayed. The values will appear in green is considered valid, orange when considered too low/high. Please note that these colors are purely informative and won't inhibit the impostor generation.

  • The total number of POV. For UV Sphere Baking : For Pseudo-Fibonacci Sphere baking :
  • The Atlas POV size. 15x15 means there are 15 POVs per line and per column.
  • Single POV resolution
  • The atlas coverage : if is an integer, the coverage will be 100% otherwise there will be blank slots in the atlas. 100% is better but not necessary.
  • Unused memory : The estimated memory held by the blank slots in the grid. Will be 0 if the coverage is 100%

On the right area stand 3 tabs for more visual information.

  • POVs : Visualize the Longitude / Latitude coverage. A great helper when tweaking the Quality Settings. You can orbit around with the mouse to see clearer.
  • Layout : Visualize the Atlas layout. Filled atlas slots will be green, blank will be red.
  • Preview : Visualize how pixelated your each single POV will be. Displays the actual objects entered in the Target foldout. You can orbit around with the mouse as well. Please note the snappiness/bluriness won't be previewed here. The area only shows your inputs layout in the impostor and the pixelization but does not stand for a contractual appearance of the ouput impostor.

LODGroup Settings

This category is not crucial since you can always modify it afterwards, but it can make you save a lot a time. If you just want to bake the impostor to a prefab without adding it to the scene, you can untick the field Automatic Setup.

Image 2024-02-06 183403606.png


There are 4 possible scenarios for this area.

  • None of the input meshes are part of a LODGroup : A LODGroup will be added on the common ancestor. all the source renderers will be added in LOD0 and the impostor will be added in LOD1 following the given settings.
  • There is already a LODGroup but no impostors : The impostor will be added in an additional LOD level following the given parameters. Note that all the source renderers MUST belong to either no LOD or the same LOD level from the same LODGroup to avoid nested LODGroup errors.
  • There is already a LODGroup with an impostor : The impostor will be replaced using the same relative height transition. Note that impostors are detected thanks to the ImpostorReference script attached to the LODGroup. If you want to have several impostors in the same LODGroup, just delete safely the ImpostorReference component before baking. Also, the previous impostor's prefab will not be deleted, only the instance in the scene will be replaced.
  • There isn't any common ancestor for the input objects. Baking won't be possible.

Save Path

Impostors are saved as packed prefabs, embedding the quad mesh, the atlas(es) and the material. You can customize this path in this section.

Image 2024-02-06 184910768.png

You can either type the path relative to the Assets folder or use the file browser with the dedicated button.

The label underneath the text field hold the actual, unique path that will be used for the impostor.

If the path contains one or more non-existing directories, they will be created automatically at baking time.

Note that no file nor directory is created before baking.


Click on the Generate Impostor button and wait a few seconds. your object should now have a LODGroup attached / updated, and the impostor should be instantiated as its children. Try to zoom out to see the LOD transition between the original object and its impostor.

Advanced

The provided scene BakingScene-Default is automatically loaded in the Baking Scene object field. Note that you can use your own scene, the only constraints are the presence of an object named "Target" and a main Camera with the script ImpostorTexturesGenerator attached.

If you are using URP, you must also fill in the UniversalRenderPipelineAsset and the UniversalRendererData fields at the bottom of the camera impostor.

The provided scene is the recommanded one for high-fidelity results, but you can modify the lighting settings or add objects in the scene to achieve some interesting result. It's up to your imagination!

  • You can change the generated atlas size with the Texture Size popup. The estimated size below gives an idea of the full impostor (Albedo atlas + Normals atlas + Billboard) size on the disk after DXT1/DXT5 compression.
  • The atlas is baked following a sphere vertices coordinates. Currently, two types of sphere are available.
    1. UV sphere: The default choice. The UV sphere is based on a constant number of longitude and latitude samples. The coverage is denser at the poles.
    2. Pseudo-Fibonacci sphere: at an experimental stage. Provides a homogeneous coverage. Not compatible with latitude interpolation in the impostor shader.
  • The Optimization info panel is some read-only information to help understanding the coverage and the atlas layout.
  • The LOD Group Settings panel contains the settings of the upcoming LODGroup. If you don't want to setup any LODGroup and just bake an impostor, you can uncheck the panel toggle.
  • Impostors baked as prefab only. You have to enter a valid output path (i.e. child from the Assets/ folder). A preview text will display the full path of the upcoming impostor.

Post baking improvements

If you select the impostor object in the hierarchy, you will see that the shader has a few parameters to improve the fidelity.

  • The Brightness slider can increase/decrease the albedo power.
  • The Smoothness/Metallic/Occlusion sliders work the same way than the default diffuse material.
  • The Curvature Occlusion slider applies an additionnal occlusion in rifts, sharp inward angles.
  • The Cutout slider can increase/decrease the sharpness of the alpha clipping geometry.
  • The Smooth toggle turns On/Off impostor bilinear interpolation smoothing.
  • The Dithering Fade toggle turns On/Off Dithering fading on the edges of the impostor.
From left to right: The original model, smooth enabled, smooth disabled.
  • The Yaw/Elevation offset sliders is the way to virtually rotate the object.

Lit / Unlit

By default, impostor shaders are rendered lit. You can change this for a provided unlit shader.

LODGroup Management

If you tick the toggle 'LODGroup Setup' in the editor window, the impostor will be part of a LODGroup when the baking process ends.

From there, there are 3 possible scenarios:

  1. The target object is not part of a LODGroup : It will be created with the provided settings.
  2. The target is already part of a LODGroup in which there is no impostor : the impostor will be added in last position with the provided transition height value.
  3. The target is already part of a LODGroup in which there is already an impostor : The impostor will be replaced.

Tip: if you want to add an additionnal impostor in a LODGroup instead of replacing it, just delete the ImpostorReference component on the LODGroup holder before baking.

Presets

You can save and load presets by pressing the buttons "Load Preset" and "Save Preset" respectively. It will save/override the following settings:

  • Resolution
  • Latitude Samples
  • Latitude Offset
  • Latitude Angular Step
  • Longitude Samples
  • Sphere Type

How to bake several objects at once

Since version 3.4, there is a new component called "AutoLODImpostorsQueue". Here is how to use it:

  • Create an empty GameObject in the scene.
  • Add the component "AutoLODImpostorsQueue" from the bottom of the inspector.
  • In the script editor, you can fill the array with the objects you want to bake.
  • Click on the "Show settings" button. The AutoLOD Impostor window will dock next to the inspector.
  • Tweak the settings as you want.
  • Come back in the queue inspector and click on "Generate Impostors"
  • Take a coffee while your objects are baked automatically

Warnings:

  • Baking a lot of objects at once may take a long time (depending on your settings and hardware)
  • Don't try to interrupt the process. It could lead to a corrupted scene.
  • Keep the focus on the unity editor.

Contact

chaumartinleo@gmail.com

References

https://www.gamedeveloper.com/programming/dynamic-2d-imposters-a-simple-efficient-directx-9-implementation

https://calcifer.org/kenneth-christiansen/ComputerScience/imposters.pdf

https://developer.nvidia.com/gpugems/gpugems3/part-iv-image-effects/chapter-21-true-impostors