What kind of performance can you expect ?

Started by Mr_Chaos, May 27, 2014, 01:43:54 PM

Previous topic - Next topic

Mr_Chaos

I'm making a small project that uses JPCT to create a 3D view of a train track with straight, curves, merges, diverter, etc.

I have a model with 2000 objects consisting of a total of 43000 triangles all elements are static, so I use CompileAndStrip on all of them, but I'm still only seeing 40 fps when running fullscreen at 800x600 on a laptop with a Nvidia Quadro 2000M with 2Gigabyte memory.

Can someone give a hint if this is the expected kind of performance, or if I can tweak some settings ?

EgonOlsen

This highly depends on the scene, the size of the objects on screen, the overdraw, the rendering attributes and stuff. Are these 2000 objects all individual objects that are visible all the time?

AGP

And are you using the software renderer or the hardware one?

Mr_Chaos

Quote from: EgonOlsen on May 27, 2014, 08:10:07 PM
This highly depends on the scene, the size of the objects on screen, the overdraw, the rendering attributes and stuff. Are these 2000 objects all individual objects that are visible all the time?

It's 2000 individual objects and at the moment I place them by creating them with center at 0,0,0 and then rotating and translating them to their correct location, they have no texture at the moment and the coloring is done using setAdditionalColor.

99% of the objects are static, but I hope later to add some animation to the mergers/diverters and maybee some textures to some of the objects.

Bumped the performance by quite a bit, by using compileAndStrip on all objects.




[attachment deleted by admin]

Mr_Chaos

Quote from: AGP on May 27, 2014, 08:25:08 PM
And are you using the software renderer or the hardware one?

I hope I'm using the hardware one


    buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY);
    buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
    buffer.enableRenderer(IRenderer.RENDERER_OPENGL);

EgonOlsen

Yes, you are using hardware. Otherwise, the strip operation would cause problems.
Anyway, 2000 objects is quite lot. Each object requires at least one draw call and these are expensive. Try to merge multiple objects into one if possible. In addition, you might want to give multi-threading a try: http://www.jpct.net/wiki/index.php/Multithreading

Mr_Chaos

Quote from: EgonOlsen on May 28, 2014, 04:18:43 PM
Yes, you are using hardware. Otherwise, the strip operation would cause problems.
Anyway, 2000 objects is quite lot. Each object requires at least one draw call and these are expensive. Try to merge multiple objects into one if possible. In addition, you might want to give multi-threading a try: http://www.jpct.net/wiki/index.php/Multithreading

I'll look into merging some of the objects into bigger ones, but there are gaps between then, so do I need to insert transperant triangles or does the engine handle that case without problems ?

I allready have the following for multithreading
Config.useMultipleThreads = true;
    Config.glVSync = false;
    Config.maxNumberOfCores = 4;
    Config.maxPolysVisible = 25000;



EgonOlsen

Gaps are no problem. You just have to make sure that any translations or rotations that you apply to the individual objects are made permanent to the mesh before merging (have a look at rotateMesh and translateMesh for more information).

Mr_Chaos

Quote from: EgonOlsen on May 28, 2014, 07:28:14 PM
Gaps are no problem. You just have to make sure that any translations or rotations that you apply to the individual objects are made permanent to the mesh before merging (have a look at rotateMesh and translateMesh for more information).

Tried merging into 10 big object, but performance dropped a lot. I suspect it's because the big objects consists of objects from all over the worldspace (I merged all straight objects into 1 big objects, all diverters into 1 big objects and so forth).
I was thinking about dividing the world into 64 pieces and then merging all objects inside into 1, so instead of 2000 objects, I would end up with 64.

Does it sound like something that could work ?, also is it possible to buy support ?

EgonOlsen

It highly depends on the scene what's best. If one or more of your objects are really huge compared to the visible area, you might also want to consider to use an octree (http://www.jpct.net/doc/com/threed/jpct/OcTree.html). If not for the rendering, it will come in handy when doing collision detection on the object.

EgonOlsen

Quote from: Mr_Chaos on May 31, 2014, 09:28:48 AM
...also is it possible to buy support ?
Rather not, at least not from me. If you need some more in depth support, you can always create a test case for me and i'll see what i can do, but i don't offer commercial support.

Mr_Chaos

Quote from: EgonOlsen on June 01, 2014, 08:47:50 PM
It highly depends on the scene what's best. If one or more of your objects are really huge compared to the visible area, you might also want to consider to use an octree (http://www.jpct.net/doc/com/threed/jpct/OcTree.html). If not for the rendering, it will come in handy when doing collision detection on the object.

Well I forgot to call CompileAndStrip and it gave a huge boost. From 60fps to 900-1000fps. I merged every type of element (straight, curve, etc) into 1 big object3D, so I have have 1 object3D pr. elementType, and that works fine, except for Mergers and Diverters.
For some reason that "merged" object cannot be displayed, my guess is that somehow the mesh is not drawable or something, but there are no errors from jpct, any ideas ?


EgonOlsen

Quote from: Mr_Chaos on June 03, 2014, 11:47:40 AM
For some reason that "merged" object cannot be displayed, my guess is that somehow the mesh is not drawable or something, but there are no errors from jpct, any ideas ?
There shouldn't be such a thing as a "not drawable mesh". Are these objects from the others in some way? Are you applying transformations to them before or after the merge?

Mr_Chaos

Quote from: EgonOlsen on June 03, 2014, 08:52:50 PM
Quote from: Mr_Chaos on June 03, 2014, 11:47:40 AM
For some reason that "merged" object cannot be displayed, my guess is that somehow the mesh is not drawable or something, but there are no errors from jpct, any ideas ?
There shouldn't be such a thing as a "not drawable mesh". Are these objects from the others in some way? Are you applying transformations to them before or after the merge?
They are part of the same railroadtrack, they are where the track splits and joins (The blue and green parts of the screenshot). All transformations and rotation is applied before the merge.

The strange thing is, that I can add 1-3 mergers with no problem, but add any more and it just doesn't show anything.

[attachment deleted by admin]

EgonOlsen

That shouldn't happen. Can you provide a test case for it that shows the problem?