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
0
Question by TIGGYsmalls · Jun 26, 2013 at 03:23 PM · shadercolortint

Color tint on a shader.

I made the simple shader but I don't know how to get the colour tint to work properly?

 Shader "Custom/IlumBlend" {
 
 Properties {
     _Color ("Color Tint", Color) = (1,1,1,1)
     _MainTex ("Texture 1", 2D) = "" 
     _Texture2 ("Texture 2", 2D) = ""
 }
 
 SubShader {    
     Material {
         Emission [_Color]
 }
     Pass {
         SetTexture[_MainTex]
         SetTexture[_Texture2] { 
             combine texture * primary + previous
         }        
     }
 } 
 
 }
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
0

Answer by Julien-Lynge · Jun 26, 2013 at 03:25 PM

Here's the reference you want:

http://docs.unity3d.com/Documentation/Components/SL-SetTexture.html

Take a look at the constantColor stuff.

Comment
Add comment · Show 3 · 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 TIGGYsmalls · Jul 01, 2013 at 01:41 PM 0
Share

Nah, I still don't get it. I tried modifying the Illume Diffuse shader and got this.

 Shader "IllumBlend2" {
 Properties {
     _Color ("$$anonymous$$ain Color", Color) = (1,1,1,1)
     _Tex1 ("Texture1 (RGB) Gloss (A)", 2D) = "white" {}
     _Tex2 ("Texture2 (RGB) Gloss (A)", 2D) = "white" {}
     _EmissionL$$anonymous$$ ("Emission (Lightmapper)", Float) = 0
 }
 SubShader {
     Tags { "RenderType"="Opaque" }
     LOD 200
     
 CGPROGRA$$anonymous$$
 #pragma surface surf Lambert
 
 sampler2D _Tex1;
 sampler2D _Tex2;
 fixed4 _Color;
 
 struct Input {
     float2 uv_Tex1;
     float2 uv_Tex2;
 };
 
 void surf (Input IN, inout SurfaceOutput o) {
     fixed4 tex = tex2D(_Tex1, IN.uv_Tex1);
     fixed4 c = tex * _Color;
     o.Albedo = c.rgb;
     o.Emission = c.rgb + UNITY_SA$$anonymous$$PLE_1CHANNEL(_Tex2, IN.uv_Tex2);
     
 }
 ENDCG
 } 
 FallBack "Self-Illu$$anonymous$$/VertexLit"
 }

It very nearly works but I can't figure it out.

avatar image Julien-Lynge · Jul 01, 2013 at 03:20 PM 0
Share

You don't seem to have ended up using the ShaderLab constantColor method as suggested and ins$$anonymous$$d have replaced your shader with a surface shader, which is much more complicated (not wrong, just more complicated). I suggest going back to the shader reference, and reading the various pages on ShaderLab, along with the examples.

avatar image TIGGYsmalls · Jul 05, 2013 at 12:30 PM 0
Share
 Shader "Custom/IlumBlend" {
  
 Properties {
         _Color ("Color (RGB)", Color) = (1,1,1,1)
         _Texture1 ("Texture1 (RGB) Texture (A)", 2D) = "white" {}
         _Texture2 ("Texture2 (RGB) Texture (A)", 2D) = "white" {}
  }
     SubShader {
     Pass {
      
         Lighting Off

         SetTexture [_Texture1] {
         constantColor [_Color]
             combine constant lerp(texture) previous
         }
          SetTexture [_Texture2]{
          combine texture lerp (texture) previous
          }
     }
 }

}

I went back the the first example but I still don't get it. Is there a command to combine them in the first set of {}? When I swap constant color into the second {} it breaks.

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

16 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

Related Questions

surface shader homeworld (space) colorize transparent 1 Answer

How do you add a Color Tint to a shader? 1 Answer

Colour tinting layered textures with transparencies. 1 Answer

Material doesn't have a color property '_Color' 4 Answers

Change a color from shader using JS script 2 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