I believe so, as I think that was the default?
It wasnât so if you didnât go to experimental settings and enabled it on purpose, it shouldnât happenâŚ
Otherwise, not sure why itâs taking so long. If you can send me the mesh + its .meta file + your ftGlobalStorage.asset, I can try to reproduce it and see whatâs going on.
Shadows are needed for dynamic objects (effects, projectiles, character and mobs).
To improve performance, I have several lighting quality settings:
- low settings (only lightmaps)
- medium settings (lightmaps + dynamic light sources without shadows)
- high settings (lightmaps + dynamic light sources with shadows)
As I said, everything works, but every time after baking the lighting, recreating prefabs is not very convenient.
Fully baked lightmaps assume youâre using light probes (or volumes) for dynamic objects, not real-time lights.
If you want objects to receive real-time lighting (without casting shadows), you can create 2 versions of each light with a differnt culling mask - i.e. one is fully baked, and another only affects dynamic objects (and doesnât have a Bakery component).
If you need dynamic objects to cast shadows, properly mixing with baked shadows, your only option is to bake using Shadowmask mode (and set lightsâ Baked Contribution to âShadowmask and Indirectâ).
Baking in Unity 6 seems to work fine for the most part until I select to bake adaptive probe volumes (from the Bakery window) at which point it just gets stuck like this forever.
I updated from GIT (using the internal updater) an hour or so before this happened and it happened just before I posted, so I would assume so.
hey , i have a question yesterday i was using bakery to bake lightsmap for a huge scene , all baked good , then unity crash idk why , when i reopen my game all lightsmap are gone from the object but still in storage of unity , and also when i want to rebake something it give me black lightsmap and it use only 10mb of vram , any help please ?
Sorry, we havenât been able to reproduce it in a separate demo scene. However we did find what it seemed to be a conflict with another plugin: AutoLOD. The error seems to have stopped since deleting it. Thanks for the help anyway!
Iâve noticed that after baking my scenes, I can no longer access _MainLightPosition
variable in shaders (its always (0,0,1)
). I did some debugging in SRP code and noticed that the mainLightIndex
value is always -1
after bake, due to which main light data is not set. Duplicating the main light fixes this, but breaks lighting as then everything becomes too bright. Iâm not sure if this is a Unity 6 thing or is this somehow related to Bakery - Iâve just upgraded to U6 from 2022 and started noticing this
Hello, I have an error when trying to bake APV right after finishing a full render. The error says âAdd at least one LightProbeGroup (L1)â
My setup has 1 main scene plus 6 additive scenes. The lightmaps are separated to four groups, which makes some scenes share a lightmap group.
To fix the error, Iâve tried the following:
- making sure that there is a lighting data and that Adaptive Probe Volumes appear when using Render Debugger. I do this by hitting âGenerate Lightingâ under Lighting â Adaptive Probe Volume settings
- In Bakery, I also unchecked âUnload scenes before renderâ
(The two methods above used to fix the problem, but hours later, I kept getting the error again.)
I also tried:
-
Clearing:
- the bake data via Unity lightmapper
- Bakery bake data and settings
- Bakery cache
- Unity GI cacke
-
Then hitting Bakeryâs Render button
After this, the lighting data disappears but the new Bakery lightmap shows. I would uncheck âExport geometry and mapsâ and âUnload scenes before renderâ, and then hit the âRender Adaptive Volumesâ. This would also throw out the âAdd at least one LightProbeGroup (L1)â error.
If you could kindly point out how I could fix this, it would be much appreciated!
---------- Edit ----------
I unchecked âSplit by baked tagâ and the APV started baking xD but then -! I got a new error
Error = âThread group count is above the maximum allowed limit. Maximum allowed thread group count is 65535.â I saw your post in the APV thread before this so Iâve already:
- bumped the minimum probe spacing from 0.25 to 2
- disabled
- sky occlusion
- dilation
- virtual offset
- reduced the size of the volumes
But Iâd still get the âThread group count is above the maximum allowed limit. Maximum allowed thread group count is 65535.â error
---------- Edit 2 ----------
I tested on a small scene, no additive scenes. After a Bakery bake, I unchecked:
- âExport geometry and mapsâ
- âUnload scenes before renderâ
- âSplit by baked tagâ
Then I got the âAdd at least one LightProbeGroup (L1)â error again. It happens with both Legacy and L1 probes.
---------- Edit 3 ----------
I managed to get the Bakery APV baking after rendering the lightmaps. The issue was that some additive scenes didnât have an adaptive probe volume in the scene.
But then the next error that popped up was âCanât read lightmap for GIâ.
I only have 4 lightmap groups and the lighting data asset also shows 4 lightmaps, but the .ftracelog seems to be trying to load a 5th lightmap.
The name of the 5th lightmap âEnvironment Terrain1â is same name as the first additive scene. This 5th lightmap was saved in the temp folder
TBH I dislike the way APVs are integrated into Unity. The whole system feels like it needs major refactoring. Needless complexity everywhere.
Iâm not entirely sure itâs worth supporting APV in its current state. Iâd rather work on something like cascaded/atlased/clipmap Bakery volumes that would live in a tiny isolated script instead of spreading over all systems. If I make it use global shader variables without having to assign data per-object, I can theoretically patch Unity includes to switch to this code instead of the default APV path.
And to be fair, itâs more interesting to design a working system than to debug someone elseâs code thatâs also constantly changing
At least this way I will fully understand whatâs going on.
Anyway, the errors youâre having are probably trivial to fix. Can you send me some test project where I can reproduce it? My test scenes are pretty limited, I guess.
âAdd at least one LightProbeGroup (L1)â is probably a consequence of another error. Anything else in the console?
This one is from Unity code. Can you bake your APV in this scene using the standard baker?
Unity doesnât allow overriding probe placement and final data post-processing, and they have some bugs there.
Do you mean you baked both scenes together, and then tried to bake APV just for one of them? Probably wonât work, as it currently needs complete geometry match between lightmap bake and APV bake.
If you didnât save the scene after the bake and before the crash, the lightmap/renderer connections are not there, and a rebake is needed.
Do you mean you successfully rebaked the same huge scene, but the lightmaps are black?
Did you bake it previously without it being black?
Are you using Bakery components on your lights?
Do you have your models UV1-unwrapped (âGenerate lightmap UVsâ enabled on your models)?
Are you on HDRP? Possibly the lights are just too dim?
Or did you use very high values for Intensity or Indirect Intensity on any lights (>100000)? Using enormous values for both can cause a numeric overflow.
Ah, interesting. I wonder how it was affecting itâŚ
It happens if you bake your directional light completely (i.e. Full Lighting render mode or Direct and Indirect baked contribution). This way there is no light, no shadowmap, etc (and no associated cost). If you want it to exist in the shaders, you need to use some mixed mode (Shadowmask, Subtractive) or bake Indirect-only.
If you donât actually want any cost of the light and use these variables for custom stuff, you can send a custom variable with e.g. Shader.SetGlobalVector.
Figured this It is a bit annoying tho as some assets that I use, utilize the main light direction and modifying them is a bit painful. Also note, 2022 didnât have this issue prior to migrating to U6.
In-case anyone needs, here is the script I use:
[ExecuteAlways]
[RequireComponent(typeof(Light))]
internal sealed class MainLight : MonoBehaviour
{
private static readonly int PropMainLightPosition = Shader.PropertyToID("_MainLightPositionCustom");
private static readonly int PropMainLightColor = Shader.PropertyToID("_MainLightColorCustom");
private Light mainLight;
private void Awake()
{
mainLight = GetComponent<Light>();
if (mainLight.type == LightType.Directional)
{
return;
}
Debug.LogError($"{mainLight} must be a directional light!", this);
enabled = false;
}
private void Update()
{
Shader.SetGlobalVector(PropMainLightPosition, -mainLight.transform.forward);
Shader.SetGlobalVector(PropMainLightColor, mainLight.color);
}
}
Then, I add the following custom node and use it in my graphs (Amplify, something similar should work in regular graphs also):
Get Direction (note, I use *Position
suffix as Unity uses this naming for light direction vars):
float3 direction = _MainLightPosition;
if (all(direction == float3(0, 0, 1))) {
direction = CustomPosition;
}
return direction;
Get Color:
float4 color = _MainLightColor;
if (all(color == float4(0, 0, 0, 0))) {
color = CustomColor;
}
return color;
This magically went away after several restarts so likely just a Unity bug.
With regards to âwhy use AVPs?â - Itâs purely for the Sky Occlusion feature which is really nice when working with realtime day/night cycles. It added a little bit of what really felt like realtime GI. Is there anything else you would recommend as an alternative for similar functionality?
My suspicion is that it was always like this, but before U6 it was still sending the last known/rendered value to the shaders.
The issue is not Bakery-only - same thing will happen with built-in bakers if you make the light fully baked. Both will enabled the isBaked flag and set LightmapBakeType.Baked type, which means the engine will stop updating the real-time light completely.
Thanks for posting your solution though - I hope others will find it handy!
No existing replacement, but I can easily force Bakery to render Skylight to a shadowmask channel and then⌠then Iâd need to hack all render pipeline includes to have a âdirectional lightâ ignoring the normal but using that mask. I should try that.
Hey @guycalledfrank, there isnât really any âproblemâ, but I figured Iâd say something about this.
In URP, when opening the Custom Functions for any of your shader graphs, I am met with an error message: "undeclared identifier 'GlossyEnvironmentReflection' at line 757"
. I donât know what the error means because the functions all still work without issue from what I can tell, but the error still shows up.
When I take a look at BakeryDecodeLightmap.hlsl
, my IDE (Rider) does indeed show a cannot resolve symbol
error. The hlsl file is missing some includes. Adding them does fix the error, but again, even without doing that, the function still works the same either way, so I have no idea why itâs complaining.
Is this something thatâs happening on your end too, or is it just me? Iâm not sure if itâs something that even needs to be resolved or not, but figured I bring it up.
Iâm using the latest URP Bakery graphs and Unity 2022.3
Hi! I have a question Mr. F,
Is it possible to mix both âFull Lightingâ and âShadowmaskâ in one scene?
Basically what I did is bae the full lighting in one scene then bake the shadowmask in another.
Good afternoon.
I am reaching out as recently Bakery has been failing to run over the past week due to a Cuda Error:
And the log is presenting this:
Init...
fixpos12
Loading geometry...
Loading alphas...
Tile size: 4096
Device 0: NVIDIA GeForce RTX 3090 (ON)
Used host memory: 28mb, available GPU memory: 23300mb
MODE: fixpos12
USING FLOAT
Load shaders...
Loading shader fixPos12.ptx::oxMain...
Loading shader lambert_backface_check.ptx::oxMain...
Loading shader clip_rtx.ptx::oxMain...
Loading shader shadow_rtx.ptx::oxMain...
Loading shader attrib_trimeshLOD.ptx::interpolate...
Used host memory: 41mb, available GPU memory: 23300mb
Used host memory: 41mb, available GPU memory: 23300mb
Create buffer...
Num passes: 2
Num tex: 2
Pass uvpos_[redacted]_LMA1.lz4_HDR...
Skipping pass Mask
Used host memory: 41mb, available GPU memory: 23300mb
Launch 1x1 tiles...
Tile 0x0...
Streaming...0
nFNLFPFSd
Launching...
Error (-1): Unknown error (Details: Function "_rtContextLaunch2D" caught exception: Encountered a CUDA error: cudaDriver().CuEventSynchronize( m_event ) returned (700): Illegal address, file: <internal>, line: 0)
Doing some research online, it appears that from an nVidia moderator, âIt means your kernel is making an illegal, out-of-bounds access. That is a defect in the code and needs to be debugged. It is not a problem with your GPU, driver, or CUDA setup.â
I was hoping for some insight, or if this will assist in some way to fix this bug.
As I am a new user and can only put one embedded image in a post, I am adding a 2nd post with my main bakery settings, in case it helps.
Iâm using per-vertex APV with sky occlusion combined with AO-only bakery lightmaps (with bicubic filtering) for fine detail. This is working very well in Meta Quest 3, the lightmaps make up for the lack of SSAO. Per-pixel APV is super costly though and has too many artifacts.
But Iâm having problems baking APV with the bakery window, so Iâm having to use the default unity ones trying to match the look.
With Bakery:
With Unity 6:
Seems like there is some sort of error in the SH encoding?
A separate issue is that the BakingSet is created outside the scene-named folder.