[x3d-public] 3D graphics, vertex attributes Tangent index and vector
John Carlson
yottzumm at gmail.com
Fri May 23 15:29:14 PDT 2025
Perhaps a better term would be gradient? Idk!
John
On Fri, May 23, 2025 at 5:16 PM Michalis Kamburelis <
michalis.kambi at gmail.com> wrote:
> John: I know, in math, in 3D, you generally speak about "tangent
> planes" ( https://en.wikipedia.org/wiki/Tangent ).
>
> The name "tangent vector" is just a shorthand for "vector lying on a
> tangent plane". This is a standard for calling this value in the
> context of bump mapping / normal maps.
>
> See e.g. glTF spec with useful definition (
>
> https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#introduction-technical-terminology
> "2.2.3. Technical Terminology" ):
>
> """
> tangent
> A unit XYZ vector defining a tangential direction on the surface.
> """
>
> There is also "tangent coordinate space". If you want to get dirty and
> read about details, search for "tangent normal mapping":
> https://learnopengl.com/Advanced-Lighting/Normal-Mapping ,
>
> https://www.cs.utexas.edu/~fussell/courses/cs384g-spring2016/lectures/normal_mapping_tangent.pdf
> .
>
> Regards,
> Michalis
>
> sob., 24 maj 2025 o 00:05 John Carlson <yottzumm at gmail.com> napisał(a):
> >
> > Tangent planes seem more likely than tangent vectors, at least in 3D.
> >
> > Just a naming convention.
> >
> > John
> > On Fri, May 23, 2025 at 4:09 PM Michalis Kamburelis <
> michalis.kambi at gmail.com> wrote:
> >>
> >> Don: I don't think that this decision (to never support Tangent node
> >> in X3D), is correct. I would actually say we should add Tangent to
> >> X3D.
> >>
> >> Let me present a clear argument "why". I copied some of the reasoning
> >> from mail below to
> >> https://github.com/michaliskambi/x3d-tests/wiki/Tangent-node-in-X3D ,
> >> to have a future reference.
> >>
> >> 1. Current state: As of now, both X_ITE and Castle Game Engine have
> >> extensions to define Tangent node.
> >>
> >> So we have invented the "Tangent" node independently in 2
> >> implementations and, predictably, they are unfortunately
> >> similar-but-not-exactly the same. Links from this thread, where you
> >> can notice a difference:
> >>
> >> - https://create3000.github.io/x_ite/components/rendering/tangent/
> ,
> >> -
> https://castle-engine.io/x3d_implementation_rendering_extensions.php#section_ext_tangent
> >>
> >> Also glTF format has them. See
> >>
> https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes-overview
> >> , information about "TANGENT".
> >>
> >> ( Holger, if you read this: I think I will change Castle Game
> >> Engine's Tangent node in the future, to match better both X_ITE and
> >> glTF, thus we will have matching definitions with X_ITE. Your approach
> >> is better, Tangent.vector should be 4D. )
> >>
> >> 2. Tangents *do not* just repeat the same information as normal
> >> vectors, DRY principle doesn't apply here. I.e. the tangent vectors
> >> are *not* a replacement for knowing normal vectors (nor is the other
> >> way around).
> >>
> >> And just because the model provides normal vectors -- doesn't
> >> mean that tangent vectors are already precisely 100% determined.
> >>
> >> There are multiple similar algorithms to determine tangent
> >> vectors. The normal vector alone doesn't yet define the tangent ->
> >> because in a 3D space, if you have a normal vector -> you still have
> >> infinite possible values for a vector "orthogonal to normal". So
> >> tangent vectors are auto-calculated (when not explicitly provided) to
> >> match the normal vectors, but *also* to match the texture coordinates
> >> used for normal maps. There are edge-cases when it is just not obvious
> >> what should be the "perfect tangent" so various implementations
> >> (MikkTSpace is just one example) can do different things.
> >>
> >> 3. Ultimately, the "perfect tangent value" is the one that was used to
> >> bake the normalmaps. If the authoring tool (like Blender) that you
> >> used to make normalmaps used a bit different algorithm to calculate
> >> tangents than your renderer -> then the rendering of normalmaps will
> >> be slightly "off".
> >>
> >> There's a nice screenshot in
> >>
> https://gamedev.stackexchange.com/questions/146855/how-do-you-compute-the-tangent-space-vectors-with-normals-given-in-the-mesh
> >> , scroll to "There are multiple ways to generate tangent spaces for a
> >> mesh, and not all of them agree on the result.". The screenshot there
> >> shows subtle problems that result from having authoring tool and
> >> renderer calculate a *bit* different tangent vectors.
> >>
> >> So the perfect thing to do, from a renderer, is to *not* calculate
> >> the tangent vectors, instead take the tangent vectors as provided by
> >> the authoring tool. That exactly why glTF has tangents, and why X_ITE
> >> and Castle Game Engine support them too -- we don't just discard
> >> tangent values from glTF (only to auto-calculate them), we prefer to
> >> take tangent values recorded in the 3D model, because this makes
> >> really good rendering.
> >>
> >> See https://github.com/michaliskambi/x3d-tests/wiki/Tangent-node-in-X3D
> >> , which I just created -- it mostly copies what I said above.
> >>
> >> I hope this helps. I'll be happy to explain it better on next Web3d
> >> Friday teleconference, if you're not tired of my talking :) I can show
> >> how the normalmaps are actually created.
> >>
> >> Regards,
> >> Michalis
> >>
> >>
> >> pt., 23 maj 2025 o 21:03 Brutzman, Donald (Don) (CIV) via x3d-public
> >> <x3d-public at web3d.org> napisał(a):
> >> >
> >> > The X3D group has looked closely at Tangent options in the past and
> decided not to support it. Instead we use Normal nodes, as ever.
> >> >
> >> > Of geometric note is that they are literally orthogonal and thus
> either representation can be used to the other.
> >> >
> >> > You will not find Tangent node in the X3D specification.
> >> >
> >> > X3D 4.1 draft Architecture, Annex Z (informative) Version content
> >> >
> https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD//Part01/versionContent.html
> >> >
> >> >
> >> > Note that the X_ITE documentation specifically notes that support in
> that application is nonstandard.
> >> >
> >> >
> >> > SFNode [in, out] tangent NULL [Tangent] non-standard]
> >> >
> https://create3000.github.io/x_ite/components/geometry3d/indexedfaceset/#fields-tangent
> >> >
> >> >
> >> > There is no issue with codebases adding functionality that might help
> their capabilities - the X in X3D is extensible, after all - but anyone
> putting a Tangent definition into an X3D model file is creating
> nonstandard, invalid, noninteroperable content.
> >> >
> >> > Also please be aware that there is a serious design principle behind
> this decision: DRY. Thus, a statement I don't expect to repeat: we do not
> intend to consider Tangent support in future X3D specifications.
> >> >
> >> > Wikipedia: Don't repeat yourself
> >> > https://en.wikipedia.org/wiki/Don't_repeat_yourself
> >> >
> >> >
> >> > And some "dry humor" on that page:
> >> >
> >> > The opposing view to DRY is called WET, a backronym commonly taken to
> stand for write everything twice (alternatively write every time, we enjoy
> typing or waste everyone's time).
> >> >
> >> >
> >> > Recommendations:
> >> >
> >> > if your model data is starting with tangent values (for whatever
> reason) then convert them to normal vectors, and
> >> > stick with standard X3D for best results.
> >> >
> >> >
> >> > Have fun with normal X3D! 🙂
> >> >
> >> >
> >> > 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
> >> >
> >> >
> >> >
> >> >
> >> > ________________________________
> >> > From: x3d-public <x3d-public-bounces at web3d.org> on behalf of Joe D
> Williams via x3d-public <x3d-public at web3d.org>
> >> > Sent: Sunday, May 18, 2025 5:03 PM
> >> > To: John Carlson <yottzumm at gmail.com>
> >> > Cc: Joe D Williams <joedwil at earthlink.net>; Extensible 3D (X3D)
> Graphics public discussion <x3d-public at web3d.org>
> >> > Subject: Re: [x3d-public] 3D graphics, vertex attributes Tangent
> index and vector
> >> >
> >> > ok, seems like from what I can study so far,
> >> >
> >> > the first use of Tangent vector is authortime production of
> >> >
> >> > normalized Normal vector for vertex or face.
> >> >
> >> > The author is looking for relief effects (bumpmapping)
> >> >
> >> > that are produced by Tangent vector.
> >> >
> >> > This process (MikkTSpace algorithm) would fill Normal vector.
> >> >
> >> > This process of generating Normal vector space is called baking.
> >> >
> >> >
> >> >
> >> > For Level5 runtime,
> >> >
> >> > If Normal vector not null then used directly.
> >> >
> >> > If Normal vector null, then normals auto generated by creaseAngle
> >> >
> >> > If Tangent vector null, then nothing.
> >> >
> >> > If Level 5 and Tangent vector not null then possible relief effects
> >> >
> >> > using length of Tangent vector.
> >> >
> >> >
> >> >
> >> > No "bake" in runtime.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > For runtime, the generated Normal vector is used and
> >> >
> >> > if Tangent vector is not null, for the author to produce relief
> effects
> >> >
> >> > using length of Tangent vector.
> >> >
> >> > Is that true?
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > .
> >> >
> >> > For runtime
> >> >
> >> > -----Original Message-----
> >> > From: John Carlson <yottzumm at gmail.com>
> >> > Sent: May 17, 2025 1:15 PM
> >> > To: Joe D Williams <joedwil at earthlink.net>
> >> > Cc: Extensible 3D (X3D) Graphics public discussion <
> x3d-public at web3d.org>
> >> > Subject: Re: [x3d-public] 3D graphics, vertex attributes Tangent
> index and vector
> >> >
> >> >
> >> >
> >> > Please review Michalis’ response on this thread about tangentIndex
> and tangentPerVertex. I believe the corresponding normal fields apply.
> >> >
> >> > Level 5? That depends on updated standard.
> >> >
> >> > On Sat, May 17, 2025 at 2:04 PM Joe D Williams <joedwil at earthlink.net>
> wrote:
> >> >
> >> > * must have tangentIndex (unless tangentIndex same as normalIndex).
> >> >
> >> > * If no tangentIndex, coordIndex used?
> >> >
> >> > * tangentPerVertex? Can tangent be applied to vertex or face (like
> normal and color)?
> >> >
> >> > * must have tangent vector (may be auto filled).
> >> >
> >> > * Level 5 required since level 4 does not have tangent.
> >> >
> >> > Thanks,
> >> >
> >> > Joe
> >> >
> >> >
> >> >
> >> > -----Original Message-----
> >> > From: John Carlson <yottzumm at gmail.com>
> >> > Sent: May 16, 2025 10:32 PM
> >> > To: Extensible 3D (X3D) Graphics public discussion <
> x3d-public at web3d.org>
> >> > Cc: Joe D Williams <joedwil at earthlink.net>
> >> > Subject: Re: [x3d-public] 3D graphics, vertex attributes Tangent
> index and vector
> >> >
> >> >
> >> >
> >> > Joe,
> >> >
> >> > X_ITE IFS:
> >> >
> >> >
> https://create3000.github.io/x_ite/components/geometry3d/indexedfaceset/
> >> >
> >> > Summary, only tangent field.
> >> > John
> >> >
> >> > On Fri, May 16, 2025 at 8:59 PM Joe D Williams via x3d-public <
> x3d-public at web3d.org> wrote:
> >> >
> >> > like for normals, is there a tangentPerVertex true/false where
> tangent value
> >> >
> >> > is associated with vertex or face?
> >> >
> >> > If tangentIndex null, is coordIndex used?
> >> >
> >> > If Tangent vector null tangents are generated after Normal vector?
> >> >
> >> >
> >> >
> >> > Thanks,
> >> >
> >> > Joe
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > -----Original Message-----
> >> > From: Extensible 3D (X3D) Graphics public discussion <
> x3d-public at web3d.org>
> >> > Sent: May 15, 2025 6:19 AM
> >> > To: X3D <x3d-public at web3d.org>
> >> > Cc: Holger Seelig <holger.seelig at yahoo.de>
> >> > Subject: Re: [x3d-public] 3D graphics, vertex attributes Tangent
> index and vector
> >> >
> >> >
> >> >
> >> > There are also glTF tests for tangents:
> >> >
> >> > Geometry with tangent node:
> >> >
> https://create3000.github.io/x_ite/laboratory/gltf-sample-viewer/?url=https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/NormalTangentMirrorTest/glTF/NormalTangentMirrorTest.gltf
> >> >
> >> > Geometry without tangent node (auto generated tangents using
> MikkTSpace algorithm):
> >> >
> https://create3000.github.io/x_ite/laboratory/gltf-sample-viewer/?url=https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/NormalTangentTest/glTF/NormalTangentTest.gltf
> >> >
> >> > The reflection in all half spheres should look the same.
> >> > Turn on IBL (Image Based Lighting).
> >> >
> >> > Best regards,
> >> > Holger
> >> >
> >> > --
> >> > Holger Seelig
> >> > Leipzig, Germany
> >> >
> >> > holger.seelig at yahoo.de
> >> > https://create3000.github.io/x_ite/
> >> > https://patreon.com/X_ITE
> >> >
> >> >
> >> > Am 15.05.2025 um 10:35 schrieb Holger Seelig via x3d-public <
> x3d-public at web3d.org>:
> >> > All nodes which have a normal field also have a tangent field in
> X_ITE, because tangents are very important for PhysicalMaterial to render
> correctly. Because tangents always come in conjunction with normals,
> normalPerVertex field is also used for tangents.
> >> >
> >> > If there is no Tangent node, the MikkTSpace algorithm is used to
> generate tangent vectors, as need by the glTF specification.
> >> >
> >> > If there is a Tangent node and the vector field is empty, results are
> undefined.
> >> >
> >> > Tangent node:
> >> > https://create3000.github.io/x_ite/components/rendering/tangent/
> >> >
> >> > IndexedFaceSet with tangent field:
> >> >
> https://create3000.github.io/x_ite/components/geometry3d/indexedfaceset/#fields-tangent
> >> >
> >> > Best regards,
> >> > Holger
> >> >
> >> > --
> >> > Holger Seelig
> >> > Leipzig, Germany
> >> >
> >> > holger.seelig at yahoo.de
> >> > https://create3000.github.io/x_ite/
> >> > https://patreon.com/X_ITE
> >> >
> >> >
> >> > Am 15.05.2025 um 10:24 schrieb Michalis Kamburelis <
> michalis.kambi at gmail.com>:
> >> > I don't know about Tangent in X_ITE...
> >> >
> >> > But in Castle Game Engine we have a similar extension -- Tangent node
> ( https://castle-engine.io/x3d_implementation_rendering_extensions.php ).
> Looks like we developed it independently from X_ITE :) It certainly makes
> sense to have a node that carry this information, to have perfect
> rendering. (Tangents can be auto-calculated, but there are various details
> in the auto-calculation algorithm that various renderers may do a bit
> differently. When the 3D author used "baking" to make a normalmap texture,
> it's better to use exact same tangents as known by the 3D authoring tool.)
> >> >
> >> > At least for Castle Game Engine, the answer is: if the Tangent node
> is not present, but we need tangents (e.g. for bump mapping), then the
> tangent vectors are calculated to match the normal vectors. So there's no
> additional tangentPerVertex or tangentIndex, they would not make sense. By
> knowing the normal vectors, by know all we need to generate reasonable
> tangent vectors.
> >> >
> >> > See
> https://castle-engine.io/x3d_implementation_rendering_extensions.php for
> more details.
> >> >
> >> > Regards,
> >> > Michalis
> >> >
> >> > czw., 15 maj 2025 o 07:43 John Carlson via x3d-public <
> x3d-public at web3d.org> napisał(a):
> >> >
> >> > Note, it’s Tangent vector=… not Tangent point=…
> >> >
> >> > John
> >> >
> >> > On Thu, May 15, 2025 at 12:38 AM John Carlson <yottzumm at gmail.com>
> wrote:
> >> >
> >> > I’d ask Holger, cc’d
> >> >
> >> > I’ve not used Tangent, myself.
> >> >
> >> > X_ITE Supports up to Level 4, so I guess you’re proposing a new level
> 5 for the Geometry 3D component?
> >> >
> >> > Look at X_ITE IFS:
> >> >
> >> > <IMG_0516.png>
> >> >
> >> > Maybe check Holger’s create3000 Library for examples?
> >> >
> >> > To retrieve examples, last time I tried:
> >> >
> >> > git clone https://github.com/create3000/Library
> >> > Online at:
> >> >
> >> > https://github.com/create3000/Library
> >> > Let’s get v2 Joe Kick out the door, check v2 finger joints, and make
> sure all joints have converted to v2.
> >> >
> >> > John
> >> >
> >> > On Wed, May 14, 2025 at 10:45 PM Joe D Williams <
> joedwil at earthlink.net> wrote:
> >> >
> >> >
> >> >
> >> > Main questions, in IFS Level5:
> >> > Is a default tangent generated if Tangent point="" field empty?
> >> > tangentPerVertex? assigned to vertex or face?
> >> > tangentIndex? If no tangentIndex is coordIndex used?
> >> >
> >> >
> >> >
> >> > Thanks,
> >> > Joe
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > -----Original Message-----
> >> > From: John Carlson <yottzumm at gmail.com>
> >> > Sent: May 14, 2025 3:00 PM
> >> > To: Extensible 3D (X3D) Graphics public discussion <
> x3d-public at web3d.org>
> >> > Cc: Joe D Williams <joedwil at earthlink.net>
> >> > Subject: Re: [x3d-public] 3D graphics, vertex attributes
> >> >
> >> >
> >> >
> >> > Joe,
> >> >
> >> > X_ITE has a tangent node:
> >> >
> >> > Tangent | X_ITE X3D Browser
> >> >
> >> > Enjoy!
> >> >
> >> > John
> >> >
> >> > On Wed, May 14, 2025 at 4:46 PM Joe D Williams via x3d-public <
> x3d-public at web3d.org> wrote:
> >> >
> >> > From this:
> >> >
> >> >
> https://docs.google.com/document/d/1hCetnGIkut_dyt4mwkDSTNiLTbrVg1jLo_EArE74DRg/edit?tab=t.0
> >> >
> >> >
> >> > In 3D graphics, vertex attributes define per-vertex data necessary
> >> > for rendering, animation, shading, and so on.
> >> > These attributes include geometric properties such as
> >> > position, normal, tangents, texture mapping information (UV
> coordinates),
> >> > shading data (vertex colors), and
> >> > deformation information (skinning weights and blend shapes).
> >> >
> >> >
> >> > In this discussion of vertex attributes, the only one I don't recall
> >> > seeing in X3D is tangent?
> >> >
> >> > Associated with this work:
> >> >
> https://docs.google.com/spreadsheets/d/18d1qy4jx-d_kLsam-JQAzig23w7dTau0Moe7M32lVvk/edit?gid=0#gid=0
> >> >
> >> >
> >> > Thanks,
> >> > Joe
> >> >
> >> >
> >> > _______________________________________________
> >> > x3d-public mailing list
> >> > x3d-public at web3d.org
> >> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > x3d-public mailing list
> >> > x3d-public at web3d.org
> >> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> >> >
> >> > _______________________________________________
> >> > x3d-public mailing list
> >> > x3d-public at web3d.org
> >> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > x3d-public mailing list
> >> > x3d-public at web3d.org
> >> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > x3d-public mailing list
> >> > x3d-public at web3d.org
> >> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20250523/d6059ac0/attachment-0001.html>
More information about the x3d-public
mailing list