V-up texture coordinate support
August Lammersdorf, InteractiveMesh
sdn at interactivemesh.com
Tue Oct 22 02:45:15 PDT 2013
My JavaFX 3D model importers convert geometric data to the JavaFX 3D
coordinate sytem to support the default camera model (viewing into the
screen along the +Z-axis). A Y-up right-handed coordinate system (e.g.
COLLADA-, OBJ-, X3D-exports from modelling tools) is mapped as follows:
+Y -> -Y, +X -> +X, +Z -> -Z. This includes the adjustment of all
transforms and also the v-flipping of the texture coordinates: v -> 1 -
v. In this case I prefer converted texture coordinates stored in the
TriangelMesh instead of converting them 'backstage'.
Alternatively, I consider providing an ImportOption to omit this
conversions if someone wants to simulate a Y-up right-handed coordinate
system in JavaFX. This would result in TriangelMesh points and texture
coordinates consistent with the imported file. Now an internal
v-flipping is needed to avoid upside-down textures because the
corresponding texture coordinates are typically v-up oriented. Right?
Simulating a Y-up right-handed coordinate system in JavaFX is discussed
in "Getting Started with JavaFX 3D Graphics/Camera/Y-down versus Y-up"
Doesn't this approach require an immediate availability of a v-flipping
Am Donnerstag, den 17.10.2013, 15:08 +0200 schrieb Chien Yang
<chien.yang at oracle.com>:
> Hi all,
> Java images are defined such that (0, 0) references the top left
> most pixel of the image. In JavaFX, the texture coordinate system for
> 3D objects is defined with its U axis increasing from left to right
> and the V axis increasing from top to bottom. Hence a texture
> coordinate of (0, 0) references pixel (0, 0), which is the top left
> corner of the texture, and a texture coordinate of (1, 1) references
> the bottom right corner of the texture. This system matches the
> of the image, which is stored such that the top-most row of pixels
> ends up in memory in row 0. It also matches with the default 3D
> coordinate system used in JavaFX where the X axis increases from left
> to right and the Y axis increases from top to bottom.
> We understand that this V-down coordinate system maybe confusing
> or hard to work with for some 3D content developers when using models
> that are defined with Y-up. We could add a V-up option (as a boolean
> property of Shape3D). If set, we would flip the texture coordinates
> when rendering, such that: V' = 1 - V.
> However it is very late in this release to consider any more
> changes, so our plan is to add this option in a post FX 8 release if
> it turns out to be needed. Please let us know right away if there is
> compelling need for V-up support in the FX 8 release.
> - Kevin and Chien
More information about the openjfx-dev