GLSL Shader Results

After squashing a rather nasty bug this morning (GLSL shader memory alloc is tricky), I made some renders to demonstrate the algorithm.

The algorithm is an object-space algorithm.  This has some implications: Operations are performed with direct vertex info. No intermediate rendering+signal filtering is done. Rendering it on the GPU makes it hard to control line width. This is the main disadvantage in using this algorithm over a CPU-implemented one. The main advantage is – of course – significant speedup in rendering.

The current version computes info for all vertices. I think I can speed things up a bit more by adding some additional tests in the vertex shader, which could signal the fragment shader that the fragment is unlikely to have contours. Whether or not the additional overhead of these tests is worth it, we’ll see. Pretty images behind the cut.

All of the following images can be rendered fast enough for a real-time environment. Tests were performed on an AMD Phenom II QuadCore with a Radeon HD4980. Any card supporting Opengl 1.4 and the ARB extensions will do, though.

Triceratops, 22640 faces

Line width for regular contours is okay, but suggestive contours tend to “smudge” out over large faces. I think subdividing the model into smaller triangles might solve that.

Skull, 40000 faces

Bringing out the details doesn’t work as well as it did int he CPU implementation. This is because the thresholds to limit line width are a bit too agressive at times … nevermind the characters on the top of the skull.

Torus, 5000 faces

Torus, 5000 faces

Apart from some artifacts where the suggestive contours merge in the regular contours, this looks pretty much the same as the CPU implementation. The simple geometry allows for good threshold tweaking.

Horse, 100000 faces

The same problems which can be seen in the triceratops render: regular contours are sharp and rather crisp, suggestive contours are smudged.

Headscan (part2), 100000 faces

Testing the shader on uncleaned, noisy data (like this head scan) results in an okay image. For the record: the nose is not included in the original scan, so the cutoff appearance is like it should be. For reference, I’ve rendered the image with the CPU implementation and regular shading enabled, contours overdrawn:

Head (part2), 100000 faces, CPU render

As you can see, the GPU shader actually brings out more details around the eyes. Again, this is due to the treshold settings.

Immunoglobin, 48000 faces

This render is as good as the CPU render: note that this object has soft curvy edges in general, and all faces are approx. the same size. This is better for the GPU algorithm, so not a lot of “smudge” to be seen here.

Stanford Dragon, 202520 faces

The Stanford Dragon. As you can see, finding good thresholds for the entire render is hard.

Armadilo, 350000 faces

Armadilo, 350000 faces

The Armadillo – the piece de résistance, if you want – a good threshold setting for this model was found immediately, resulting in a good line drawing.

Leave a Reply