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
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 higher, causing sprites to appear more opaque than intended.

The last section of this 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, this 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 this?

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

Are you using the legacy GUI system? Does this thread help? edit: I forgot to link the thread but you found it :P

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. This 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 this is not applicable here. This may be changing for 5.0.

*When switching to linear mode it (greatly) changes how blending works, this 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). This 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 this 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 this can be fixed:

1) Reauthor the content for linear blending (this 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). This 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

How to reauthor content for linear blending in Photoshop?

avatar image shuichih1 · Jul 06, 2018 at 03:25 AM 0
Share

The shader code mentioned in this answer did not solve the problem in my experiment. Appropriate alpha value changes according to RGB color in linear space blending. See the image below. This is more obvious when the background color is white.

alt text

Also, AFAI$$anonymous$$, There is no practical way to reauthor linear texture with alpha channel in Photoshop. Our artist told me that we need to use AfterEffects or Nuke for the reauthoring content for linear blending.

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

UI is darker in some devices with Linear Color Space 0 Answers

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

Which UI events propagate? 0 Answers

OnMouseHover on UI 1 Answer

[Closed, I guess] Imported font appears very messy on UI Text 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