Ok so I tested the DarkOcclusion demo (old TGC site link) and it really does not make any difference especially if you're using a modern graphics card which is ready to handle significant amount of polygons. Yes, it's true that DarkOcclusion reduces the poly count which I included below (statistics) but apparently it does sort of make multiple render pass to achieve the effect which is time and fps consuming.
Here's my version of the demo which I tried to line up 500 objects (mesh and cube alternate) so the first one in front will occlude all objects from the scene, but I got the same frame rate or higher removing the D.O. functions.
Apparently, frame rate is more of a concern than poly count.
Rem --------------------------------------------------------------
Rem Dark Occlusion Example
Rem --------------------------------------------------------------
color backdrop rgb(0,0,0)
// Enable syncing
Sync on
Sync rate 60
// Set the general occlusion settings: PixelError=4, Fps=every frame
set occlusion settings 4, 0
set camera range 1, 200000
load object "HighPolyModel.x",1
// Create 100 randomly placed cubes
for i=2 to 500
position mouse 320,240
objectID = i
// Create the cube
if s = 0
make object cube objectID, 30
scale object objectID, 900,2000,900
s = 1
ry = 200
else
clone object objectID,1
s = 0
ry = 0
endif
rx = rnd(10000)
rz = rnd(10000)
`position object objectID, rx, ry, rz
position object objectID, i*400, ry, 0
`position object occID, rx, 150, ry
// Enable occlusion culling for the cube
set object occlusion cull objectID, 1, objectID
// Draw the cube as a wireframe so the occlusion culling is visible
`set object wireframe objectID, 1
next i
// Reset the mouse movement
null# = mousemovex()
null# = mousemovey()
`position camera 250,250,250
occ = 1
// Main loop
Do
// Print the frames per second to the screen
text 10, 10, "Fps: "+str$( screen fps() )
// Print the number of static occluders checked in the last update call (These are grouped, so this will not match the actual number of objects)
text 10, 30, "Static: "+str$( get static occluders() )
// Print the number of dynamic occluders checked in the last update call
text 10, 50, "Dynamic: "+str$( get dynamic occluders() )
// Print the number of visible objects on the screen
text 10, 70, "Visible: "+str$( get visible objects() )
// Print the id's of the visible objects
`text 10, 90, "---"
// Create a memblock holding the id's of all the visible objects on the screen
`make memblock from visible objects 1
// Loop through the memblock and print the id's
`for i=0 to get visible objects()-1
` text 10, 100 + i*20, str$( memblock dword(1, i*4) )
`next i
// Delete the temporary memblock
`delete memblock 1
// Simple camera movement
if upkey() then move camera 50
if downkey() then move camera -50
// Rotate the camera with the mouse
rotate camera wrapvalue( camera angle x()+mousemovey() ), wrapvalue( camera angle y()+mousemovex() ), 0
if mouseclick()=1 then occ=1
if mouseclick()=2 then occ=0
text 200,0,"Dark Occ.:" + oc$
text 300,0,str$(statistic(1))
// Update dark occlusion for camera 0, all occluded objects will be culled
if occ = 1
oc$ = "ON"
Update Dark Occlusion 0
else
oc$ = "OFF"
endif
// Sync the screen
Sync
Loop
// This function should be ignored
// Includes all the libraries (3D, Camera, Memblock) for Dark Occlusion
Function IncludeLibraries()
make object cube 1, 1
make camera 1
delete camera 1
delete object 1
make memblock 1, 1
delete memblock 1
endfunction
Benchmark (All objects totally occluded by 1 box object in front (object visible = 1), sync rate is 60)
With D.O: 4k polys/tris, 45~48 fps (somehow it counts my 4k poly model even though it's already occluded, maybe static?)
W/O D.O: 1M+ polys/tris, 52~55 fps
Maybe I should test more or it does work on older video cards but with my setup there's no difference at all in fact it runs a bit faster without it.
Quote: "Actually, there are 3 render passes. DirectX occlusion culling works by first rendering every objects reduced bounding mesh, bounding box, or bounding sphere to a render target surface. Then rendered again and their occlusion queries are received. Finally the object meshes that had pixels drawn in the second render are rendered to the actual scene."
Confirmed and thanks WickedX for the heads up, and at least I got to see and tested it for myself.