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 bboysil · Jan 26, 2014 at 11:40 AM · diffuseillumination

Why is the default diffuse shader 2x brighter then expected?

The setup(the image bellow should make things clear):

  • one directional light pointing pointing perpendicular to one of the faces of two cubes.

  • both cubes are set to have the color white

  • ambient light set to black (has no effect)

  • the directional light color is set to 0.25 (i.e. ~64 gray in the byte range)

So one would expect that when a white light with the value 0.25 hits perpendicularly a white surface(1.0) the result would be 0.25 1.00 cos(0 deg) = 0.25 (or 64,64,64 in the R8G8B8 format) but we get twice that.

alt text

If I use this simple shader the result is as expected:

 Shader "Custom/Simple Shader" {
     Properties {
         _Color ("Main Color", Color) = (1,1,1,1)
     }
     SubShader {
         Pass {
             Material {
                 Diffuse [_Color]
             }
             Lighting On
         }
     }
 } 

Knowing that the diffuse shader does only the following (you can see it from the unity built in shaders "Normal-diffuse.shader"):

 ...
     void surf (Input IN, inout SurfaceOutput o) {
         fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
         o.Albedo = c.rgb;
         o.Alpha = c.a;
     }
 ...

and there is no texture set and the default is white (so it's neutral to the multiplication) where does the 2x factor come from?

Basically if the directional light has an intensity of 0.5 or above, the face of the cube is saturated in if it has a diffuse shader;

diffuse vs simple shader.png (64.2 kB)
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 ArchieVision · Jun 03, 2014 at 06:33 PM 0
Share

I am having the same issue. The textures are 2x brighter and overdriving my colors.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Adamcbrz · Jun 03, 2014 at 08:48 PM

Ok there are two issues here.

1) Not sure why yet but Diffuse shader is falling back to VertexLit in the example above.

2) Diffuse/VertexLit shader have a texture attached which yours does not. If the texture is not set it assumes white. So a diffuse shader with no texture sets it color to white * white which explains your white doubled.

Hope this helps.

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 bboysil · Jun 24, 2014 at 04:57 PM 0
Share

I will look into your answer when I have the time, but at a glance it doesn't seem satisfactory... I mean white white = white (1.0 1.0 = 1.0) there shouldn't be a 2x factor from that..

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

20 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

Related Questions

How to make a Diffuse Bump Blending 1 Answer

Rim Light shader problem 0 Answers

I Created NORMAL map , SPECULAR map , DIFFUSE(BASE) map , DISPLACEMENT map . 3 Answers

Trying to have sprites affected by fog without having to use default/diffuse shader. 3 Answers

How can I make my illumination look like this? 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