# Support for new Tangent node in X3D, with vectors as 4D, better aligned with glTF

**URL:** https://forum.castle-engine.io/t/support-for-new-tangent-node-in-x3d-with-vectors-as-4d-better-aligned-with-gltf/1967
**Category:** News
**Created:** [July 9, 2025, 3:55pm UTC](https://forum.castle-engine.io/t/support-for-new-tangent-node-in-x3d-with-vectors-as-4d-better-aligned-with-gltf/1967 "2025-07-09T15:55:45Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [July 9, 2025, 3:55pm UTC](https://forum.castle-engine.io/t/support-for-new-tangent-node-in-x3d-with-vectors-as-4d-better-aligned-with-gltf/1967/1 "2025-07-09T15:55:45Z")

</div>

| [![Bump mapping with explicit tangent vectors. See https://github.com/castle-engine/demo-models/tree/master/gltf/tangents for info and credits.](https://forum.castle-engine.io/uploads/default/original/2X/3/310fb702ee57f6b7413342698726056da78c6cb9.png)](https://castle-engine.io/wp/wp-content/uploads/2025/07/scene_screenshot_castle_model_viewer.png "Bump mapping with explicit tangent vectors. See https://github.com/castle-engine/demo-models/tree/master/gltf/tangents for info and credits.") |
| [![Bump mapping with explicit tangent vectors. See https://github.com/castle-engine/demo-models/tree/master/gltf/tangents for info and credits.](https://forum.castle-engine.io/uploads/default/original/2X/3/307e29e194630a2bada7373c34fa77fe878e5efb.png)](https://castle-engine.io/wp/wp-content/uploads/2025/07/scene_screenshot_castle_model_viewer-1.png "Bump mapping with explicit tangent vectors. See https://github.com/castle-engine/demo-models/tree/master/gltf/tangents for info and credits.") |
| [![Bump mapping with explicit tangent vectors. See https://github.com/castle-engine/demo-models/tree/master/gltf/tangents for info and credits.](https://forum.castle-engine.io/uploads/default/original/2X/4/404c8d89096cebe93c6e277c8b56aa58c3fa7fa4.png)](https://castle-engine.io/wp/wp-content/uploads/2025/07/scene_screenshot_castle_model_viewer-2.png "Bump mapping with explicit tangent vectors. See https://github.com/castle-engine/demo-models/tree/master/gltf/tangents for info and credits.") |
| [![Tangent vectors test from Khronos sample assets](https://forum.castle-engine.io/uploads/default/original/2X/e/ef854ff679b47c1799c723a96be407a339f97443.png)](https://castle-engine.io/wp/wp-content/uploads/2025/07/NormalTangentMirrorTest_0.png "Tangent vectors test from Khronos sample assets") |

The short version of this post, if you don’t want to go into technical details, is that one aspect of using _bump mapping_ is now better in _Castle Game Engine_. Our data transfer and logic is more efficient and more aligned with glTF and latest X3D specifications.

And if you still don’t want to go into technical details, you can [clone our demo-models repository](https://github.com/castle-engine/demo-models) and open the models in subdirectory [bump\_mapping/tangents/](https://github.com/castle-engine/demo-models/tree/master/bump_mapping/tangents). There are 3 models there, and they are all available in both [glTF](https://castle-engine.io/gltf) and [X3D](https://castle-engine.io/x3d) model formats (`scene.gltf`, `scene.x3d`). Open them using the latest [Castle Model Viewer snapshot (5.3.0)](https://castle-engine.io/castle-model-viewer) and they should work equally well and pretty.

You can also [clone glTF-Sample-Assets](https://github.com/KhronosGroup/glTF-Sample-Assets/) and open the testcase [NormalTangentMirrorTest](https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/NormalTangentMirrorTest) there and observe that we handle it correctly (well, as much as we can without [environment lighting](https://castle-engine.io/roadmap#_environment_lighting)).

You can also watch our old video about [using normalmaps with Blender and Castle Game Engine](https://www.youtube.com/watch?v=3dA8IT8C_Js). When using _normal maps_, you do _bump mapping_ and then exporting your models with _tangent vectors_ makes sense. It’s literally one checkbox when doing Blender-\>glTF export.

An if you’re still reading, time’s out! Now I assume you _want to go into technical details_ 🙂 So what are _tangents_ and what’s going on?

- To make _bump mapping_ look good, the 3D models may provide explicit information about the _tangent vectors_ at the surface.

- Our [proposal of Tangent node](https://github.com/michaliskambi/x3d-tests/wiki/Tangent-node-in-X3D) contains a good explanation what _tangent vectors_ are and why do we recommend to provide them in 3D models (if you use bump mapping). In short, tangent vectors, along with normal vectors, define the _tangent coordinate space_ in which the values of the _normal map_ are provided. Whatever process you use to create normal maps (most of you _bake_ normal maps), it’s best to provide to the rendering engine the same tangent vectors as have been assumed when creating the normal map. In other words, simplifying, it’s best if [Blender](https://castle-engine.io/blender) calculates tangent vectors, and uses the same tangent vectors for normalmap baking and passes the same vectors to glTF.

- glTF standard defines how to store tangent vectors, Blender-\>glTF exporter can generate them, and we read the information from glTF, and convert it into X3D `Tangent` node.

- We already had `Tangent` node in our engine for some time, but with a definition that had a small simplification: I defined the vectors there as _3D, right-handed_. In contrast, glTF defines them as _4D, with XYZ designating direction, and W designating the handedness_. We think the glTF idea is quite smart and useful 🙂

- We have recently recommended to add `Tangent` node to the X3D spec, [the proposal is here](https://github.com/michaliskambi/x3d-tests/wiki/Tangent-node-in-X3D). While adding to X3D, we also proposed to add them in a version more aligned with glTF, so 4D.

- Of note is that [X\_ITE](https://create3000.github.io/x_ite/), another cool open-source X3D viewer, also has [compatible Tangent node](https://create3000.github.io/x_ite/components/rendering/tangent/). With 4D, matching also glTF. So after this, we’re all better aligned.

- The new [X3D prose about Tangent node is here](https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD//Part01/components/rendering.html#Tangent).

- And to close the circle, the _Castle Game Engine_ has now adopted this `Tangent` node specification with 4D vectors. This means we display X3D models with the new `Tangent` node, and when reading glTF we convert the glTF -\> X3D information in the trivial way (glTF 4D tangents -\> X3D 4D tangents).

Does anyone still follow? 🙂 Hopefully above was a good summary and link to hopefully useful resources.

If you like what we do, in _Castle Game Engine_ but also around standardization efforts like [X3D](https://castle-engine.io/x3d), we always appreciate your [donations](https://castle-engine.io/donate). Thank you!

---

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [July 9, 2025, 4:09pm UTC](https://forum.castle-engine.io/t/support-for-new-tangent-node-in-x3d-with-vectors-as-4d-better-aligned-with-gltf/1967/2 "2025-07-09T16:09:57Z")

</div>


