JDK-8092112 : Non-standard Sphere texture mapping
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 8u40
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2015-03-16
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
A common and mostly used texture mapping for spheres in 3D computing is the direct polar projection, also known as spherical or equirectangular projection.

For instance, the 4 texture files of the 3D Sphere Ensemble application are built for this projection.

However, the current texture mapping of a JavaFX sphere does not correspond to the direct polar projection. This leads to distorted continents in the 3D Sphere Ensemble application, the poles occupy too much space. Other textures should be used here.

The current texture mapping of a JavaFX sphere should be documented in the API.

Alternatively, the standard texture mapping could be used in JavaFX as well, by changing line 323 in Sphere.java from:
                tPoints[tPos + 1] = ty; // which is 0.5f + (float) Math.sin(va) * 0.5f;
to linear:
                tPoints[tPos + 1] = 0.5f + va / (float) Math.PI; 

This is the current Sphere texture mapping used in JavaFX: http://en.wikipedia.org/wiki/UV_mapping

Note that we will not "switch" to a different mapping. Instead we might provide a choice of mappings, selected based on an enum. The default will remain as it is today.

Instead of lines 323 and 328, sinply line line 314 should be changed to: float ty = 0.5f + va / (float) Math.PI;

A switch to standard texture mapping would require also a corresponding change of line 328, same as for described change in line 323.

We might consider improvements such as this for a future release.