Jump to content
  • Advertisement

Archived

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

ashwin_s

Speed Problem

This topic is 6930 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am quite new to OpenGL (working on it for about 3-4 months) and I am currently developing an application which creates a 3D model of a wing of our office and lets a person walk through it. The Application: --------------- As of now I have completed building the model (ours is - of course - a software company). The model contains the following objects - Walls, Desks, Ceiling, Floor - created by specifying vertices. I used glBegin(GL_POLYGON)... glEnd() to build the display lists. Some of them, for example, the floor and the ceiling are also Texture Mapped. Chairs, Computers, Phones, Pots - created by loading objects from .3ds files downloaded from the net. Since I didn''t have a good .3ds loader, I used 3D Exploration from XDSoft to export them to .obj models and used Nate''s Wavefront Object File loading code to load them. The class converts all objects into display lists. Each of these files contain object with around 1000 vertices on an average. Materials and Lighting - since I wanted to concentrate on getting the geometry of the model right first I''ve added just 1 White light and all objects are made created are made of the same material. Keyboard Navigation - user can move around the model using the arrow keys to move Forward (Up Arrow Key), Backward (Down Arrow Key), Turn Left (Left Arrow Key), Turn Right (right arrow key), Move Up (''A'' Key) and Move Down (''Z'' Key). The Development Environment: --------------------------- I am developing this software on a Pentium II 350 Mhz machine with 128 MB RAM. It doesn''t have a 3D card, has a normal video card with 4MB VRAM. I am using SGI''s OpenGL Implementation as I heard that it is better for non-accelerated systems and is optimized for MMX processors (But I didn''t find any significant speed improvement over the Microsoft''s implementation). The OS is NT 4.0 (Service Pack 5.0) and I am using VC 6.0. I am working on 800 X 600 mode. The Problem(s): ----------- Finally coming to the problem I am facing. The main problem I am facing is that the speed is very very poor. I am hardly getting 1 Frames/s. I''ve done face culling wherever possible to minimize the number of polygons. But still since those .obj files contain objects huge number of vertices the polygon count is still pretty high. I am also using Display Lists everywhere possible to store geometry. As of now I am rendering the entire scene each time the screen is redrawn. And I am sure that the speed is going to go down further, once I add more Lighting to the scene. 1 - Is there a way in which I can improve the speed at which my application works?? I am sure that I can improve the speed even without the use of 3D acceleration b''cos I saw applications like Quake 2 or Doom/Wolf3D etc, working really fast even without 3D cards. How do these applications achieve this kind of speed? This is the problem I intend to address first. Please do mention any good sources of information too if possible. 2 - And if I find time, I would also like to implement some Collision Detection into the program. How do I do that? Any help in this regard would be greatly appreciated. I would love to send in Screenshots of my application on request. Thanks in advance. Regards, Ashwin

Share this post


Link to post
Share on other sites
Advertisement
well i have to admit that im totally guessing here =)

doom and wolf3d arent using opengl ( the originals, not the free source code modified once ), and things/monsters in them where just a few bitmaps, selected after the their viewing angle.

quake2 runs fine in software mode, but i think it uses thier own software render, not the opengl32.dll.

Indoor "3d-shooter games" offen uses BSP trees ( or at least the quake series does ). I only know the are good for indoor, but not quite why. I''ve read they will give you collision detection almost for free if you use them.

(and there is something with splitting you wolrd into sectors, and thereby fast cull any out of sight triangles)

maybe you should seek information on the BSP tree tecniques, to see if they give you any advantage =)

and there is also something called "portals", also used in indoor "applications"

there is also a tutorial avaiable from nehe, that shows how to build up a 3d world.

Share this post


Link to post
Share on other sites
Sorry for u but if u have no 3D accelerated card...
and esp.if u have so many polygons and objects...
(u tryed optimize modifyer in 3dmax3 ?)

i think there is no other chance than do a Software Rederer
yourself....anyway if it pays...

Yes Doom was fast but used ASM do draw/render a single line
and heavy C/C++ opimized code to do the render itself
it also runned under DOS witch is much faster than Window
(read Directx6.1 intro: "DirectX ALMOST as fast as DOS"
but then u know Micro$oft will overexagerate their software)

So buy a 3D Card or go for ASM and heavy tricks
because u know that texture mapping in Doom is an Art of
itself...and also there in not a *real* 3D space as
objects cant sit on top of eachother...
i think is easyer to buy a 3D cheap card (8Megabytes RAM
will do i think for 15-20 frames lets say)

i think i saw Dooms amd wolfenstein''s sources free on the Net...anyway linux has sources for Doom at least

Share this post


Link to post
Share on other sites
Hi Ashwin,

The key here is to eliminate excess geometry before sending anything to the rendering pipeline. There are two ways you can do this (I recommend you do both).

The first is to try and reduce the complexity of your models if it is at all possible/feasible. Does a model of a chair really need 1000 polys? (If you like, you can have low-poly models for use with slower systems, and your original high-poly models for use with faster (hardware accelerated) systems).

Secondly, you have to come up with a method of eliminating geometry that is not visible at the present time. For instance, is there any point in drawing something that is behind the viewer (or generally outside their field of vision, for that matter, e.g. in another room)?
Now, as suggested by Cluas, you can use a BSP tree structure to store your ''world'', or something similar, like an octree (if you do a search on either of these, you will find a tonne of info). If you want to do something a bit more challenging , then a portal-engine approach would also be very well suited.
You can still store all your objects as display lists (these are good), but if its not within the viewing frustum/same room as the viewer/whatever, don''t draw it.

There are many other rendering optimisations that you could probably make such as using primitives such as GL_TRIANGLES and GL_QUADS when drawing, or better still, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, and GL_QUAD_STRIP, rather than GL_POLYGONS (although, this generally applies more when you have hardware, but is better nonetheless).
Also limiting state changes, and drawing as many primitives as you can between glBegin and glEnd will help (the latter won''t work with GL_POLYGONS though, because it thinks every vertex specified is part of one poly).
Take a look around in the developer section at www.opengl.org to see what all the gurus say about optimising your app (this site is also a good general resource).

You do have to realise that when you''re talking about displaying thousands of polys at a time (with OpenGL), a software implementation isn''t really gonna cut it... you should seriously look into some hardware acceleration if you''re going to do this type of thing.

Sorry for the epic post. Hope that helped a bit

-------------
squirrels are a remarkable source of protein...

Share this post


Link to post
Share on other sites
Ashwin,

OpenGL is totally unsuited for realtime software rendering. The SGI implementation is a bit faster than Microsoft''s one, but it is not supported anymore, and it runs only decent in color-index mode.

I recommend you to do one of these three things:

- Get a hardware accelerator. The low-end ones are very cheap nowadays. You do not nescessarily need a GeForce256, a simple NVIDIA TNT1 or S3 Savage3D/Savage4 based card will work too.

- Build a good software engine. This will take an incredible amount of time since it is hard to get it fast, and you lose image quality when compared to hardware solutions. If you decide to go this way (it is very exciting and fun, at least), learn how to build BSP trees and C-buffer/S-buffer renderers. This is one of the most suitable combination of structures for software rendering, especially for static geometry.

- Use an existing engine like Crystal Space or Genesis3D if you need results quickly. They are free for commercial use, and you have the hardest part already up and running. Obviously this is less fun ;-)

Hope this helps,
DaBit.


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!