Documentation
Guides
NanoGeo guides: add it to many objects at once, tune NanoGeoMesh settings, check compatibility, manage baked data and use the visualization modes.
Many objects at once
NanoGeo Mesh Prefab
Asset packs often have hundreds of prefabs made of many parts. Instead of adding NanoGeoMesh to every part by hand, add the NanoGeo Mesh Prefab component to the root of a prefab, or to any parent object in a scene.
NanoGeo Mesh Prefab gives every child that has a MeshRenderer a NanoGeoMesh, including children you add later. It skips the lower levels of LOD Groups, because the LOD0 NanoGeoMesh replaces the whole group.
A whole asset pack
- In the Project window, select the folder with the prefabs, or select the prefabs themselves.
- Right click and choose NanoGeo > Add NanoGeo Mesh Prefab.
- Confirm. The prefabs are changed and saved. Prefabs inside other prefabs are handled first.
NanoGeo > Remove NanoGeo Mesh Prefab takes everything off again. Try it on a small folder first, because it saves the prefab files and cannot be undone with Ctrl+Z.
What the Inspector checks
The NanoGeo Mesh Prefab Inspector checks all parts and shows a warning with a Fix Now button for each kind of problem.
- Unsupported parts
- Transparent materials, shaders NanoGeo cannot convert, empty material slots and meshes made of lines or points. Fix Now keeps those parts on their MeshRenderer and remembers the choice.
- Meshes without Read/Write
- Fix Now turns Read/Write on in the model’s import settings.
- Lightmapped parts
- Parts that would receive baked lightmaps. NanoGeo does not draw lightmapped objects. Fix Now switches them to light probes.
- Batching Static
- Unity would still build combined meshes for them, which wastes memory. Fix Now clears that flag.
Parts kept on their MeshRenderer are listed under Kept as MeshRenderer, where Use NanoGeo brings them back. Turn off Auto Add to stop the component from adding NanoGeoMesh, and use Remove From Children to take the components off.
Turning NanoGeo on and off
In the Editor
Tools > NanoGeo > Disable NanoGeo makes every object use its MeshRenderer again, and Tools > NanoGeo > Enable NanoGeo turns NanoGeo back on. The On/Off button on the left of the NanoGeo bar in the Scene view does the same. Nothing is removed from your objects, so you can switch back and forth to compare looks and frame rate.
The choice is remembered for the project in the Editor. It does not affect builds of your game.
In scripts
Set NanoGeoManager.enabled.
NanoGeoMesh settings
The Inspector also shows the baked data and, when the object is not drawn by NanoGeo, the reason.
Error Threshold Pixels
Default 1. How far, in pixels on screen, the simplified shape may move away from the real mesh. 1 looks the same as the full mesh. Higher values are faster, lower values keep more detail in extreme close ups. Values from 0.5 to 2 make sense.
Shadow Error Multiplier
Default 3. Shadows may use simpler shapes than the object itself, because they are soft anyway. Higher values make shadows cheaper. If you raise it a lot and see stripes of self shadowing, increase the shadow bias on the light a little.
Shadow Min Lod Level
Default 0. Above 0, the shadow never uses detail finer than this level. Good for objects whose shadow does not need detail.
Cast Shadows
Turn off to stop the object from casting shadows.
Force Fallback
Always draw this object with its MeshRenderer.
What works and what does not
Works
- Static and moving objects
- Many copies of the same mesh
- Mirrored objects (negative scale)
- Several materials per mesh
- HDRP Lit and URP Lit materials
- HDRP Shader Graph materials made from a Lit graph
- Alpha clipping and double sided materials
- All light types and their shadows, HDRP cached shadows and light layers
- Light probes, decals and SSAO
- Motion vectors for TAA and motion blur
- Clicking objects in the Scene view (Unity 6000.3 and newer)
Keeps its MeshRenderer
These objects simply keep their MeshRenderer:
- Skinned meshes and blend shapes
- Transparent materials
- Tessellation and terrain
- URP Shader Graphs and hand written shaders
- Objects that use baked lightmaps
Alpha clipping
Leaves, fences and grilles are drawn by NanoGeo, but always with the normal GPU rasterizer, and they never hide objects behind them, because you can see through the holes. Thin leaf cards can thin out a little far away; lower Error Threshold Pixels on that object if you notice it.
LOD Groups
NanoGeo makes its own smooth level of detail, so put NanoGeoMesh on the LOD0 object only. While it draws, the other LOD levels are hidden. NanoGeoMesh components on LOD1 or lower do nothing, and their Inspector says so.
Baked lightmaps
An object that was in the scene when lighting was baked uses lightmaps and stays on its MeshRenderer. To move it to NanoGeo, set Receive Global Illumination on its MeshRenderer (or on the prefab) to Light Probes. NanoGeo picks it up right away. Bake the lighting again later so the rest of the scene matches.
HDRP Shader Graphs
NanoGeo makes a NanoGeo version of the graph’s shader in Generated/Shaders and updates it when you change the graph. The first time, the object can be missing for a moment while the shader compiles. Vertex movement made in the graph, such as wind, works, but very large movement can be cut off at the screen edge.
Scene view draw modes other than Shaded, such as Wireframe, show the original meshes.
Baked data
Where it is stored
Baked data is stored in Generated/Baked, one file per mesh. Objects that use the same mesh share it. When you change a mesh, it is baked again the next time it is used. The data is about as large as the mesh itself.
Keep the Generated folder in version control. Your builds need it.
Bake commands
The Bake button on the NanoGeo bar in the Scene view has three commands. The same commands are in Tools > NanoGeo. While baking, the button shows how many bakes are running.
- Rebake Selected
- Bakes the selected objects again.
- Rebake All In Open Scenes
- Bakes everything in the open scenes again.
- Delete Unused Baked Data
- Removes files that no scene or prefab uses anymore.
Seeing what NanoGeo does
Open the window
Open Window > Analysis > NanoGeo Visualization, or use the dropdown on the NanoGeo bar in the Scene view. The same tools are in Window > Analysis > Rendering Debugger, also in Development builds. Visualization works only in the Editor and in Development builds.
Visualization modes
- Overview
- Shows eight modes at once around the normal picture.
- Triangles, Clusters, Groups, Instances, Primitives, Material ID
- Give each triangle, cluster, group, object, mesh or material its own color.
- Hierarchy
- Colors by level of detail, from blue (full detail) to purple (simplest).
- Raster Mode
- Shows normally rasterized parts in blue and software rasterized parts in orange.
- Overdraw
- Shows how often each pixel was drawn.
- NanoGeo Mask
- Shows in green everything NanoGeo draws. Black means NanoGeo draws nothing there.
- Streaming
- Shows which data page each part comes from.
- Shadow Clusters
- Shows what is drawn into the first shadow cascade.
- Freeze culling
- Keeps the current selection, so you can fly around and look at it from outside.
Statistics
The window also lists how many objects use NanoGeo, which objects do not and why, how much is drawn, and how much memory is used. Tick Record GPU Timings to see the cost of each step.
Unity’s Statistics overlay in the Game view does not count what NanoGeo draws. Use the NanoGeo window instead.
Demo scenes
Open a demo
Open Samples/Demo/NanoGeoDemo_HDRP.unity or Samples/Demo/NanoGeoDemo_URP.unity. While the scene is open, it switches the project to a matching render pipeline from the Settings folder, so both demos work in one project. Afterwards, run Tools > NanoGeo > Restore Project Render Pipeline to switch back to your own.
Controls
Press Play and use these keys:
- W, A, S, D or arrow keys
- Move. Q and E (or Page Down and Page Up) go down and up, hold the right mouse button to look around, hold Shift to move faster.
- V and C
- Switch to the next and previous visualization mode.
- F
- Freezes culling.
- O
- Turns occlusion culling on and off.
- R
- Turns the software rasterizer on and off.
- H
- Hides the text.
The keys work with the Input System package, with the old Input Manager, and with both.
Baking uses meshoptimizer by Arseny Kapoulkine, under the MIT license. It runs in the Editor only and is not part of your game build.