[x3d-public] IndexedTriangleSet default texture coordinates

Michalis Kamburelis michalis.kambi at gmail.com
Mon Nov 15 06:44:43 PST 2021


I second that, I mean

- The algorithm for automatic generation of 2D texture coordinates
that is now at IndexedFaceSet, actually applies to many other 3D
geometries. It applies to IndexedTriangleSet , IndexedQuadSet,
TriangleSet , QuadSet, triangle fan, triangle strip.

    Pretty much everything *except* nodes that have specialized
algorithms for texture generation (Box, Cone, Cylinder, Sphere,
ElevationGrid, Extrusion).

- That is how we implement it in Castle Game Engine / view3dscene too.


    We even have an option for TextureCoordinateGenerator to request
this algorithm explicitly by `TextureCoordinateGenerator { mode
"BOUNDS2D" }` (so it can even by used on Box, Cone etc.). See
https://castle-engine.io/x3d_implementation_texturing_extensions.php#section_ext_tex_coord_bounds
.

- Don's solution to edit the spec seems nicest. I.e., move the
description to some general section, like "Automatic generation of 2D
texture coordinates" and just refer to that section from respective
nodes like IndexedFaceSet, IndexedTriangleSet etc.

I think the current spec state is a result of the fact that in VRML
97, this algorithm was only for IndexedFaceSet. Then X3D added
IndexedTriangleSet, IndexedQuadSet etc. but their descriptions were
not filled with "what to do when texCoord is NULL and user tries to
apply a texture".

Regards,
Michalis

pon., 15 lis 2021 o 04:06 Andreas Plesch <andreasplesch at gmail.com> napisał(a):
>
> On Sat, Nov 13, 2021 at 6:48 PM Brutzman, Donald (Don) (CIV)
> <brutzman at nps.edu> wrote:
> >
> > Thanks for taking the time to report this issue Andreas.  Recorded in the Mantis issue tracker at
> >
> > * Mantis 1375: default texture coordinates for IndexedTriangleSet and related nodes
> > * https://www.web3d.org/member-only/mantis/view.php?id=1375
> >
> > Another option is to move the full definition (plus Figures 13.6 and 13.7) up from 13.3.6 IndexedFaceSet to the X3DComposedGeometryNode  abstract node type, where the texCoord field is defined.
>
> That could work well. I think the default texCoords would apply to all
> of the implementing nodes.
>
> Thank you for considering that option,
>
> Andreas
>
> >
> > * 4.4.2.3 Interface hierarchy
> >   https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/concepts.html#InterfaceHierarchy
> >
> >         |                   +- X3DComposedGeometryNode -+- IndexedFaceSet
> >         |                   |                           +- IndexedTriangleFanSet
> >         |                   |                           +- IndexedTriangleSet
> >         |                   |                           +- IndexedTriangleStripSet
> >         |                   |                           +- IndexedQuadSet
> >         |                   |                           +- QuadSet
> >         |                   |                           +- TriangleFanSet
> >         |                   |                           +- TriangleSet
> >         |                   |                           +- TriangleStripSet
> >
> > * 11.3.2 X3DComposedGeometryNode
> >    https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/rendering.html#X3DComposedGeometryNode
> >
> > * 13.3.6 IndexedFaceSet
> >   https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/geometry3D.html#IndexedFaceSet
> >
> > All feedback always welcome.  Dick and I will consider this editorial correction in an upcoming specification-editors meeting.
> >
> > all the best, Don
> > --
> > Don Brutzman  Naval Postgraduate School, Code USW/Br        brutzman at nps.edu
> > Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149
> > X3D graphics, virtual worlds, navy robotics https:// faculty.nps.edu/brutzman
> >
> > -----Original Message-----
> > From: x3d-public <x3d-public-bounces at web3d.org> On Behalf Of Andreas Plesch
> > Sent: Saturday, November 13, 2021 9:31 AM
> > To: X3D Graphics public mailing list <x3d-public at web3d.org>
> > Subject: [x3d-public] IndexedTriangleSet default texture coordinates
> >
> > https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/rendering.html#IndexedTriangleSet
> >
> > does not specify behaviour if the texCoord field is NULL (default).
> >
> > https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/geometry3D.html#IndexedFaceSet
> >
> > in contrast specifies for IndexedFaceSet:
> >
> > "If the texCoord field is NULL, a default texture coordinate mapping is calculated using the local coordinate system bounding box of the shape. The longest dimension of the bounding box defines the S coordinates, and the next longest defines the T coordinates. If two or all three dimensions of the bounding box are equal, ties shall be broken by choosing the X, Y, or Z dimension in that order of preference. The value of the S coordinate ranges from 0 to 1, from one end of the bounding box to the other. The T coordinate ranges between
> > 0 and the ratio of the second greatest dimension of the bounding box to the greatest dimension. Figure 13.6 illustrates the default texture coordinates for a simple box shaped IndexedFaceSet with an X dimension twice as large as the Z dimension and four times as large as the Y dimension. Figure 13.7 illustrates the original texture image used on the IndexedFaceSet used in Figure 13.6."
> >
> > This could apply to IndexedTriangleSet as well as other Rendering component nodes.
> >
> > So the options are:
> >
> > a) leave undefined, up to the browser
> > b) refer to IndexedFaceSet
> > c) repeat language
> >
> > My preference is b) with a single sentence like:
> > "If the texCoord field is NULL, a default texture coordinate mapping is calculated in exactly the same way as it is for IndexedFaceSet."
> >
> > a) is also an option since b) was implied and there was probably not a lot of confusion anyways.
> >
> > --
> > Andreas Plesch
> > Waltham, MA 02453
> >
> > _______________________________________________
> > x3d-public mailing list
> > x3d-public at web3d.org
> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
>
> --
> Andreas Plesch
> Waltham, MA 02453
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org



More information about the x3d-public mailing list