2
\$\begingroup\$

I'm creating a game engine, and I'm trying to define a 3D model format I want to use. I haven't come across a format that quite does what I want.

My game engine assumes a shader model 5+ environment. By the time I'm finished with it, that won't be a very unreasonable requirement. Because it assumes such a modern environment, I'm going to try and exploit tessellation.

The most popular way, it seems, to procedurally increase geometry through tessellation is to tessellate to a height map. This works for a lot of things, but has limitations in that height maps still use up VRAM and also only have finite scalability.

So I want to be able to use curves to define what a mesh should tessellate to. The thing is, I have no idea what definition of curves I should use, how I should store it, and how I should tessellate to it. Do I use NURBS curves? Bezier? Hermite?

And once I figure that out, is there an algorithm to determine how the tessellation shader should produce and move vertices to match the curve as closely as possible? Is the infinite scalability and lower memory usage when compared to height maps worth the added computational complexity?

I'm sorry I'm kind if ignorant as to these matters. I just don't know where to start.

\$\endgroup\$

3 Answers 3

3
\$\begingroup\$

One area you might want to look into is CAD programs. They mostly use modelling techniques based on some version of parametric surfaces, curves and solids. The one thing that could be useful is the fact that most CAD programs can export their parametric based models to some sort of mesh based format like STL. There is usually some sort of "resolution" setting for the export that governs how close the mesh approximation of the parametric model will be. I guess those exporters use some version of what you might want, albeit not necessarily suitable for realtime tessellation. Still, it might give you some ideas to start with.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Well the useful thing about some of those curves is I can define a mesh as control points, so I can still store it as a mesh. I just have to tell the tessellation shader to treat them as control points for a kind of curve, right? But that's only for NURBS and bezier curves, not curves defined solely by equations. I think I know what I want to do now. \$\endgroup\$
    – Publius
    Aug 31, 2012 at 1:04
2
\$\begingroup\$

You might want to look into Phong tessellation and PN triangles. The idea with both of these techniques is to start with an ordinary triangle mesh with vertex normals - just as you would build in a standard art pipeline. Smoothed vertex normals fake the appearance of a curved surface, and the goal of both of these techniques is to actually generate a curved surface that matches the normals. This is nice because you can just drop it in and apply it to existing assets, as long as they have entirely smoothed normals.

Of the two, Phong tessellation is simpler and faster; PN triangles use a higher-order interpolation method and might look better in some cases but are more complex and slower.

Both of these methods have problems with cracking along hard edges: the geometry gets displaced differently on either side of the edge. One way to solve this would be to include an additional "tessellation normal" field in the vertex data, which would be globally smoothed. There's some more discussion of this problem in My Tessellation Has Cracks by Bryan Dudash, and a bit more in Deus Ex is in the Details by Matthijs de Smedt.

\$\endgroup\$
4
  • \$\begingroup\$ This is nice, but my primary problem is that it doesn't really offer the same control a NURBS curve, for example, does, in that the modeler can't assign weights to the vertices. That said, I can still write phong tessellation shaders for model formats that only define meshes, so this is still useful. \$\endgroup\$
    – Publius
    Aug 31, 2012 at 5:59
  • \$\begingroup\$ @Avi, yes, it's not as general as NURBS and suchlike. You can influence the shape by editing the normals, though (if your modeling software has a good tool for it). \$\endgroup\$ Aug 31, 2012 at 6:03
  • \$\begingroup\$ I'm probably going to require that my modelers use blender. Is that reasonable? \$\endgroup\$
    – Publius
    Aug 31, 2012 at 23:33
  • \$\begingroup\$ @Avi I don't know; I don't use Blender. \$\endgroup\$ Aug 31, 2012 at 23:58
1
\$\begingroup\$

If you use height map with bicubic filtering, you should get curved look even with a lower resolution bitmap. Besides using just a single-channel height map you can use three-channel displacement map to distort the vertices in any direction, not just along the normal.

\$\endgroup\$
4
  • \$\begingroup\$ Do you not think that, for the purposes of video games, I gain any benefit from allowing the use of curves to define models? \$\endgroup\$
    – Publius
    Aug 30, 2012 at 5:36
  • \$\begingroup\$ I don't know, I've never used tesselation myself. I just have a feeling that curves are not practical and they would suite better than displacement maps only for some abstract surfaces. \$\endgroup\$
    – msell
    Aug 30, 2012 at 5:54
  • \$\begingroup\$ I'd prefer a strong argument than "I just have a feeling." Nevertheless I will take bicubic filtering into consideration when evaluating the practicality and utility of mathematically defined curves. \$\endgroup\$
    – Publius
    Aug 30, 2012 at 5:59
  • \$\begingroup\$ I know, but the feeling is all I can share :). I hope others can give better answers than I. \$\endgroup\$
    – msell
    Aug 30, 2012 at 6:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .