tisdag 13 april 2010

A strike of ingenuity

OK, after working on the space-to-surface engine for a little while, i started to notice a few problems down the line.

One of these problems was the fact that when you render huge worlds like you do in a space-to-surface engine, you encounter problems with the horizon and the amount of distance you need to render.

In a normal terrain engine, you might divide your map into Tiles, and each tile can be ... let say 128x128 big, in each of these tiles we then store the vertex data.

Now, lets say we make a world that is 64x64 of 128x128 tiles, up close this might be OK even tho i consider 128x128 tiles a bit big to generate in realtime at max LOD quality on the CPU.
This also means that the size of the tile set the limit of how low the LOD quality can be, basically... you could render every corner of the tile as part of the ground, making it 1/128 of max quality.

But even at this big tiles, 64x128 is not a very great distance for a planet, and even if you double it to 128, its STILL far to short and you would have to fog things prematurely, and whats worse, as big as those tiles might be up close, they are very very tiny at that distance, not to mention all the 128x128 of tiles , thats over 16.000 iterations every render.

After baking my noodle for a while, i got a strike of ingenuity.

I Invent a very special type of QuadTree!

The basic idea is this, using a QuadTree, we can create HUGE world boxes from start, constantly dynamically creating them self around the player when he moves around, we can make them insanely big so they go all the way to the horizon.
When we render our world, we do it inside the QuadTree, where the upper levels(the big size nodes) are rendered as far away tiles at very Low quality, and the closer the camera is to a QuadTree box, it goes lower and lower inside the QuadTree, using the smaller more high quality nodes closer to the bottom layer.

Now, this means we don't have any max tile size limits (well, the size of the QuadTree of course, but we can make that one almost any size we want... like 65536x65536 for example, or even bigger )

and we can still render things all the way down to 32x32 and use as our chosen minimum "tile" size :)

I have found a few problems with this idea, especially since the planet surface is round and the QuadTree would have to be bent along the surface(*yikes*) but that is tomorrows problems.

I really like this idea, not only can i have "tiles" that is 2048x2048(or bigger) rendering like only 32x32 vertices in each, but i also get super high-quality nodes that can be only 32x32 big if i so wishes.


if everything goes as planned, this should be perfect for my engine :)

Then again, i have no idea how others have created there space-to-surface engines, it might very well be a common solution, but at least i figured it out by my self :P

just like the Liero3d project, i don't read much of others solutions, i invent my own. :)

Inga kommentarer:

Skicka en kommentar