Object picking Kills framerate?

Started by
31 comments, last by skow 20 years, 9 months ago
Well i added object selection. I was getting a frame rate in the 900''s (this is just in a testing scene witha skybox and 20 models). When i call the second rendering with glRenderMode(GL_SELECT); And the rest setup my frame rate drops to 150ish. That is a huge diffrence. Ill comment out the second render (in select mode) and it s back at 950 fps. Is this normal?
Advertisement
Yesh when i have 125 models on screen the diffrence is 8 FPS to 200 FPS.


I hope I''m just doing somthing wrong.
How do u get such a big FPS? I''ve implemented a FPS Counter in my OpenGL Application and i never get more than 60-80 FPS. When i use VSync i can set up this to 200 no more ...

Do u think u''re counter works right?
He must be using a GF4 or higher.

I have tested an app running with about 1.5k textured polys with text and some basic stuff at 900-1200 fps on a Xeon 1.7ghz with a GF4 TI4600.

It barely runs at 200 at home on my 2.2ghz GF2MX.

Anyway, this is something i used to have an issue with. Just accept this fact and give it some thought and it will make some sense. The higher the framrate, the faster it falls.

For example you add some additional processing for the gfx card, maybe say more polygons or the object picking in your case, this additional process has to be processed upto 1k times if your original fps was 1k. What im trying to say is, the higher the fps, take that fps value and multiply it by the additional processing required to give u a sense of why there is a drop in fps.

Even then, I cant really say if the drop is normal because, i have no experience with the gl Picking commands and would''nt know how much they really bog you down.
Doesn''t GL_SELECT essentially force a software render into an internal buffer so that OpenGL can report what you''ve picked?

If that''s the case, each frame you are:

1. Doing a full hardware render.
2. Allocating and clearing a section of system memory the same size as your frame buffer.
3. Software rendering into that same buffer every polygon you are rendering on screen.
4. Deallocating said buffer automatically after receiving the result.

Sounds like a good way to kill frame-rate to me.

What are you trying to pick? Could you just cast a ray following the vector from the camera position to the viewplane position of your mouse and do a bounding-sphere test or something to find out what you are picking instead of trying to use OpenGL''s way of doing it, which is designed to work in all possible situations and not for optimal speed?


RomSteady - I play games for a living.
Michael Russell / QA Manager, Ritual EntertainmentI used to play SimCity on a 1:1 scale.
Yeah, i am using a radeon 9700 so i can get really high frame rates.

With a high poly count a drop from 200 to 8 is HUGE. Im oject selecting ships that can be all sorts of shapes and sizes. I would prefur not to drop to a simple shere close to a line calculation.

Does any one know for sure that oject selection kills preformance that much? I''ll keep adjusting it seeing if i can get anything.
I''ve tried it with my game, testing it with and without the glselection code and the FPS didn''t change as much.

From 72FPS with the glselection to 78FPS without the glselection. I guess it''s all dependent on how you are utilizing it. I tested it on 4 textured spheres using a slightly modified version Kevin Kevin Harris'' sphere code.

I have a Verto GeForce 4 MX 440-SE 64MB graphics card interfaced through the South Bridge of my motherboard on a 733Mhz Celeron Processor. (Stupid Manufacturer)
The drop in performance is normal. At least if you do picking every frame. If you need that for aiming, you cant help it, but if you want to select things with a mouse click, you dont need to pick every frame, just the frame the button down event occured.

But if you really want picking i suggest you go to ray collision. Create the ray from the mouse position and the modelview and projection matrix. Then do a coarse intersection test with spheres, and if you hit a sphere do ray triangle collision with each triangle. With 900 fps it shouldn''t be a big hit, I assume your models are < 1000 Tris. If not, think about a partitoning schem for your models.

Thats my experience, im using rays for terrain selection and modification.

Florian
Yeah I''m doing a single mouse click.

All the movement is based on frame loading time. So with that one frame taking 20X as long to draw there is a slight pause that is noticable.
you can do it manually.. when ever you click, you just render your scenes with

for(int index = 0; index<objects.size(); ++index) { Object& o = objects[index]; glColor3ubv(&index); o->draw();}  


and then just a glReadPixel for the one pixel you clicked on..


then you can get the index back

int index = -1;
glReadPixels(......,&index);

and your clicked obj is Object& o = objects[index];


you cannot use antialiasing then, and of course you have to disable all sort of lighting, texturing, smooth shading, etc..



i've done this. it works great.


its essencially your GL_SELECT mode, manually done..

"take a look around" - limp bizkit
www.google.com

[edited by - davepermen on July 14, 2003 6:04:30 AM]
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

This topic is closed to new replies.

Advertisement