Let me start off by saying I’m a beginner at this stuff
Right now I have a shader setup I was trying that’s like below (I edited it just to make it simpler to look over the structure)
I basically tried to do a surface pass just to get the tessellation, and then do my vert/frag for the lighting. The result is two separate objects overlapping, my original object and a solid black tessellated version of that object.
Is there some way I’m supposed to pass my output from the surface shader TO my vert/frag or is this not even possible?
Shader "TestCustom"
{
Properties
{
_Tess ("Tessellation", Range(1,32)) = 4
_Displacement ("Displacement", Range(0, 1.0)) = 0.3
}
SubShader {
// Tags { "Queue"="Transparent" "RenderType"="Transparent" }
//Blend One OneMinusSrcAlpha made ocean colored even with 0 alph
Blend SrcAlpha OneMinusSrcAlpha
Cull Off
Tags { "Queue"="Transparent-1" "IgnoreProjector"="True" "RenderType"="Transparent"}
Fog {Mode Off}
LOD 2
GrabPass { "_RefractionNoDistort" }
CGPROGRAM
#pragma surface surf BlinnPhong addshadow fullforwardshadows vertex:disp tessellate:tessFixed nolightmap
#pragma target 5.0
struct appdata {
float4 vertex : POSITION;
float4 tangent : TANGENT;
float3 normal : NORMAL;
float2 texcoord : TEXCOORD0;
};
float _Tess;
float4 tessFixed()
{
return _Tess;
}
sampler2D _Bump;
float _Displacement;
void disp (inout appdata v)
{
float d = tex2Dlod(_Bump, float4(v.texcoord.xy,0,0)).r * _Displacement;
v.vertex.xyz += v.normal * d;
}
struct Input {
float2 uv_MainTex;
};
sampler2D _MainTex;
sampler2D _NormalMap;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Specular = 0.2;
o.Gloss = 1.0;
o.Normal = UnpackNormal(tex2D(_NormalMap, IN.uv_MainTex));
}
ENDCG
Pass {
CGPROGRAM
//#pragma exclude_renderers xbox360
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
struct v2f
{
};
v2f vert (appdata_tan v)
{
return o;
}
half4 frag (v2f i) : COLOR
{
return half4;
}
ENDCG
}
}
}
