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 Gamify3D · Mar 03, 2017 at 06:21 PM · colorscalematerialsemissive

Accessing current Material Emissive Scale?

Hello,

We've been working on a project that uses the standard Unity materials, and we're having an issue with getting the current emissive scale (brightness). There are quite a few answers out there concerning accessing them already, but they don't seem to answer our question.

Basically, we have some point lights and light bulb models underneath them, and we want to be able to control the color and brightness of both the light (easy to do) and the model (requires editing the material's "_EmissionColor" property). We haven't had any issues setting "_EmissionColor", but we can't get the value from "_EmissionScaleUI" since it is UI only.

Other solutions said to simply multiply whatever color we're passing in by some float to scale the emissiveness, but how can we get the current emissive scale? If our lights are at a brightness of "0.5", how do we access "_EmissionScaleUI" to get that value?

Thanks

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
Best Answer

Answer by G-Reusch · Mar 03, 2017 at 09:12 PM

I don't know of any way to access that specific material property, but if you haven't noticed, the brightness is just the highest value between the r, g, and b of your material's emission color.

So, for example, if your material has a Color of (0.9f, 0.6f, 0.1f), the brightness (or emissive scale as it's referred to behind the scenes) would be 0.9. You can see the brightness change in realtime in the editor if you change the emission color.

To get the current emissive scale of a standard material, just make a function similar to this and multiply the new color you're assigning to "_EmissionColor" by the result:

In C#:

//Function to find the emissive scale of a material's color (the highest value out of r,g,b)
private float FindScale(Color color)
{
      return color.r < color.g ? (color.g < color.b ? color.b : color.g) : (color.r < color.b ? color.b : color.r);
}

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 Gamify3D · Mar 03, 2017 at 09:36 PM 0
Share

Thanks! I hadn't noticed that, so this did exactly what we wanted

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Surface Shader issue: property color gets changed 0 Answers

Seamless Water Material on a Plane using Shader Graph 3 Answers

Instantiated object material colors 1 Answer

material wont change color all the way. (still some sort of Tint) 1 Answer

Pressing play Causes Re-instancing of material (Editor) 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