[x3d-public] 3D graphics, vertex attributes Tangent index and vector

Michalis Kamburelis michalis.kambi at gmail.com
Sun May 18 17:37:51 PDT 2025


Let me try to clear some terminology and give some hints to understand
these terms:

1. "Baking" means you create a texture with some properties by using
some renderer (which may not be a real-time renderer, maybe it's 3D
authoring tool slow-but-pretty renderer, like Blender's non-real-time
renderers) to calculate some surface properties.

    "Baking" is a general term, you can "bake" many parameters that
some renderer can calculate for a surface. For example, you can bake
normals (from high-poly mesh to low-poly). Or bake lighting (to make
specular highlights or shadows "baked" in a texture). Or bake "ambient
occlusion". In all cases, the goal is to express something
"computationally expensive" as a simple texture and thus make it
possible to be used in "real-time renderers" (like typical X3D
browsers).

    To really understand what it is, I advise to just use it. It's a
feature of Blender and many other 3D authoring tools, and 3D artists
routinely use it. See
https://docs.blender.org/manual/en/latest/render/cycles/baking.html .
On https://castle-engine.io/blender I document both baking normalmaps
and baking lighting in Blender.

2. "Baking normalmaps" is a specific case of "baking" used to create a
normalmap (texture with encoded normals), useful for bump mapping,
e.g. X3D normalTexture (in both Material and PhysicalMaterial).

    Again, you can do this from Blender or any other 3D authoring
tool. Just try it :) See links above for descriptions how. Searching
the Internet or even YouTube for "blender normalmap baking" or the
like will yield some results :)

3. "Tangents" are values you need to know (as well as "normals") to
generate as well as later render (use) the normalmap.

4. "MikkTSpace" is one algorithm, rather standard but not the only one
(e.g. CGE has custom algorithm, though similar) to calculate tangents.
https://github.com/mmikk/MikkTSpace , http://www.mikktspace.com/ .

5. X3D browsers already have a notion of tangents, since you must know
tangents for normalTexture. At Shape level 1 this is optional. At
Shape level 2 all PhysicalMaterial are already required, so X3D
browsers must implement normal map handling (== bump mapping) so they
must know tangents (auto-calculated or derived from "Tangent" node).

6. The "Tangent" node, in CGE and X_ITE, allows us to avoid the
recalculation of tangents and to use the exact same tangents as were
used during the "baking normalmap" process. This is both good for
loading speed, and for using the normalmap such that it looks
perfectly right.

Regards,
Michalis

pon., 19 maj 2025 o 02:06 Joe D Williams via x3d-public
<x3d-public at web3d.org> napisał(a):



>
> Hi All,
>
> Does the relief effect (bump mapping) depend upon the length of the Tangent vector?
>
> Thanks,
>
> Joe
>
>
>
> -----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



More information about the x3d-public mailing list