Ogre performance

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
franticnick
Gnoblar
Posts: 9
Joined: Thu Jun 17, 2004 9:42 am
Location: Serbia and Montenegro

Ogre performance

Post by franticnick »

Hi to all,

When I put 130 cube objects on the scene, application slows down to about 6fps.

Is there any optimal number of nodes in ogre? Maybe 130 cubes is to much?

PS
Tested with GeForce 440MX.

Please, give some advice to speed up.
Franticnick.
Raza
Gnoblar
Posts: 1
Joined: Fri Jul 09, 2004 7:36 am

Post by Raza »

if you are using windows then select Directx9 as render device instead of OpenGL it may speed up your demo
franticnick
Gnoblar
Posts: 9
Joined: Thu Jun 17, 2004 9:42 am
Location: Serbia and Montenegro

Post by franticnick »

Raza wrote:if you are using windows then select Directx9 as render device instead of OpenGL it may speed up your demo
I already use DX9.
Franticnick.
User avatar
mikeprosser
Gnoblar
Posts: 18
Joined: Thu Apr 08, 2004 7:35 am

Post by mikeprosser »

are you running in Release mode? Debug mode can make it much slower sometimes.
Mike Prosser, programmer: Ogrian Carpet
User avatar
ahmedali
Gnome
Posts: 302
Joined: Fri Feb 20, 2004 8:52 pm
Location: Lahore, Pakistan

Post by ahmedali »

I own GeForce 440MX too but I was able to render 600 fighters(700 tris) with lod at around 30 fps. My machine is 2.4Ghz with 512 sdram.

Are you also using physics or other calculations based on cubes?

Do you have latest nVidia drivers?
franticnick
Gnoblar
Posts: 9
Joined: Thu Jun 17, 2004 9:42 am
Location: Serbia and Montenegro

Post by franticnick »

ahmedali wrote:I own GeForce 440MX too but I was able to render 600 fighters(700 tris) with lod at around 30 fps. My machine is 2.4Ghz with 512 sdram.

Are you also using physics or other calculations based on cubes?

Do you have latest nVidia drivers?
I have 130 cube meshes on the scene (4334 tris) and no calculations or physics. Each cube has 6 subentities (sides of cube). Also have latest drivers. Machine is 1.7GHz with 512 sdram.

Frame rate is about 6fps :(
Franticnick.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

All GPUs hate lots of itty-bitty render ops. This is not Ogre's fault. You simply cannot render this many individual, movable meshes at a good frame rate, since each tiny fragment of geometry needs it's own world matrix, preparation and set up which kills the performance of all modern GPUs.

If you're thinking that rendering 4000 faces in 130 cubes is the same as rendering 4000 faces in one chunk, think again. They are vastly different things. I've happily rendered upwards of 30M tris/sec (200,000 tris @ 150fps) in Ogre, but this is only possible if the geometry is submitted in large batches. Any GPU manufacturer's specs will tell you this.

Normally this is simple because the majority of the tris on the screen are world geometry, which is immovable and therefore easy to batch up. Movables cannot be batched because they require different transforms.

So you need to be more realistic about how you build your scene.
franticnick
Gnoblar
Posts: 9
Joined: Thu Jun 17, 2004 9:42 am
Location: Serbia and Montenegro

Post by franticnick »

sinbad wrote:All GPUs hate lots of itty-bitty render ops. This is not Ogre's fault. You simply cannot render this many individual, movable meshes at a good frame rate, since each tiny fragment of geometry needs it's own world matrix, preparation and set up which kills the performance of all modern GPUs.

...

Normally this is simple because the majority of the tris on the screen are world geometry, which is immovable and therefore easy to batch up. Movables cannot be batched because they require different transforms.

So you need to be more realistic about how you build your scene.

Thanks for explanation, but I need to make puzzle game that has 130 cubes on the screen that could be movable. Do you have some idea or advice how to setup such scene without loosing performance so much?
Franticnick.
User avatar
epopov
Halfling
Posts: 85
Joined: Tue Jun 10, 2003 2:57 pm

Post by epopov »

Ugly possibility: use a single mesh for your 130 cubes and create a skeleton with 130 bones. Then assign the 8 vertices of each cube to a different bone. To move a cube, move the related bone (I assume bones can be translated, in addition to be rotated ?).
Problem: I think there's an upper limit to the number of bones you can create in a skeleton (?). If yes, then you may have to create several meshes instead of one.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

A simpler way is to create all 130 cubes as a single set of geometry, and manipulate the vertex data (on the CPU or in the vertex shader) to reposition them. It sounds old-school, but if your cubes are not moving every single frame, and you're only dealing with 4000 vertices, this is a much more practical approach than trying to render 130 sets of 12 triangles individually.

Take a look at SimpleRenderable, and some of the custom renderables which use it in the source code. The trick is to put all the bits which will remain static (like texture coordinates, maybe normals if you only translate) in one HBU_STATIC_WRITE_ONLY vertex buffer, and all the things that are to modified in another HBU_DYNAMIC_WRITE_ONLY buffer (with shadow option, if you intend to read from it). This will pack all your cubes into one renderable, which will fly.
Chev
Gnoblar
Posts: 13
Joined: Fri Mar 05, 2004 6:11 pm

Post by Chev »

Here is ogre fully animating 100 robots in release mode. I just changed NUM_ROBOTS for the skeletal animation demo. Ogre seems to run just fine. My computer isn't that fast either. athlon 2000xp with radeon 9800 (non-pro). Perhaps there is something else that is slowing your app down besides the number of nodes.
Image
DrEvil
Halfling
Posts: 45
Joined: Fri Jan 02, 2004 6:07 am

Post by DrEvil »

looks like another preview for the I Robot movie.
Chev
Gnoblar
Posts: 13
Joined: Fri Mar 05, 2004 6:11 pm

Post by Chev »

1000 robots :-) lol
(converted to jpeg)

Image
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2

Post by Kencho »

Lol. ^ THAT ^ looks like the I Robot preview :lol:
Image
User avatar
IoN_PuLse
Goblin
Posts: 220
Joined: Mon May 31, 2004 5:54 am
Location: Canada

Post by IoN_PuLse »

Computer isn't fast? 9800 pro is a pretty damn good card...
User avatar
neocryptek
Gnome
Posts: 335
Joined: Sat Mar 01, 2003 11:21 pm
Location: Idaho, USA

Post by neocryptek »

IoN_PuLse wrote:Computer isn't fast? 9800 pro is a pretty damn good card...
he said it was a regular, non-pro version ;)

-N30
vdl
Gnoblar
Posts: 7
Joined: Fri Feb 20, 2004 10:44 am

Post by vdl »

about hardware skinning. why does ogre keep using software skinning on my radeon 9700 pro? i get all types of hardware skinning in ms directx SkinnedMesh demo.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

Take a look at your ogre.log where it reports the capabilities of your card. You need vertex program support and UBYTE4 support for hardware skinning (the D3D sample does it using texture coords, which is good for a hack but not good generally).

Even my Radeon Mobility 9000 supported hardware skinning..
vdl
Gnoblar
Posts: 7
Joined: Fri Feb 20, 2004 10:44 am

Post by vdl »

i dont see anything suspicious in log

Code: Select all

09:00:14: Loading library OgrePlatform.dll
09:00:14: ArchiveFactory for archive type Zip registered.
09:00:14: Loading library .\RenderSystem_Direct3D7
09:00:14: Direct3D7 Rendering Subsystem created.
09:00:14: ----- DirectDraw Detection Starts
09:00:14: Detected DirectDraw driver Primary Display Driver.

09:00:14: Detected DirectDraw driver RADEON 9700 PRO.

09:00:14: Detected DirectDraw driver RADEON 9700 PRO - Secondary.

09:00:14: ----- DirectDraw Detection Ends
09:00:14: Loading library .\RenderSystem_Direct3D9
09:00:14: D3D9 : Direct3D9 Rendering SubSystem created.
09:00:14: D3D9: Driver Detection Starts
09:00:14: D3D9: Driver Detection Ends
09:00:14: Loading library .\RenderSystem_GL
09:00:15: OpenGL Rendering Subsystem created.
09:00:15: Loading library .\Plugin_FileSystem
09:00:15: ArchiveFactory for archive type FileSystem registered.
09:00:15: Loading library .\Plugin_ParticleFX
09:00:15: Particle Emitter Type 'Point' registered
09:00:15: Particle Emitter Type 'Box' registered
09:00:15: Particle Emitter Type 'Ellipsoid' registered
09:00:15: Particle Emitter Type 'Cylinder' registered
09:00:15: Particle Emitter Type 'Ring' registered
09:00:15: Particle Emitter Type 'HollowEllipsoid' registered
09:00:15: Particle Affector Type 'LinearForce' registered
09:00:15: Particle Affector Type 'ColourFader' registered
09:00:15: Particle Affector Type 'ColourFader2' registered
09:00:15: Particle Affector Type 'ColourImage' registered
09:00:15: Particle Affector Type 'ColourInterpolator' registered
09:00:15: Particle Affector Type 'Scaler' registered
09:00:15: Particle Affector Type 'Rotator' registered
09:00:15: Loading library .\Plugin_BSPSceneManager
09:00:15: Loading library .\Plugin_OctreeSceneManager
09:00:15: Loading library .\Plugin_GuiElements
09:00:15: GuiElementFactory for type Cursor registered.
09:00:15: GuiElementFactory for type Panel registered.
09:00:15: GuiElementFactory for type BorderPanel registered.
09:00:15: GuiElementFactory for type TextArea registered.
09:00:15: GuiElementFactory for type TextBox registered.
09:00:15: GuiElementFactory for type Button registered.
09:00:15: GuiElementFactory for type BorderButton registered.
09:00:15: GuiElementFactory for type List registered.
09:00:15: GuiElementFactory for type ScrollBar registered.
09:00:15: GuiElementFactory for type PopupMenu registered.
09:00:15: GuiElementFactory for type TTY registered.
09:00:15: Loading library .\Plugin_NatureSceneManager
09:00:15: Loading library .\Plugin_CgProgramManager
09:00:15: *-*-* OGRE Initialising
09:00:15: *-*-* Version 0.14.0
09:00:15: FileSystem Archive Codec for ../../../Media created.
09:00:15: FileSystem Archive Codec for ../../../Media/fonts created.
09:00:15: FileSystem Archive Codec for ../../../Media/materials/programs created.
09:00:15: FileSystem Archive Codec for ../../../Media/materials/scripts created.
09:00:15: FileSystem Archive Codec for ../../../Media/materials/textures created.
09:00:15: FileSystem Archive Codec for ../../../Media/models created.
09:00:15: FileSystem Archive Codec for ../../../Media/overlays created.
09:00:15: FileSystem Archive Codec for ../../../Media/particle created.
09:00:15: Zip Archive codec for ../../../Media/packs/cubemap.zip created.
09:00:15: Zip Archive codec for ../../../Media/packs/cubemapsJS.zip created.
09:00:15: Zip Archive codec for ../../../Media/packs/dragon.zip created.
09:00:15: Zip Archive codec for ../../../Media/packs/fresneldemo.zip created.
09:00:15: Zip Archive codec for ../../../Media/packs/OgreCore.zip created.
09:00:15: Zip Archive codec for ../../../Media/packs/ogretestmap.zip created.
09:00:15: Zip Archive codec for ../../../Media/packs/skybox.zip created.
09:00:15: D3D9 : RenderSystem Option: Anti aliasing = None
09:00:15: D3D9 : RenderSystem Option: Full Screen = No
09:00:15: D3D9 : RenderSystem Option: Rendering Device = RADEON 9700 PRO
09:00:15: D3D9 : RenderSystem Option: VSync = No
09:00:15: D3D9 : RenderSystem Option: Video Mode = 1280 x 1024 @ 32-bit colour
09:00:17: D3D9 : Subsystem Initialising
09:00:17: D3D9 : Created D3D9 Rendering Window 'OGRE Render Window' : 1280x1024, 32bpp
09:00:17: D3D9 : Using hardware vertex processing
09:00:17: RenderSystem capabilities
09:00:17: -------------------------
09:00:17:  * Hardware generation of mipmaps: yes
09:00:17:  * Texture blending: yes
09:00:17:  * Anisotropic texture filtering: yes
09:00:17:  * Dot product texture operation: yes
09:00:17:  * Cube mapping: yes
09:00:17:  * Hardware stencil buffer: yes
09:00:17:    - Stencil depth: 8
09:00:17:    - Two sided stencil support: yes
09:00:17:    - Wrap stencil values: yes
09:00:17:  * Hardware vertex / index buffers: yes
09:00:17:  * Vertex programs: yes
09:00:17:    - Max vertex program version: vs_2_0
09:00:17:  * Fragment programs: yes
09:00:17:    - Max fragment program version: ps_2_0
09:00:17:  * Texture Compression: yes
09:00:17:    - DXT: yes
09:00:17:    - VTC: no
09:00:17:  * Scissor Rectangle: yes
09:00:17:  * Hardware Occlusion Query: yes
09:00:17:  * User clip planes: yes
09:00:17: ***************************************
09:00:17: *** D3D9 : Subsystem Initialised OK ***
09:00:17: ***************************************
09:00:17: Parsing material script: Examples.program
09:00:17: Parsing material script: Example-Water.material
09:00:17: Parsing material script: Example.material
09:00:18: Parsing material script: Examples-Advanced.material
09:00:18: Parsing material script: Ogre.material
09:00:18: Parsing material script: OffsetMapping.material
09:00:19: Parsing material script: RZR-002.material
09:00:19: Parsing material script: smoke.material
09:00:19: Parsing material script: RA_Idle_1_b.material
09:00:19: Parsing material script: fresnelenviron.material
09:00:19: Parsing material script: ogrecore.material
09:00:19: Parsing material script: ogreprofiler.material
09:00:19: Parsing particle script Example-Water.particle
09:00:19: D3D9 : Loading 2D Texture, image name : 'basic_droplet.png' with 0 mip map levels
09:00:19: Parsing particle script Example.particle
09:00:19: D3D9 : Loading 2D Texture, image name : 'flare.png' with 0 mip map levels
09:00:19: D3D9 : Loading 2D Texture, image name : 'flaretrail.png' with 0 mip map levels
09:00:19: Parsing particle script smoke.particle
09:00:19: D3D9 : Loading 2D Texture, image name : 'smoke.png' with 0 mip map levels
09:00:19: Bad attribute line: glyph	 	0.152344	0.125	0.160156	0.1875 in font Ogre
09:00:19: D3D9 : Loading 2D Texture, image name : 'New_Ogre_Border_Center.png' with 0 mip map levels
09:00:19: D3D9 : Loading 2D Texture, image name : 'New_Ogre_Border.png' with 0 mip map levels
09:00:19: Font TrebuchetMSBoldusing texture size 512x512
09:00:19: Info: Freetype returned null for character 160 in font TrebuchetMSBold
09:00:19: D3D9 : Loading 2D Texture, image name : 'TrebuchetMSBoldTexture' with 0 mip map levels
09:00:19: D3D9 : Loading 2D Texture, image name : 'font_matisse_itc.png' with 0 mip map levels
09:00:19: D3D9 : Loading 2D Texture, image name : 'ogreborderUp.png' with 0 mip map levels
09:00:20: D3D9 : Loading 2D Texture, image name : 'scr-up.png' with 0 mip map levels
09:00:20: D3D9 : Loading 2D Texture, image name : 'scr-down.png' with 0 mip map levels
09:00:20: D3D9 : Loading 2D Texture, image name : 'scr-thumb.png' with 0 mip map levels
09:00:20: D3D9 : Loading 2D Texture, image name : 'scr-back.png' with 0 mip map levels
09:00:20: D3D9 : Loading 2D Texture, image name : 'New_Ogre_Border_Break.png' with 0 mip map levels
09:00:20: D3D9 : Loading 2D Texture, image name : 'New_Ogre_Logo.png' with 0 mip map levels
09:00:20: Creating viewport on target 'OGRE Render Window', rendering from camera 'PlayerCam', relative dimensions L:0.00,T:0.00,W:1.00,H:1.00, Z-Order:0
09:00:20: Viewport for camera 'PlayerCam' - actual dimensions L:0,T:0,W:1280,H:1024
09:00:20: Mesh: Loading RA_Idle_1_b.mesh.
09:00:20: Skeleton: Loading RA_Idle_1_b.skeleton .
09:00:20: D3D9 : Loading 2D Texture, image name : 'Map_RedAnt.bmp' with 5 mip map levels
09:00:20: Win32Input8: DirectInput Activation Starts
09:00:20: Win32Input8: Establishing keyboard input.
09:00:20: Win32Input8: Keyboard input established.
09:00:20: Win32Input8: Initializing mouse input in immediate mode.
09:00:20: Win32Input8: Mouse input in immediate mode initialized.
09:00:20: Win32Input8: DirectInput OK.
09:00:20: D3D9 : Loading 2D Texture, image name : 'spot_shadow_fade.png' with 5 mip map levels
09:03:20: D3D9 : Shutting down cleanly.
09:03:20: *-*-* OGRE Shutdown
09:03:20: FileSystem Archive Codec for ../../../Media/materials/programs unloaded.
09:03:20: FileSystem Archive Codec for ../../../Media/models unloaded.
09:03:20: Zip Archive Codec for ../../../Media/packs/OgreCore.zip unloaded.
09:03:20: FileSystem Archive Codec for ../../../Media/particle unloaded.
09:03:20: FileSystem Archive Codec for ../../../Media unloaded.
09:03:20: FileSystem Archive Codec for ../../../Media/materials/scripts unloaded.
09:03:20: FileSystem Archive Codec for ../../../Media/materials/textures unloaded.
09:03:20: FileSystem Archive Codec for ../../../Media/overlays unloaded.
09:03:20: Zip Archive Codec for ../../../Media/packs/dragon.zip unloaded.
09:03:20: Zip Archive Codec for ../../../Media/packs/ogretestmap.zip unloaded.
09:03:20: FileSystem Archive Codec for ../../../Media/fonts unloaded.
09:03:20: Zip Archive Codec for ../../../Media/packs/fresneldemo.zip unloaded.
09:03:20: Zip Archive Codec for ../../../Media/packs/skybox.zip unloaded.
09:03:20: Zip Archive Codec for ../../../Media/packs/cubemap.zip unloaded.
09:03:20: Zip Archive Codec for ../../../Media/packs/cubemapsJS.zip unloaded.
09:03:20: Unloading library .\Plugin_CgProgramManager
09:03:20: Unloading library .\Plugin_NatureSceneManager
09:03:20: Unloading library .\Plugin_GuiElements
09:03:20: Unloading library .\Plugin_OctreeSceneManager
09:03:20: Unloading library .\Plugin_BSPSceneManager
09:03:20: Unloading library .\Plugin_ParticleFX
09:03:20: Unloading library .\Plugin_FileSystem
09:03:20: Unloading library .\RenderSystem_GL
09:03:20: D3D9 : Direct3D9 Rendering SubSystem destroyed.
09:03:20: Unloading library .\RenderSystem_Direct3D9
09:03:20: Direct3D7 Rendering Subsystem destroyed.
09:03:20: Unloading library .\RenderSystem_Direct3D7
09:03:20: Unloading library OgrePlatform.dll
and as i said - ms skinmesh sample uses hardware skinning without problems.
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49

Post by Crashy »

hello, I'm just askin a little question: is it possible to "reunificate in one object" meshes loaded separatly,in order to increase FPS?
Follow la Moustache on Twitter or on Facebook
Image
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

and as i said - ms skinmesh sample uses hardware skinning without problems.
The MS demo uses a very simplistic approach which does not generalise well, unless you can pre-set the number of texture coordinate sets your models will use. A single game might be able to do this because they probably fix the geometry formats they will use, but as a general engine we cannot do this. Don't mistake a quick hack demo for a generally applicable technique.

I've tried this on my a Mobility 9000, a Mobility 9700 and a Radeon 9600 and they all use hardware skinning just fine. Please look in the DirectX caps viewer under HAL/Caps/DeclTypes and tell me whether D3DDTCAPS_UBYTE4 is in there.
vdl
Gnoblar
Posts: 7
Joined: Fri Feb 20, 2004 10:44 am

Post by vdl »

D3DDTCAPS_UBYTE4 is present
vdl
Gnoblar
Posts: 7
Joined: Fri Feb 20, 2004 10:44 am

Post by vdl »

found what's wrong - had to add vertex program to material. but now hardware skinning makes some glitches -> Image

ps. sinbad maybe you know answer to this.
I use directx file exporter from maya 5.0. When exporting animation and playing it with meshviewer [from dx sdk] tweening for some bones between some [not all] frames is reversed. Thumb supposed to rotate a little bit, but it rotates in opposite direction to get in next frame's position.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

Argh - I thought you were using Demo_SkeletalAnimation to test with - had you mentioned you were using a custom model / material it would have been a lot simpler to explain! :)

Your problem looks like you have too many bones. vs_1_1 has a limited number of constants available to it, meaning that it can't use more than about 24 bones. You can use higher vertex shader versions to get around this (vs_2_0 supports plenty) but then you'll be limiting hardware skinning to more advanced cards.

The other possibility is that you're using the wrong shader for the number of bone assignments you have per vertex. Ogre comes with 2 example sknning shaders in Example_Basic.cg (hardwareSkinningOneWeight_vp and hardwareSkinningFourWeights_vp), maybe you're using hardwareSkinningOneWeight_vp with a model which has more assignments. It doesn't hurt to use a shader which supports more than you use (except in a higher VS overhead which you could avoid), but using one which processes too few assignments can cause you problems.
vdl
Gnoblar
Posts: 7
Joined: Fri Feb 20, 2004 10:44 am

Post by vdl »

i thought hardware skinning is automatical ;)

bone count was causing this.
uniform float3x4 worldMatrix3x4Array[64] seems to fix this but fourweights program still makes strange glitches. designer has designed char with two bone weights to vertex so i'm trying to find whats wrong with fourveights program