Thursday, June 16, 2016

Day 32: Roughly A Bazillion Triangles

Phew! Today marks a big milestone in my graphics programming know-how. Through use of the hull and domain shader, I can now tessellate my terrain!

What is the hull and domain shader, you ask? Well, compared to the geometry stage in GLSL, the hull shader is very specific to tessellation. The hull shader is responsible for making a "patch" of control points, or taking a set of vertices in which to tessellate by a tessellation factor. It's a fairly automatic process, but very important. The domain shader... well, does what the vertex shader originally did.

It doesn't make too much sense to use the vertex shader; the vertices need to be tessellated before any world-to-view-to-projection space transformations are involved. In this case, the domain takes the work off of the vertex shader in another pipeline stage.

The result? We go from this:


To this!


Wowza! That's about the same distance from the camera. 5 times as many triangles!

What does that do, other than kill the graphics processor? Well, imagine that we don't have to produce 1000x1000 points anymore and just tessellate the detail in! Or do so anyways and optimize it.

Next up; only optimize at a certain distance!

No comments:

Post a Comment