#I'm trying to bake this spot light but after baking (2nd screenshot), those shadows don't appear.
1 messages · Page 1 of 1 (latest)
Share the setting of your light bake and spotlight
I managed to fix shadow for objects. The issue was I hadn't marked some objects "Static". But these objects are still not casting shadows on the Terrain I've created. I can't find any such option "Static" for Terrain. Here are some settings:
These walls and blue box should cast shadow on the ground but they cast only on realtime lights.
Actually Terrain is also Static but no shadows on Terrain
I don't see any light on the terrain, so that's good then right?
Terrain's relative lightmap resolution may be too small to capture shadows of the objects
Lightmap space is ultimately limited, and the way it normally works is that the lightmap resolution must be shared across the entire terrain
Actually that is the issue. The Terrain should have shadows of objects on it? See this image. If I make the light realtime, I get shadows. But same is missing when baked:
Oh. That could be a reason.
Lightmap resolution of 80 should be well enough to capture the detail
But your max lightmap size of 1024 clamps it particularly for the terrain
These are current settings
Which would probably require a 16k lightmap texture with 80 resolution
Just so it can receive the shadows of those couple of meshes
Which is terribly inefficient
Would it be resource heavy? I mean we bake lights to save resources. So I wonder if I make it 16K would it make it more slower than realtime lights?
It'd affect build size, load times and memory consumption, not rendering performance
If there will not be other baked light sources illuminating the terrain, I'd rather place a plane mesh on the ground to receive baked shadows in the terrain's stead
Mixed lighting would give you the best results without need for any workarounds like that, but mixed is more expensive than realtime
Isn't it possible to move this lightmap to a particular location in realtime? So it can have shadows where the camera is looking?
OK but it would hide the terrain? E.g., the terrain is green grass but plane would have its own texture.
It should have the same texture to ideally sit seamlessly on top of it
If the terrain further away is in total darkness as we see, that wouldn't be much of an issue
Not in realtime, but in cases like this where a very large surface needs very high lightmap resolution in one spot, but due to its large size should have very low resolution elsewhere, the mesh could be split into tiles each with their own Size in Lightmap (or lightmap UV island size if using custom lightmap UVs for this kind of fine control)
But Terrains can't be split like that as they're totally generated by the component
Maybe Neighbour Terrains can have different sizes in lightmap, but not sure, and you can't easily convert an existing Terrain into multiple Neighbours
Got it. But I am not sure I should do this approach (separate plane) for what I'm trying to achieve. I wonder how open world games like GTA 5 or even Counter Strike 2 does it for outdoor scenes. We easily see shadows casted by sun on the ground right? And they don't even use ray tracing. I wonder if that's baked or realtime.
Maybe I should bake only indoor lights or the lights that cover very small area (like street lights) and not baked Directional Light?
Right now I've baked all lights.
Including directional.
Which lights you bake isn't really important, but which meshes need lightmaps for receiving baked lighting
Yeah. So I guess I can fix indoor lights in my scene (the area around the walls) by using a separate plane. But how about outdoor scenes? I want to see shadows of static objects and moving objects in the open, during day time. Like shadows created by sun light.
I guess that's not possible/ideal with baking directional light.
Can't get any baked shadows from moving objects
Maybe realtime directinal light would be better for that. I'm not sure.
You're right. I actually tested it. It can only get baked light (using Probes) but I still didn't get shadows).
So what do you suggest? I should use realtime lights for outdoor?
Depends what kind of lighting you need
Wait
In the images I see the terrain as being in total darkness which probably isn't indicative of what you want?
Yeah the current scene is actually static (no dynamic day and night system). I'm just learning lights and baking. Here's an example of what I want outdoor:
From GTA
See the shadow of cars, streetlights, NPCs and even if some plane is flying in air, it casts shadow on ground.
GTA has dynamic day and night cycle, do you need that also?
And all shadows move with moving objects
Yeah, I would need it eventually.
Smooth transition from day and night like most games.
(try "few" rather than "most")
Yeah maybe
CS2 doesn't have I think
It has static so it could be baked.
So my original idea of CS2 like lights is wrong. Instead I want lights like GTA
Or maybe Far Cry 3
That also has dynamic day and night IIRC
ANDDDDD
Euro Truck Simulator 2 is perfect example
If you don't need accurate global illumination, meaning soft indirect bounce lighting that can be seen in the reference, then you could get by with just a realtime directional light and updating one light probe for global ambient lighting
But if you do (and to make that easier) you'd likely want to be using Realtime Global Illumination rather than realtime lighting alone
Nothing that needs to respond to change can be baked into lightmaps
I vaguely remember URP doesn't support realtime GI but only realtime lights. I think I read it in the tutorials.
But for now yeah I don't need very accurate results.
It's just learning experience.
Maybe I'll learn more in Prototyping tutorial.
Realtime GI support is dropping in the future, maybe even as soon as the newer unity 6 versions
But not 6.0 yet I believe, which is the one you should be using anyway
Yes I'm using 6.0 currently as tutorials are based on that.
Would it use hardware ray tracing?
No
OK
Realtime GI is also a baked ("precomputed") lightmap system
Good