Sunday, July 31, 2011

Added (ab)Normals

I had a go at adding normals to all the vertices on the planet and it had a pretty dramatic effect. I started off with an algorithm from … here … site seems to be down at the moment though. Anyways, I converted it to work with triangle strips and got some pretty nice results:

JellyEngineXna 2011-07-25 22-35-12-36

I threw in another planet in the background to look like a moon, textures are still non-existent.

JellyEngineXna 2011-07-28 16-12-12-09

There are some problems with this technique though, namely that the vertices at the edges (and especially the corners) of patches calculate their normal from a smaller number of connections – so there’s always seams between patches, and exaggerated peaks at corners… looks a bit like the labels are coming off…

JellyEngineXna 2011-07-26 10-39-41-82

I *think* the solution is to either share the edges between patches (but that might force me to do SetData on 4 neighbouring patches – very slow), or for each patch to generate more data than it will show, e.g. a 1-cell skirt around the existing patch.

There’s also some weird effect going on around ridges, maybe because the diagonals are longer so should be weighted differently? I’m hoping it’ll go away when I use a normal map… after I figure out how to generate it first! :)

Other than that I put normals on the trees (much easier) and implemented a recycling scheme so patches that weren’t used wouldn’t keep a hold on memory. One result of all the above work is that there are cracks in the patches again so I’ll have to revisit my LOD decision stuff… one step forward, two steps back, then get hit by a bus.

No comments: