In the latest Intel-sponsored feature, part of the Gamasutra Visual Computing microsite
, Intel senior graphics software engineer Joshua Doss looks at techniques for edge detection, crucial for creating cel shading and other non-photorealistic rendering methods in games.
Doss, a member of the advanced visual computing team in the Intel Software Solutions Group, includes several code examples and diagrams illustrating ways to approach GPU-based edge inking using Direct3D 10.
After describing existing techniques, Doss moves on to strategies for DirectX 10 and beyond:
"Since DirectX 10 got its geometry shader, programmers are able to calculate face normals on the GPU, allowing for accurate detection methods for both silhouette and crease edges without the preprocessing step and the bus overhead resulting from frequent CPU to GPU communication.
Nvidia devised this application and presented it at Siggraph 2006 (see Tariq in References) with respect to detecting and extruding silhouette edges.
The first step is to create a mesh with adjacency information. This is done by creating a vertex buffer with three vertices per primitive, and then creating an index buffer containing the adjacent vertices in the proper winding order.
The primitive-type triangle with adjacency must be declared in both the host code and the geometry shader constructor. As a result, the geometry shader gets access to vertex information from three triangles: the primary triangle, and the three adjacent triangles for a total of six vertices."
You can now read the full feature
, including three code excerpts and numerous visual aids. (No registration required; please feel free to link from other websites.)