Analytics

30 May, 2011

Quartz Composer Procedural Terrain Mesh Test

The terrain mesh is generated by creating vertex structures with iterators and feeding it to the Kineme GL Triangle Structure patch. I initially tried with the built in Mesh Creator patch, but this one seems faster and more stable. 

The current method is not incredibly fast as it uses individual quads rather than long triangle strips. A 64*64 grid takes 17 seconds! I have a version which is faster that uses iterated triangle strips, but I’m having some problems wrapping the end of the mesh so I need to clean it up further. A lot of the slow-down is due to the way I calculate vertex colors I think.

The height values are generated by a Noise patch and entirely mediated by math to get the “island” effect, with the terrain coming down at the edges into flat land. No heightfield images are used.
Normals are not yet calculated so no shadows for now. The vertex colors are generated through the Color Map patch fed by gradients and an initial colouring of the vertices from black to white based on the height value. 

Overall quite primitive and unpolished, but I look forward to refining it.





These are earlier versions using the built-in Mesh Creator patch. The slight advantage of this is that you can use the Grid Normals Generator patch to generate normals and get shadows, however this proved very unstable so I’ll probably have to find an alternative way.