Transform Feedback

Hi, this is a little thread about Transform feedback.

For those who are new to TF:
Its basically a way to render to eg vertex buffer/texture buffer.
You can capture data outputted by vertex shader, or geometry shader.
Any applications?
-geom shader culling
-particles updated in vertex shader
-transforming matrices once and using multiple times etc…

Atm I am testing how TF works for culling gpu instanced meshes. Well, since I am implementing it anyway, might as well contribute it to jme3.

So, first of all, I have to ask if TF contribution is welcome.
The contribution will focus on the basic transform feedback feature (Core since version 3.0).

If we agree to go for it. Then we can discuss the implementation details. About design questions, such as will enabling transform feedback be a new method in Material, or as additionalRenderState, etc etc…

There are plenty of things to discuss, so let’s first agree whether we go for it or not.

Well, in any case, I am going to test culling with transform feedback, and will post results what I’ll get.

3 Likes

Hey, i have a working implementation of transform feedback, instance culling and lod for jme.

Transform feedback is here: https://github.com/riccardobl/jmonkeyengine/commit/60bc2a1fb8d728ec7baf1be872dd9681b1e3ce3a

This is an example of it being used to move 1 million of particles


(source included in the commit)

Instance culling and lod is currently unreleased.

The problem with culling and lod is that i had to hack-in those features in the materials and renderer using techniques, and this approach is not exactly clean enough for a pr.

Also, when you query the number of drawn primitives for the culling, you need to sync with the opengl command queue. That’s not very optimal, and to get the best out of it we should implement also indirect rendering.

If you want to discuss in detail, come to the discord server.

4 Likes

sounds cool, just hope it will dont slow down render in ANY way if someone just dont use it.

Basic working transform feedback, along with testcase showing culling on over 1M cubes is ready.

1 Like