Subdivision Surface Tessellation

Hello, i am stuck again with a kind of big problem. I know this is not quite a JME task since Tessellation is not yet officially supported. But i hope that someone is here who has a bit experience with is.



The idea was to create a terrain system which allows easy editing, high details, LOD as well as any form (caves … ).

So after thinking during work about this i ended with the idea that using a Bloxel enging would solve the easy-editing and any form task. On modern hardware tessellating these object with a Catmull clark tessellation shader should eliminate the Block-look and solve the LOD task… (The form of the terrain can be adjusted by adjusting the Normals)



Bloxel + Tessellation = Roxel (Roundes Voxels, and the name sounds cool :wink: )



Now i have search for two day’s for implementations of a Catmull clark algorithm. And beside Math-Papers showing nice results without any code :frowning: (Which are unfortunately over my head (I am quite not a math guy) i found two different methods.



-Adaptive PN

-Phong Tessellation



However, both of them are not similar to Catmull clark’s result. They are both extruding the tessellated part, while the original vertices stay at the same position.



Here is a picture: With ‘debug show normals’ texturing. In this picture i have used a Tessellation level of 6 for the whole mesh.



http://i.imgur.com/0i99z.jpg



Anyone has a link to a working Catmull shader, or knows a relativly easy to follow paper?

1 Like

hello



sorry, i can’t help you. just wanted to tell that i’m impressed.



but i see some problems in yours idea:

it’s bad that modified surface will not affect on Physics or pathfinding. (mostly physics, where it need to have that modified vertexes).

@oxplay2 said:
but i see some problems in yours idea:
it's bad that modified surface will not affect on Physics or pathfinding. (mostly physics, where it need to have that modified vertexes).

I would doubt that. In the current incarnation of my game, physics has a very coarse model of the world and as far as I tested it, I'm rather buying it. This is even though I am using bounding spheres for creatures that can be directly controled by a human player. Nonetheless, I have to admit that there might be game mechanics that would suffer from tesselation of solid objects.

Any news? Since this is a more general topic, more general knowledge hubs might have answers for you, e.g. gamedev.stackexchange.com, and gamedev.net.

@oxplay2 said:
hello

sorry, i can't help you. just wanted to tell that i'm impressed.

but i see some problems in yours idea:
it's bad that modified surface will not affect on Physics or pathfinding. (mostly physics, where it need to have that modified vertexes).


There is a way of solving this... I hope I remember the name properly... @Momoko_Fan said something about using transform feedback to return the updated vertex positions to the app, however he also mentioned needing custom bindings as it is only supported in versions... um.. 2.0 (to some extent) and higher. I probably have the name wrong... but his response is in a thread I had about trying to retrieve an updated mesh from a deform shader I wrote.
@zzuegg said:
Hello, i am stuck again with a kind of big problem. I know this is not quite a JME task since Tessellation is not yet officially supported. But i hope that someone is here who has a bit experience with is.

The idea was to create a terrain system which allows easy editing, high details, LOD as well as any form (caves ... ).
So after thinking during work about this i ended with the idea that using a Bloxel enging would solve the easy-editing and any form task. On modern hardware tessellating these object with a Catmull clark tessellation shader should eliminate the Block-look and solve the LOD task.. (The form of the terrain can be adjusted by adjusting the Normals)

Bloxel + Tessellation = Roxel (Roundes Voxels, and the name sounds cool ;) )

Now i have search for two day's for implementations of a Catmull clark algorithm. And beside Math-Papers showing nice results without any code :( (Which are unfortunately over my head (I am quite not a math guy) i found two different methods.

-Adaptive PN
-Phong Tessellation

However, both of them are not similar to Catmull clark's result. They are both extruding the tessellated part, while the original vertices stay at the same position.

Here is a picture: With 'debug show normals' texturing. In this picture i have used a Tessellation level of 6 for the whole mesh.

http://i.imgur.com/0i99z.jpg

Anyone has a link to a working Catmull shader, or knows a relativly easy to follow paper?


Per GPUGems2:

Example 7-1. Subdiv.cg—Subdividing a Regular Mesh Using Catmull-Clark Rules

[java]

float4 main(float4 srcCoord,

uniform samplerRECT srcTexMap : TEXUNIT0) : COLOR

{

float3 wh, wv; // weight values

float3 s1, s2, s3;

float2 f;



// calculate weights based on fractional part of



// source texture coordinate

//

// x == 0.0, y == 0.0 use face weights (1/4, 1/4, 0)

// (1/4, 1.4, 0)

// ( 0, 0, 0)

// x == 0.5, y == 0.0 use edge weights (horizontal)



// (1/16, 6/16, 1/16)

// (1/16, 6/16, 1/16)

// ( 0, 0, 0)

// x == 0.0, y == 0.5 use edge weights (vertical)

// (1/16, 1/16, 0)

// (6/16, 6/16, 0)



// (1/16, 1/16, 0)

// x == 0.5, y == 0.5 use valence 4 vertex weights

// (1/64, 6/64, 1/64)

// (6/64, 36/64, 6/64)

// (1/64, 6/64, 1/64)

wh = float3 (1.0/8.0, 6.0/8.0, 1.0/8.0);

f = frac (srcCoord.xy + 0.001) < 0.25; // account for finite precision



if (f.x != 0.0) {

wh = float3(0.5, 0.5, 0.0);

srcCoord.x += 0.5; // fraction was zero -- move to texel center

}

wv = float3 (1.0/8.0, 6.0/8.0, 1.0/8.0);

if (f.y != 0) {

wv = float3 (0.5, 0.5, 0.0);

srcCoord.y += 0.5; // fraction was zero -- need to move to texel center



}



// calculate the destination vertex position by using the weighted

// sum of the 9 vertex positions centered at srcCoord

s1 = texRECT (srcTexMap, srcCoord.xy + float2 (-1, -1)).xyz * wh.x +

texRECT (srcTexMap, srcCoord.xy + float2 (0, -1)).xyz * wh.y +

texRECT (srcTexMap, srcCoord.xy + float2 (1, -1)).xyz * wh.z;



s2 = texRECT (srcTexMap, srcCoord.xy + float2 (-1, 0)).xyz * wh.x +

texRECT (srcTexMap, srcCoord.xy + float2 (0, 0)).xyz * wh.y +

texRECT (srcTexMap, srcCoord.xy + float2 (1, 0)).xyz * wh.z;



s3 = texRECT (srcTexMap, srcCoord.xy + float2 (-1, 1)).xyz * wh.x +

texRECT (srcTexMap, srcCoord.xy + float2 (0, 1)).xyz * wh.y +

texRECT (srcTexMap, srcCoord.xy + float2 (1, 1)).xyz * wh.z;



return float4 (s1 * wv.x + s2 * wv.y + s3 * wv.z, 0);

}[/java]

The correct solution in this case, @oxplay2, is to create a physics only collision mesh version of the original. This is something you would do in the modelling tool. The kind of detail you can get with tessellation is not useful for physics, it just needs an approximate version.

Also, for most games it can be assumed there’s already a normal triangle mesh available for models, in order to support GPUs without tessellation.



@t0neg0d: If tessellation is supported, then you can count on vertex transform feedback to also be supported since transform feedback preceded tessellation.

1 Like

Actually i would use tesselation only for additional details taht are somewhat small. Now i either supply a high detials colllision shape, (wee high enough details that differnces are not visible) Or make sure the tesselation does only change stuff in a few cm differnece so a normal player cannot see that the physics does not fit perfectly. (Eg with stones() on the ground in crysis, you will net recognise that the actuall colision is flat)



http://www.behardware.com/articles/838-6/crysis-2-dx11-a-closer-look-at-performance-and-tessellation.html

Just hover that text to switch the images

@EmpirePhoenix said:
http://www.behardware.com/articles/838-6/crysis-2-dx11-a-closer-look-at-performance-and-tessellation.html
Just hover that text to switch the images

Hehe it's already crazy good without tesselation :p
I'm surprised they use Parallax Occlusion Mapping along side hardware tesselation.