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 /
This question was closed Jan 24, 2018 at 01:33 PM by jamesa33uk for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by jamesa33uk · Jan 24, 2018 at 11:50 AM · gamma correction

What's happening to my colour outputs from my shader?

Hello, I have the following simplified Shader, which outputs grey rgb(0.5,0.5,0.5) - I have tried it in both linear and gamma modes of rendering and when I screenshot I get RGBs of 174.174.174 (linear mode) or 109.109.109 (gamma mode), when it should really be 128.128.128. For my application I need to render pixels exactly without any correction, from a shader, but I can't work out how to do this - is there a setting I am missing somewhere? Any help much appreciated!

 Shader "Custom/ColourDemo"
 {
     Properties {}
     SubShader
     {
         Pass
         {
             CGPROGRAM
             #pragma vertex vert
             #pragma fragment frag
             #include "UnityCG.cginc"
 
             struct v2f
             {
                 float4 grabPos : TEXCOORD0;
                 float4 pos : SV_POSITION;
             };
 
             v2f vert(appdata_base v) {
                 v2f o;
                 o.pos = UnityObjectToClipPos(v.vertex);
                 o.grabPos = ComputeGrabScreenPos(o.pos);
                 return o;
             }
 
             float4 frag(v2f i) : SV_Target
             {
                 float4 output = float4(0.5,0.5,0.5,1);
                 return output;
             }
             ENDCG
         }
     }
 }
Comment
Add comment · Show 5
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 aurelioprovedo · Jan 24, 2018 at 12:12 PM 1
Share

I have created an empty project with your shader. The gamma space shows value of 127, and the linear space shows 187. I assume your problem will not persist in a new project, will it?

avatar image jamesa33uk aurelioprovedo · Jan 24, 2018 at 01:17 PM 0
Share

No I'm still getting 109 - Although I am applying it to a material on a quad, how did you test the shader? It's for a 2d game...

avatar image jamesa33uk aurelioprovedo · Jan 24, 2018 at 01:21 PM 0
Share

I've also tested it with a sprite renderer and get the same.

avatar image jamesa33uk aurelioprovedo · Jan 24, 2018 at 01:33 PM 0
Share

The issue was with the program i was testing colours with. I tested it with GI$$anonymous$$P and the colours were being produced correctly....

avatar image aurelioprovedo jamesa33uk · Jan 24, 2018 at 01:57 PM 0
Share

hahaha that's good to know! Shit happens, glad it's fixed

For sampling pixel colors I use this little app called Colorblind Assistant. I've been using it for years. And you don't have to be colorblind to use it hehe

Cheers!

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

74 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

Related Questions

Difference between Gamma Correction and RenderSettings.ambientLight 0 Answers

Linear Color Space washed out in android URP build. 2 Answers

Unity Linear color space causing over blurr on sprite 0 Answers

UnityWebRequest.GetTexture returns incorrect Linear or Gamma or whatever 1 Answer

How to force to use Gamma Space instead of Linear Space? 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