Skip navigation, go to main content
About NanoGeo

Documentation

Optimize and build

Make NanoGeo faster with shadow, occlusion culling, software rasterizer and video memory and global settings, then build your Unity game.

Making it faster

Shadows

Shadows are often the largest cost, because a directional light draws several cascades. Raise Shadow Error Multiplier, use Shadow Min Lod Level on objects that do not need detailed shadows, or on HDRP let static lights update their shadows on demand (cached shadows).

Occlusion culling

Cameras skip NanoGeo parts that are hidden behind other NanoGeo objects. It checks twice per frame, so nothing pops in when the camera turns quickly. Only NanoGeo objects hide other objects; ordinary MeshRenderers do not. In scripts: NanoGeoOcclusion.enabled, or NanoGeoOcclusion.SetEnabled(camera, false) for one camera.

Software rasterizer

On Full devices, very small parts are drawn by a compute shader, which is faster for tiny triangles. The result looks the same. In scripts: NanoGeoSoftwareRaster.enabled and NanoGeoSoftwareRaster.SetEnabled(camera, value). To see what it brings in your scene, tick Record GPU Timings in the NanoGeo window and compare the times with the software rasterizer on and off (R in the demo scenes).

Video memory

The default buffer sizes are generous and use a few hundred megabytes. You can lower them, and for very large worlds you can turn on streaming. Both are explained in Global settings.

Streaming

Streaming is off by default, so all NanoGeo geometry stays in video memory. For very large worlds you can turn it on by setting Streaming Budget MB to a value above 0, for example 256.

With streaming on, NanoGeo keeps at most that many megabytes of geometry in video memory. The simplest level of every mesh always stays loaded. Finer detail is loaded when the camera comes close, and when the budget is full, the parts that were not seen for the longest time are removed.

Choose a value below the NanoGeo geometry line in the NanoGeo window, otherwise nothing changes. If the value is very low, objects stay simpler than they should, and after a fast camera move, detail can appear a few frames late.

Streaming saves video memory only. The full data stays in normal memory, and the per frame buffers do not get smaller.

Global settings

What it is

NanoGeo keeps its global settings in one file called NanoGeoRuntimeResources. It is where you go when you want to save video memory, stream a huge world, turn the software rasterizer off, or see how your game behaves on a weaker device.

You do not need to touch it to get started. The defaults work for most projects.

Where to find it

All global settings are in one file: Runtime/Resources/RoamMoon.NanoGeo/NanoGeoRuntimeResources.asset. Select it in the Project window and change the values in the Inspector. Leave the file where it is, because NanoGeo loads it by this path. If it was deleted, run Tools > NanoGeo > Repair Runtime Resources to create it again.

NanoGeo reads these values only when it starts. After a change, click Reset NanoGeo at the bottom of the NanoGeo window, or press Play. A build uses the values saved in the file when you built it.

The fields at the top, from Cull Shader to Debug Shader, connect NanoGeo to its own shaders. Do not change them. If one is empty, NanoGeo stays off, and Repair Runtime Resources fills it in again.

The settings

Tier Override (default Auto)
Auto picks the best mode the graphics card supports. You can only choose a lower mode than the detected one, which is handy to see how your game runs on weaker hardware. Hardware only turns off the software rasterizer. Fallback turns NanoGeo off, so every object uses its MeshRenderer. A higher mode than the card supports is ignored, and the reason shows in the NanoGeo window.
Max Instances (default 16384)
How many NanoGeoMesh objects NanoGeo can draw. Objects beyond this number keep their MeshRenderer, and their Inspector says that the instance capacity was reached. Raise it if your scene has more objects. Each extra object needs very little memory.
Max Slots Per Frame (default 16384)
Each camera, shadow cascade and shadow casting light draws every material on its own, and each of these takes one slot. If a frame needs more slots, some views draw no NanoGeo objects and the Console warns that the slot capacity was exceeded. Raise it if you have many shadow casting lights and many materials.
Visible Cluster Capacity (default about 4 million)
How many clusters, the small pieces NanoGeo draws, fit in one frame for all cameras and shadows together. This is the largest buffer. If it is too small, parts of objects disappear and the NanoGeo window says that visible clusters did not fit.
Scratch, Node Queue, Candidate and Occluded Capacity
Working space the GPU uses while it chooses what to draw. If one is too small, the NanoGeo window shows Queue overflow for that camera.
Software Raster (default on)
Lets NanoGeo use the software rasterizer on Full devices. Turn it off to always use the normal GPU rasterizer. To switch it at runtime, use NanoGeoSoftwareRaster in scripts.
Sw Threshold Pixels (default 32)
Clusters smaller than this on screen go to the software rasterizer, larger ones to the normal GPU rasterizer. The Raster Mode visualization shows the split, and Record GPU Timings in the NanoGeo window helps you compare values. Most scenes are fine with the default.
Streaming Budget MB (default 0, off)
Above 0, NanoGeo keeps at most this many megabytes of geometry in video memory. See Streaming for how to choose a value.
Streaming Upload MB Per Frame (default 8)
How much geometry NanoGeo may send to the GPU in one frame while streaming. Higher values bring detail back faster after a fast camera move, but can cause small hitches.

Common changes

Save video memory
Lower Visible Cluster Capacity and the four working buffers together, for example all to half. Then fly through your heaviest view and check the NanoGeo window for warnings. If you see one, go back up a step. The Per-frame buffers line in the window shows how much these buffers use. On phones and tablets NanoGeo already uses at most a quarter of the defaults for these five buffers, so you do not need separate mobile values.
A very large world
Set Streaming Budget MB to a value below the NanoGeo geometry line in the NanoGeo window. See Streaming.
Test a weaker device
Set Tier Override to Hardware only, press Play and compare. Set it back to Auto when you are done.
See what the software rasterizer gives you
Tick Record GPU Timings in the NanoGeo window and compare the times with Software Raster on and off. In the demo scenes you can switch it with R.

Building your game

Steps

  1. Make sure BatchRendererGroup Variants is set to Keep All (see Installing).
  2. Build as usual.

The baked data, materials and shaders are included automatically because your scenes reference them. The baking library is used by the Editor only and is not part of the build.

Android

Use URP and put Vulkan first in Project Settings > Player > Other Settings > Graphics APIs (the default in Unity 6). You can keep OpenGL ES 3 in the list for older phones; there your objects are drawn by their MeshRenderers.

iOS

Use URP and keep the default graphics API (Metal). Build the Xcode project from Unity, then build and sign it on a Mac as usual.

Baking uses meshoptimizer by Arseny Kapoulkine, under the MIT license. It runs in the Editor only and is not part of your game build.