Performance issue with lots of dynamic ModelInstance

Anything libgdx related goes here!

Re: Performance issue with lots of dynamic ModelInstance

Postby Estelle » Thu Aug 22, 2019 10:13 am

tomski wrote:Your model cache is basically doing nothing in relation to the cars.


Yes, I know that, but I use ModelCache for the rendering of roads, because roads are static so I don't need to update the Modelcache each frame.
But this seems to use ram and not vram. So I guess I need to use Vertex Buffer Object ?

Also , I read something interesting here : https://www.badlogicgames.com/forum/vie ... 2&start=20

Janusz wrote:
przemyslawlis wrote:Janusz, this is very interesting. Do you have any suggestions how to achieve the same effect for dynamic scene where mesh merge would be required almost for each frame?


Yes, If I were you, I will use different tactic. Maybe you shoudl:

1. Use 1 VBO;
2. Use models using the same texture atlas;
3. In each frame fill VBO with vertex data of all models after transformations(dynamic scene).

This is my idea.


So I guess I need to use this : https://github.com/libgdx/libgdx/blob/m ... bject.java

Though I have no idea of how to use this. I have 1000 cars which are moving each frame. For now each car has the same model but it will not be the case in the future.

Are you using skinning?


No I'm not.
Estelle
 
Posts: 8
Joined: Mon Aug 19, 2019 10:20 pm

Re: Performance issue with lots of dynamic ModelInstance

Postby tomski » Thu Aug 22, 2019 5:41 pm

You aren't using model cache for cars? Have you tried it to see the trade off?

There are other things you can do, instanced renderering via many methods including the "official" instancing. You could simplify the model and use vertex colouring. (depends on the style you are going for).

Even if you are using many different cars in the future, you can still batch them into groups and have at most 1 draw call per type.
tomski
 
Posts: 909
Joined: Wed Jun 26, 2013 6:06 pm

Re: Performance issue with lots of dynamic ModelInstance

Postby Estelle » Fri Aug 23, 2019 8:49 am

tomski wrote:You aren't using model cache for cars? Have you tried it to see the trade off?


I tried to use a ModelCache for cars. But since I need to update it every single frame, performance are very bad.

There are other things you can do, instanced rendering via many methods including the "official" instancing. You could simplify the model and use vertex colouring. (depends on the style you are going for).


According to xoppa we can't do that with LibGDX : https://www.badlogicgames.com/forum/vie ... 11&t=23964
Estelle
 
Posts: 8
Joined: Mon Aug 19, 2019 10:20 pm

Re: Performance issue with lots of dynamic ModelInstance

Postby tomski » Fri Aug 23, 2019 10:56 am

You can still use model cache for dynamic meshes, it just depends on the trade off of cpu vs gpu, so it just has to be tested for each specific case.

That thread is 3 years old, and whilst gles 2.0 still doesn't support it officially, gles 3.0 and libgdx does have native support for official instancing. so if you don't care about gles2.0 compatibility, you can just use that.




You can still do 'instancing' gpu side on gles 2.0 by encoding info in vertex data, or by passing data to shader via uniforms and doing it that way.
tomski
 
Posts: 909
Joined: Wed Jun 26, 2013 6:06 pm

Re: Performance issue with lots of dynamic ModelInstance

Postby Estelle » Sat Aug 24, 2019 8:32 pm

tomski wrote:You can still use model cache for dynamic meshes, it just depends on the trade off of cpu vs gpu, so it just has to be tested for each specific case.


I tried to do that, but the cpu usage is even higher.

That thread is 3 years old, and whilst gles 2.0 still doesn't support it officially, gles 3.0 and libgdx does have native support for official instancing. so if you don't care about gles2.0 compatibility, you can just use that. You can still do 'instancing' gpu side on gles 2.0 by encoding info in vertex data, or by passing data to shader via uniforms and doing it that way.



My game is only for desktop, so I guess I should not use Open GL ES ? But how do I force LibGDX to use only Open GL ?
Also I saw that in the LibGDX 1.9.10 release news :

- API Addition: new InstanceBufferObject and InstanceBufferObjectSubData classes to enable instanced rendering.
- API Addition: Support for InstancedRendering via Mesh


Any tutorial to learn to use those new features ?
Estelle
 
Posts: 8
Joined: Mon Aug 19, 2019 10:20 pm

Previous

Return to Libgdx

Who is online

Users browsing this forum: Chaplin, Google [Bot] and 1 guest