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 /
  • Help Room /
avatar image
0
Question by Beeerer · Apr 25, 2017 at 04:39 PM · shadermerge

Combining Two shaders

Hello, I am trying to combine two shaders. I want to have something like Seethrough effect, when my object is for example behind rock, i still want to see something, like some color or anything else. I found the SeeThrough shader, which even has tutorial how to merge it with some different shader:

 Shader "Simple SeeThrough v2/Unlit Player"
 {
     Properties
     {
         [Enum(Off,0,Front,1,Back,2)] _CullMode ("Culling Mode", int) = 0
           _Color ("Color", Color) = (1,1,1,1)
         _SeeThroughColor ("SeeThrough Color", Color) = (1,1,1,1)
         _MainTex ("_MainTex (RGBA)", 2D) = "white" {}

     [Header(Cutout)]
     [Toggle(ISCUTOUT)] _isCutout ("Is Cutout?", Float) = 0
     _Cutoff ("Alpha Cutoff", Range(0,1)) = 0.5
 }
 SubShader
 {
     Pass
     {
         Tags {"Queue"="Transparent+100" "IgnoreProjector"="True" "RenderType"="Transparent"}
         Blend SrcAlpha OneMinusSrcAlpha //Alpha Blend
         Lighting Off ZWrite Off Cull [_CullMode]
         ZTest Greater
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag_unlit_seethru
         //#pragma fragment frag_unlit_seethru_invert
         #pragma shader_feature ISCUTOUT
         #include "SCTCGUnlit.cginc"
         ENDCG
     }

     Pass
     {
         Tags {"Queue"="Geometry" "RenderType"="Opaque"}
         Lighting Off ZWrite On Cull [_CullMode]
         ZTest LEqual
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag_unlit
         #pragma shader_feature ISCUTOUT
         #include "SCTCGUnlit.cginc"
         ENDCG
     }
 }
 }

and it says: copy Properties and first Pass{} to another shader, for example this:

 // Toony Colors Pro+Mobile 2
 // (c) 2014-2016 Jean Moreno


 Shader "Toony Colors Pro 2/Mobile"
 {
     Properties
 {
         //TOONY COLORS
         _Color ("Color", Color) = (1.0,1.0,1.0,1.0)
         _HColor ("Highlight Color", Color) = (0.6,0.6,0.6,1.0)
         _SColor ("Shadow Color", Color) = (0.2,0.2,0.2,1.0)
     
         //DIFFUSE
         _MainTex ("Main Texture (RGB) Spec/MatCap Mask (A) ", 2D) = "white" {}
     
     //TOONY COLORS RAMP
     _Ramp ("#RAMPT# Toon Ramp (RGB)", 2D) = "gray" {}
     _RampThreshold ("#RAMPF# Ramp Threshold", Range(0,1)) = 0.5
     _RampSmooth ("#RAMPF# Ramp Smoothing", Range(0.01,1)) = 0.1
     
     //BUMP
     _BumpMap ("#NORM# Normal map (RGB)", 2D) = "bump" {}
 }
 
 SubShader
 {
     
     
     Tags { "RenderType"="Opaque" }
     LOD 200
     
     CGPROGRAM
     
     #include "Include/TCP2_Include.cginc"
     
     #pragma surface surf ToonyColors noforwardadd interpolateview halfasview
     #pragma glsl
     #pragma target 2.0
     
     #pragma shader_feature TCP2_RAMPTEXT
     #pragma shader_feature TCP2_BUMP
     
     //================================================================
     // VARIABLES
     
     fixed4 _Color;
     sampler2D _MainTex;
     
 #if TCP2_BUMP
     sampler2D _BumpMap;
 #endif
     
     struct Input
     {
         half2 uv_MainTex : TEXCOORD0;
 #if TCP2_BUMP
         half2 uv_BumpMap : TEXCOORD1;
 #endif
     };
     
     //================================================================
     // SURFACE FUNCTION
     
     void surf (Input IN, inout SurfaceOutput o)
     {
         half4 main = tex2D(_MainTex, IN.uv_MainTex);
         o.Albedo = main.rgb * _Color.rgb;
         o.Alpha = main.a * _Color.a;
         
 #if TCP2_BUMP
         //Normal map
         o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
 #endif
     }
     
     ENDCG
     
 }
 
 Fallback "Diffuse"
 CustomEditor "TCP2_MaterialInspector"
 }


but it is not working and it will mess with it, when you add the Pass{} section to second shader. here is link to tutorial, Thank you for any help.

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

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Need help to make a color replace shader 0 Answers

Specular colored shader problems after 5.6.1 update 1 Answer

AVPro plugin + Amplify Shader 0 Answers

Circular Bar Transparent gradient 0 Answers

Add contrast to projector/light? OR add fade in/out to projector/multiply 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