if(_cam!=NULL){
_octree.DrawOcclusion(&_octree, &_world, _cam, 0);
if(bShaders){
// render only z
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
glDepthMask(GL_TRUE);
_octree.DrawOctreeMesh( &_octree, &_world,_cam );
// now render scene by material
int num = _world.pMaterials.size();
int count;
for(count=0;count<num;++count){
// render only color
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
glDepthMask(GL_FALSE);
_octree.DrawOctreeByMaterial(&_octree, &_world,_cam, count, 0);
glDepthMask(GL_TRUE);
}
}
else{
_octree.DrawOctree_NoShaders(&_octree, &_world, _cam);
}
}
else{
int num = _world.pMaterials.size();
int count;
for(count=0;count<num;++count){
_octree.DrawOctreeByMaterial(&_octree, &_world, NULL, count, 0);
}
}
Early Z - How to?
Hi there,
I've managed to push my geforce 5600 to draw a 20k scene mesh, with 5 materials, all using GLSL shaders, at 300 fps.
I want to get it faster.
I think I understand the concept of early z...
1. disable color writes / enable depth writes
2. render geometry
3. enable color writes / disable depth writes
3. render geometry by shader/material
using the following code isn't working though...
Do I have to alter my shaders in some way to accomodate the early-z? Or am I doing the rendering routine incorrectly?
that should work but its not the ideal method speedwise
u wanna lay down the depth pass first (of all solid geometry) for the whole scene in one go ie not continually changing states
also for extra speed (if theres a lot of occlusion eg a terrain with hills viewwed from FirstPerson) u will want to do occlusion tests whilst laying down the first depth pass (though on the nv3x this is broken but if u have >15% occlusion its still a win, on other cards eg nv4x> or ati its a win always)
u wanna lay down the depth pass first (of all solid geometry) for the whole scene in one go ie not continually changing states
also for extra speed (if theres a lot of occlusion eg a terrain with hills viewwed from FirstPerson) u will want to do occlusion tests whilst laying down the first depth pass (though on the nv3x this is broken but if u have >15% occlusion its still a win, on other cards eg nv4x> or ati its a win always)
cheers zedzeek, the problem is that when I use the aforementioned method, no gometry is rendered to screen.
You should make sure that the second pass uses a depth comparison with less or equal. Otherwise your geometry will not be rendered as the depth buffer has already that Z value.
EDIT:
You should also move the glColorMask and glDepthMask calls out of the loop.
EDIT:
You should also move the glColorMask and glDepthMask calls out of the loop.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement