P-152: Virtual World Concept Update 38: Chunked Levels of Detail Using Quad Trees Part 7
I have devised an algorithm to solve the integration problems with between the spherical terrain and the quad tree.
Basically, it works like this.
The size of the quad tree is the primary determining factor, this would be chosen by the user, and all other values regarding resolution and size are based on this.
So, if the user specifies a size of 4096 for the terrain, this means that the quadtree will have 4096 spaces.
However, 4096 is not evenly divisible by 6, so I cannot directly plug that into the spherical terrain algorithm. I first need to divide 4096 by six: 4096/6 = 682.666. Then I cut off the decimal point to give just 682 (It is impossible to have .6 of a vertex). This means that each face of the quad sphere has a maximum of 682 vertices. Now, to satisfy the final condition, I need to take the square root of 682, which is: sqrt(682) = 26.115. Again, I cut off the decimal point, which gives 26. This is the critical number, which tells me the length of the axes on each face of the terrain. This allows me to construct a spherical terrain which will fit into the quad tree leaving as little wasted nodes as possible.
Working forward from 26 it is possible to calculate the efficiency of the algorithm:
If the x and y axes of each face of the quad sphere are 26, 26*26 gives the number of vertices in a single face, this is: 676. 676*6 gives the number of vertices in the entire quad sphere, which is: 4056.
The quad sphere has 4096 spaces, 4096-4056 gives 40, so 40 spaces are wasted. This gives an efficiency of 99.99% The efficiency actually increases as the size of the quad tree increases.
I am still having an issue with rendering. With the new algorithm, only part of the terrain is being rendered. I am in the process of solving this problem.
