Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by klabauterklaus · Jul 07, 2011 at 06:50 PM · lightmappingambientambient-occlusion

Changing ambient light color during runtime with baked ambient occlusion

I'd like to be able to change the ambient light color in realtime, while using beast's baked ambient occlusion. So what I do is set my light to realtime only and the ambient light to white, which effectively creates a nice ambient occlusion bake.

The problem is that changing ambient lighting afterwards won't affect a thing - makes sense since normally you would have baked shadows / reflected light etc. in the lightmap, meaning you need to rebake when changing ambient light.

Is there any way to access the lightmap in the shader so i just can multiply the albedo with the lightmap color and ignore lightmapping during light calculation? I played around with using renderer.lightmapIndex and renderer.lightmapTilingOffset and putting the corresponding lightmap texture as a separate texture in the shader using the secondary uvs (they are the ones for lightmapping i suppose, turned on generate lightmap uvs in the importer), but the results are wrong - any ideas how to access it in the surface shader, or is there another way?

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
0

Answer by Dreamora · Jul 19, 2011 at 03:48 PM

if you explicitely implement the lightmap support and don't let the auto add of surface shaders do it, then yes you could overwrite it. But as long as you rely on auto addition no, as it will not exist for your access in the surface shader code you write.

Comment
Add comment · Show 2 · 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 klabauterklaus · Jul 27, 2011 at 07:39 PM 0
Share

ehm could you clarify what you mean by auto addition? or could you point me in a direction how to access the lightmap directly in a surface shader? many thanks for the answer

avatar image Dreamora · Jul 27, 2011 at 07:47 PM 0
Share

surface shaders, when compiled, get a host of extra coded added for the lightmap handling. In the docs you find a pragma that allows you to prevent that from happening if I recall right, which would allow you to write the whole code for lightmap handling yourself.

you can add a #pragma debug to make it generate the inbetween code for you so you can look at it

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Have Ambient Light Setting Affect Lightmapped objects? 0 Answers

About Beast Lightmapping? 0 Answers

How do you get ambient occlusion working with transparency and lightmapping? 0 Answers

Lightmap baking with nature and enviro shaders 0 Answers

Change GameObject's ambient/brightness 1 Answer


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