Z coordinate still missing?


#1

Hi,
AS3 allowed to work in a preudo3D environment without troubling stage3D: you only needed to set the Z coordinate of your DisplayObjects and BOOM, you had 3D flat objects moving in a 3D space.
Z buffer was ignored, you had to control the display list order by yourself, but it was sufficient to create very nice effects, I created complete card-games based on this feature.
I tried to use Z coordinate about 2-3 years ago in Openfl and it didn’t work: can someone (Joshua?) please update me about this feature? Is it supported? Will it be supported?
Thanks


#2

This is not supported, but open to consideration, if anyone knows what the perspective projection would be for the objects, etc.

This would break support for masking, scroll rect and other features that expect flat rendering, but it might be possible


#3

I remember that as soon as Z was set the general quality of the stage rendering changed (heavier/better antialias): I am pretty sure there was a swap between two render engines, or at least a change in the engine behaviour: could the engine swap be a “simple” solution for Openfl too, to keep the current engine separated and optimized?
In AS3 the 3D DisplayObjects could still use masks (I don’t remember anything about scrollRect, I used the Greensock implementation).

About the perspective projection you could set the vanishing point, I don’t remember about the other settings: if you think it is feasable I could take a look.


#4

I think one of the first steps would be determining what type of projection it used, so that we can translate things to have the same perspective as the Adobe implementation. The “camera” is located somewhere, with a certain level of focus, but the question is where and at what angle :slight_smile:


#5

I am not sure you could set the camera…


EDIT: these are the only parameters I was setting

root.transform.perspectiveProjection.fieldOfView = 102;
root.transform.perspectiveProjection.projectionCenter = new Point(640, 255);	// 1280x720
root.transform.perspectiveProjection.focalLength

You can’t move the camera.


EDIT 2: An obvious reference: AS3 PerspectiveProjection


#6

Well, that’s the thing – I think there’s a hard-coded projection built into the displayObject.z implementation, but I’m not really sure what exactly they are using. It’s like secret numbers we would need to reproduce the same effect


#7

Exactly, Z only simulates the perspective of an object, I think using skew and other deformations. We should find this combination based on the 3 perspectiveProjection parameters, I wonder where we can find such formulas…