Monday, March 24, 2008

Cracks Painted Over

I had to redo the algorithm for creating the index buffer for a patch again but finally the patches don't show cracks anymore. If a neighbouring patch is at a lower level of detail, I draw the edge that borders that patch a little coarser by omitting a vertex. In the image below left, the red circle indicates where a crack occurs. By omitting the vertex from the higher detailed patch, the poly on the right of the left patch and the poly on the left of the right patch - share an edge. The other image shows where this happens on my engine.

removevertexfixcrack fixedcracks

The results aren't very stunning, just the terrain with no cracks:

clodnocracks clodnocrackstextured

One bad side effect of this is that recreating the index buffer each time is a big performance hit. I might pre-calculate all the kinds of index buffers (one set for each level of detail - a set has 16 versions for every configuration that deals with every combination of neighbouring level of details) and share them between the patches. I'm not that bothered about performance at the moment though, I'll just rely on whenever quantum computing comes around to speed my engine up.

When going towards or away from the terrain, it pops a lot as it changes from one level of detail to the next - so I might look into geomorphing to minimise popping. I think I could come up with a better way of calculating the level of detail too (non-linearly). Or... go back to brute force terrain and wait for quantum computing...

No comments: