Author Topic: What kind of performance can you expect ?  (Read 3466 times)

Offline Mr_Chaos

  • int
  • **
  • Posts: 55
    • View Profile
What kind of performance can you expect ?
« on: May 27, 2014, 01:43:54 pm »
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 ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: What kind of performance can you expect ?
« Reply #1 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?

Offline AGP

  • quad
  • ******
  • Posts: 1515
    • View Profile
Re: What kind of performance can you expect ?
« Reply #2 on: May 27, 2014, 08:25:08 pm »
And are you using the software renderer or the hardware one?

Offline Mr_Chaos

  • int
  • **
  • Posts: 55
    • View Profile
Re: What kind of performance can you expect ?
« Reply #3 on: May 28, 2014, 07:45:50 am »
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]

Offline Mr_Chaos

  • int
  • **
  • Posts: 55
    • View Profile
Re: What kind of performance can you expect ?
« Reply #4 on: May 28, 2014, 07:48:04 am »
And are you using the software renderer or the hardware one?

I hope I'm using the hardware one

Code: [Select]
    buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY);
    buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
    buffer.enableRenderer(IRenderer.RENDERER_OPENGL);

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: What kind of performance can you expect ?
« Reply #5 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

Offline Mr_Chaos

  • int
  • **
  • Posts: 55
    • View Profile
Re: What kind of performance can you expect ?
« Reply #6 on: May 28, 2014, 07:08:00 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
Code: [Select]
Config.useMultipleThreads = true;
    Config.glVSync = false;
    Config.maxNumberOfCores = 4;
    Config.maxPolysVisible = 25000;


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: What kind of performance can you expect ?
« Reply #7 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).

Offline Mr_Chaos

  • int
  • **
  • Posts: 55
    • View Profile
Re: What kind of performance can you expect ?
« Reply #8 on: May 31, 2014, 09:28:48 am »
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 ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: What kind of performance can you expect ?
« Reply #9 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: What kind of performance can you expect ?
« Reply #10 on: June 01, 2014, 08:49:14 pm »
...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.

Offline Mr_Chaos

  • int
  • **
  • Posts: 55
    • View Profile
Re: What kind of performance can you expect ?
« Reply #11 on: June 03, 2014, 11:47:40 am »
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 ?


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: What kind of performance can you expect ?
« Reply #12 on: June 03, 2014, 08:52:50 pm »
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?

Offline Mr_Chaos

  • int
  • **
  • Posts: 55
    • View Profile
Re: What kind of performance can you expect ?
« Reply #13 on: June 04, 2014, 01:22:55 pm »
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]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: What kind of performance can you expect ?
« Reply #14 on: June 04, 2014, 08:40:34 pm »
That shouldn't happen. Can you provide a test case for it that shows the problem?