- Home /
Baked + Real-Time Shadows
I have an outdoor scene with a single directional light and am using forward rendering and using Unity Pro.
I was planning on using baked shadows for the terrain, tree, structures, etc and using real-time shadows for the characters.
What is the best way to achieve this?
Retagged with lightmap(ping) and singular shadow. Both pairs of tags are running about neck and neck in popularity.
I've got a somewhat similar problem, using deferred lighting (dual lightmaps). For some reason, my shadows aren't smoothly transitioning between my near and far maps. It basically goes from no shadows to hard shadows that pop right in. I've also had trouble with figuring out if the lightmaps are actually assigned to the right index (does anyone know which index they should be on, for a terrain?).
Answer by yoyo · Jan 13, 2011 at 03:32 AM
Um, what's the politest way to say rtfm? :-)
Read these first, try some stuff -- if it all works, awesome, come back and answer your question so we can all benefit from your new-found knowledge ... if it doesn't, not to worry, come back with specific questions. Good luck!
http://unity3d.com/support/documentation/Manual/Lightmapping.html http://unity3d.com/support/documentation/Manual/Shadows.html http://unity3d.com/support/resources/tutorials/lightmapping-in-maya
Well, that wasn't my intent, just wanted to point out the available resources. Sorry if it came across the wrong way.
Answer by Emihaa · Feb 28, 2013 at 01:37 PM
If you wanna use realtime shadows together with beast lightning you need light that lights aren't going to bake. So choose the light that you want to make the realtime shadows and make sure it is realtime only in lightmapping options. And make sure your object is not static and that the lights shadow type is either soft or hard and strength is enough to make shadows visible. There should be more information about this matter. http://docs.unity3d.com/Documentation/Manual/LightmappingInDepth.html
Answer by bobjwatts · May 13, 2014 at 01:28 AM
So after many moons of trying to figure this out, I got it to work.
In the lightmapping settings, click the "forward rendering" checkbox. I guess the shortcoming of this is that other lights won't cast shadows, but if you are happy with the one dynamic directional light and the rest baked lights with no shadows then it's a solution. It's works for my project.
Answer by Turbo · Feb 18, 2011 at 05:45 AM
The short answer is, as far I know, you can't. In my testing, as soon as you lightmap geometry using Beast, realtime shadows no longer work. I would love for someone to prove me wrong.
However, you can use dual lightmaps, which will smoothly blend between your lightmaps and your realtime shadows. This is nice, but often times your lightmapped shadows will look much better, or at the very least, different, from your realtime shadows.
Answer by theropodx · Feb 25, 2012 at 03:05 AM
"In my testing, as soon as you lightmap geometry using Beast, realtime shadows no longer work. I would love for someone to prove me wrong."
OMG, was going crazy with this one but think I've got the solution...I baked a lightmap on my terrain and then couldn't enable realtime shadows again after that--even if I disabled lightmapping. Saw your comment and tried the same with another object--yep, after baking a lightmap, I couldn't ever get a realtime shadow from that object again. UNTIL...
I selected my object that lost realtime shadows ability, went under Lightmapping > Object > Atlas, and changed the Lightmap Index to "255", matching the other objects I hadn't lightmapped...
It works! Real-time shadows are back.
Note you must have "Static" enabled for the object in question to make this change, but then you can un-check Static again afterwards.
Unfortunately this actually removed your baked lightmaps, so it's not a solution.
I had this same issue, after deciding to go back to dynamic lighting I couldnt get the shadows back. This fixed it.