Copy link to clipboard
Copied
Hello there !
I am developping an OpenGL plugin that allows 3D transformations of a selected layer in the comp (a sort of a 3D version of the "transform" effect)
I am able to checkout the selected layer, apply to it the transform data of the original layer, and display it on screen.
... BUT!
1. AE and OpenGL have a different coordinates system: in AE, {0,0} is not the center of the screen but rather the upper left corner. So OpenGL's objects are positioned in the 3D world according to their center, whereas AE's layers are placed on the comp according to their upper-left corner.
2. Also, in OpenGL, Y points upwards and Z points away from the camera. In AE, it's the opposite.
So rotations are inverted, and moving through the Y and Z axis are inverted.
I tried many things, :
- For the first problem, to shift the camera by (comp_width/2, comp_height/2) and the layer by (-layer_width/2, -layer_height/2). Seems to work but I am not sure if there is a better way...
- For the second problem, to put a minus "-" before the Y and Z coordinate of the translation data of the layer's transform matrix. But that results in an empty screen as the layer is now far away from the camera.
Moving the camera to compensate also does not resolve the issue.
Does someone have a better solution for this ?
Thanks
Copy link to clipboard
Copied
Can you move the layer to the centre of the comp instead of the camera?
for the coordinates, I'm not sure if you're writing shorthand, but something like this looks like it should work:
X = xVar + thisComp.width/2;
Y = yVar + thisComp.height/2*-1;
Z = zVar*-1;
[X,Y,Z]
with xVar, yVar and zVar being the initial states of the layer position with the comp's dimensions for adjustment.
If you take a look at the C4D cineware plugin, that might shed some light on, as i notice that has comp camera and centred comp camera options.
Copy link to clipboard
Copied
Wouldn't you just use the GL functions for this? Set origin and set world matrix in particular?
Mylenium