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 Guidolatry · Jul 11, 2014 at 02:44 PM · shaderunlittexture blending

How can I change a shader to be "unlit" while keeping its other properties?

I have a shader that I found searching around on the forums that blends between two textures, but I need to modify it so that it behaves like an Unlit shader would. Having it be mobile-friendly would be good as well since this is for an iOS/Android game. My knowledge of shaders is basically non-existent and I've tried researching but it hasn't worked out thus far.

Here's the shader as is currently:

 Shader "Custom/ChangeMaterial" 
 {
     Properties 
     {
         _Tint ("Tint Color", Color) = (.9, .9, .9, 1.0)
         _TexMat1 ("Base (RGB)", 2D) = "white" {}
         _TexMat2 ("Base (RGB)", 2D) = "white" {}
         _Blend ("Blend", Range(0.0,1.0)) = 0.0
     }
    
     Category
     {
         ZWrite On
         Alphatest Greater 0
         Tags {Queue=Transparent}
         Blend SrcAlpha OneMinusSrcAlpha
         ColorMask RGB
         SubShader 
         {
             Pass
             {
            
                 Material
                 {
                     Diffuse [_Tint]
                     Ambient [_Tint]
                 }
                 Lighting On
                
                 SetTexture [_TexMat1] { combine texture }
                 SetTexture [_TexMat2] { constantColor (0,0,0,[_Blend]) combine texture lerp(constant) previous }
                 SetTexture [_TexMat2] { combine previous +- primary, previous * primary }
             }
         }
         
         FallBack " Diffuse", 1
     }
 }

Any and all help is appreciated. Thanks in advance!

Comment
Add comment · Show 4
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 tanoshimi · Jul 11, 2014 at 02:59 PM 0
Share

This is not so much a technical query as it is a "write my code for me" request. What have you tried? What did you get stuck on?

avatar image thomasindustry · Jul 11, 2014 at 03:14 PM 0
Share

Does switching "Lighting On" to "Lighting Off" do anything?

avatar image meat5000 ♦ · Jul 11, 2014 at 03:19 PM 0
Share

http://answers.unity3d.com/questions/272749/how-to-write-unlit-surface-shader.html

$$anonymous$$aybe you can get something from this. I don't know much about shaders, yet, but I notice in your script it is written

Lighting On

avatar image Guidolatry · Jul 11, 2014 at 03:29 PM 0
Share

@tanoshimi Sorry, I really don't know anything about shaders and have been trying to learn but so far it has lead nowhere. I really just need this one shader so the idea of potentially spending days learning how to write them seems ridiculous to me at the moment. I've tried pasting in code from other Unlit shaders, but that didn't work.

@thomas and @meat5000, I tried changing lighting to off and that just ignores light, it doesn't have the same effect that an Unlit shader has.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Guidolatry · Jul 18, 2014 at 01:43 PM

I figured this out, finally. And of course the answer was a lot simpler than I thought. Here's the shader if anyone needs it:

 Shader "Custom/Blend Textures" { 
  
 Properties {
     _Blend ("Blend", Range (0, 1) ) = 0.0
     _MainTex ("Texture 1", 2D) = "" 
     _Texture2 ("Texture 2", 2D) = ""
 }
  
 SubShader {    
     Pass {
         SetTexture[_MainTex]
         SetTexture[_Texture2] { 
             ConstantColor (0,0,0, [_Blend]) 
             Combine texture Lerp(constant) previous
         }
     }
 } 
  
 }
Comment
Add comment · 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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

iPhone Shader - Unlit, 2 textures (alpha blend), Base needs tint. 1 Answer

Is there a way to Separate the light contribution from the shadow? 0 Answers

Unlit Shader with alpha mask 2 Answers

Unlit Alpha Shader not working with Simple Water 0 Answers

Unlit shader that receives shadows? 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