Thursday, March 4, 2010

Cube to Sphere Tessellation

My previous tessellation example was just a 2D, screen-space quad. My latest example steps into the world of 3D.

No code to share, just a pretty little video. It shows a cube being tessellated on the fly to form a sphere. What's being done is each quad is being tessellated and then the vertex position is normalized.

I was lazy and instead of making an entire cube with 6 sides, I only built a vertex/index buffer for 3 sides. You can only tell when I move the camera around at the end of the video.

I was getting about 1500 fps for the cube and about 900 fps for the fully tessellated sphere. 63*63*3*2 = 23,814 triangles!

Here ya go:


Hexadecimal said...

Cool example. The best part is that the only geometry stored in memory is the base cube model -- endless things are possible with procedural transformations in the shaders.

Anonymous said...

nice sphere! :)
i'm starting now to play with tessellation. did you provided adjacency informations in the cube mesh? or tessellation deformation is based on normals of original faces? is this cube mesh build with 4 ctrl points patches?

Patrick said...

Sorry for the late response. No, I didn't use any adjacency information in the mesh. The deformation is based on the vertex position and the mesh center [normalize(position - center)]. Since the cube is centered at the origin, I just normalize the position. Yes, the patches were made up of 4 control points.