• 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
0
Question by $$anonymous$$ · Dec 27, 2016 at 02:50 PM · shaderlightmapshadowbakingunlit

bake (?) the moving object

I'm new here and still confused with lightmap and shadow. Sorry if the questions are too basic, I'm just confused.

I just read some documents about shader and understand that unlit shader has best performance because it has nothing to do with light and shadows. And mobile shader has unlit shader and it's support lightmaps. here is my question:

  1. what is lightmap? what is the difference between shaders and lightmap?

  2. is baking shadows and baking light different?

  3. how baking shadow/light can give better performance to the game?

  4. why we can't bake the shadows of moving object?

Say I have game object shaped letter (L) and the left side of game Object "(| )" cast shadows to lower side of it"( _)".

5.what happen when I bake shadow/light to that object?

  1. can I move the object with static shape of shadow(the shape is same as when it's baked)?

7.if can, what shader can I use in mobile shaders?

your answers will help me a lot

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by IgorAherne · Dec 27, 2016 at 04:44 PM

1) shader = set of rules (code) for displaying colors in appropriate places of the game (each visible object has a shader

1,5 ) lightmap - a resource / an asset (a large picture), which is used in some shader, allowing to 'fake' light. Imagine you are sitting in a room with the light turned on. Well, you can take a 'picture' of that room and remove any photons from being in the scene. Instead, you can use this 'picture' to describe how the light falls on surfaces. As long as objects don't move, this lightmap will work as intended. As soon as something moves, lightmap picture won't fit the current scene and will look weird

2) Baking shadows and baking light is the same thing. Baking a lightmap is a better terminology.

3) You can also pre-compute a real-time light datastructure (GI). Instead of 'wrapping' the scene as the lightmap picture would, this 3-dimensional light system stores intensities and colors of light in various scene locations. This allows 3d objects to move (to be dynamic), but it looks worse than lightmap and requires a lot more resources during the gameplay, to "cater" or service the structure.

If we don't use lightmap or the pre-computed system, we will use usual lights which are very resource consuming and have to be calculated every frame for many many pixels on the screen. Because of that, the quality is inferior to the pre-computed solutions discussed above.

4) as discussed in 1), it's a picture which wraps the objects in the scene; as somethign moves, it will no longer be fitting the description of light in the lightmap texture.

5) It will behave as you expect it to be, the | will cast a shadow on _ (self-shadowing will be present)

6) Yes, if the shadow is very very crude (like a circular gradient) under the character. It could literally be a square with a semi-transparent picture (also called a texture) applied to that square. But it looks terrible and was used in like 2006 games. Even mobile games use dynamically computed shadows.

7) Mobile shader is a set of algorithms which:

  • doesn't use realtime lights (or uses a few)

  • doesn't use too many pictures to wrap around objects to which such a shader is applied

  • doesn't perform any expensive operations (like reflecting the incoming light or warping picture by bending the light.

Keep in mind that I used a very basic terminology here. Shaders are more complex than that, - they work on 3d-coordinates which describe each object in your game. Further, it works on fragments, which are mapped to the pixels on your screen. Hence, any 3dimensional entity which ends up on your screen will generate fragments. A Vertex-version of a Shader is first ran for each 3d-coordinate, and then the Fragment Shader is ran for each fragment (there are a lot more fragments than there are coordinates, hence it is more expensive).

Also, Baked vs realtime light http://answers.unity3d.com/questions/1255610/what-is-the-difference-between-baked-and-realtime.html#answer-1255794

Comment
Add comment · Show 1 · 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 $$anonymous$$ · Dec 28, 2016 at 03:57 AM 0
Share

thank you! It's work and you help me a lot!

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Is there a way to Separate the light contribution from the shadow? 0 Answers

bake error 1 Answer

Having problems with unlit shaders casting shadows 0 Answers

Shadows pass through meshes after baking 0 Answers

how to use directional map in my shader (lightmap) 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