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 { MFVec3f [in,out] vector [] }
This node can be used within the new field tangent
of X3DComposedGeometryNode
:
X3DComposedGeometryNode { ... SFNode [in,out] tangent NULL }
If specified, this node holds tangent vectors information, necessary for bump mapping. The vector field should contain normalized tangent vectors, in the right-handed coordinate system.
The ordering of the tangent vectors is exactly the same as ordering of normal vectors would be, so e.g. X3DComposedGeometryNode.NormalPerVertex affects the interpretation of tangent vectors 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 should automatically calculate the tangent vectors.
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.