Extensions introduced in Castle Game Engine related to rendering.
See also documentation of supported nodes of the Rendering component and X3D specification of the Rendering component.
Contents:
Tangent
node, X3DComposedGeometryNode.tangent
field)We add a new node:
Tangent : X3DGeometricPropertyNode { MFVec4f [in,out] vector [] }
This node can be used within the new field tangent
of X3DComposedGeometryNode
:
X3DComposedGeometryNode { ... SFNode [in,out] tangent NULL }
This node is not an extension anymore, it was adopted in the X3D 4.1 specification and is now part of the X3D standard. We have recommended it and helped with the prose and we're happy with the end result!
( To be precise, X3D 4.1 is only a draft spec version now. X3D 4.0 is the last officially approved X3D version, as of this writing, 2025-07. But, just like all previous X3D versions, sooner or later X3D 4.1 will be approved as well. )
When reading data from glTF, we automatically import glTF information about tangent vectors into this node.
While not strictly necessary, it is advised to put tangent vectors in X3D file when doing bump mapping (using Material.normalTexture, PhysicalMaterial.normalTexture fields). This way the X3D browser knows the tangent vectors, with exactly the same values as were used when generating ("baking") the normalmap texture. This, in turn, allows 1. perfectly correct rendering, 2. faster loading and animating of X3D files with bump mapping — as the tangent vectors don't have to be calculated.
When the Tangent
node is missing, but the relevant information is required
(e.g. for bump mapping) X3D browsers automatically calculate the tangent vectors.
Backward compatibility break at 2025-07-08: Our definition and implementation changed a bit on 2025-07-08: vector
field changed from MFVec3f
to MFVec4f
. We did recommend this change ourselves (we proposed to add MFVec4f
to X3D 4.1 spec, knowing it will imply a change in our extension), to be better aligned with glTF and X_ITE. The new 4th component is a sign value (-1 or +1) indicating handedness of the tangent basis. See the X3D 4.1 and glTF specifications for details.
X3DColorNode.mode
)We add a new field to X3DColorNode
(ancestor of Color
and ColorRGBA
that specify per-vertex colors):
X3DColorNode { ... SFString [] mode "REPLACE" # ["REPLACE","MODULATE"] }
"REPLACE"
is the default, and is compatible with X3D 3.
"MODULATE"
means to multiply per-vertex colors (with the same value as was replaced by `"REPLACE"`, like Material.diffuseColor
or PhysicalMaterial.baseColor
or UnlitMaterial.emissiveColor
, with alpha added from XxxMaterial.transparency
). This allows to achieve glTF-compatible behavior.