FarValue and Zbuffer question

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Amt0571
Posts: 128
Joined: Mon Mar 06, 2006 6:29 pm

FarValue and Zbuffer question

Post by Amt0571 »

Hello,

I've been experimenting issues with performance for some time now. Today I tried to add a function which changes camera FarValue depending on the fps.

First of all I tried to change between 2 fixed values when fps where above or below 25 and it worked as expected. But as I was also expecting, when the lower value was used, frame rate got up and farValue changed again on the next frame producing an horrendous flickering.

I then tried to change the values gradually, so I put a "camera->setFarValue(farcam)" in the loop and made the function change the farcam value gradually depending on the fps. The problem is that when I do it this way it does not work and the camera uses the same value constantly.

I would highly appreciate any help :)

EDIT:

I forgot the zbuffer question :p

Is there a way to force the 24 or 32 bit zbuffer from irrlicht? I'm asking this because I have noticed that intel gma cards use 16 bit zbuffer unless you force them to use 24 bit in the driver.


Thanks!
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Are you absolutely sure that the value you are passing to setFarValue is actually changing? From the sounds of it the only thing you have changed is the way that you are calculating the far value. If that is true, I don't see how it could be with anything else.

The z-buffer behavior has changed recently. If you want the details, you should be able to find them in the source code. For the D3D9 driver, you would look here at about line 288. The OGL driver looks like it attempts 24-bit and then falls back to 16-bit.

Travis
Amt0571
Posts: 128
Joined: Mon Mar 06, 2006 6:29 pm

Post by Amt0571 »

Thanks, I have solved the FarValue problem, although I still don't know what I have done wrong... now it seems it's adjusting correctly, except that it needs around 2 seconds to adjust... very strange... it acts as if fps were not calculated every frame like I told it to do.

About the Zbuffer it's strange if in OpenGL it adjusts automatically, because the Intel GMA supports 24 bits and on my work computer it uses 16 bit unless I force it to use 24 from the graphics card control panel.

Thanks for your help
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

it acts as if fps were not calculated every frame like I told it to do.
The fps value is only updated every 2 seconds [see the code in CFPSCounter.cpp for details]. If you want more frequent updates, you might want to consider keeping a frame count and an elapsed time yourself.

Travis
Post Reply