#Lighting Issues within URP in Unity
1 messages ยท Page 1 of 1 (latest)
You can select your lights in the scene hiearchy and in the inspector itll tell you the modes
Thsts the light type, not the mode
"scene turns dark on scene change" is fixed by generating ambient lighting for a scene
baked lightmapping is not necessary for it
I got you, sorry, its been a long day:
Ok, i'll look up generating ambient lighting as well, Thanks for the tip Spazi
Back sorry, was in the middle of something
So you have lights set to mixed which means they'll get included in the bake
Which is good
I suppose the next thing to do is to configure your lighting settings
Then doing a bake and see what comes up @storm barn
so for your scene creating a lighting settings asset is needed
and to speed things up i'll just list off what to tick (these can be changed later of course)
- set lighting mode (which is under mixed lighting) to subtractive
- under lightmapping settings set the lightmapper to Progressive GPU
- tick off progressive updates
- set direct samples to 16
- set indirect samples to 32
- set enviorment samples to 32
- set filtering to advanced
- for each of the denoising types that pop up set them to open image denoise
again, all of these can be changed and configured later, but basically just doing a somewhat low res lightmap to see how things look and what issues come up so we can fix them
Ok 2 ticks and i'll try this, when i was searching about ambient lighting i stumbled across a post that said that it only happens in the editor, and not when its built, i wanted to see if that was apllicable.
nearly finished building
Hmm, something isnt right here! - didnt restart the scene at all in build mode, yet it invoked the screenfader.. in editor.. restarts but turns everything dark
So, onto your solution and then i'll check that out later
I dont see a denoise option for any of these drop downs:
those are the denoise options
open image denoise
for both Direct Denoiser and Indirect Denoiser
yep
ooh, i just got this i need to change the other scene to this setting, question is, will that affect this light generation?
no it wont
ok comp is working really hard so i'll give it two mins to complete
you can drop the sample counts numbers even lower if you want it to go faster
i.e. instead of 32 can just drop to 16
but worth nothing that depending on how the scene looks this can sometimes lead to noisy results, but those can be fixed with denoising/higher sample counts
currently right now its just prioritizing what the baked lighting will look like roughly
and adjust/tune/fix issues until it looks good
Its finished and it looks good!
lets test it ๐
Just snacking, back in 5, and again, really appreciate your help, thank you
screenshot?
Getting some strangeness actually:
i changed all the floor tiles to cast shadows no before the bake thinking about it
I saw some lights you have aren't casting shadows also
whoops worded that wrong, fixed it ๐
but lights that don't cast shadows will be treated the same in lightmaps, but since your baking them I'd go ahead and enable shadow casting on all lights
I wouldn't worry about the overlapping UVs, I never found those warnings to be much of a problem
yes
This is what i have, it looking right?
mhm
K, now all changed, bake again?
it destroys my computer, slow to move mouse, slow to type. need to upgrade
Ok, not as bright.. but this discolouration of some of the textures is strange:
If i click on both a light tile, and a darker tile, they both the same values, materials, everything.
spotted something
Darker tile has this lightmaps tab:
lighter one doesnt have it:
yep thats about right
since there is a lightmap and even after adding shadows, none what so ever only leads me to believe that most of your scene objects are not actually marked contribute GI in the static flags
And i take it they need to be then
So i could select the full enviroment prefab i created and change those?
I'm not sure how your scene is setup but all I can tell you is that most of your meshes (those that are not dynamic or moveable props) should be marked static
nope
you can also mark it on the top right in the inspector when an object is selected
So pretty much, i would just go anything Static, contribute GI right?
walls, roof, everything?
yes
Ok
if its not marked static it won't be included in the bake
tick it again
should override
the general rule of thumb I tell everyone for lightmapping, mark everything static that isn't dynamic (i.e. doesn't move, get destroyed/disabled/hidden) because again if it isn't the lightmapper is never going to see it
Ok, but you are right in that most of the floor tiles do not have "Contribute" In the compnent tickbox
Ok, so i disabled, and renabled it
before i bake im sensing i should allign all objects to have contribute ticked in their component properties
that field should be ticked automatically honestly when its done through this menu
You're right it did, all ticked
but if you want to be certain
so rebake now
you can go by hand and double check if you want to be certain
screw that
๐ i trust you
K, Baking, back in 4
350 objects with overlapping UV's lol
I wouldn't worry so much about it, generally in my experience the only time I've had issues with overlapping UVs are with complex objects that I auto generated lightmap UVs for in unity where sometimes you'll get random black/white texels and sitching issues, but there are ways to get around it
Ok, so the floor is evenly coloured but looks more duller than id like, i guess i can fix that in material. but.. some of the walls in one room appear very black:
They're all supposed to be the same material/colour
something is still wrong... there is still tons of light leaking through
are you sure they are all marked contribute GI static? and are casting/reciving shadows?
I did just notice a small gap in the roof
between the window and the top plane
Ah..
no its a cube.. i was thinking Plane only render one side dont they.. but its a cube so its not that
are you sure your lights in your scene are casting shadows?
static shadow caster is off
either that or you still have tons of lights in your scene that aren't casting shadows
Im pretty sure all lights were sorted and youre right there were plenty of walls without static shadows
rebake again
Rebake present the same results:
confused but have some solutions in mind, first off do your meshes all have auto generate lightmap uvs enabled?
Im looking in the mesh components and i dont see that setting?
Got it, was ticked:
No thats optimise you said auto-generate
I think we can assume they all have these settings:
I guess "Generate"?
Tickign that Generate bock made them look hoorendous:
But i havent rebaked..
You know you said about light leakage? there are gaps in the windows, you can see light leaking through the bottom, do you think that could be it?
Rebake with all of those checked right? Generate Uvs..
Looking at those last images I think the geometry may have some serious issues with texel validity, especially the walls.
Probably.. i modelled them in blender...
What that means is that some of the faces may be backwards
I'm actually terrible at Blender and havent used it in a long time, i mean, effectively thats import and add solidify modifer, right? i could do that. do i just take Solidify at its default settings?
clueless at this, even more so when it comes to Unity
Blender i mean!
long day..
instersting observation, since ticking that box and re-baking, the overlapping UV's as decremented by 50%
Yeah, or whatever settings look good for your scene
At the top of the scene view can you click that moon-looking icon and select Texel Validity from the list?
its weird how the other walls are fine though? around the lebel
level*
It seems attributed to direction of light
bout outside all around the back
Dumb it down please ๐
Waypoint markers for mesting AI navmesh
i just had a little sphere model on them so i could see them ๐
No sorry!
that one is a bowling ball
Okay great
With my mates face on it:
I love my job
I love this community tbf.. cant believe how helpful everyone is
Makes it easy to want to jump aboard the train really
Yeah it's pretty great!
Okay so did you change the env lighting to have a 0 indirect multiplier?
In the settings you showed above
0 , 0
Go for 1 let's see what happens
Rebake on change?
Yes
Ok, 5 mins, potato laptop
And I guess the skybox color should also have indirect intensity 1? Did you change that intentionally?
You can also make bakes faster by reducing the Lightmap Resolution and Max Size (you don't have to bake 4K Lightmaps while we troubleshoot)
Ok will do! lol. every day is a school day ๐
Those are in the Scene tab in the Lighting Window
I think i was following some different tutorials and got things confuddled if i'm honest
happens to all of us, no worries
Sorry which settings to reduce?
lightmap res currently at 40, should i put 5 for now?
Yeah that should be ok
It will be a little blurry but much faster
And max lightmap size at 512 looks good, nice 
So rebaking at those settings again
though after the bake just done, still the same black walls
intensity now at 1 as well
for this new bake
Can you focus the scene view on that wall
jesus thats almost instant
Select the object and look at the inspector
There should be a Baked Lightmap thumbnail, click on it (In the inspector window to the right)
It's at the top
okay can you show what material you're using for this object (in the meshrenderer)
Can you select Render Face "both"
(and rebake)
you're sure that the model has "Generate Lightmap UVs" checked right?
I did a cube with the same texture as well in the test:
Baked a cube in with the texture and it looks fine
I sleected all my models and clicked Generate UV's
that was done in Davids advice previously
i could progress with the cubes for these walls but the glass ones.. could really do with fixing those
Internally, a slightly weirder output
It looks like that because of the lower resolution
In this view can you go to the Texel Validity mode again?
do they have child objects that have the mesh renderer?
So this means that you have a bunch of back-faces in your geometry
Yep!:
So i can't really use these models without fixing the backfaces?
Its the same here though:
Not with lightmapping ๐ฆ
Yet it looks exactly as id like it do:
Thats what i cant get ๐
All the way around:
Then that corner.. dark
Office next door starts getting darker:
Yep
whats the shadow strength
๐ I thought it was set above I was just scrolling to see that
yep me too lol
pain
did you do a bake?
yes mate
is your roof marked static?
yep:
hmmm
Could for good measure do a untick/retick on all if you think it could help
can you switch the scene to baked lightmap view
turn off the checkerboarding pattern
which should be at the bottom of the menu of scene modes
Still in this menu?
"Show Lightmap Resolution"
Most of the light you have in there is realtime direct light then
yep
the lightmapping window
yeah thats one way to do it
So I am seeing a bit of a fundamental issue with how this is set up, which is that you are using one light from the outside to light the entire scene through windows
Do you have any more lights?
he has alot of localized ceiling lights which hes showing off there
Ah sorry
one note also, for some of your ceiling lights make sure they are not placed inside objects @storm barn
otherwise they will be occluded
probably because the lights are occluded like I just mentioned
how would i verify that please?
select one of the ceiling lights, press f or double click in inspector and check its position
if its inside the ceiling light mesh
its being occluded
the position of the light that is
Reemmerb i still had realtime off from when Girgo asked to untick:
yeah thats fine
thats the mesh, not the light
yep
bingo
called it
so to fix it either 1. unmark the lightbulb mesh as contribute GI or 2. move the light so its not inside the mesh
Ok but these lights are duplicated all over the level, wouldnt we see similar issues on other walls?
I think that you need to block the realtime light from your directional
It's the model that's at fault here I think and it's causing all the weird artifacts
the child object is just the light so it doesn't matter
The reason why they don't appear in other places is I think because the directional realtime light is too bright and it's hiding the lightmap
the problems are not gone just yet though
still have some issues left
for one that directional light
so I would actually start by disabling the directional light
and tune your local lights and make sure they are actually working first
and doing some iterative bakes
making sure of course each light you have placed is actually being cast and not occluded
Disabling directional makes it look even weirder:
Disable and bake
see a couple of things going on, the obvious being the low lightmap resolution but that makes sense with what im seeing, but I'm seeing alot of ambient light + the skybox reflection
can you disable your enviorment reflections for now?
Spaced out a few lights:
I would just drop the intensity multiplier
We turned that up before, I suppose it should be turned down for now. I really thought this was a one-light scene ๐คท
yeah I don't blame you lol
but yeah enviorment reflections off and at 0
so we can hopefully look at just the diffuse lighting
.5? or all the way?
0
K
with it how does it look now
you don't have to rebake when changing those
there we go, so we can see the ugliness more clearly, thats good
lightmap UVs front and center seem the be the biggest issue here
are you auto generating them for your meshes?
you mean like this?
from here it looked like the UV scale is quite off, right?
true it does look inconsistent
though im more confused by the walls/ceiling and how they seem unaffected
they look completely unlit
what shader are you using on them?
URP lit I believe ^
Yep!
thats for a floor tile, not the walls/ceiling
O....M....G
?
im tired, sorry daved
its ok lol
David*
I mean, i sleected all materials and did the "Convert to URP" when i had all the pink issues
The wall not the window ๐
so they should all be using the same shader
just to make sure
so that confirms that
worth mentioning a bit unrelated but when it comes to modular meshes like I see how your environment is constructed in the future I would avoid that since you can run into alot of lightmap seam issues
but anyways
Yeah i didn't know anything i just dove in. How would you do it? like long cubes for a wall and just change tiling offsets for material?
more like long quads, but not too big as to be too large for a lightmap
Fair enough, i should read up on some level design really
so now that were here
go back to the baked lightmap view
I wanna see how the area looks
even though we can sort of already see it I wanna verify some things
Thats not offering much:
your sure your not inside the ceiling?
move the camera lower
you did mention your celing was a cube
in baked lightmap view there is no backface culling for a reason
Aaah ok
so good news is I can see its working
some obvious low sample ocunts and low resolution artifacts but that is to be expected
no directional light though
but we did disable that
now do a bake
New reuslt:
can you deselect the floor
yep
thinking...
the brighter areas look decent
don't see too much issues there
its just the floor meshes that are a problem
re-enable the checkerboard pattern
Done that and rebaked:
Hmm can you go back to the texel validity mode?
could try something actually...
can you do us a favor and zoom out to show your whole scene?
one thing I've typically done with interior scenes to stop leaking is to encase them in large oclcuding cubes/meshes
that are quite thick
That sounds really clever i have to admit
so, do a massive cube? that encases the scnee?
More like 6 cubes
^
Because if you do one the inside of it will be backfaces which is bad news
think of it like housing the scene in a cardboard box, its not completely solid inside
now granted
your scene has windows
so you'll have to model your blocker mesh around that
Got ya
That's why I recommended doing the solidify before
This is going to be something i have to pick up tomorrow gentlemen, if i yawn anymore i'll swallow my tongue ๐
I'll encase it in the 6 Cubes like you said tomorrow
Get some rest! Great work with the project so far ๐
Thanks guys! - really appreciate the support!
I'll be on in the morning, not sure about you guys ๐
cheers!
just a quick example to show you when you get up later to show what an exterior solid mesh can do for an interior scene to alleviate light leaks
and another
worth showing this since this solution in some instances like you can see won't completely 100% alleviate light leaks but it can help quite a bit
example of a blocker
doesn't have to be this messy, but just an example
Thanks David, and good morning both!
Up a bit earlier than i like, wind decided to throw a bin at my house and it woke me up.
Wasn't a great start, i got to my laptop and as soon as i touched it, it crashed... and heres the clanger.. i disabled the autosave script thinking it was causing an issue, forgot to re-enabled it when i ruled it out.
Lost all changes..
Anyway.. loaded it up this morning, changed all the lightbulbs again like you suggested and tinkered with light according to yours and giorgios latest.
Here is the miracle part.
I fixed the SceneLoading Issue at build, i changed the scene name and forgot to update it. I then checked position of directional and it was semi inside the roof and too close to the building. So i moved it around the side to where the faces were blackened:
and Voila, It looks Ok.
Play, restart, looks ok. Build, restart, looks Ok.
Absolutely clueless, and astounded, as to how this issue has gone away. But Grateful none the less!
It isn't perfect, but its a first project for me i only started a few weeks ago. (i modeled the pieces a year ago, spent 2 weeks in unity and gave up) Its just a mock up of my office at work so i can have some fun with it and test my capabilities.
I'm hoping i can make something semi-comical, and use it as some team-building exercise when i'm out visiting teams ๐
I would again, like you sincerely thank you for the amount of time you spent with me on my issue, i recognise thats some serious dedicated time out of your life! - Happy to throw you a few beers! - DM me an email address and i'll paypal, it won't be much i'm not rich though lol.
