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 unic · Apr 25, 2018 at 01:29 AM · shadertransparencycolors

Why additive particle shader with transparent and non-transparent textures in linear color space look differently?

I have a project that uses Linear Color Space instead of the default Gamma Color Space. I've made an image in Photoshop and saved it with (no background) and without (black background) transparency. Then I've created new material using shader "Particles/Additive". I've noticed, that material with transparent texture looks much different than the one with black background (see screenshots below).

(with non-transparent texture:) alt text

(with transparent texture) alt text

Materials with both the textures look identically in Gamma Color Space. But I need exactly Linear Color Space. I'd like the material with the transparent texture to look as material with non-transparent texture does.

Do anybody have an idea ohw to achieve this and why it renders as it currently does?

nontransparent.png (161.8 kB)
transparent.png (173.7 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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Remy_Unity · Apr 25, 2018 at 07:57 AM

I did the test, and I think what you see is happening because your texture are imported as sRGB textures:

You must know that the alpha channel is always stored in linear. So, if the textures are sRGB it's normal to have a difference in the two renders, because the additive blending is done this way : finalColor = backgroundColor + tint * textureRGB*textureAlpha.

On the one without alpha you only have white pixels with a linear alpha, and without alpha you have RGB values in gamma space and a "white" alpha.

You now have two solutions : use the version without alpha if possible, or author your texture with alpha to compensate this linear/gamma difference.

This can be done by blending a black layer with the inverse of the alpha as a mask, and at about 50%. Here's my layout in photoshop: alt text

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 unic · Apr 25, 2018 at 08:45 AM 0
Share

@Remy_Unity, thanks for response, it's helpful and informative! I've tried your solution and it works, but in this case I need to create absolutely new texture that is partially alpha and partially with black background. I prefer to leave my textures clear.

Finally I've made my own shader for additive blending. The shader simply does pow(alpha, 1.5) - and I have the look I expected before. Yes, it's more expensive in context of GPU computations, but on the other hand I don't need to replace all my transparent textures with new ones.

avatar image Remy_Unity unic · Apr 25, 2018 at 09:58 AM 0
Share

You could also keep your texture clear and apply a linear to gamma correction to the alpha channel in your authoring app.

If you're working with photoshop I recommand you to get the free plugin SuperPNG http://www.fnordware.com/superpng/ to be able to author easilly the alpha channel (like you would when exporting TGA files).

Use "Image/Adjustments/Exposure" and set the "Gamma Correction" to 0.45 (=1/2.2).

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

129 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 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 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

How to fix transparent rendering problem 3 Answers

Rendering problem with opaque objects with the same Mat rendering through each other (Grouped to the same empty object) 0 Answers

Transparency from light shader 1 Answer

Transparent material on iPhone Android 3 Answers

How to use the Unity 5 Transparent Shader? 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