PDA

View Full Version : Something strange



Orzech
02-06-2003, 04:19 AM
Hello everyone.
Meaby my problem is not such strange but it looks strange to me. I've got some 3d level. I use mipmap textures. The performance is quite good. My map rotates fast - even when computer render the whole terrain. But there is a moment when my fps get low. It happens when my camera is little above the ground. I see that some textures are sharp and some are not. There is a visible border beetwen to textures on the screen. Then performance is low. Is there any way to solve this problem (i suppose there is http://www.opengl.org/discussion_boards/ubb/smile.gif ).

Thanks for any help!

zen
02-06-2003, 04:40 AM
Depends on how you draw your level.If you draw all of it then I can't think why there should be a big speed difference.If you use some form of culling or lod then your algo doesn't do a very good job on that specific view and more than the usual has to be drawn which causes the slowdown.There could be more causes but these are the most obvious.

JustHanging
02-06-2003, 10:12 AM
It sounds like a fillrate problem. When the camera is close to the ground, you typically draw the same pixels many times, since the mountains tend to get behind the other ones. To see if this is the case, render your scene to a very small window, and see if the speed gets better.

It's not an easy thing to fix. You might get a little improvement by rendering the terrain sorted by depth, nearest first. Then more pixels get rejected by the depth test, and don't have to be textured, blended etc. The sort doesn't have to be perfect. Then there are the occlusion culling algorithms, but that's a lot of work.

-Ilkka

Orzech
02-06-2003, 11:39 AM
It's hard for me to explain exactly what is wron. Generally i've got my 85 fps but when i zoom there is ONE moment when program works slowly. You know what, i think i should post it. I'll bring you a link in 24h (i have to sleep, all right?).

Thanks

02-06-2003, 09:25 PM
A momentary drop of framerate indicates that huge amounts of data has to be moved, I would say...

HamsterofDeath
02-07-2003, 12:26 AM
same problem here :
in some situations, my framerate drops to 30% of its previous rate.
if i look a bit higher, and don't see the ground, the framerate is high again (and it does not depend on the number of polys, it doesn't change much)

it really could be the fillrate...

i guess the depthbuffer works like this :
poly drawn, for every pixel a depth-value is stored.
next poly. if a pixel is nearer than the one drawn, draw the new one.

right ?

in this case, if everything is drawn from back to front, i would understand the performance-drop. i'm using 6 texture-layers, so there is much work to be done for my card, and if it's done over and over again just to be overdrawn by a simple quad...omg poor radeon

[This message has been edited by HamsterofDeath (edited 02-07-2003).]

JustHanging
02-07-2003, 01:06 AM
Yeah, you should always draw opaque polygons front to back. Some cards support a kind of a hierachial z-buffer, which might speed things up a when drawing in a right order. With these cards you can also make occlusion queries to cull out entire quad/octree nodes.

If your terrain is a heightmap, you can also do pretty good occlusion culling with occlusion horizons (google). I got about 50% increase in speed with a totally unoptimized culling algorithm. That's with pure terrain, no buildings or other good occluders. This starts to really pay off, when you have lots of complex objects on that ground, like humans, and you get to cull most of those out practically for free.

-Ilkka

Orzech
02-07-2003, 02:17 AM
HamesterofDeath said he has the same problem. But - he is using 6 texture layers while i'm using only singel texture. Hmmm.
Although thanks. But i'm stil not sure if it's something about culling. OK. I said i'll post m a link to the program. Run it. Try zooming in and out and let me know if you see something 'strange'. AhA! And please don't laugh http://www.opengl.org/discussion_boards/ubb/smile.gif. It's my first program of this type...
http://priv.ckp.pl/aero/my_prog.htm

See you!

JustHanging
02-07-2003, 07:46 AM
Sorry, but I can't run your program. It changes the resolution and gives a page fault. I tried changing the path in the config file, but it didn't help.

-Ilkka

HamsterofDeath
02-07-2003, 09:34 AM
Originally posted by JustHanging:
Yeah, you should always draw opaque polygons front to back. Some cards support a kind of a hierachial z-buffer, which might speed things up a when drawing in a right order. With these cards you can also make occlusion queries to cull out entire quad/octree nodes.

If your terrain is a heightmap, you can also do pretty good occlusion culling with occlusion horizons (google). I got about 50% increase in speed with a totally unoptimized culling algorithm. That's with pure terrain, no buildings or other good occluders. This starts to really pay off, when you have lots of complex objects on that ground, like humans, and you get to cull most of those out practically for free.

-Ilkka


my idea for occlusion culling was to build a cone for every big hill and then use this triangle (a cone from a single point of view is a triangle to occlude everything the frustum culling doesn't kick of the draw-these-array). then, i discovered the hw occlusionquery :-D

Orzech
02-07-2003, 12:29 PM
Is here anyone who saw my program? I must have done something wrong. I have no idea what, but i'll take a look and if i find anything i'll let you know. Thanks anyway...

And what about this cone... I think i'll need to read your post and i should do it very slowly http://www.opengl.org/discussion_boards/ubb/smile.gif... I got to think what it means because my english isn't really perfect...

BUT - i am not sure if it's all about culling.

[This message has been edited by Orzech (edited 02-07-2003).]

stodge
02-07-2003, 12:40 PM
Your program crashes on my Win2k machine. The debug file is empty. Probably because you've hard coded the filename into the config file to c:/terrain3d/Data/mapa3.bmp? I'm running it from drive G. Also there is no such file as mapa3.bmp.

[This message has been edited by stodge (edited 02-07-2003).]

[This message has been edited by stodge (edited 02-07-2003).]

Orzech
02-07-2003, 01:02 PM
[QUOTE]Originally posted by stodge:
[B]Your program crashes on my Win2k machine. The debug file is empty. Probably because you've hard coded the filename into the config file to c:/terrain3d/Data/mapa3.bmp? I'm running it from drive G. Also there is no such file as mapa3.bmp.

It could be possible. Meaby i forgot to change the path? If so you should enter config.txt and change this path to real path to this texture. Damn! How can i check a directory in which is exe file (in VC++) ?

Let me know if it doesn't run anyway...

stodge
02-07-2003, 01:14 PM
It runs if you change the config file to point to the texture file in the data directory. Could you create a new zip file and include mapa3.bmp? That way I can see how my computer compares to yours.

Orzech
02-08-2003, 01:42 AM
****************************************
I'm so stupid! http://www.opengl.org/discussion_boards/ubb/smile.gif

I really forgot to pack a map. Ok. I have updated the zip file. You can now download it form previous link. The file should be "map.bmp".
*****************************************

JustHanging
02-08-2003, 02:55 AM
Ok, it runs now, but I can't find the problem. It seems fluid all the time, even on my tnt. There's no fps counter, so it's hard to tell, but the flickering implies that it's running a lot faster than my monitor's refresh rate http://www.opengl.org/discussion_boards/ubb/smile.gif

The thing about sharp/blurry textures, it's just because of mipmapping. I don't think it's related to the other problem. You can get mostly rid of the visible edge between the mipmap levels by using LINEAR_MIPMAP_LINEAR filtering.

One thing that might be causing problems is the fact that you seem to be drawing the terrain with quads. I doubt that they're all planar, so you really shouldn't use them like that. Easy to fix, just replace your glBegin(GL_QUAD_STRIP) with glBegin(GL_TRIANGLE_STRIP).

-Ilkka

Orzech
02-08-2003, 06:14 AM
Ok. Thanks. I'll try it. I will tell you if it helped. And by the way - why there isn't fps counter while i see it on my computer? (Don't worry, it's not any question http://www.opengl.org/discussion_boards/ubb/smile.gif ). I should check it about. And what thing - what does it mean that quad are polar? I have no idea what that is. Meaby some hint, please?

JustHanging
02-08-2003, 06:33 AM
Not polar, planar. A quad should always be planar, meaning that all it's vertice lie on the same plane.

Maybe I don't see the fps counter because you use some font, I don't have don't know. It would also be cool, if you could put some marker on the terrain so I would know where the problem arises.

-Ilkka

Orzech
02-08-2003, 06:48 AM
[QUOTE]Originally posted by JustHanging:
[B]Not polar, planar. A quad should always be planar, meaning that all it's vertice lie on the same plane.

Ok. Know i understand. I tried GL_TRIANGLE_STRIP and it work a lot better know! Great thanks.

I was thinking about the font too. I used "times". You should have this one. Although i've change it to "sans". I'll update the program. It won't take me long.

I will also try to mark the problem.

Bye!

Orzech
02-08-2003, 07:28 AM
Take a look http://priv.ckp.pl/aero/my_prog.htm

When you run it press SPACE. Then try to rotate the map with arrows. You should see decrease of fps. Is there anything i can do?
I was running on 1024x768x32.

JustHanging
02-11-2003, 10:12 AM
I'm sorry, your program runs very fast http://www.opengl.org/discussion_boards/ubb/smile.gif

Orzech
02-11-2003, 12:11 PM
Originally posted by JustHanging:
I'm sorry, your program runs very fast http://www.opengl.org/discussion_boards/ubb/smile.gif

Well. I don't fell sorry. I'm rather happy to hear that my program works good. Thanks.
http://www.opengl.org/discussion_boards/ubb/smile.gif

yakuza
02-11-2003, 04:11 PM
Yup, your program also ran fine for me. The lowest framerate I saw displayed was 191 fps.

Athlon 1.1ghz
Radeon 8500

shinpaughp
02-11-2003, 08:51 PM
Not for me, but I only have a GeForce 2 MX 400 with Athlon XP 1800+ on Win2k. When at the edge of the map, and down among the peaks, x=0.0 y=-8.5 z=-50.0 between 90 and 180 and 270 looking away from rest of map it would be 60.0 fps. Between 89 and 0 and 271 it would slow down to around 30 fps and sometimes even 15 fps. Just to let you know. Also, I was getting pointer problems if the application directory was not at highest level on drive. c:\Terrain3d\... was fine as opposed to c:\some directory\some directory\Terrain3D\... and it had nothing to do with the config file which I had already edited to point to c:\...\...\data\tekstura.bmp

[This message has been edited by shinpaughp (edited 02-11-2003).]

Orzech
02-12-2003, 08:22 AM
Originally posted by shinpaughp:
Not for me, but I only have a GeForce 2 MX 400 with Athlon XP 1800+ on Win2k. When at the edge of the map, and down among the peaks, x=0.0 y=-8.5 z=-50.0 between 90 and 180 and 270 looking away from rest of map it would be 60.0 fps. Between 89 and 0 and 271 it would slow down to around 30 fps and sometimes even 15 fps. Just to let you know. Also, I was getting pointer problems if the application directory was not at highest level on drive. c:\Terrain3d\... was fine as opposed to c:\some directory\some directory\Terrain3D\... and it had nothing to do with the config file which I had already edited to point to c:\...\...\data\tekstura.bmp

[This message has been edited by shinpaughp (edited 02-11-2003).]

Yeap. I have the same graphics card and my fps are not always max. Although it never fall to 15... And about the pointer problems - i know. It was very quick version and it works in this way.

I should search for some culling to make the performance better.

And last thing. Did you see fps counter?

Thanks

shinpaughp
02-12-2003, 05:27 PM
I could see the fps counter, though if a peak was right in front of me it appeared to block the counter.

Orzech
02-13-2003, 05:45 AM
Originally posted by shinpaughp:
I could see the fps counter, though if a peak was right in front of me it appeared to block the counter.

That sounds interesting... http://www.opengl.org/discussion_boards/ubb/smile.gif

delsydsoft
02-15-2003, 01:08 AM
Well, I have a 566mhz p3/32 mb geForce 2 MX 400/win2k box, and your 3d engine runs at a fluid 75-76fps, regardless of camera movement,rotation , etc. Ya know, it could just be a driver issue. Do you have the newest nVidia Detonator drivers for your gf2mx? I mean, it's pretty sad that I'm getting a higher framerate than someone with an Athlon xp 1800 and the same gfx card. http://www.opengl.org/discussion_boards/ubb/smile.gif

So, I'm thinking that you might have some older drivers.

Orzech
02-15-2003, 02:06 AM
No, no, no. It works good on my computer but there are some moments (for example when i'm getting closer to the terrain) when fps decrase for 50%. I have a new version but i haven't posted it. But if someone would like to see it I can (I not sure if there is anyone like that http://www.opengl.org/discussion_boards/ubb/wink.gif ... )
Now I'm thinking about something adding few textures BUT -
how can i bind texture for triangles using triangles strip without closing glBegin/glEnd each time I want to change a texture. Without that the performance would be really sad, i think.

Thanks

JustHanging
02-15-2003, 02:36 AM
You can't change a texture in the middle of a strip. What you can do is to sort your faces by a texture, so you only need to bind each texture once. That causes some strips to break, but it's not that serious. All this is a preprocess, of course.

-Ilkka

Orzech
02-15-2003, 08:56 AM
Well I was thinking about something else. What if I pack all terrain textures into one "mega-texture" and I will be just changing textures coordinates. I can store them in an array an then use without breaking the glBegin/glEnd bracket. What about something like this?

JustHanging
02-15-2003, 12:13 PM
That's ok, but I'm not if it's any easier. Every triangle in a strip shares two vertice with the previous one, so you can't change the texture for an entire triangle unless you draw some degenerate triangles. Plus you will lose the possibility to tile a texture easily.

A common way to use multiple textures is to blend them together instead of changing the textures on a per-triangle basis. It's a bit more expensive though. This subject just got beaten to death in another thread, search for "outdoor beautifullyzing" on the beginners forum.

Please note, that at the moment your program runs very fast. You can easily afford some speed loss to get better visuals.

-Ilkka

Orzech
02-16-2003, 04:45 AM
I was also thinking about looking to 'outdoor beautyfulizing' because I remember that there was such a topic which could be interesting. I will serach there.
When I'll add textures do the program I will post it so you can see how it works. How about that?

Thanks, thanks

PS. I am afraid I won't have to much time this week but I'm really determined...

02-17-2003, 01:46 AM
The Truth is out there :\

02-18-2003, 01:36 PM
I strongly suggest getting rid of that frame based movement. I got a Geforce 4 Ti 4200 and Athalon XP 1800, and controls become really unmanagable at 350-750 fps.

Orzech
02-19-2003, 07:41 AM
Originally posted by DudeMiester:
I strongly suggest getting rid of that frame based movement. I got a Geforce 4 Ti 4200 and Athalon XP 1800, and controls become really unmanagable at 350-750 fps.

OK. I can do it. I am nearly finishing my new version. But how it is possible that fps can reach 350? There should be something like monitor refresh rate.

Orzech
02-19-2003, 07:46 AM
Ow, I forgot to say :

Thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

Orzech
02-20-2003, 09:33 AM
Hello everyone!

Now I have finished my latest version.
It would be nice if you just take a look at it. Comments are welcome (generally performance). Guess from where I took the sky cube http://www.opengl.org/discussion_boards/ubb/wink.gif ?

Here it is : http://priv.ckp.pl/aero/my_prog.htm

Thanks!!!

darkbyte
02-21-2003, 10:49 AM
Your code runs almost at constant speed on my lap, but the skybox textures are not displayed correctly and when I zoom in, some triangles on the terrain are not well textured... what filter(s) are you using for the textures??

Are your skybox textures generated from a Bryce rendering?

J.

darkbyte
02-21-2003, 11:04 AM
hhmmm... are you using HFONT to display the fps??? I recommend using textured quads instead. Some time ago I compared both methods and the difference was about 40fps...

J.

darkbyte
02-21-2003, 11:14 AM
one more before I go to bed...
I noticed that if I get close enough to a peak, the fps counter is blocked.
Are you using glRasterPos ?

J.

Orzech
02-22-2003, 05:00 AM
Hello. Thanks for your comments. So :
1)I didn't saw any degenerated textures on my PC. I'm using mipmap textures. What's wrong with the skybox?
2)Well, I use HFONT and glRasterPos. They work properly (from what I have seen). You think that it decrease the performance? Hmmm... So I will think about it.

Thanks for your help!
If you have anything more - shoot. http://www.opengl.org/discussion_boards/ubb/smile.gif

Orzech

02-22-2003, 10:13 AM
ziomek ja miałem 300 fps. moi kumple też robią enginy. chcesz rzucić okiem ?

Orzech
02-23-2003, 06:56 AM
Originally posted by wsp.Zbuj:
ziomek ja miałem 300 fps. moi kumple też robią enginy. chcesz rzucić okiem ?

Sure. Just give me some links. http://www.opengl.org/discussion_boards/ubb/smile.gif

darkbyte
02-23-2003, 04:19 PM
I would suggest you change to ortho mode when drawing the fps counter and then switch back to perspective mode instead of using glRasterPos, I think that way the counter wouldn't be blocked sometimes.

about the skybox, I'll send you a screenshot...

J.

Orzech
02-24-2003, 11:48 AM
Yeah. That is a solution (at least for the fps counter). Now I know what you mean by saying 'blocked'.

And what about sky box... http://www.opengl.org/discussion_boards/ubb/smile.gif (it is all i can say)

Great thanks,

Orzech