#Whats the right order to bake?
1 messages · Page 1 of 1 (latest)
APV and reflections rely on GI so GI first
APV is baked GI.
I meant the component on scene
Also, can I bake the shadows of the static objects in order to reduce shadow casters? I couldnt make it with the values I thought it should work
Baked-type lights with shadowcasting enabled record their shadows into baked GI only, so yes
With Mixed lights the answer is more complicated
@oblique aurora there is any documentation or tutorial teaching how to bake the shadows in order to reduce shadowcasters ? I tried directional mixed + mode shadowmask + static objects, it didnt baked the static objects shadows
My purpose is to have dynamic objects casting realtime shadows and static objects having their shadows baked, so they dont need to cast real-time shadows
That is indeed what shadowmask (and subtractive) modes do
There is documentation, and tutorials too
I read and it didnt work as I understood it should. Shouldnt I use Sun on mixed mode + shadowsmask ?
I would guess it didn't work for unrelated reasons
Whatever you precisely mean by that
Does it mean the baking failed with an error
Or the lighting became visually artifacted
Or the result was just not what you expect
Or something else
The static objects keep casting realtime shadows and their shadows on baking process didnt get baked on scenario
I thought the static objects would get their shadows recorded in scenario and this would prevent they cast shadows dynamically
do you recomend any specific channel/youtube/etc to dive into lighting?
https://youtu.be/XzJe4W96Mgc?t=313
This one demonstrates some mixed lighting modes
And though it shows them it fumbles the explanation of shadowmask and distance shadowmask because they are different
Distance shadowmask renders realtime shadows from static objects up to shadow distance and baked shadows beyond that
Shadowmask always renders baked shadows only for static objects
So distance shadowmask is more expensive
Both mix realtime and baked shadows seamlessly though
It also seems to fail to demonstrate subtractive mode or to explain it properly
Which can be seen here
https://youtu.be/hMnetI4-dNY?t=2317
Which unfortunately only shows subtractive mode in action
Though notes that mixed lighting must not be disabled in settings for it to be rendered
-
My lighting mode doesnt show 'distance shadowmask' option.
-
I tried to bake with directional realtime and mixed with lighting mode 'shadowmask', both didnt bake the shadows from statics objects.
I will watch the first tuto to see how to manage shadowmask render baked shadow for static objs
I watched and it didnt clear my doubts. Cant I paint the shadows of a static object in textures and let the realtime lights only affect dynamic objects?
I thought that would be the approach everybody uses, because it makes no sense you make static objects reproduce shadows in realtime, since they wont move
The choice between shadowmasking and distance shadowmasking is determined in quality settings, which is shown being changed in the first video (but you don't want distance shadowmasking)
That's what is shown in action in both videos when using shadowmask mode in the first and as well the second as it uses subtractive mixed lighting
There's not just one approach that everybody would use, because each one has tradeoffs
Realtime shadows can be of significantly higher quality than baked direct shadows, because direct shadows can be rendered relative to camera position while baked shadows are hard limited by your lightmap size
Typically lightmap resolution becomes too big to be practical before you're at half of the resolution you can easily achieve with realtime shadows, so distance shadowmasking is the best option for quality
Shadowmask and subtractive on the other hand achieve the same result each but using different means, with subtractive using a cheaper, simpler method for blending
Baked indirect renders realtime shadows for static objects too, but doesn't do any blending
That means it can look as good as distance shadowmasking, but only at short ranges below the shadow distance
It can also be cheap because it doesn't do any shadow masking or blending operations, and while it does render static objects again for shadow casting passes, the expense of that depends on the complexity and number of those meshes
Typically the costly part of realtime shadows is the overhead of the pass and added shader complexity of using the produced realtime shadowmap, not the shadow casting geometry itself
Oh, It was all good, the whole problem was that the option to swap shadowmask and distance shadowmask was in quality setting as you mentioned (and the video aswell).
Now all seems perfect! Thank you so much @fair glacier and @oblique aurora
Oh one last question @oblique aurora, when adding reflection probe inside rooms, the probe should exceed the room space, like a room 5x5x5 → ref probe 6x6x6 or just covering the room interior, like a room 5x5x5 → ref probe 4.9x4.9x4.9 ? Im asking cause I used the last option and I got this result (lights on character body inside the dark room → sealed + no lights)
Reflection probe of a room should cover the walls so the walls can be affected by it, given also the fade distance if any
The lighting in the image on the character appears to be diffuse, not related to reflection probes
So it's from a light component that's not shadowed by the room, or from light probes
Oh I indeed have a APV covering the entire scene, should I have a second one or Probe adjustment volume or a light probe group inside the dark room?
No
If the room is occluded from light sources by shadow casting geometry, the probes inside should be shadowed accordingly
Light probe groups are not used concurrently with APVs
But first of all things you should determine what exactly the objects are lit by
A light component or probes from whichever system you are using
And if there are reflections in that area as well
- I have 1 directional light - mixed (sun) → attatched img 1.
- I baked GI with shadowmask → attatched img 2.
- I have an APV for the entire scene → attatched img 3 & 4.
- The dark room is made by primitives cubes as walls and roof. Those primitives are static shadowcasters and GI contributors → attatched img 5.
- I have a reflection probe inside the dark room → attatched img 6.
These rule out some potential problems, but don't reveal what kind of lighting exists in that particular room or your scene in general after it's been generated
This indicates that the room's walls are baked using lightmaps and APVs provide GI for dynamic objects, so it's conceivable that they receive different lighting so you can't draw conclusions based on either one
If the walls and floors also used APVs, they would be the same
Baked lightmaps can be visualized using the debug draw modes
https://docs.unity3d.com/Manual/GIVis.html
APVs can be visualized using the rendering debugger
https://docs.unity3d.com/6000.0/Documentation/Manual/urp/features/rendering-debugger-reference.html#probe-volume-panel
Reflection probes you can just select and look at directly, but to see what their result is at a specific point the most convenient way is probably to make a Lit material that's fully metallic and fully smooth and apply it to a default sphere moved to the point you want to examine
Rendering debugger does have a debug mode for reflections, which could be more helpful here as it'd override all renderers and provide information over a larger area
I finished rebaking GI, now Im rebaking APV, and I will look de debugs
APV is GI
Everything is baked when you press Generate Lighting
Oh, so I dont need to go into the apv components and press bake there after bake GI? Good to know
Also, I opened the rendering debugger and I went to "Lighting" tab > Lighting Features.
- When I enable GI → the scene goes dark (img 1 + 2 - inside dark room).
- If I also tick "Main Light" → directional light appears and illuminates the char inside the dark room (img 3 + 4 - inside dark room).
Shadowmask:
- img 1 → scene.
- img 2 → dark room.
What do you refer to exactly by "tick" main light
These aren't exactly the debug views I suggested you use
- Debug draw modes for visualizing baked lightmaps, to confirm that lightmapped surfaces do show illumination where they are in light, and only darkness where they're not
- Rendering debugger for visualizing APVs, to examine where the probes are placed by the APV and what lighting they show in the dark room
- Rendering debugger or a chrome material to examine reflection probes and reflections in general, to rule out them reaching the dark room
It's good to become familiar with all the debugging options, but in this case your main goal is to find out where the light is coming from and what type it is that affects the dynamic objects in occluded areas
img 1 → the drop menu from rendering debugger > lighting
I can select some features to show. When I select GI, the character inside dark room is not illuminated. While keeping the GI selected, if I select Main Light aswell, the character inside the dark room is illuminated
That does indicate that it's your directional light that is getting into the dark room the most, specifically its realtime part
But also this image
https://cdn.discordapp.com/attachments/1448658776038183127/1449144717081051247/image.png?ex=693dd4b0&is=693c8330&hm=79d4d6925d8be275244989dba9a79dc2cacf768e890d44876a45ccde47679bd3&
you mentioned is GI only? The character still shows some illumination
That's why I think you should examine APVs and reflections specifically
You can see the char in this image?
Also, if I change a small thing on scene, like move an object for 0.1 unit, the baking process, if I rebake GI, still taking a long time?
Yes
Yes, it must be done from scratch each time
Im finishing rebaking and I will follow steps 1, 2, 3 that you mentioned
It's basically a simulation from millions of raycasts to determine how light travels and bounces between each texel/probe and light source
It'd be practically impossible to determine how to do that only partially and still get correct results
It makes sense, I thought the system might keep the data about what changed from the last bake in comparison with the current solicitation, in terms of objects position/rotation in scene, and only focused in those changes, but that would generate many possible erros
Ok, lets start for the 3 step:
2 points:
-
selecting by probe shading mode "Validity" it shows this red spheres (img 1), and they are crossing the entire scene, passing through the dark room.
-
When I debug selecting the pixel, it clears shows that the char is being affected by probes outside the dark room (img 2).
My conclusion: the blending area between the dark room APV (it has its own) and the scene general APV is making the character get the outside probe values.
My questions:
- Should I increase the size of the dark room APV ?
- Why there is those red probes (probably not valid ones) ?
The conclusion seems likely correct, as the picker shows influence from probes outside the room
But also based on earlier most of the light is probably from your directional light
You can double check that by disabling the light
And triple check with Light Explorer to verify there are no rogue light components around
Probe invalidity is not not necessarily a problem
They are probes inside geometry and thus can get incorrect lighting
There are a few methods to mitigate the wrong lighting if it does occur:
https://docs.unity3d.com/6000.0/Documentation/Manual/urp/probevolumes-light-probe-validity.html
But most of the time when it occurs when probes directly intersect surfaces like that, you can just add a global offset that's some odd value smaller than the grid your objects are on
- img 1 → light on.
- img 2 → light off.
- img 3 → light explorer = just one light.
0.12345 on all axes is quite good because it's not a value you're ever likely to hit with any division of a grid
For the light leaking in second image you likely need smaller probe minimum distance
Either for the whole scene or in and around the house
Normally APVs add more density automatically where it's neaded
But your probes are very sparse
So virtual offsets would not be enough to fix it, even though those are usually the most useful tool for it
- The house apv should exceed his size or not transpassing its internals walls?
Exceed a little, if the minimum distance is smaller so you get more probes outside the walls too and the darkness doesn't leak out from inside either
But generally you don't need multiple APVs at all, as the system can allocate blocks of different densities in these situations automatically
For the directional light the mystery remains why the realtime shadowing seems to fail to occlude the room
While baked shadowing succeeds
by 'multiple apvs', you mean have more than one apv in the scene?
Yes
By "house APV" I assume that's what you mean
In that situation I might Clear Baked Data to delete the baked lighting, which causes the room to be lit in realtime only subject to realtime shadows to see the problem more clearly
At least as long as it isn't prohibitively long to do a bake
If so, frame debugger is one option to see what the directional light's shadow pass sees and maybe reveal clues to the issue
yes, I created 2 apvs
As mentioned not usually necessary, but shouldn't be harmful either
Ok, I kept the subdiv from scene apv on 1.5 ~ 13.5 and changed the house apv subdiv to 0.5 ~ 1.5 and now the dark room if completely dark, the char dont get illuminated by nothing and all is working as intended
Last question (I guess ^^): should I use skybox reflection for the general scene or to have a central refl probe placed or multiple refl probes?
If the directional light leaking was due to APV probe placement, that I guess means it was related to APV mixed lighting
The probes also do shadowmasking of sorts
Whatever provides accurate enough reflections
The sky rarely is good enough if most of your scene has a floor or a ground and walls nearby
One option is to bake a large or global probe in a spot that's the most "average" environment, and add smaller local probes with a higher priority in areas where reflections must be notably different
The only limits to how many reflection probes you can have is practicality of setting up a lot of them, and transitions between them becoming noticeable if too frequent
Humm, thats interesting. Also do you have any tip for a good min/max apv probe spacing in general scene?
Minimum whatever's tight enough to account for rapid changes in lighting
Usually that is determined by how thin light-blocking walls you have
Small light sources or sharp spot lights also push the limits of probe densities
Max is a balancing act
Max closer to Min means empty space is likely to filled with unnecessary probes
But further from Min requires more Bricks, meaning chunks of different resolution
Bricks require memory to be allocated per each size of Brick
And they (maybe still) cannot be blended together at transition areas
Humm, I got the principles! You help me a LOT!! Thanks so MUCH!
May I ask why do you help me?
Nothing personal really
But many reasons to, as it tests my knowledge, practices my communication technique, helps the community and collectively reduces time lost on trial and error
And lighting is an engaging topic in general
I really appreciate!
@oblique aurora I read and play around with APV and I could solve almost all problems, but this one:
Dynamic objects (the cube in this case) dont get the right shadow/light probe sampling in the shadow border.
The problem is that the object get sampling from a probe outside the shadows. I could apply offset, but it would make probes that are correctly positioned in the opposite side get an offset aswell and bring light from outside or invalidity from inside geometry.
Do you have any sugestion?
Applying an 0.12345 offset on all axis fix that shadow problem, but as I said it creates new ones:
- inside the dark room the illuminated probes from outside went inside.
- invalid probes from below the ground (plane) went up and didnt generate lighting on objects base.
Is it a room with paper thin walls or?
Usually the thickness of walls is enough to conceal the transition, which can be aided by probe adjustment volumes
The walls are 0.35, should I increase more? Also shouldnt I use plane as floor?
Also, with the Y offset, the base of objects loses the probe and gets an invalid one from below the floor
If the wall separates probes with different lighting it should cover preferably two probes inside it, one for outside and one for inside
So wall thickness depends on probe density and vice versa
And probe and wall offsets determine how well or poorly they line up
This solves the outside light going inside ambients, but the probe inside wall that will enter inside is invalid and will make objects get no light from this probe, as the floor did, how to solve that?
The lighting on spots between two probes is interpolated between them
Invalid probes try to copy lighting of nearest valid probe
So if there's just one probe inside the wall, it has to copy either outside or inside lighting and cause light leaking on the other side respectively
With two probes inside the wall, each can copy the light of the closer valid side
And neither side will see leaking
Thanks! I managed to fix 99,99%, I just need to play more and get deep knowledge.
Also what are the values you used to use for walls thickness ?
That really depends on the design
As thick as they can be
Then determine the probe spacing to be able to accomodate that spot
If it must be really really thin, there's also the option to separate the outer half and inner side of the wall as well as the floor and use light layers to isolate the inner and outer lighting totally
Adaptive Probe Volumes (APV) provide a new way for you to build global illumination lighting. Watch this video to learn how to achieve high-quality results using the APV features in Unity 6. We’ll share best practices for setting up and previewing your lighting choices and how to identify and fix common problems like light leaking. Finally, we...
The tent part of this video shows how that can be done