How many Triangles can OGRE render with 60 FPS?

Advanced game related topics
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

How many Triangles can OGRE render with 60 FPS?

Post by Bananenfreak »

Heyho,

I´m programming a game, where you can cut Wood. Trees are created from 3 over to 15 meshes / entities. A forest has hundreds of trees. I did a test and the rendered triangles were ~320k / ~120 trees + 100 * 100 terrain. The FPS fall to 31 FPS. With ~570k triangles I get only ~20 FPS.
In the Internet I´ve read a PC can render a few Million triangles a cycle with 60 FPS...
Or ist it my main Loop?

Program specs:
Anisotropic filtering: 16x
FSAA: 6x
Texture Additive shadows with 4096
1920 x 1080

PC Specs:
Win 7 x64
6 Gb RAM
AMD Phenom II X4 B55 3,6 GHz
GTX 660 OC 2Gb VRAM

I´ve found this one here:
http://www.ogre3d.org/forums/viewtopic.php?f=8&t=75445
Image
User avatar
STARGÅTE
Addict
Addict
Posts: 2085
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: How many Triangles can OGRE render with 60 FPS?

Post by STARGÅTE »

Code?
Debugger On/Off?
Purifier On/Off?
ThreadSafe On/Off?
Windowed/Screen?

If you have to many single entities, it is better to use a static geometry (for your trees):
PureBasic - StaticGeometry
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: How many Triangles can OGRE render with 60 FPS?

Post by Bananenfreak »

Code: Over 2000 lines...

Debugger: on
purifier: off
threadsafe: off
Windowed Screen: Yes

Hmm, I can´t use Static geometry for trees, because it´s the worldeditor and in the game you´re be able to cut the trees off.

EDIT: Are ~2700 tris too much for one tree?!
Image
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: How many Triangles can OGRE render with 60 FPS?

Post by PMV »

Btw.: the triangle count doesn't matters really.
The problem is the number of (sub)meshes.

http://www.ogre3d.org/tikiwiki/tiki-ind ... erformance
Batching
You may be using too many individual objects/submeshes. Graphics cards (GPU) like to have rendering queued into a relatively small number of large batches to operate at peak efficiency. If you use lots of small movable objects, especially if they are composed of multiple submeshes (each of which is its own render operation), the GPU underperforms because too much time is being spent in the overhead of setting up the individual rendering operations. This enqueueing process is done in the driver, which is constrained by the speed of the CPU, not the GPU. This presentation explains that 25000 batches per second will saturate (completely, on its own) a 1Ghz CPU. That means to maintain 60 FPS on a 1Ghz CPU you cannot issue more than about 416 batches per frame, where a batch is one instance of a submesh (for example). Of course, other factors may limit your performance earlier. You can improve batching by grouping static objects together in a StaticGeometry object, or by reducing the number of submeshes you use per mesh (do you really need that many different materials per mesh?).
OGRE has something similar to StaticGeometry for moving objects,
like they can move in groups. And there is the "InstanceManager", but
i dont think that one is implemented. And before i want to make
the feature request i have to research a little bit more :)
But i'm pretty sure that this features are missing in the current
OGRE implementation and they are necessary for most games.

MFG PMV
User avatar
STARGÅTE
Addict
Addict
Posts: 2085
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: How many Triangles can OGRE render with 60 FPS?

Post by STARGÅTE »

Bananenfreak wrote:EDIT: Are ~2700 tris too much for one tree?!
Yes!

look this:

Code: Select all

InitEngine3D()
InitSprite()

Enumeration
	#Window
	#Camera
	#Mesh
	#Entity
	#StaticGeometry
EndEnumeration


OpenWindow(#Window, 0, 0, 800, 600, "ScreenTitle", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Window), 0, 0, WindowWidth(#Window), WindowHeight(#Window), 0, 0, 0, #PB_Screen_NoSynchronization)

CreateCamera(#Camera, 0, 0, 100, 100)
MoveCamera(#Camera, 8, 8, 8)
CameraLookAt(#Camera, 0, 0, 0)

CreateSphere(#Mesh, 1, 8, 8)

#UseSingleEntitys = #False ; change this true/false

If #UseSingleEntitys
	For I = 1 To 2700
		CreateEntity(#PB_Any, MeshID(#Mesh), #PB_Material_None, Random(400)/100-2, Random(400)/100-2, Random(400)/100-2)
	Next
Else
	CreateEntity(#Entity, MeshID(#Mesh), #PB_Material_None)
	CreateStaticGeometry(#StaticGeometry, 20, 20, 20, #False)
	For I = 1 To 2700
		AddStaticGeometryEntity(#StaticGeometry, EntityID(#Entity), Random(400)/100-2, Random(400)/100-2, Random(400)/100-2)
	Next
	BuildStaticGeometry(#StaticGeometry)
EndIf


Repeat
	
	Repeat
		
		Select WindowEvent()
			Case #PB_Event_CloseWindow
				End
			Case #PB_Event_None
				Break
		EndSelect
		
	ForEver
	
	RenderWorld()
	
	SetWindowTitle(#Window, Str(Engine3DFrameRate(#PB_Engine3D_Current))+" -- "+Str(CountRenderedTriangles()))
	
	FlipBuffers()
	
ForEver
2700 single Entitys: 100 FPS
2700 Entitys in one Geometry: 1800 FPS
(388944 Triangles)

idea: use chunks with StaticGeometry, and if the player enter a chunk, delete the StaticGeometry and create single entitys.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: How many Triangles can OGRE render with 60 FPS?

Post by Bananenfreak »

@PMV:
Thanks for sharing, very interesting.
http://www.ogre3d.org/tikiwiki/tiki-ind ... y+Batching

@Stargate (How do i make the o over a? ^^):
Not 2700 meshes / entities.
tris = triangles... I think 2700 triangles for one tree is not soo much.
The main reason are too many entities.

Is there a saving when I attach the treeparts for example to the trunk with AttachEntityObjext()?
Or is there no difference for Rendering, only for physics?
Or every tree is one StaticGeometry. But I would prefer AttachEntityObject(), because I can detach Entities very easy (and so I don´t have to set up the whole Static Geometry for the tree).

This is a better Static Geometry (according to OGRE wiki):
http://www.ogre3d.org/tikiwiki/tiki-ind ... try+Engine
Image
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: How many Triangles can OGRE render with 60 FPS?

Post by Bananenfreak »

AttachEntityObject() don´t do anything to rendersavings. Is there only staticgeometry() for saving rendertime?

If I could move and rotate a whole static geometry my Needs would be fulfilled :)
Image
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: How many Triangles can OGRE render with 60 FPS?

Post by Bananenfreak »

I´ve read much in the OGRE Forum about StaticGeometry, but I still don´t know how to use StaticGeometry.

Is there a saving in rendertime when every tree is one StaticGeometry? Or is there only a saving when I put treeparts with same material in a Staticgeometry (branches with the trunk and the roots / Leaves in another)
I´m confused about how to use Static Geometry... :?

One Thing more:
If I attach a Entity to a Static Geometry, can I attach the physics Body "Static geometry" to this entity? Or is it already?!
Image
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: How many Triangles can OGRE render with 60 FPS?

Post by Olby »

Bananenfreak wrote:Is there a saving in rendertime when every tree is one StaticGeometry? Or is there only a saving when I put treeparts with same material in a Staticgeometry (branches with the trunk and the roots / Leaves in another)
I´m confused about how to use Static Geometry... :? !
As far as I understand static geometry it batches entities based on material. So lets say you have 100 entities in a static geom group using only one material. In this case GPU will render all entities in one batch. On the other hand if you have 100 entities and they share 3 different materials within a static group. GPU will batch them into 3 separate groups and render each material separately. Even in this case you will gain considerable performance by converting all your static entities into static geometry.
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
Fred
Administrator
Administrator
Posts: 16681
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: How many Triangles can OGRE render with 60 FPS?

Post by Fred »

On a side note, OGRE also support different LOD level per meshes, so you could use it to reduce polycount for distant objects (should be activated by default using the distance from the camera).
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: How many Triangles can OGRE render with 60 FPS?

Post by PMV »

Don't read to much, just test it. :)

If you want to know more about the possibilities of OGRE, you
can download the SDK and run the examples. There is a good
one for static geometries, where you can test the performance, too.

The implemented version is the static geometry class from OGRE.
It just pre-renders everything together, but only for every mesh + material
combination. So it is just good, if you are using the same mesh + material
very often. But then it can be count as one. The disadvantages of this
technique is, that nothing can be moved in any way. No rotation, even
no hid is possible. Additional, the LOD is the same for all. So if one mesh
has already a very high polygon count, it could be a problem. Especially on
older cards or onboard chips. Just because all meshes are visible with
the same LOD level.

Do you have already read the documentation itself? :D
http://www.ogre3d.org/docs/api/html/cla ... ml#details


MFG PMV
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: How many Triangles can OGRE render with 60 FPS?

Post by Bananenfreak »

Fred wrote:On a side note, OGRE also support different LOD level per meshes, so you could use it to reduce polycount for distant objects (should be activated by default using the distance from the camera).
500k triangles is nothing for a graphics Card... But I think I have too many Batches. LOD seems interesting, I´ll look at this later :)

@PMV:
Ok, I´ve read enough, time for testing :)
Given to the LOD I have to make meaningful Groups. All trees (except the leaves) in one static geometry is the wrong way :)
Image
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: How many Triangles can OGRE render with 60 FPS?

Post by Bananenfreak »

With adding StaticGeometry to my Project, I can render 1.000.000 tris with 40FPS. There is still the Problem with too many Batches, but I believe I can solve this Problem. For example with LOD.

@ Anyone who knows about LOD with PB and OGRE:
How can I realise this in my Project? I can´t find anything about it in the documentation.
Image
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: How many Triangles can OGRE render with 60 FPS?

Post by PMV »

LOD doesn't reduces the batch-count as i have understand
it, that is per mesh, not per triangle. LOD will just result in
less triangles as for something that is more far away, you
doesn't need a high level of detail. It is important for
meshes, that have a high count of triangles. :)
And as fred said already, there isn't much to do.
But good Mesh-Exporter have settings for that like this:
http://www.ogremax.com/Documents/OgreMa ... h-lod.html
:) So it is something that has to be set inside of the mesh-file
Maybe there is a OGRE-Class to change that at runtime,
but we don't have access to that.

the LOD for texture is changed automatically too (mipmaps),
but you have the possibility to adjust that if you want:
http://www.ogre3d.org/docs/manual/manua ... al-Scripts
scroll a little bit down (lod_value, lod_index, lod_strategy)

MFG PMV
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: How many Triangles can OGRE render with 60 FPS?

Post by Bananenfreak »

Thank you for These informations.
I will use the LOD for trees out of one Mesh. So in near, i get detailed trees, which can be cut. In distance, there are "standart" trees.
Image
Post Reply