Difference between revisions of "Troubleshooting"
(→Whole scene is very bright or black) |
(→Light probes are too bright in Subtractive mode) |
||
Line 181: | Line 181: | ||
* Enable [[Manual#Occlusion_probes|Occlusion Probes]]. | * Enable [[Manual#Occlusion_probes|Occlusion Probes]]. | ||
* Bake | * Bake | ||
+ | |||
+ | <hr> | ||
=== Baking produces "Not allowed to access uv2" errors === | === Baking produces "Not allowed to access uv2" errors === |
Revision as of 14:39, 29 June 2020
This is a list of common problems, their symptoms and solutions.
Contents
- 1 Shadowmasks are not baked
- 2 Shadowmasks are baked, but Unity renders real-time shadows instead
- 3 Using a version control system I copied the scene to another PC and it doesn't look right
- 4 Baking same asset in one scene breaks its UVs in another scene
- 5 Denoiser throws error 505 or Unknown error
- 6 I get an “Out of memory” error
- 7 I get a “Can't map texture” error
- 8 After importing Bakery I get errors containing “obsolete” and “UnityUpgradable”
- 9 I get a "Can't load" error
- 10 I get a "Launch timeout" error
- 11 I have an Android project, and lightmaps don't look good
- 12 I get too many lightmaps
- 13 I get jagged shadows
- 14 "Exporting scene - preparing" is taking too long
- 15 Stuck at "Waiting for Unity to initialize the probes..."
- 16 Baked prefabs instantiated at runtime in a build have no lightmaps
- 17 Speedtrees look fine in the editor, but black in builds
- 18 HDRI produces scattered bright spots (fireflies)
- 19 "Adjusting UV padding" happens too often and takes too much time
- 20 Denoiser produces bright edges around geometry/shadows
- 21 Light probes are too bright in Subtractive mode
- 22 Baking produces "Not allowed to access uv2" errors
- 23 Whole scene is very bright or black
Shadowmasks are not baked
Check following things:
- Bakery's Render Mode is set to Shadowmask.
- Masked lights have both Unity and Bakery light components on them.
- Masked Bakery light components have "Baked contribution" set to "Indirect and shadowmask".
Shadowmasks are baked, but Unity renders real-time shadows instead
You're in Distance Shadowmask mode, it's expected. Read more about the difference:
https://docs.unity3d.com/Manual/LightMode-Mixed-Shadowmask.html
https://docs.unity3d.com/Manual/LightMode-Mixed-DistanceShadowmask.html
- To switch between two modes, you can use "Distance Shadowmask" checkbox in Bakery main window.
- If you're on 5.6, go to Window->Lighting->Mixed Lighting->Lighting Mode to switch the mode.
Using a version control system I copied the scene to another PC and it doesn't look right
Make sure you followed version control guidelines.
Baking same asset in one scene breaks its UVs in another scene
The reason here is UV padding adjustment. It modifies the UVs in the asset, so spacing between UV charts is optimal, meaning they never leak over each other and there is no much wasted space. Unity has a manual Pack Margin option on model assets, but it’s limited since it applies the same exact value for all meshes inside the model, while each mesh can get drastically different size in the final lightmap based on its surface area. Therefore Bakery overrides it with automatically calculated per-mesh (instead of per-model) padding. However, because “optimal” varies depending on baking resolution, it can be problematic to reuse the same asset in isolated scenes with different lightmap size. There are multiple ways to solve it:
- Generate your own optimal UVs. UV padding adjustment only applies to models with auto-generated UV layout (aka “Generate Lightmap UVs” checkbox) and never touches custom data.
- Use UV padding: increase only checkbox and first bake the lowest resolution scene, and then the rest.
- Just disable UV padding adjustment. Results will be similar to built-in baking.
- Use two different models for different lightmap resolutions, so each will get the most efficient set of UVs.
- Bake both scenes together.
- Lock UVs using Save UV padding to asset
Denoiser throws error 505 or Unknown error
If you are using a Kepler GPU, try switching to legacy denoiser.
I get an “Out of memory” error
This means rendering needed more video memory from your GPU than it has available.
First, try closing any other graphics-intensive programs (browsers too).
If the problem persists, the most likely reason is that the resolution you selected is unreasonably high for the given scene. Resolution is defined by Texels per Unit (this section also has a list of reference values) or set explicitly in Lightmap Groups. Reducing it will help. You can always selectively use high resolution for important objects via Scale in Lightmap.
If the error happens during GI phase, try setting GI VRAM optimization to Force On in advanced settings.
If you have terrains in your scene, make sure Terrain optimization is enabled.
If you have a very high amount of painted trees on your terrain, try disabling the Export terrain trees option.
I get a “Can't map texture” error
Typically happens if your system went out of RAM (system memory, not video memory) during the scene export process. Your scene could already be taking too much RAM by itself, not leaving enough free memory for Bakery export.
- Try closing any memory-intensive programs before baking.
- Try reducing Max Resolution from 4096 to 2048.
- If you are baking very highly detailed (millions of triangles) geometry, try excluding some of it from the bake.
- Try disabling Export terrain trees.
- Try enabling Terrain optimization.
This error can also be shown in case of GPU driver crash, in which case Unity editor also won't render anything.
After importing Bakery I get errors containing “obsolete” and “UnityUpgradable”
Before importing Bakery, make sure you don't have any compilation errors in your project.
Restart Unity, reimport the package. Click “I made a backup, go ahead” if Unity asks.
See this page for more details.
It is also known that some versions of Unity Hub have a bug preventing API updater from running.
I get a "Can't load" error
If Bakery says it can't load something, make sure you have enough free disk space on the drive used for temporary data.
I get a "Launch timeout" error
This error can happen if your GPU took more time than it is allowed by Windows TDR.
- Try lowering the value of Tile Size, especially if it's higher than 512, so baking job is split into smaller chunks.
- Depending on the pass being processed, try lowering the Samples value (e.g. GI samples, Skylight samples, etc).
- Reduce geometric complexity of the scene, if tile size/samples don't help.
- Try disabling Terrain Optimization.
- As a last resort, disable TDR registry keys. This will prevent Windows from resetting the driver, but your computer may appear unresponsive during the bake.
I have an Android project, and lightmaps don't look good
Sometimes, when working on Android projects, you may encounter banding artifacts, with gradients having discrete steps of different hue. This is caused by texture compression and HDR encoding Unity uses for this platform, which often turns out to be "Double LDR" (see details). The problem is not exclusive to Bakery and will as well happen with built-in lightmaps.
Select lightmap assets and set texture compression quality to High or None (try both).
Note that setting it to None will use more video memory on the device.
I get too many lightmaps
Possible causes are:
- Texels Per Unit value is high or Max Resolution is low. Bakery packs objects from open scenes into multiple lightmap atlases and packs them as rectangles (in a fashion similar to this) with their size dependent on (surface area * texels per unit). If some object can't fit into existing atlases, a new one is allocated. New atlases are always as large as the Max Resolution parameter, or smaller (but not smaller than Min Resolution), if the estimated surface area of remaining unpacked objects is below some threshold. You can also increase Min Resolution a bit, replacing a bunch of small (but dense) maps with a few large (but possibly with some empty space).
- If you bake multiple open scenes and Split by scene checkbox is on, different scenes will never share the same lightmap, therefore multiplying their count.
- If Terrain optimization is on, terrains will always use a separate lightmap.
Pre-atlasing your scene in your modelling package of choice and using the Original UV mode instead of relying on the auto-atlaser can significantly improve packing effectiveness.
Since v1.71 Bakery prints number of future used lightmaps to console when enabling/refreshing Checker Preview. You can experiment with resolution/density settings until the desired value is printed.
I get jagged shadows
Apparently you are baking very sharp shadows at low resolution. Try increasing shadow spread parameter on the light (direct or point) and optionally enable bicubic interpolation.
"Exporting scene - preparing" is taking too long
- Try setting Atlas Packer to Default.
- Make sure you use reasonable Texels Per Unit value.
Stuck at "Waiting for Unity to initialize the probes..."
There isn't much Bakery can do about the logic of Unity lighting data asset generation (there is no API in the engine to control it at the moment). Try to focus editor window (especially scene view) to wake Unity up.
Baked prefabs instantiated at runtime in a build have no lightmaps
Because Unity technically has no support for prefabs having lightmaps, it can omit lightmapped shader versions from builds, not realizing they are needed. You can fix it by going to Shader stripping settings and enabling lightmap modes you use.
Speedtrees look fine in the editor, but black in builds
Also related to shader stripping. See the prefab solution.
HDRI produces scattered bright spots (fireflies)
This artefact comes from the fact your HDRI has very bright, yet very small parts, typically sun. Rays will miss it often, producing occasional spots when they don't. This problem is well known in many offline ray tracers as well.
- Use Direct Light for the sun
- Remove sun from HDRI (also recommended by Unity)
- Possibly downsample/blur the HDRI
"Adjusting UV padding" happens too often and takes too much time
UV padding adjustment is a feature that optimizes asset UVs based on the size they take in lightmaps. This process will happen for a model if:
- Option is globally enabled.
- Asset has "Generate Lightmap UVs" checkbox enabled. Models with custom UVs are not adjusted.
- Model was not adjusted before or...
- ... its lightmap size has changed.
Therefore it can be triggered for all auto-unwrapped models after their geometry or resolution changes. UV padding adjustment will try to waste less lightmap resolution and reduce texel leaking, but it is not necessary. If you are doing many experimental/draft bakes, you may consider disabling it (set to "Don't change"), then possibly enabling it back for the final quality bake.
Also note that using xatlas as Unwrapper can be notoriously slower comparing to Default.
Denoiser produces bright edges around geometry/shadows
Sometimes you may encounter bright edges or spots at high contrast edges caused by the denoising neural net. It was determined that OptiX denoiser may act slightly differently on different GPUs, producing them only on some hardware. There are multiple solutions to this problem:
- Make sure your GPU driver is updated.
- Try enabling Denoise: Fix bright edges.
- Try using Legacy Denoiser.
- Try setting texture compression to None on lightmap assets.
- Try setting Backface GI to 1, removing dark shadows inside objects. While these shadows are normally not visible, their edges may cause problems for both denoiser and texture compression.
- Try using OpenImageDenoise instead of Optix denoiser:
- Update from github
- Open ftRenderLightmap.cs and set oidnDenoiser to true.
Note that OpenImageDenoise integration is currently experimental and will only work for color lightmaps (not shadowmasks or directions).
Light probes are too bright in Subtractive mode
Light occlusion information is not baked into probes. Solution:
- Set your Unity directional light to Mixed mode.
- Enable Occlusion Probes.
- Bake
Baking produces "Not allowed to access uv2" errors
All lightmapped models must have Read/Write enabled on.
Whole scene is very bright or black
- Check if your light intensities are in a reasonable range (< 100).
- Check the same for indirect intensity on all lights. A multiplication of direct and intensity intensity must not go into thousands, otherwise GI algorithm may overflow.
- Check if you don't use assets with High mesh compression. When set to High, Unity mesh compression will completely destroy lightmap UVs, only leaving 8 bits for them. This may produce many lightmapping errors including this one.