Computer 128 MB Video Card 64 MB 31 M Triangles Per Second 1 G Pixel Per Second Scene Nb=128 Nt=10 Nc~100 Terrain vertices 100x100x(pv+cv+tuv0=4*9=36)=368.64 kB faces 99x99x2x(2*3)=115 kB textures 256x256x3xNt=192*Nt kB Building*Nb vertices 16x8x(pv+cv+tuv0=4*9=36)=4.5 kB faces 16x8x(2*3)=0.75 kB textures 256x256x3=192 kB Character*Nc vertices 500x(pv+nv+tuv0+tuv1+blend0=4*11=44)=21.484375 kB faces 1000x(2*3)=5.859375 kB textures 256x256x3=192 kB Resolution 1600x1200x32x2 = 15000 kB memory usage = 15000 + 368.64+115+(192*10)+128*(4.5+0.75+192)+100*(21.484375+5.859375+192)= 15000+368.64+115+1920+25248+21934.375=64586.015 kB = 63 MB. Hooray, it's under limit for memory usage! Barely. faces total = 99*99*2 + 16*8*128 + 1000*100 = 19602+16384+100000 = 135986 trianges triangles per second/triangles = frames per second = 228 frames per second Bullshit, I say. But it says.. that I should be able to fly downtown Seattle with the GeForce2. When I do Javantea's Fate, I have Nc=5, Nb=2, Nt=1 and it goes at 30 fps. The truth is that it only does 157,000 tps with three small textures. So my great idea would run at ~1 fps. But then I just do a bunch of calculation and I can squeeze 30 fps out of it really quickly. How to do that? 1) Only render characters that are in view of the camera. The number of faces then jumps down to: 99*99*2 + 16*8*128 + 1000*Ncv = 19602+16384+1000*Ncv. In a normal day, there's only 10 people at the same time in one area. So Ncv = 10 and faces rendered = 45986. That gives us 3 fps. Then we do the same thing for buildings. The number of faces then jumps down to: 99*99*2 + 16*8*Nbv + 10000 = 19602+128*Nbv+10000. In a normal day, there's only 8 blocks in view at the same time in one area. So Ncb = 8 and faces rendered = 30626. That gives us 5 fps. We can get rid of the flat parts on the terrain, as seen in nmesh_1095.x, which will give us a reduction to 2000 faces max. That means our total faces is 2000+1024+10000=13024 faces. That gives us 12 fps. At that point on the CPU side, we've only lost only API calls, 228 box-frustrum culling, 13024 backface culling operations, matrix-based rotation camera operations, and 10 rotation animations. We can do CLOD or N-Reduce if we like, but at this point, we are running at 40 fps, mission accomplished. Stunning! All the lighting has to be precalculated, but I can do that. I can have 2 dynamic directional lights for free and point lights cost. JFa = 384+452+476+230=1542 faces, 75 fps = 115 kfaces per second. JFb = 4*452+384+476+230=2898 faces, 52 fps = 150 kfaces per second. JFc = 4*452+384+476+5872=8540 faces, 42 fps = 358680 kfaces per second! WTF?! JFc2(no lights or fog) = 4*452+384+476+5872=8540 faces, 50 fps = 427000 kfaces per second 534+476+476+534+644+602+552+476+476=4770 JFd2("") = 4770+384+476+5872=11502 faces, 39 fps = 448578 kfaces per second JFd2("", no gui) = 4770+384+476+5872=11502 faces, 47 fps = 540594 kfaces per second Predicted 13000 faces, 41 fps = 540000 kfaces per second. Cube-Frustrum Culling cube {float left, right, top, bottom, front, back;) just check each point: bool CubeFrustrumCull(cube cubeIn) { if (!PointFrustrumCull(D3DXVECTOR3(cubeIn.left, cubeIn.top, cubeIn.front))) return false; if (!PointFrustrumCull(D3DXVECTOR3(cubeIn.left, cubeIn.bottom, cubeIn.front))) return false; if (!PointFrustrumCull(D3DXVECTOR3(cubeIn.left, cubeIn.top, cubeIn.back))) return false; if (!PointFrustrumCull(D3DXVECTOR3(cubeIn.left, cubeIn.bottom, cubeIn.back))) return false; if (!PointFrustrumCull(D3DXVECTOR3(cubeIn.right, cubeIn.top, cubeIn.front))) return false; if (!PointFrustrumCull(D3DXVECTOR3(cubeIn.right, cubeIn.bottom, cubeIn.front))) return false; if (!PointFrustrumCull(D3DXVECTOR3(cubeIn.right, cubeIn.top, cubeIn.back))) return false; if (!PointFrustrumCull(D3DXVECTOR3(cubeIn.right, cubeIn.bottom, cubeIn.back))) return false; return true; } bool PointFrustrumCull(D3DXVECTOR3 p) { float d = PlaneRight.ABC*p + PlaneRight.D; if (d < 0) return true; d = PlaneLeft.ABC*p + PlaneLeft.D; if (d > 0) return true; d = PlaneTop.ABC*p + PlaneTop.D; if (d < 0) return true; d = PlaneBottom.ABC*p + PlaneBottom.D; if (d > 0) return true; return false; } This doesn't allow for rotated cubes, but I'll figure something out...

Permalink

Comments: 0

Leave a reply »

 
  • Leave a Reply
    Your gravatar
    Your Name