Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
5
Question by wilgieseler · Oct 16, 2013 at 11:20 PM · lightinglightmapshadow

Realtime shadows on lightmapped surfaces

I'm looking into making a top-down vehicle game and I'd like to have the vehicles cast realtime shadows. I'd also like to take advantage of lightmapping for performance and quality reasons on the terrain.

Since it's top down, dual lightmaps don't seem like a good solution, because everything is basically on the same plane and you don't see any distant object.

What I'd like to accomplish is this:

  • Vehicles and props cast realtime shadows on the environment.

  • The environment casts realtime shadows on the vehicles and props.

  • The environment casts lightmapped shadows shadows on the environment.

Here's an illustration:

alt text

The issue seems to be that I can't figure out how to get realtime shadows on lightmapped surfaces. Am I correct that this is just simply not supported?

I'm aware that there are differences in how this works between forward and deferred lighting modes, but none of the combinations of rendering paths and lightmap settings seemed to work for me.

I've also tried a two-light solution, but I couldn't seem to get the intensities to match and I couldn't get a realtime-only light to cast shadows without illuminating objects. (Although maybe there is a way to use two lights that I didn't figure out).

I've also tried having an invisible object that only receives realtime shadows using a shader found on the Unify wiki. That failed to work when I baked a lightmap, then the realtime shadows disappeared from the invisible object even though it wasn't marked as static and the light was on auto. This also makes it very difficult to have interesting background geometry that can receive realtime shadows.

Here's some of the resources I looked at but couldn't find a solution:

  • http://answers.unity3d.com/questions/286403/can-i-cast-real-time-shadows-on-lightmapped-object.html

  • http://www.edy.es/dev/2013/08/reference-guide-for-lightmapping-in-unity-3d/

  • http://docs.unity3d.com/Documentation/Manual/LightmappingInDepth.html

  • http://docs.unity3d.com/Documentation/Manual/RenderingPaths.html

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tarlius · Oct 17, 2013 at 05:22 AM 0
Share

I haven't enough experience with 3D to really help, but kudos the effort you put into making the question clear! (+1'ed)

This looks like a problem I might run into too if I ever get let loose on a 3D game; following!

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ejpaari · Oct 17, 2013 at 06:14 AM

It is supported. Use light probes http://docs.unity3d.com/Documentation/Manual/LightProbes.html

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image wilgieseler · Oct 17, 2013 at 06:15 AM 0
Share

Use light probes how? Will the probes cast shadows?

avatar image ejpaari · Oct 17, 2013 at 06:20 AM 0
Share

Yes, you can achieve real-time shadows with light probes: "It isn't possible to calculate lightmapping for moving objects in real time but it is possible to get a similar effect using light probes."

You can create light probes in Unity via Component -> Rendering -> Light Probe Group

I really suggest you to read the light probe manual I linked. It explains very well how to use light probes.

avatar image wilgieseler · Oct 17, 2013 at 06:48 AM 0
Share

I actually have read the light probe manual a couple times, but it doesn't mention that the light probes can bake any kind of shadow data that would cause them to generate realtime shadows. They are useful for baking some of the shadow information (i.e. darkness) from static geometry but there's no shape to the shadow.

This wouldn't be a big deal but there are other more serious downsides. Unfortunately, in my testing, it seems like light probes only help in a specific case where you are:

  1. Using forward rendering

  2. Don't want specular highlights on both static and dynamic objects. (You can have specular on static objects with directional lightmaps, but this causes light-probed objects to lose specularity. You can have specular on dynamic objects but this means you can't use directional lightmaps.)

  3. Don't care about the shape of shadows cast on dynamic objects. (For example, you don't get any interesting effects from trees.)

Specularity is a must-have for me on both static and dynamic objects, so I think I'm still looking for a solution.

avatar image ejpaari · Oct 17, 2013 at 07:35 AM 0
Share

Light probes are especially meant for non-static objects and they can create a shaped shadow for a moving object. They also work for deferred rendering. Here is a simple example video with light probes & deferred rendering: http://www.youtube.com/watch?v=m8Gki3S4$$anonymous$$dY&feature=youtu.be

If you want to download the project, it's here: http://speedy.sh/EFn$$anonymous$$9/light-probe-example.zip

avatar image wilgieseler · Oct 23, 2013 at 09:10 PM 1
Share

Hmm, interesting. It seems like in that project, though, all the shadows are realtime shadows (unless you back the camera really far away to use the far lightmap), which isn't really what I want. I would want the static cubes to have baked shadows and only the moving cube to have realtime shadows.

avatar image
0

Answer by screenname_taken · Mar 04, 2014 at 07:44 AM

I was just able to use the default Diffuse material and have lightmaps on environment and realtime shadow from the moving mesh on to the environment. I sort of cheated a bit though. I first baked the lightmaps with the light set to baked, and then set the lightmaps to dual and light to auto.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by lermy3d · Apr 18, 2016 at 08:53 PM

I think we are at that moment when this feature is around the corner, you can read the last paragraph from this link regarding light probes, and I will quote here:

"In Unity 5.4 light probes will store full illumination from sky lights, emissive materials and ‘Baked’ lights, but only indirect illumination from ‘Mixed’ lights. Thanks to that, objects can be lit in real-time with ‘Mixed’ lights and take advantage of dynamic elements such as real-time shadows, but at the same time receive indirect lighting added to the scene by these lights."

If you download Unity 5.4 you can make this test, since is now in beta.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Lightmapping Darkness & Lightmapped Hard/Soft Shadows 0 Answers

How to add shadows in Game Environment 1 Answer

Lighting bleeding through seams between/in objects 1 Answer

Shadows pass through meshes after baking 0 Answers

Disable Lightmap when baked lights turn off 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges