Archive for August, 2011

More Tessellated Terrain

Thursday, August 25th, 2011

Just a quick note about some small changes I made to the terrain object in Haze. Originally its initialization code just created a single quad made of two triangles with an index buffer in the form {0, 1, 2, 2, 3, 0}. Since then I have updated the constructor to take in an initial size value (int) that sets the number of quads (width and height) in the x and z direction to create. The initialize method now just generates the starting geometry in a loop and sends quad indexes in instead of triangles {0, 1, 2, 3}

The major effect this has on things is that now there can be a single vertex for every single texel passed in as a height map. Since the max tessellation level is 64, we only have to make an 8×8 initial grid to get a full 512×512 tessellated terrain. This opens up other doors as well for things like levels of detail using different tessellation in different quads based on camera distance or view angle. Next up is to get some texture mapping going and see how much I can make things look like real terrain.

I might start with standard splatting techniques, but I’d really like to have the video card generate some of the splat “stencils” based on heights on the whole map (snowy parts at the highest points, less snow on steep slopes, etc.) We’ll see what happens.

Tessellated Terrain

Thursday, August 18th, 2011

As an exercise in learning Hull and Domain shaders with DirectX 11, I decided to whip up a quick (or what I thought would be quick) height mapped terrain demo that only sent a single quad to the video card and handled everything else in the shader. Aside from some minor problems remembering to use SampleLevel instead of Sample in the Domain Shader everything came together fairly well.

At the moment I have a 512 x 512 height map texture (a simple black and white Filter > Render > Clouds in Photoshop) and a single quad that gets tessellated up to level 64 with the heights added in the Domain Shader. I am currently tessellating at the triangle level and would like to switch to quad as well just to see how it looks both ways. I’ll stick a video of the whole on here once I get the quad tessellation going and throw in a FillMode = Wireframe option to make it easier to see what is going on.

edit: Here’s the video

Do NOT follow this link or you will be banned from the site!