PDA

View Full Version : More Tesselation Detail



D3v01d
05-10-2014, 11:12 AM
Hi, I am trying to add more detail to a tesselated grid, which has a heightmap applied to it.
Basically, changing the tesselation factor to greater than 80.0f doesn't result in more visible detail.

Here are my two shaders:

Tesselation Control Shader:


# version 430

layout (vertices = 3) out;
uniform float tessLevel = 1000.0f; //Changing this to 1000.0f looks exactly the same as 80.0f

void main (){
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
gl_TessLevelOuter[0] = tessLevel;
gl_TessLevelOuter[1] = tessLevel;
gl_TessLevelOuter[2] = tessLevel;
gl_TessLevelInner[0] = tessLevel;
}

Tesselation Evaluation Shader:


# version 430

layout (location=0) uniform sampler2D heightMap;
layout (triangles, equal_spacing) in;

uniform mat4 modelWorld;

void main (){
vec3 p0 = gl_in[0].gl_Position.xyz * gl_TessCoord.x;
vec3 p1 = gl_in[1].gl_Position.xyz * gl_TessCoord.y;
vec3 p2 = gl_in[2].gl_Position.xyz * gl_TessCoord.z;

vec3 position = p0 + p1 + p2;
float height = texture(heightMap, vec2(position.x/1024.0f, position.z/1024.0f)).x;
position.y += height * 200;

gl_Position = modelWorld * vec4(position, 1.0f);
}

Aleksandar
05-10-2014, 06:31 PM
You can't add more details that way. Read the value of GL_MAX_TESS_GEN_LEVEL and you'll find out what is the limit of your hardware. For all known hardware it is "only" 64 by now. How have you achieved 80?

D3v01d
05-11-2014, 06:31 AM
Awesome thanks, I didn't really know what value it stopped tesselation, just took a stab at around 80ish