I am working with the ‘crop’ parameters on the render TOP as a way to center certain objects in a render and now want to re-project the image back into some geometry however I am struggling to re-construct whatever the crop parameters are doing to the projection matrix in order to do the centering in the first place. It seems if I could retrieve or otherwise figure out how to apply the same crop settings to a custom projection matrix I would be set. I am curious if anyone has anything to suggest- thanks!

The projection crop is a basic re-range operation applied after the projection: (this is C++ code)

```
// Scale to 0, 1 range
proj->scale(0.5f, 0.5f, 1.0f);
proj->translate(0.5f, 0.5f, 0.0f);
// now rescale to the crop
proj->translate(-cropX0, -cropY0, 0.0f);
proj->scale(1.0f / (cropX1 - cropX0), 1.0f / (cropY1- cropY0), 1.0f);
// Rescale to -1, 1
proj->translate(-0.5f, -0.5f, 0.0f);
proj->scale(2.0f, 2.0f, 1.0f);
```

Awesome, thanks. Bear with me I’m learning… Would I want to apply this math in the vertex or pixel shader? I am currently using the attached GLSL MAT for texture projection and fiddling with it to modify for this purpose.

alphaProj.tox (1.9 KB)

I’m able to mess with position by manipulating worldSpacePos however that’s world space and I think I want to move the projection texture around in screen space? In order to rescale / translate it to counteract the scaling and cropping of the original render.

TDWorldToProj() will apply the projections and leave the position in clip space. If you then want to undo the above scales/translations, you’d apply them to that after, in the vertex shader.

Thank you so much for the info- I ended up getting the camera projection matrix and using this math with the matrix class to do the ‘de-crop’. Works great, will try to do it direct in vertex shader next. This helped shore up a lot my understanding of projection matrices- thank you again.