[Feature Proposal]: TriangleMesh - Vertex Color Support

Michael Strauß michaelstrau2 at gmail.com
Sat Sep 21 02:17:37 UTC 2024


> I'm not yet convinced that new vertex formats are the way to go.

To be fair, I'm not sure why VertexFormat even exists. It serves no
purpose when creating a TriangleMesh, as the vertex format could
easily be inferred by the presence (or absence) of vertex data. Having
users specify the VertexFormat explicitly is probably not a good API,
as it now makes the other data components be dependent on the choice
of the vertex format.

Of course, not all combinations of vertex data are valid, but this
could be specified in documentation and be validated by the
implementation. I think it might be best to deprecate VertexFormat for
removal. This would also prevent a potential explosion of vertex
formats in the public API.

I have no objection to the choice to add vertex colors as an
additional data component to TriangleMesh. It adds to the API, but
this is not a slippery slope as there's only a very finite set of
features we might be tempted to add next:

The most obvious thing that JavaFX 3D really can't do is shadows.
These come in static form (light mapping) and dynamic form (shadow
mapping). Light mapping requires a second set of texcoords, while
shadow mapping does not.

Adding light mapping would make JavaFX 3D competitive with late-90's
graphics, and adding shadow mapping would make it competitive with
early-2000's graphics.


More information about the openjfx-dev mailing list