Tesselation and GeometryBatchFactory

Hello,

Some people might have seen my Tree gen in the previous November Monthly showcase.

The problem is, i m still unable to Batch the meshed together and it s really bad for my game if i can’t. I don’t know if it s hard or not to modify the actual GeometryBatchFactory to support the square (4 vertices) Batching.

I can try doing it myself, but the code actually seem a bit complex for a random people to just jump in and try fixing it. Also i m pretty sure some other people might need it in the future since Tessellation is a nice way of improving graphics or having the same quality at a lesser cost on modern hardware.

So let me know if this isn’t part of your concern, i will try to work on it myself. Or trying to explain me how i could make it work. Maybe it s a quick fix(But i m quite sure it won’t lol) .

Thank you anyway, have a nice day.

edit:
Nov 23, 2017 12:44:09 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.UnsupportedOperationException
at jme3tools.optimize.GeometryBatchFactory.mergeGeometries(GeometryBatchFactory.java:133)
at jme3tools.optimize.GeometryBatchFactory.makeBatches(GeometryBatchFactory.java:340)
at jme3tools.optimize.GeometryBatchFactory.optimize(GeometryBatchFactory.java:391)
at jme3tools.optimize.GeometryBatchFactory.optimize(GeometryBatchFactory.java:375)
at mygame.Tree.TreeExemple.sceneTest(TreeExemple.java:132)
at mygame.Tree.TreeExemple.simpleInitApp(TreeExemple.java:64)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:220)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
at java.lang.Thread.run(Thread.java:745)

looks more like a candidate for instancing imo.

Instancing? yes you would be right but i m gonna have only different visual of the same tree, i m not copying 1 tree all over the place sadly :confused: Instancing is a perfect copy if i m not wrong?

Ha ok it looked in your screenshot that the trees were similar.
Instancing allows you to render the same mesh multiple times in one draw call. the mesh needs to be the same , but the transforms of the geometry can be different.
then if you have different trees first you should page your scene with batches of the original non tesselated trees, then have your tesselation shader account for the batching when tesselating, and maybe have a texture atlas of displacement textures.

Ok, so you saying i should make the mesh first, batch it all, then modify the mesh back to square polygon? And yeah i already support the Textures Atlas in my Shader, i m really just in need of batching the whole thing together, But i feel like it s impossible to modify a batched mesh after.

Won’t it burn my cpu to do that kind of task twice?

Edit: the thing is, it feel like it s gonna be such a pain to do, Since i m cloning my meshes from a preloaded asset class. I really think i should just fix the class for performance gain and readability of the whole code.

Shouldn’t be. What the geometrybatchfactory does (or what I think it does) is basically only checks for stuff that has the same material, concatenates the mesh buffers and spits out a new geometry for each material group. You can modify that one as you would any other geom.

Oh no, they shut down when they hit about 100 degrees. :stuck_out_tongue:

lol i didn’t mean literally burn, I meant use more cpu resources to do it all :confused: