Archived

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

Ilankt

How many is a good Frame Rate?

Recommended Posts

Ilankt    229
I did a program in full screen(800*600*32) and it''s (only?) 150 FPS, and i''m only rendering 2 polygons... is this low relative?

Share this post


Link to post
Share on other sites
RhoneRanger    100
umm, no monitor I know of has a vsync of 150..


Ilankt, the human eye only detects frame rates slower than 33 fps.

AAMOF, cartoons and animations are rendered at 35 fps.


Share this post


Link to post
Share on other sites
Mephs    354
I actually recall reading somewhere that Vsync can cause framerate to lock at multiples of the framerate aswell, or something to that effect and seeing as (2 * 75) = 150.... could just be!?

Anyhoo, 32 bit color also drains a lot of framerate, try switching your desktop and application to using 16bit color, you may see vast improvement, for me it''s the difference between 8-9 fps and 80-90 fps in my level editor.

Share this post


Link to post
Share on other sites
RhoneRanger    100
Which monitor?

I have a flatscreen 19 incher, and at 1280*1024 it has a vsync at 60 hz.

at 1024 and at 800 it has a vsync of 75.

Explain to me what "good" monitor means(mine cost over 500 US dollars used) and tell me which monitor has a vsync of 150 at 800*600*32(n0t 16, but 32 bpp)?

Share this post


Link to post
Share on other sites
RhoneRanger    100
Ilankt, there is nothing wrong with 150 fps, even at only 2 polygons. I would assume you have a TNT2 or a GF2 (maybe a rage 128)

Anyway, all those cards ran at 150 fps until the mem got filled up, when they started to drop dramatically.

Remember -> Human Eye=33fps.

As long as you are above that, dont worry!

Share this post


Link to post
Share on other sites
eldee    122
monitors can go up to 200hz iirc.
in fact, if you go into display properties > Settings, then click on Advanced > Monitor, you can uncheck the box that says something like "hide modes that this monitor cannot display"..

-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

Share this post


Link to post
Share on other sites
Ilankt    229
DON''T INSULT MY G-FORCE4 MX420 64M!!!

can someone give me some of your programs with the frame rate shown?
i will see if it''s a problem in my program...

Share this post


Link to post
Share on other sites
150 is extremely low for two polygons on a non-T&L card, much less a GeForce4. What is the framerate when you draw nothing and only clear the screen each frame? And how are you measuring/reporting the framerate? It could be your framerate counter is wrong.

~CGameProgrammer( );
DevImg.net - Post screenshots, comment on others.
Town 3D Engine - A city-rendering 3D engine. Download the demo.


[edited by - CGameProgrammer on April 28, 2003 9:40:55 AM]

Share this post


Link to post
Share on other sites
drslush    122
First of all, any geforce MX is just pitiful. Seriously, check the benchmarks. For a couple more bucks you can get a TI 4200 which is easily 2 times as fast (Maybe more for certain cases).

As to the 150FPS, I once had a really odd problem when programming for the game boy advance. No matter what I drew on the back buffer, when I flipped at the vsync, it would never show up. It turned out that the loop was going fast enough to flip twice while the hardware was on the same retrace line. I figure it is the same way with PC hardware. It is certainly possible that the scene could be drawn twice while the CRT is in vertical retrace, which would explain being locked in multiples!

Share this post


Link to post
Share on other sites
Ilankt    229
here is the full source code...
just look on DrawFrame() and Init3D()





#include <windows.h>
#include <d3d8.h>
#include <d3dx8.h>
#include <stdio.h>
//Window Variables
HWND g_hWnd;
HINSTANCE g_hInst;
const w_Width=800;
const w_Height=600;

RECT rect={0,0,400,400};
//Direct3D Variables
IDirect3D8 *g_D3D = NULL; //object
IDirect3DDevice8 *g_D3DDevice = NULL; //device
IDirect3DVertexBuffer8 *g_VB = NULL; //vertex buffer
IDirect3DTexture8 *g_D3DTexture =NULL;//Texture
ID3DXFont *g_pFont = NULL;

//Vertex
typedef struct
{

FLOAT x, y, z; // 3-D coordinates
float tu,tv; // Diffuse color component
} sVertex;

float xr=0,yr=0;

char Debug[10];
long FPS_LastCheck;
long FPS_Count;
int FPS_Current;






//Prototypes
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdShow);
LRESULT CALLBACK WindowProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL Init3D();
DrawFrame();
Terminate();


int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdShow)
{
WNDCLASSEX wcex;
MSG Msg;
g_hInst = hInst;



wcex.cbSize = sizeof(wcex);
wcex.style = CS_CLASSDC;
wcex.lpfnWndProc = WindowProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInst;
wcex.hIcon = NULL;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = NULL;
wcex.lpszMenuName = NULL;
wcex.lpszClassName = "Ilan";
wcex.hIconSm = NULL;
if(!RegisterClassEx(&wcex))
return FALSE;

g_hWnd = CreateWindow("Ilan",NULL,
WS_BORDER,
0, 0, 400, 400,
NULL, NULL,
hInst, NULL );
if(!g_hWnd)
return FALSE;

ShowWindow(g_hWnd, SW_NORMAL);
UpdateWindow(g_hWnd);
if (Init3D()==FALSE)
{
MessageBox(NULL,"FAILED","ERROR",MB_OK);
return FALSE;
}


ZeroMemory(&Msg, sizeof(MSG));
while(Msg.message != WM_QUIT)
{




if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
DrawFrame();
if(GetAsyncKeyState(27))
Terminate();

}
UnregisterClass("Ilan", hInst);

return Msg.wParam;




}



LRESULT CALLBACK WindowProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);

return 0;

}

return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

BOOL Init3D()
{
ShowCursor(FALSE);

//D3DCREATE
if ((g_D3D=Direct3DCreate8(D3D_SDK_VERSION))==NULL)
return FALSE;

//DISPLAYMODE
D3DDISPLAYMODE d3ddm;
d3ddm.Width=w_Width;
d3ddm.Height=w_Height;
d3ddm.RefreshRate=0;
d3ddm.Format=D3DFMT_R5G6B5;
//D3DPRESENT PARAMETERS
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp,sizeof(d3dpp));
d3dpp.Windowed=FALSE;
d3dpp.SwapEffect=D3DSWAPEFFECT_FLIP;
d3dpp.FullScreen_RefreshRateInHz=D3DPRESENT_RATE_DEFAULT;
d3dpp.FullScreen_PresentationInterval=D3DPRESENT_INTERVAL_DEFAULT;
d3dpp.BackBufferFormat=d3ddm.Format;
d3dpp.BackBufferWidth=d3ddm.Width;
d3dpp.BackBufferHeight=d3ddm.Height;

//CREATE DEVICE and RESETING
if (FAILED(g_D3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,g_hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&g_D3DDevice)))
return FALSE;
//Creating the Vertex and stuff
sVertex Verts[8]=
{
{-100.0f, 100.0f, 100.0f,0.0f,0.0f},
{ 100.0f, 100.0f, 100.0f,1.0f,0.0f},
{-100.0f,-100.0f, 100.0f,0.0f,1.0f},
{ 100.0f,-100.0f, 100.0f,1.0f,1.0f},

{-100.0f, 100.0f,-100.0f,0.0f,0.0f},
{ 100.0f, 100.0f,-100.0f,1.0f,0.0f},
{-100.0f,-100.0f,-100.0f,0.0f,1.0f},
{ 100.0f,-100.0f,-100.0f,1.0f,1.0f}

};
if (FAILED(g_D3DDevice->CreateVertexBuffer(sizeof(sVertex)*8,0,D3DFVF_XYZ | D3DFVF_TEX1,D3DPOOL_MANAGED,&g_VB)))
return FALSE;
BYTE *ptr;
if (SUCCEEDED(g_VB->Lock(0,0,(BYTE**)&ptr,0)))
{
memcpy(ptr,Verts,sizeof(Verts));
g_VB->Unlock();
}

//VIEW
D3DXMATRIX matView;
D3DXVECTOR3 vecVP,vecTP,vecUp(0.0f,1.0f,0.0f);
vecVP.x=0.0f;
vecVP.y=0.0f;
vecVP.z=-700.0f;
vecTP.x=vecTP.y=vecTP.z=0.0f;
D3DXMatrixLookAtLH(&matView,&vecVP,&vecTP,&vecUp);
g_D3DDevice->SetTransform(D3DTS_VIEW, &matView);
//PROJECTION
D3DXMATRIX matProj;
D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI/4.0f,(float)w_Width/ (float)w_Height, 1.0f, 1000.0f);
g_D3DDevice->SetTransform(D3DTS_PROJECTION, &matProj);
g_D3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
g_D3DDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
g_D3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
//Testure
D3DXCreateTextureFromFile(g_D3DDevice,"texture.bmp",&g_D3DTexture);

LOGFONT Font;
ZeroMemory(&Font, sizeof(Font));
strcpy(Font.lfFaceName, "Arial");
Font.lfHeight = -32;
D3DXCreateFontIndirect(g_D3DDevice, &Font, &g_pFont);


return TRUE;
}

DrawFrame()
{
D3DXMATRIX matWorld;


g_D3DDevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_RGBA(0,0,0,255),1.0f,0);

g_D3DDevice->BeginScene();
{

g_D3DDevice->SetStreamSource(0,g_VB,sizeof(sVertex));
g_D3DDevice->SetVertexShader(D3DFVF_XYZ | D3DFVF_TEX1);

D3DXMatrixIdentity(&matWorld);
g_pFont->DrawText(Debug, -1, &rect, DT_CENTER | DT_VCENTER,D3DCOLOR_RGBA(255,0,0,255) );


g_D3DDevice->SetTransform(D3DTS_WORLD,&matWorld);










g_D3DDevice->EndScene();
}

g_D3DDevice->Present(NULL,NULL,NULL,NULL);

sprintf(Debug,"%i",FPS_Current);


if (GetTickCount() - FPS_LastCheck >= 1000)
{

FPS_Current = FPS_Count ;//We check every 1/10 of a second, so we scale it up....
FPS_Count = 0;// reset the counter
FPS_LastCheck = GetTickCount();
}

FPS_Count = FPS_Count + 1;



return TRUE;
}

Terminate()
{
ShowCursor(TRUE);

if(g_VB != NULL)
g_VB->Release();

if(g_D3D != NULL)
g_D3D->Release();
PostQuitMessage(0);
return FALSE;
}


[edited by - ilankt on April 28, 2003 10:08:36 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Okay, you guys need to learn something. 150 FPS is fast. But why isn''t it faster when there are only a few triangles on the screen? Because something else is the bottleneck. So now that we''ve all learned that, how about there are no more discussions about why a couple hundred FPS isn''t enough?

Share this post


Link to post
Share on other sites
1) FPS is framecount divided by time. In other words you can make an improvement by saying:

FPS_Current = int( 1000 * float(FPS_Count) / float(GetTickCount() - FPS_LastCheck) );

The 1000 counters the fact that we're dividing by milliseconds. With this code you can update the framerate every second, every 1/10 of a second, every 10 frames, whatever. The code will still remain unchanged.

2) GetTickCount() is an imprecise function. You need to use QueryPerformanceCounter() and QueryPerformanceFrequency(). Search these forums or Google for tutorials on using them to get framerate.

These suggestions will make your framerate counter accurate but honestly it doesn't seem that they alone are the reason for your framerate. I suggest setting the vertex-buffer creation flags to D3DUSAGE_WRITEONLY and use hardware vertex processing instead of software.

~CGameProgrammer( );
DevImg.net - Post screenshots, comment on others.
Town 3D Engine - A city-rendering 3D engine. Download the demo.


[edited by - CGameProgrammer on April 28, 2003 11:22:24 AM]

Share this post


Link to post
Share on other sites
bpopp    122
Code looks ok. I don''t see any obvious bottlenecks(like initializing vertex buffers inside the loop or excessive use of SetTexture).

150 does seem low. On my GeForce2TI, without rendering anything, I get 200-300 FPS. With a full terrain (2000+ tris), skydome(200tris), and an MD2 model (800 tris) I get over 100 FPS and my code is abhorant!

Have you tried upgrading the drivers on your video card? This can make a huge difference in performance.

bpopp (bpopp.net)

Share this post


Link to post
Share on other sites