How to determine/account for vertex coordinates that are normalized before being passed to the vertex shader?

Hello!!!

I’m using VTK 9.5.0 and trying to modify the position of points in the glsl vertex shader.

I’ve noticed that in some cases (not all), the vertex locations passed to the vertex shader by VTK are scaled/shifted relative to the point locations defined in the geometry datasets.

So I have two questions,

  1. Is the assumption above about VTK modifying the coordinates before passing to the vrtex shader correct?
  2. If so, how can I get hold of the transformation matrix so that I can account for this shift/scale before applyting the vertex updates in my shader?

The relevant part of my vertex shader looks something like this

      "int vertexIndex = gl_VertexID;\n"
      " vec4 deformed_pos = vertexMC + deformations[vertexIndex]*1000.;\n"
      " vertexVCVSOutput = MCVCMatrix * deformed_pos;\n"
      " gl_Position = MCDCMatrix *      deformed_pos;\n"

It works just fine when the model is small and close to the orgin, but messes up in other cases….

I found the ShiftScaleMethodType enum on the mapper and associated methods to set. This basically answers my first orginal questions.

I can also disable shift/scale and this delivers me the dataset point coordinates I expect in the vertex shader. So I can uses these get what I need.

But I’m assuming the default setting of shift/scale is in place for a reason….. so I’m thinking it would still be better to be able to get a hold of the shift/scale transfromation and use it in my shader?

Anyone have any thoughts on this?