Archived

This topic is now archived and is closed to further replies.

Lupin

SkyBox = SlowBox?!

Recommended Posts

I noticed that my BSP renderer goes very slow after adding skybox rendering, sometimes I only get 30 FPS instead of 60FPS (very simple scene) and sometimes I even don''t notice any speed chenge (in complex scenes). the speed loss changes depending on the viewing direction of my player... I''m just using an box made up out of 10 polys, prelit and with one texture-stage (rendered several times with other textures blendet together). I also deactivated gouraud shading and Z-Buffer, but it still don''t work, the dimension of the box is 20, 4, 20 (x-y-z) What do I have to specify for D3DTSS_TEXCOORDINDEX for the second texture-stage when I only have one texture-coordinate in my custom vertex-format (D3DTSS_COLOROP is set to D3DTOP_DISABLE)?

Share this post


Link to post
Share on other sites
I''ve read that by rendering only 5 sides of the box in the engine you will gain some speed. In a sample I''ve seen a guy got extra 15 fps by removing the bottom side.

Share this post


Link to post
Share on other sites
I don''t know what an display list is, I used an vertex-array wich I set up every frame (because player position changes), but I could also use an buffer and an matrix to add the translations of the player-cam

How could I set up an corectly textured box with less than 30 vertices?

Share this post


Link to post
Share on other sites
I dont think you have to change vertices of your box every frame. Just translate it to the position of your player, keeping him in the center of the box.

maybe this: (?)
BOXVERTEX vBox[] = { //box vertex data
{-2.0f, 1.0f, 2.0f, 0.0f, 0.0f}, //front
{ 2.0f, 1.0f, 2.0f, 1.0f, 0.0f},
{-2.0f, -1.0f, 2.0f, 0.0f, 1.0f},
{ 2.0f, -1.0f, 2.0f, 1.0f, 1.0f},

{ 2.0f, 1.0f, -2.0f, 0.0f, 0.0f}, //back
{-2.0f, 1.0f, -2.0f, 1.0f, 0.0f},
{ 2.0f, -1.0f, -2.0f, 0.0f, 1.0f},
{-2.0f, -1.0f, -2.0f, 1.0f, 1.0f},

{-2.0f, 1.0f, -2.0f, 0.0f, 0.0f}, //left
{-2.0f, 1.0f, 2.0f, 1.0f, 0.0f},
{-2.0f, -1.0f, -2.0f, 0.0f, 1.0f},
{-2.0f, -1.0f, 2.0f, 1.0f, 1.0f},

{ 2.0f, 1.0f, 2.0f, 0.0f, 0.0f}, //right
{ 2.0f, 1.0f, -2.0f, 1.0f, 0.0f},
{ 2.0f, -1.0f, 2.0f, 0.0f, 1.0f},
{ 2.0f, -1.0f, -2.0f, 1.0f, 1.0f},

{-2.0f, -1.0f, 2.0f, 0.0f, 0.0f}, //bottom
{ 2.0f, -1.0f, 2.0f, 1.0f, 0.0f},
{-2.0f, -1.0f, -2.0f, 0.0f, 1.0f},
{ 2.0f, -1.0f, -2.0f, 1.0f, 1.0f},

{-2.0f, 1.0f, -2.0f, 0.0f, 0.0f}, //top
{ 2.0f, 1.0f, -2.0f, 1.0f, 0.0f},
{-2.0f, 1.0f, 2.0f, 0.0f, 1.0f},
{ 2.0f, 1.0f, 2.0f, 1.0f, 1.0f}
};

Share this post


Link to post
Share on other sites
Is it going directly from 60 to 30 EXACTLY?

If so, the skybox is not the problem but rather an accumulation of slow things that make your frame rate drop under 60.

If vsync is turned on and you drop below 60... it goes directly to 30fps.

______________________________
Oooh, you found the horadric cube!

Share this post


Link to post
Share on other sites
it goes directly from 60 FPS to 30 FPS...

I don''t know why, I will try using matrices, but I know that the rendering call needs so much time and not one of the other calculations or other stuff because I comented out the rendering call - everything worked fast

Share this post


Link to post
Share on other sites
The usual technique is to draw a skybox, maybe 1 unit big. Then reset the Z-buffer, then draw the rest. This prevents testing everything against a skybox of 1000 units big without clearing the buffer, in other words making it part of the scene. Maybe this will save you some time.

Share this post


Link to post
Share on other sites