The problem is that also the bottom of the trees go through the terrain and so if the trees are on a hill, the shadows on the far side of the hill can be seen from the front of the hill:
How can this be fixed? Thanks!
The problem is that also the bottom of the trees go through the terrain and so if the trees are on a hill, the shadows on the far side of the hill can be seen from the front of the hill:
How can this be fixed? Thanks!
Quote:
Original post by daniel_i_l
Anyone? And isn't there a way to do it without the stencil buffer? For example, is it possible to color the texture on only one side, or make the side oppisite the normal not show up?
Thanks.
Quote:
Original post by bpoint
Even if you did implement it, the performance cost of sorting would be too slow and there is no way you could render the same number of polygons that you have now at the same FPS.
void CBspTree :: RenderMap(){ if(!p_HeightMap) return; number_of_parts=0; Frustum.CalculateFrustum(); glLoadIdentity(); Camera.Look(); glActiveTextureARB(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, g_Texture[0]); if(g_bDetail) { glActiveTextureARB(GL_TEXTURE1_ARB); glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2); glBindTexture(GL_TEXTURE_2D, g_Texture[1]); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glScalef((float)g_DetailScale, (float)g_DetailScale, 1); glMatrixMode(GL_MODELVIEW); } Render(map); //render the map + trees // Turn the second multitexture pass off glActiveTextureARB(GL_TEXTURE1_ARB); glDisable(GL_TEXTURE_2D); // Turn the first multitexture pass off glActiveTextureARB(GL_TEXTURE0_ARB); glDisable(GL_TEXTURE_2D);} void CBspTree :: Render(BSP* node){ //if((node->is_leaf) && (Frustum.BoxInFrustum( node->centerX, node->centerY, node->centerZ, 32, 50, 32 )) ) if(node->is_leaf) { glColor3f(1,1,1); if(Frustum.BoxInFrustum( SCALE_SIDE*node->centerX, node->centerY, SCALE_SIDE*node->centerZ, node->height/2, (SCALE_SIDE*node->width)/2, (SCALE_SIDE*node->depth)/2)) { RenderHeightMap(p_HeightMap, (int)(node->centerX - node->width/2), (int)(node->centerZ - node->depth/2), (int)(node->centerX + node->width/2), (int)(node->centerZ + node->depth/2) ); number_of_parts++; //draw trees with tree texture sort(node->MyTrees.begin(), node->MyTrees.end()); for(int i=0; i<node->MyTrees.size(); i++) { node->MyTrees.rotation = Camera.BillBoard(node->MyTrees.position); node->MyTrees.Render(); } } } else { if(Frustum.BoxInFrustum( SCALE_SIDE*node->p_sec1->centerX, node->p_sec1->centerY, SCALE_SIDE*node->p_sec1->centerZ, node->p_sec1->height/2, (SCALE_SIDE*node->p_sec1->width)/2, (SCALE_SIDE*node->p_sec1->depth)/2)) Render(node->p_sec1); if(Frustum.BoxInFrustum( SCALE_SIDE*node->p_sec2->centerX, node->p_sec2->centerY, SCALE_SIDE*node->p_sec2->centerZ, node->p_sec2->height/2, (SCALE_SIDE*node->p_sec2->width)/2, (SCALE_SIDE*node->p_sec2->depth)/2)) Render(node->p_sec2); if(Frustum.BoxInFrustum( SCALE_SIDE*node->p_sec3->centerX, node->p_sec3->centerY, SCALE_SIDE*node->p_sec3->centerZ, node->p_sec3->height/2, (SCALE_SIDE*node->p_sec3->width)/2, (SCALE_SIDE*node->p_sec3->depth)/2)) Render(node->p_sec3); if(Frustum.BoxInFrustum( SCALE_SIDE*node->p_sec4->centerX, node->p_sec4->centerY, SCALE_SIDE*node->p_sec4->centerZ, node->p_sec4->height/2, (SCALE_SIDE*node->p_sec4->width)/2, (SCALE_SIDE*node->p_sec4->depth)/2)) Render(node->p_sec4); }}This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more