Vertex shader output question

I would like to be able to use a vertex shader I created to make a modified duplication of the object passed in for rendering to pass into another vertex/fragment shader for final rendering. I hope that makes sense…



What would be my options for doing this? How would I store the the modified vertex positions and pass them into the next vertex shader? Or is this even possible?



EDIT: Worth mentioning… the second vertex shader will be modifying the vertex positions again…

EDIT: Also worth mentioning… the first vertex shader that would produce the modified mesh, only needs to run once to create the modified duplication.



And secondary though… would it be better to create the duplication via the JME side of things in this case?

Its definitely possible. Requires an OpenGL extension as its not supported by baseline OpenGL2 though, its called vertex transform feedback.

1 Like

If the first transform only needs doing once you could always do that on the CPU side?



Or create it as a library and apply both transforms in the second shader?

Should also be possible using the geometry shader…

@zzuegg said:
Should also be possible using the geometry shader..


We have access to the geometry shader? O.o Sorry for the stupid question...
@zarch said:
If the first transform only needs doing once you could always do that on the CPU side?

Or create it as a library and apply both transforms in the second shader?


Definitely could apply this each rendered frame... it would be the fastest solution to trying out the idea I had. Lol... ever feel like you completely overlooked the obvious?

The basic idea was... I have a shader that deforms meshes against three axis... you can compound the deformations and it recalcs the normals. Does some fairly neat thing-ies. I thought it would be a cool addition to some of the work I have seen floating around for different shielding effects.

The pulse deform is an animated version of moving the vertexes along there existing normals... and could be used to create a form-fitting shield. The other effects (ripple, wave, warble, etc) to slightly warp the shielding in a constant animation.

Between this and animated/deformed textures... you could end up with some really awesome looking effects.

There is a tesselation prototype afloat here in the forums, so basically yes

Neither geometry shader nor tesselation shader actually allow you to keep the results of the computation, only transform feedback allows you to do that. Also in case it was not clear, its an OpenGL feature, that is not supported by jME3 at the moment.



Doing it on the CPU is another alternative, but performance will suffer.