- Home /
DirectX 11 tessellation not working
Hi all, I am trying to have the most basic DirectX tessellation shader to work.
My graphics card (nvidia geforce GTX 560 ti) supports DirectX 11
I verified with dxdiag.exe that I have DirectX 11 installed
I use Windows 7 and Unity 4.0.0b7 with DirectX 11 definitely activated both in Player Settings and in Preferences > General.
I gave all the required textures correctly (diffuse, heightmap and normal map).
The following shader is an EXAMPLE coming from THIS LINK and it just doesn't work. I don't see any tessellation happening.
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 5.0
#include "Tessellation.cginc"
struct appdata {
float4 vertex : POSITION;
float4 tangent : TANGENT;
float3 normal : NORMAL;
float2 texcoord : TEXCOORD0;
};
float _EdgeLength;
float4 tessEdge (appdata v0, appdata v1, appdata v2)
{
return UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, _EdgeLength);
}
sampler2D _DispTex;
float _Displacement;
void disp (inout appdata v)
{
float d = tex2Dlod(_DispTex, 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
}
FallBack "Diffuse"
}
Console shows this warning:
Shader warning in 'Custom/TessallationBasic': Program 'tessvert_surf', undeclared identifier 'UnityEdgeLengthBasedTess' (compiling for d3d11) at line 93
Thanks in advance for your attention.
Steak
Temporary post scriptum: At the moment the search server is totally down so I couldn't crawl around very much looking for a solution before asking. I don't see lot of information out there anyway on these topics. I might delete this post if I see it's a duplicate soon. (I like to be tidy)
Answer by smb02dunnal · Mar 28, 2013 at 03:53 PM
Hello Riccardo!
Seems to work fine for me. It's because you aren't running the latest version of Unity, these functions didn't exist when the beta version was around.
Your answer
Follow this Question
Related Questions
Unity 5 Tessellation shaders vs. Standard 0 Answers
Adding Decal to Tessellated Material 0 Answers
DirectX 11 Tessellation Displacement Smooth Shader 1 Answer
Compute Shader crashes when buffer is too big 0 Answers
No Shadows on Tessellated Terrain 1 Answer