Confirming coordinate system transformation with scene.useRightHandedSystem

The RH scene at https://playground.babylonjs.com/#UU7RQ#1956 shows the _nz image of a CubeTexture in the negative Z direction. The _pz image is shown in the positive Z direction. To me this is then as expected. I thought I had the flipped situation earlier. I had used explicit files which is what I try next on the playground.

1 Like

Sorry, it looks like I was confused about which way the pointed end of the capsule is directed. Adding markers at the origin and at (0,0,-10) shows that it is actually pointing towards positive Z (from -10 towards 0):

https://playground.babylonjs.com/#UU7RQ#1960
https://playground.babylonjs.com/#UU7RQ#1961 (with PositionGizmo)

This then means that the CubeTexture _nz image is actually shown in the positive Z direction, in a RH scene. This behaviour would then be unexpected, and either benefit from documentation or from being considered a bug.

Apologies again for the confusion.

Adding @bghgary the king of handedness :slight_smile:

No, no, handedness of the king. :upside_down_face:

As far as I know, cubemaps are always in left-handed. This can’t change because it’s the convention of cubemaps and has nothing to do with the engine. If the engine mucks with this, the textures won’t line up anymore. I found this that has some explanation. I guess documentation doesn’t hurt here.

2 Likes

The Khronos wiki does say that a cubemap’s axes are always in a LH system. I think that just defines in which direction the u and v for each face goes, and perhaps not necessarily where the pos Z goes but I cannot grasp that clearly without more figures.

In any case, it is clear that currently using a cubemap without modification in a RH scene will result in showing the backwards face (nz) in the pos. Z direction which is the backwards direction in a RH scene. For me the forum entry here suffices as documentation.

For completeness, here is the playground with explicit files for each direction:
https://playground.babylonjs.com/#UU7RQ#1962
It shows the same result, eg. is consistent with the faces inferred from the filename.

2 Likes