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 /
  • Help Room /
avatar image
1
Question by kilogold · Jan 09, 2016 at 08:36 PM · unity 5shadermateriallightemissive

Standard Shader Emissive Warning?

tl;dr -- Why do I get the warning in the picture below?

===================================================

I'm following was marked as answered here: http://answers.unity3d.com/questions/914923/standard-shader-emission-control-via-script.html

However, there is one unspoken caveat. Apparently GI doesn't update on it's own, as observed here: http://answers.unity3d.com/questions/920023/change-materials-emission-scale-at-runtime.html

It turns out, that setting the "_EmissionColor" on the Standard Shader is not enough, we must also set the emissivity via DynamicGI.SetEmissive (although I see other posts using DynamicGI.UpdateMaterials: http://answers.unity3d.com/questions/919499/dynamicgisetemissive-not-working.html)

I have an empty room, with a cube that has a magenta emissive light. Technically, everything is visually correct (the surroundings receive emitted light), so I have nothing to worry about, except that I have the following warning on my editor, which is bugging me: alt text

Searching for this specific error only yield one result in my Google searching: http://forum.unity3d.com/threads/unity-5-0-shader-assigning-movietexture-in-emission-map-slot-problem.309680/

I can only guess that this is due to not properly activating the shader variant related to Emissive lighting? I read about this here: http://docs.unity3d.com/Manual/MaterialsAccessingViaScript.html Granted, I'm not satisfying requirement #2, but as per the doc, I did enable the keywords and it should be enough:

Using the keywords above is enough to get your scripted Material modifications working while running in the editor.

My code below:

 public class IlluminatingWall : MonoBehaviour
 {
     [SerializeField]
     private Color wallColor;
 
     private Material wallMaterial;
     private readonly string shaderEmissiveName = "_EmissionColor";
     private readonly string shaderKeywordFeatureEmission = "_EMISSION";
 
     private const float enabledIntensity = 1.0f;
     private const float disabledIntensity = 0.0f;
 
     MeshRenderer myrend;
     // Use this for initialization
     void Start()
     {
         Shader.EnableKeyword(shaderKeywordFeatureEmission);
         wallMaterial = GetComponent<MeshRenderer>().sharedMaterial;
         wallMaterial.EnableKeyword(shaderKeywordFeatureEmission);
 
         myrend = GetComponent<MeshRenderer>();
     }
 
     // Update is called once per frame
     void Update()
     {
         if (Input.GetButton("Fire1"))
         {
             Illuminate();
         }
         else
         {
             Dim();
         }
     }
 
     public void Illuminate()
     {
         wallMaterial.SetColor(shaderEmissiveName, wallColor * enabledIntensity);
         DynamicGI.SetEmissive(myrend, wallColor * enabledIntensity);
     }
     public void Dim()
     {
         wallMaterial.SetColor(shaderEmissiveName, wallColor * disabledIntensity);
         DynamicGI.SetEmissive(myrend, wallColor * disabledIntensity);
 
     }
 }

I even saw someone doing the same on a youtube tutorial here: https://youtu.be/h5GFoI38DOg?t=1136

I don't think I'm doing anything different from everyone else, so I'm guessing this has to do with some Material configuration?

capture.png (22.0 kB)
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by kilogold · Jan 22, 2016 at 01:23 PM

Found the answer!

Turns out that aside from Unity's documentation telling you that you can indeed manually activate the Standard Shader variants, the warning will still occur on the editor because it seems to deactivate the variant the moment the Emissive value is set to (or hits) zero.

I tried my same algorithms without ever setting to zero, and everything worked.

I need to figure out a more appropriate way to deal with disabling emissive, but the core of this mystery is solved!

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 Grisnak · Feb 05, 2016 at 07:33 PM

Can confirm, this worked for me! I was trying to manipulate the emission value on the shared material as well so I'd only have to do it once for multiple game objects. Initializing it as close to 0 fixed the issue. Really ridiculous

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

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

Related Questions

Changing color on specific tile in texture at runtime 0 Answers

Do you know how to create this wall 2 Answers

Light from Emissive Materials/Objects on Sprites 1 Answer

Problem with fresnel materials 0 Answers

apply lighting to custom shader made in shader graph? 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