• 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
1
Question by RobertasQA · Jul 02, 2015 at 12:14 PM · uilinear

UI created in Gamma color space does not appear correctly when switched to Linear

UI that was originally created when using Gamma space does not appear correctly when switched to Linear space. In particular, it seems to be a problem with how Unity treats the alpha channel differently in Gamma and Linear space.
In Linear space, all the alpha values are much $$anonymous$$gher, causing sprites to appear more opaque than intended.

The last section of t$$anonymous$$s article (http://docs.unity3d.com/Manual/LinearLighting.html) seems to imply that these kind of issues can be avoided by setting UI textures to "Bypass sRGB Sampling" in the texture importer when in Linear space; however, t$$anonymous$$s not only failed to fix the problem, but it introduced a new one. When our UI textures are set to "Bypass sRGB Sampling" the alpha problem remains, but also the colors become much brighter than they originally were. How do we solve t$$anonymous$$s?

Comment
Add comment · Show 1
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 samizzo · Jul 02, 2015 at 12:29 PM 0
Share

1 Reply

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

Answer by RobertasQA · Jul 02, 2015 at 12:39 PM

So what we are seeing is actually intended behavior, even though it really may not seem that way. Let me explain.

*The first issue is the bypassing of sRGB sampling. T$$anonymous$$s should only be used for legacy IMGUI. IMGUI renders AFTER scene rendering when linear rendering has been disabled, so we need to mark the texture to not be linearized on sample. Your UI is rendered in the world so t$$anonymous$$s is not applicable here. T$$anonymous$$s may be changing for 5.0.

*When switc$$anonymous$$ng to linear mode it (greatly) changes how blending works, t$$anonymous$$s is because when sampling only the rgb channels are linearised as it is assumed the alpha is a linear scale representation already. That's just how it's designed (http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html). T$$anonymous$$s is all well and good for normal scene rendering, but it does cause some issues when it comes to UI. Essentially whats happening is that alpha is getting pushed out because it is assumed to be in linear when it's been authored in gamma space. If you take a look at t$$anonymous$$s link you can see that when alpha blending gamma vs linear the results are quite different: https://docs.google.com/spreadsheets/d/1-6J_pAatXuAx7x5WwtN6RxoKGToBVZTn3zVyzl85Fm4/edit?usp=sharing Feel free to input your own values and have a play.

The issue is basically that the content has been authored for gamma blending but not linear. There are two ways t$$anonymous$$s can be fixed:

1) Reauthor the content for linear blending (t$$anonymous$$s is supported in photoshop). 2) Add a workaround in the shader if in linear space to 'pretend' the alpha from the source texture is in the correct format. An example of how to do that is here (http://hastebin.com/webexacepa.avrasm). T$$anonymous$$s workaround requires Unity 5.

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 iamarugin · Mar 13, 2017 at 11:46 AM 0
Share
avatar image shuichih1 · Jul 06, 2018 at 03:25 AM 0
Share

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Using UI textues authored in Gamma space in Linear mode 3 Answers

UI is darker in some devices with Linear Color Space 1 Answer

Find out if gameObject is UI in 4.6 1 Answer

How to make my ui button trigger a unity input? 0 Answers

World Space Canvas causes blurry text with anti-aliasing 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