Taking XNA 4.0 Beta for a spin: Terrain Editing

jwatte's picture

I'm taking the XNA 4.0 beta for a spin. I don't have a Windows 7 phone (who does? :-) so I can't get motivated to start porting things like kW Animation / X-port to it, but I thought I'd check out the new and improved render target and effects APIs. Here's a little screen shot:

I think I found one buglet in the XNA, having to do with assigning to the "CurrentTechnique" member and then reading back from it and getting shaders the wrong technique, when using a uniform boolean as an argument to shader compiling (different in the two techniques), but I can't reproduce it in simple code, so I just worked around it. If some better reproduction path comes back to me, I'll be sure to post on Connect!

Meanwhile, here are the stats:

  • Terrain blocks are 65x65 vertices
  • Terrain overall is a R32F format texture, sampled in the vertex shader. Could probably get away with A8, but whatever :-)
  • With a 1024x1024 terrain height texture, that's 16x16 terrain blocks.
  • Terrain paints use an RGBA control texture with a base layer, so 5 total terrain types can be painted. Additionally, the top 10% of the height range (which I clamp) is automatically snow covered.
  • Painting tools: Raise, Lower, Noisify and Smooth
  • Only round brushes, but brushes can go from meter size to kilometer size!
  • Painting operations use render targets, both for height manipulation and terrain type.
  • Each tool is its own little FX file shader. I ought to expose some parameter tweaking UI, but haven't done it yet.

AttachmentSize
terrain-editor-2010-08-08.jpg316.94 KB
terrain-editor-2010-08-08-thumb.jpg26.45 KB