[x3d-public] wondering about Texture mapping specified in material nodes [corrected]

Michalis Kamburelis michalis.kambi at gmail.com
Mon Sep 21 12:09:42 PDT 2020


Don,

AD 1 - I have labeled the examples A B C D E F on
https://github.com/michaliskambi/x3d-tests/wiki/How-to-add-PBR-to-X3D%3F#can-we-make-texture-mapping-using-def--use
.

    Four of them (the ones that present design that works IMO, with
mapping as SFString) are inside
https://github.com/michaliskambi/x3d-tests/tree/master/pbr/enhanced_phong_material
, in files mapping_single_shape.x3dv, and
mapping_second_shape_reusing_*.x3dv . They already work with
view3dscene.

AD 2 - As you know, all my examples are public (and open-source,
license is in the repo) since day one of my work of PBR + X3Dv4. They
are all on https://github.com/michaliskambi/x3d-tests/tree/master/pbr/
.

AD 3 - The xxxTextureMapping fields and how it matches with
TextureCoordinate.mapping / TextureTransform.mapping is explained at
the very link you mention:
https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD2/Part01/components/shape.html#TextureMapping
. The field "mapping" itself is mentioned at the nodes where it is
present ( https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD2/Part01/components/texturing.html#X3DSingleTextureCoordinateNode
, https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD2/Part01/components/texturing.html#X3DSingleTextureTransformNode
). Indeed there should be a link from X3DSingleTextureCoordinateNode /
X3DSingleTextureTransformNode -> """12.2.4 Texture mapping specified
in material nodes""".

To answer the rest of your message:

I'm afraid you didn't understand where the issue is.

You presented how to express my "example A" using a different approach
(where you put the texture coordinate nodes inside Material).

But in your approach, texture coordinates are now inside a Material
node. Which goes contrary to the design of meshes/materials in all
other software and formats (glTF, Blender, Unity, X3D 3...). And in
your approach, you cannot express things like:

- another shape uses the same Appearance node, but with different
IndexedFaceSet (my example B)

- another shape uses the same Material node, but with different
IndexedFaceSet (my example C)

And "sharing" an Appearance and/or Material is a very common thing,
available across various 3D authoring tools and formats. This
"sharing" is also very useful also to browsers to optimize loading /
rendering. So we want to keep this sharing possible, just as it was in
X3D 3.

In my text on https://github.com/michaliskambi/x3d-tests/wiki/How-to-add-PBR-to-X3D%3F#can-we-make-texture-mapping-using-def--use
, I already tried to do what you did, in examples E and F. Yes, it
works for one shape. But it breaks as soon as someone tries to reuse
- Appearance (which is possible in my example B) or
- Material (which is possible in my example C) or
- IndexedFaceSet (which is possible in my example D).

Regards,
Michalis

sob., 19 wrz 2020 o 19:55 Don Brutzman <brutzman at nps.edu> napisał(a):
>
> continuing just a little more.
>
> [...]
>
> On 9/19/2020 7:59 AM, Don Brutzman wrote:
> > If we are converging, then identical field pattern for PhysicalMaterial above would be similarly applied to Material and UnlitMaterial in X3D4 specification.
>
> [3] 12.4.5 Material
>      https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD2/Part01/components/shape.html#Material
>
> ============================================
> # Current WD2 Material with mapping fields, backwards compatible with X3D3
>
> Material : X3DOneSidedMaterialNode {
>    SFFloat  [in,out] ambientIntensity          0.2          [0,1]
>    SFNode   [in,out] ambientTexture            NULL         [X3DSingleTextureNode]
>    SFString [in,out] ambientTextureMapping     ""
>
>    SFColor  [in,out] diffuseColor              0.8 0.8 0.8  [0,1]
>    SFNode   [in,out] diffuseTexture            NULL         [X3DSingleTextureNode]
>    SFString [in,out] diffuseTextureMapping     ""
>
>    SFColor  [in,out] emissiveColor             0 0 0        [0,1]
>    SFNode   [in,out] emissiveTexture           NULL         [X3DSingleTextureNode]
>    SFString [in,out] emissiveTextureMapping    ""
>
>    SFNode   [in,out] metadata                  NULL         [X3DMetadataObject]
>
>    SFNode   [in,out] normalTexture             NULL         [X3DTexture2DNode]
>    SFString [in,out] normalTextureMapping      ""
>    SFFloat  [in,out] normalScale               1            [0, ∞]
>
>    SFFloat  [in,out] occlusionStrength         1            [0,1]
>    SFNode   [in,out] occlusionTexture          NULL         [X3DTexture2DNode]
>    SFString [in,out] occlusionTextureMapping   ""
>
>    SFFloat  [in,out] shininess                 0.2          [0,1]
>    SFNode   [in,out] shininessTexture          NULL         [X3DSingleTextureNode]
>    SFString [in,out] shininessTextureMapping   ""
>
>    SFColor  [in,out] specularColor             0 0 0        [0,1]
>    SFNode   [in,out] specularTexture           NULL         [X3DSingleTextureNode]
>    SFString [in,out] specularTextureMapping    ""
>
>    SFFloat  [in,out] transparency              0            [0,1]
> }
> ============================================
>
> to follow the explicit-field pattern shown in PhysicalMaterial would replace "mapping" fields to become something like
>
> ============================================
> # Suggested Material without mapping fields, backwards compatible with X3D3
>
> Material : X3DOneSidedMaterialNode {
>    SFFloat  [in,out] ambientIntensity          0.2          [0,1]
>    SFNode   [in,out] ambientTexture            NULL         [X3DSingleTextureNode]
>    SFNode   [in,out] ambientTexCoord           NULL         [X3DSingleTextureCoordinateNode]
>    SFNode   [in,out] ambientTextureTransform   NULL         [X3DSingleTextureTransformNode]
>
>    SFColor  [in,out] diffuseColor              0.8 0.8 0.8  [0,1]
>    SFNode   [in,out] diffuseTexture            NULL         [X3DSingleTextureNode]
>    SFNode   [in,out] diffuseTexCoord           NULL         [X3DSingleTextureCoordinateNode]
>    SFNode   [in,out] diffuseTextureTransform   NULL         [X3DSingleTextureTransformNode]
>
>    SFColor  [in,out] emissiveColor             0 0 0        [0,1]
>    SFNode   [in,out] emissiveTexture           NULL         [X3DSingleTextureNode]
>    SFNode   [in,out] emissiveTexCoord          NULL         [X3DSingleTextureCoordinateNode]
>    SFNode   [in,out] emissiveTextureTransform  NULL         [X3DSingleTextureTransformNode]
>
>    SFNode   [in,out] metadata                  NULL         [X3DMetadataObject]
>
>    SFNode   [in,out] normalTexture             NULL         [X3DTexture2DNode]
>    SFNode   [in,out] normalTexCoord            NULL         [X3DSingleTextureCoordinateNode]
>    SFNode   [in,out] normalTextureTransform    NULL         [X3DSingleTextureTransformNode]
>
>    SFFloat  [in,out] occlusionStrength         1            [0,1]
>    SFNode   [in,out] occlusionTexture          NULL         [X3DTexture2DNode]
>    SFNode   [in,out] occlusionTexCoord         NULL         [X3DSingleTextureCoordinateNode]
>    SFNode   [in,out] occlusionTextureTransform NULL         [X3DSingleTextureTransformNode]
>
>    SFFloat  [in,out] shininess                 0.2          [0,1]
>    SFNode   [in,out] shininessTexture          NULL         [X3DSingleTextureNode]
>    SFString [in,out] shininessTexCoord         NULL         [X3DSingleTextureCoordinateNode]
>    SFNode   [in,out] shininessTextureTransform NULL         [X3DSingleTextureTransformNode]
>
>    SFColor  [in,out] specularColor             0 0 0        [0,1]
>    SFNode   [in,out] specularTexture           NULL         [X3DSingleTextureNode]
>    SFNode   [in,out] specularTexCoord          NULL         [X3DSingleTextureCoordinateNode]
>    SFNode   [in,out] specularTextureTransform  NULL         [X3DSingleTextureTransformNode]
>
>    SFFloat  [in,out] transparency              0            [0,1]
> }
> ============================================
>
> ... so for proper spelling of field names ("*TexCoord" vice "*TextureCoord"), consistency correction to previous Version 3-fieldnames-verbose and Version 4-fieldnames-terse examples:
>
>        diffuseTextureCoord  USE TEXTURECOORDINATE_6
>        normalTextureCoord   USE TEXTURECOORDINATE_6
>        specularTextureCoord USE TEXTURECOORDINATE_7
>
> should be
>
>        diffuseTexCoord      USE TEXTURECOORDINATE_6
>        normalTexCoord       USE TEXTURECOORDINATE_6
>        specularTexCoord     USE TEXTURECOORDINATE_7
>
> No change to logic or topology here, just getting precise on spelling.
>
> 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 http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list