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
Your answer
