I noticed that the Unity support dynamic batching. Does JME support dynamic batching now? If the dynamic batching has been supported by JME, could you point a way to me where I could learn the relevant knowledge? If not, does the JME plans to add this feature? Thank you very much.
What do you mean by dynamic batching?
Did you already look for the word “batch” in the javadoc?
I think you might be looking for BatchNode. There are some variations such as SimpleBatchNode etc.Look those up.
The detailed description is:
Unity can automatically batch moving objects into the same draw call if they share the same material.
Dynamic batching is done automatically and does not require any additional effort on your side.
Batching dynamic objects has certain overhead per vertex, so batching is applied only to meshes containing less than 900 vertex attributes in total.
If your shader is using Vertex Position, Normal and single UV, then you can batch up to 300 verts and if your shader is using Vertex Position, Normal, UV0, UV1 and Tangent, then only 180 verts.
Use the dynamic batching can reduce the draw call.
I know the “BatchNode”, and I had did some tests on the “BatchNode” and “GeometryBatchFactory.optimize(node);” And I got a conclusion that the “GeometryBatchFactory.optimize(node)” is better than the “BatchNode”, because when the numbers of triangles are same, the performance of “GeometryBatchFactory.optimize(node)” is better.
Well, GeometryBatchFactory is not dynamic since you must call it every time the objects move where as BatchNode is dynamic as it automatically recalculates the buffers (using GeometryBatchFactory as I recall).
So, yes the one that does a lot more will probably be a little slower but the ultimate triangle/object count should be the same.
Well there is a huge difference in use case though…
Though it’s not has automatic as the description you provided, but on the other hand it doesn’t have any limitations in vertex count.
Ok，the “BatchNode” is great!
Do you think the feature that automatically batch moving objects that the vertex is less than a number is needed? I think it’s truly needed. Because it can reduce the draw call and don’t need to change the “VBO”, it will improve the performance. So, will JME add the feature that I descript? I’m looking forward to achieving this feature. Thanks.
No, JME will probably not do that automatically for a scene. It has about 10,000 down sides for various scenes and in general JME expects you to know a little bit about what you are doing. You should know at least a minimal amount about optimizing a scene before expecting best performance from JME.
The plus side is that it also won’t be messing you up “automatically” when you don’t expect it. It does very little that you don’t tell it to do.
So, if you want stuff batched… use batch node. If you don’t want stuff batched, don’t use batch node. Easy. No guesswork.
Well it’s hard to guess what should be batched tbh, and IMO it would imply almost batching on every frame…and that’s far from free. That’s maybe the reason why Unity is imposing those very restrictive limitations on the vertex count.
Also note, that jme does support instancing, wich basically has a few new downsides, but can skip the whole batching stuff.
If this fits your objects and they are moving it is way superior to any batching approach.