Forums > Jitter

Access to modified geometry of vertex shader?

August 6, 2010 | 1:52 pm

Hi all,

In short: Is it possible to access vertex data after it has been processed by a vertex shader? As I’ve seen on the forum, using the "matrixoutput 1" option on sketch or mesh has no effect.. :(

I want to do the following:

  1. Render a jit.matrix with the or object, while applying a vertex shader, that modifies the positions of the vertices
  2. Read the outcoming vertices back into jitter (preferably as jit.matrix)

August 6, 2010 | 4:08 pm

not possible.

August 6, 2010 | 4:13 pm

Hello Marcus, very interesting question.
I don’t think is possible to retrieve vertex data as direct matrices in jitter(please someone correct me if i am wrong!). There has been some discussion in how to access shader data:

You need to bind the shader to an object. Look at the next example(attached):
if you apply the binding of the shader to the and then turn on the matrixoutput attribute, the stills retrieves the original data from the gridshape. The shader wouldn’t work until you bind it to the mesh object.

Another option might be to use a geometry shader:

but so far they are not supported on jitter.

Maybe someone around here knows a way to ouput matrices with bound shader data(that would be really cool!)



August 6, 2010 | 5:28 pm

Due to the nature of the programmable pipeline, you don’t have access to the results of a vertex program, except within the fragment program of the same shader (as varying variables). The easy answer is that this is just not possible, and you should just do whatever vertex processing on the CPU if you want matrix-level access. Theoretically, you could find a way to capture vertex points to float32 texture using a special shader that passes the vertex positions as varying to the fragment program, but this would be a completely separate rendering stage and seems kinda overkill. To maintain your sanity, I would encourage you to not think too hard about it, and just use jit.expr to manipulate your vertex positions as you like.

Viewing 4 posts - 1 through 4 (of 4 total)