- Home /
Question by
Seyed_Morteza_Kamaly · Aug 21, 2017 at 10:08 AM ·
unity 5shaderlabtessellation
Accessing vertex position in surf directly without vert's out parameter
I have problem with output vertex In Tesselation Shader How can I fix it? https://forum.unity3d.com/threads/accessing-vertex-position-in-surf-directly-without-verts-out-parameter.432333/
Shader "Tessellation Sample" {
Properties {
_EdgeLength ("Edge length", Range(2,50)) = 15
_MainTex ("Base (RGB)", 2D) = "white" {}
_DispTex ("Disp Texture", 2D) = "gray" {}
_NormalMap ("Normalmap", 2D) = "bump" {}
_Displacement ("Displacement", Range(0, 1.0)) = 0.3
_Color ("Color", color) = (1,1,1,0)
_SpecColor ("Spec color", color) = (0.5,0.5,0.5,0.5)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 300
CGPROGRAM
#pragma surface surf BlinnPhong addshadow fullforwardshadows vertex:disp tessellate:tessEdge nolightmap
#pragma target 4.6
#include "Tessellation.cginc"
float _EdgeLength;
float4 tessEdge (appdata_full v0, appdata_full v1, appdata_full v2)
{
return UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, _EdgeLength);
}
float _Displacement;
struct Input {
float4 position : POSITION;
float3 worldPos : TEXCOORD2; // Used to calculate the texture UVs and world view vector
float4 proj0 : TEXCOORD3; // Used for depth and reflection textures
float4 proj1 : TEXCOORD4; // Used for the refraction texture
};
void disp (inout appdata_full v, out Input o){
UNITY_INITIALIZE_OUTPUT(Input,o);
o.worldPos = v.vertex.xyz;
o.position = UnityObjectToClipPos(v.vertex);
o.proj0 = ComputeScreenPos(o.position);
COMPUTE_EYEDEPTH(o.proj0.z);
o.proj1 = o.proj0;
#if UNITY_UV_STARTS_AT_TOP
o.proj1.y = (o.position.w - o.position.y) * 0.5;
#endif
}
sampler2D _MainTex;
sampler2D _NormalMap;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = float4(0,0,0,0);
}
ENDCG
}
FallBack "Diffuse"
}
how can I fix it Shader error in 'Tessellation Sample': 'disp': no matching 1 parameter function at line 230 (on d3d11)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612133209im_/https://answers.unity.com/themes/thub/images/avi.jpg)