Something strange

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 ).

Thanks for any help!

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.

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

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

A momentary drop of framerate indicates that huge amounts of data has to be moved, I would say…

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).]

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

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 . It’s my first program of this type…
http://priv.ckp.pl/aero/my_prog.htm

See you!

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

Originally posted by JustHanging:
[b]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[/b]

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 :smiley:

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 … 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).]

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).]

[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…

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.


I’m so stupid!

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”.


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

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

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 ). 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?

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

[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!

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.