Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 0tacun · Jun 04, 2014 at 12:31 AM · shaderlightmaplightmappingbakediffuse

where is Unity's shader handeling lightmapping?

Hi all,

I noticed that after I baked a lightmap with Beast within the Unity Editor, my standard Diffuse shader must use a different shader to display the lightmap.

So my question is: Where do find this shader so I can customize how the lightmap is calculated. Or is there a built-in function that is handleing the lightmap data? Again, where could I find it? Do I have to change and overwrite the legacy's shader (Lightmapped Diffuse)?

Thank you for your help,

0tacun

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 rutter · Jun 04, 2014 at 05:47 AM

Unity provides several built-in lightmapping shaders.

If those don't work, and/or you're going as far as creating your own lightmaps, it's not terribly difficult to incorporate lightmaps into them. It can be as simple as an extra multiply between your own color and the lightmap texture.

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 0tacun · Jun 04, 2014 at 11:37 AM 0
Share

Thank you very much for your reply.

Unfortunatly it was not the solution. I tried to feed one lightmap shader with the lightmap unity generated. Alas the shader has not the correct uv coordiantes to display. (I made a copy of the generated lightmap and saved it in another folder. After that I cleared the lightmap in the lightmap tab)

alt text

Furthermore It looks more like when a lightmap is built, this lightmap is overlayed on top of any shader regardless of the type. So is there somewhere a function to change this behaivour?

P.S.: I used dual lightmaps.

lightmap1.jpg (56.4 kB)
avatar image 0tacun · Jun 30, 2014 at 07:55 PM 0
Share

I think in the fallback shaders (Vertex-Lit) there you can change how the lightmapping is handled:

     // Lightmapped, encoded as RGB$$anonymous$$
     Pass {
         Tags { "Light$$anonymous$$ode" = "VertexL$$anonymous$$RGB$$anonymous$$" }
         
         BindChannels {
             Bind "Vertex", vertex
             Bind "normal", normal
             Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
             Bind "texcoord1", texcoord1 // unused
             Bind "texcoord", texcoord2 // main uses 1st uv
         }
         
         SetTexture [unity_Lightmap] {
             matrix [unity_Lightmap$$anonymous$$atrix]
             combine texture * texture alpha DOUBLE
         }
         SetTexture [unity_Lightmap] {
             constantColor [_Color]
             combine previous * constant
         }
         SetTexture [_$$anonymous$$ainTex] {
             combine texture * previous QUAD, texture * primary
         }
     }

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

22 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 avatar image avatar image avatar image avatar image

Related Questions

Replacing lightmap shader pass 0 Answers

what does LightingLambert_DirLightmap()? 0 Answers

Day Cycle and LightMapping 2 Answers

Light mapping does not map some of my objects 1 Answer

fbx baking not creating lightmapped materials 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