I don't know if anyone realizes but it's the amount of data that is sent to the rendering pipeline that causes the infamous slow downs ... Blitz is not slow, but you cannot shovel huge amounts of data down the rendering pipeline, you have to cut as much out as possible ... that is why you see the 2 GHZ computers slowing down when they shouldn't be .. too much data being sent to the rendering pipeline.
So if I where to write a terrain algorithm I would probably do the following (for terrain only):
--------------------------------------
create 4 ^ X terrain meshes (or whatever you want to use) and place them together so they make up one large grid of terrains. We will use 4 ^ 3 (64 terrains total)
1) Hide all terrain entities -- (they are out of the rendering pipeline)
2) divide your map into 4 invisible bounding boxes (alpha 0) to take into account what LT said about looking up etc.
-----
| | |
-----
| | |
-----
these are your 4 parent entities ... they can be really huge ... then you add another 4 bounding boxes to each parent entity so it looks like a heirarchy --- you stop when you have created enough bounding boxes to cover the amount of terrains you have.. so for 64 terrains it would go something like this
MainBoxes (1 = size of 16 terrains)
4 total
SubBoxes (Parent is mainBoxes) (1 = size of 4 terrains)
16 in total
MiniSubBoxes (Parent is SubBoxes) (1 = size of 1 terrain)
64 in total (one for each terrain)
Terrain (Parent is MiniSubBoxes)
So now we make sure everything is completely hidden and the alpha for all bounding boxes are set so they look invisible .. so lets start our render loop...
Pseudo code :
' use a nested loop for rendering and checking
do
for i = 1 to 4
ShowEntity(MainBox(i))
if entityinview(MainBox(i)) then
for j = 1 to 4
ShowEntity(SubBox(j))
if entityinview(SubBox(j)) then
for k = 1 to 4
ShowEntity(MiniSubBox(k))
if entityinview(MiniSubBox(k)) then
ShowEntity(TheChildTerrain?)
else
HideEntity(MiniSubBox(k))
endif
next
else
HideEntity(SubBox(j))
endif
next
else
HideEntity(MainBox(i))
endif
next
loop
---------------
anyway that is some pseudo code and the arrays are all screwed up because I did not want to make it super messy for anyone to read ... but you might even be better using some of the parent/child command to travers the nested boxes.. also remember to hide all terrains the you showed after you render.
So if I where to write a terrain algorithm I would probably do the following (for terrain only):
--------------------------------------
create 4 ^ X terrain meshes (or whatever you want to use) and place them together so they make up one large grid of terrains. We will use 4 ^ 3 (64 terrains total)
1) Hide all terrain entities -- (they are out of the rendering pipeline)
2) divide your map into 4 invisible bounding boxes (alpha 0) to take into account what LT said about looking up etc.
-----
| | |
-----
| | |
-----
these are your 4 parent entities ... they can be really huge ... then you add another 4 bounding boxes to each parent entity so it looks like a heirarchy --- you stop when you have created enough bounding boxes to cover the amount of terrains you have.. so for 64 terrains it would go something like this
MainBoxes (1 = size of 16 terrains)
4 total
SubBoxes (Parent is mainBoxes) (1 = size of 4 terrains)
16 in total
MiniSubBoxes (Parent is SubBoxes) (1 = size of 1 terrain)
64 in total (one for each terrain)
Terrain (Parent is MiniSubBoxes)
So now we make sure everything is completely hidden and the alpha for all bounding boxes are set so they look invisible .. so lets start our render loop...
Pseudo code :
' use a nested loop for rendering and checking
do
for i = 1 to 4
ShowEntity(MainBox(i))
if entityinview(MainBox(i)) then
for j = 1 to 4
ShowEntity(SubBox(j))
if entityinview(SubBox(j)) then
for k = 1 to 4
ShowEntity(MiniSubBox(k))
if entityinview(MiniSubBox(k)) then
ShowEntity(TheChildTerrain?)
else
HideEntity(MiniSubBox(k))
endif
next
else
HideEntity(SubBox(j))
endif
next
else
HideEntity(MainBox(i))
endif
next
loop
---------------
anyway that is some pseudo code and the arrays are all screwed up because I did not want to make it super messy for anyone to read ... but you might even be better using some of the parent/child command to travers the nested boxes.. also remember to hide all terrains the you showed after you render.