[SOLVED] FPS decrease from 150 to 5 ?!

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
blackgun
Halfling
Posts: 51
Joined: Tue Jun 21, 2005 2:49 pm

[SOLVED] FPS decrease from 150 to 5 ?!

Post by blackgun »

I made a scene including 20k polygons and run with 150 FPS with a simply .material file and a few textures. Then I rendered the all the textures. so every mesh has a different own textures (about 150 meshes).
Now, I find the FPS turn to 5 FPS!

150 mesh, 150 texture maps. all texture files in TGA format size is about 60MB, I convert them into JPG format,it is about 6MB.

My PC: P4 2.0G, 1G RAM, ATI 9600pro with 128M GraphicRAM.

even the texture size is 60MB, my graphic card can't deal with it?

Image
Last edited by blackgun on Sat Mar 04, 2006 3:32 pm, edited 1 time in total.
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Post by haffax »

Are your TGAs compressed? You need to be aware, that the file size is irrelevant. The image data uploaded to the video card is uncompressed and depending on the format/size of the texture they can get really huge and the moment the vido memory doesn't suffice for the amount of texture data the usually used least-recently-used algorithm for texture swapping turns into the slowest possible algorithm, as now all textures are swapped out and in every single frame.

I don't know if this is happening for you here. One thing you can try is to convert your textures into compressed DDS textures, this usually saves 2/3 - 3/4 of the texture size.
The performancewise best solution would be, to create lightmaps, that are seperate from the base textures, allowing for better reuse of the base textures.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
Chris Jones
Lich
Posts: 1742
Joined: Tue Apr 05, 2005 1:11 pm
Location: Gosport, South England
x 1

Post by Chris Jones »

so, it was 1 model with 1 material file referencing a few textures? or 150 models using the same .material and a few textures?

if youve converted from 1 model to many models and increased the amount of textures, the FPS drop is because youve got more textures, more models, graphics cards like to a few high poly models, rather than lots of low poly

so your increase in textures etc, causes more render state changes on the graphics card, these are slow, the fewer changes the better

i hope this info is correct, i havent really done anything about this, just info ive picked up off these forums :P
User avatar
raicuandi
Gargoyle
Posts: 1092
Joined: Wed Nov 09, 2005 12:56 pm
Location: Adelaide, Australia
Contact:

Post by raicuandi »

That scene looks quite small for 150 objects. Try grouping more objects into one, especially if they are not animated. Don't forget: the video driver (and so your overall performance) will be saturated if you use too many batches to the GPU. That means: too many objects and subobjects. Though I've done something similar (as number of poly and of objects) and I've got 100FPS with my GeForce2 (though I wasn't using Ogre3D). Maybe you're running in Debug mode?
User avatar
raicuandi
Gargoyle
Posts: 1092
Joined: Wed Nov 09, 2005 12:56 pm
Location: Adelaide, Australia
Contact:

Post by raicuandi »

nice pic, btw :D
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Post by haffax »

Batching doesn't really help here, as you need seperate textures for each object. Batching helps if you have many objects with the same material.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
blackgun
Halfling
Posts: 51
Joined: Tue Jun 21, 2005 2:49 pm

Post by blackgun »

Thanks all advices.
haffax wrote:IOne thing you can try is to convert your textures into compressed DDS textures, this usually saves 2/3 - 3/4 of the texture size.
The performancewise best solution would be, to create lightmaps, that are seperate from the base textures, allowing for better reuse of the base textures.
I will try DDS, do i need to set up something in ogre for using DDS texture? and why lightmaps will be better? I considered this solution, but 2 passes(base texture+lightmaps) mixing will need to process more polygons (2 times),right?
Chris Jones wrote:so, it was 1 model with 1 material file referencing a few textures? or 150 models using the same .material and a few textures?
The scene has 150 different meshes and about 20 materials at first(I mean in 3Dsmax). The directly exported scene will run in 150FPS,so I don't think it is a meshes count problem. After rendering texture, I got 150 baked texture. So the material file has 150 materials ( one material for one mesh). I am not sure fewer mesh higher FPS. I think the scene manager has divided the space for rendering. I use the dotscene format. but I don't find the polygons much different when I move the viewport in the room. I don't know which one is better, dotscene or BSP for interior space? and I plan to make a garden for the rooms in future.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Post by Kojack »

I don't know the capabilities of your 9600pro, but non power of two textures can increase memory usage a lot if your hardware doesn't support them. For example, a 513x513 texture takes 4 times the ram of a 512x512 texture because it has to be resized to 1024x1024 internally. So your 60MB of textures might really take up 240MB of video ram.

Compressed DDS textures will take 1/4 or 1/8 of the ram, depending on which alpha channel mode you pick. You don't have to do anything in ogre to use them, just specify the dds file in your material. One problem with compressed dds files though is that they are 16 bit colour, so they can look crappy. But most of the time they look a lot better than you'd think they should.

Oh, and very cool pic. :)
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Post by haffax »

blackgun wrote:And why lightmaps will be better? I considered this solution, but 2 passes(base texture+lightmaps) mixing will need to process more polygons (2 times),right?
In your case the textures are the problem. They are never being reused, since they are unique for each model. Lightmaps help to fix this. First a luminance texture uses less space than an RGBA texture and the RGBA textures can be reused between the models, so you end up with much less RAM needed for textures and less shuffling in the texture cache too, which is also important here.
You can apply base texture and lightmap in a single pass, no problem at all.
blackgun wrote: I think the scene manager has divided the space for rendering. I use the dotscene format. but I don't find the polygons much different when I move the viewport in the room. I don't know which one is better, dotscene or BSP for interior space? and I plan to make a garden for the rooms in future.
For a single room, spatial organisation of the scene is more or less irrelevant. You won't get significant differences when half the scene is on the screen all the time anyway. Using an octree for the scene you proposed with garden and more rooms should be good enough.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
Borundin
Platinum Sponsor
Platinum Sponsor
Posts: 243
Joined: Fri Oct 03, 2003 5:57 am
Location: Sweden
x 2
Contact:

Post by Borundin »

Another possible optimization would be to use an atlas texture. That way you minimize render state changes and can use the same material for several meshes.

Nice screenshot !
Image : Image
User avatar
blackgun
Halfling
Posts: 51
Joined: Tue Jun 21, 2005 2:49 pm

Post by blackgun »

Thanks. I will try these ways, DDS, lightmap and atlas texture. And show the different way's results.
I don't know what atlas texture is, is that make a big texture used for serveral meshes? such as 1024*1024 for 4 meshes (original 512*512 )?
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

is that make a big texture used for serveral meshes? such as 1024*1024 for 4 meshes (original 512*512 )?
yes that's it. 2048*2048 is more interesting, and depending on video card you can go up to 4096*4096. If textures are non power of two it can get quite interesting, as you really save space.
Some automated tools does that :

DxSDK: http://msdn.microsoft.com/library/defau ... e_Tool.asp
NvidiaSDK: http://developer.nvidia.com/object/text ... tools.html and a tutorial for nvidia tools that does atlas + dds: http://www.gamasutra.com/features/20060 ... v_02.shtml
DeepUV: http://www.righthemisphere.com/products/duv/
User avatar
blackgun
Halfling
Posts: 51
Joined: Tue Jun 21, 2005 2:49 pm

Post by blackgun »

Thanks Tuan. I will try atlas texture, but why 1024*1024 texture is faster than 512*512 texture *4? block data load faster?
I find Octopus can't export the lightmap, so I have to use oFusion that is great but some meshes did not scale as them in 3dsmax. So there are still works to do. but I find the octree (oFusion OSM) works well and divide the space. the polygons count is much smaller than dotscene and it changes as you move the viewport. But it is dark whatever with oFusion exported material or Octopus exported material.
Image
User avatar
blackgun
Halfling
Posts: 51
Joined: Tue Jun 21, 2005 2:49 pm

Post by blackgun »

1) I compressed all textures from JPG to DDS by DXT method, the FPS too low problem is solved, it is about 87 FPS.
The original 512*512 texture size in TGA is 136KB, in JPG is about 18-40KB. And in DDS is 129KB. not much smaller. DDS is compressed?

2) I render to texture the lightingmap by VRAY and Mental Ray is coloured in RGB. only by Scan Line is greyscale. Is that right? If I convert these lightingmaps to greyscale, can it work in small size in VRAM?
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Post by haffax »

I can't answer most question, only the one about DDS size being not too much smaller. you have to note, that the DDS also contains the mipmaps, by default 10 mipmap-levels, this costs mem too. but is needed for good looks and performance.
team-pantheon programmer
creators of Rastullahs Lockenpracht
Post Reply