Add anisotropy support to PrincipledMaterial


Anisotropy stretches the specular highlight along one direction of the
surface, which is what makes brushed metal, hair and vinyl reflect in
bands rather than in points. It is not an extra lobe: it replaces the
distribution and visibility terms of the existing specular lobe with
the anisotropic forms of the glTF KHR_materials_anisotropy extension.
Image based lighting uses the bent normal approximation the extension
recommends, so probe reflections stretch along with the highlight.

It is controlled by anisotropyStrength, anisotropyRotation and
anisotropyMap. The map has the fixed channel layout of the extension
(direction in red and green, strength in blue), so it has no channel
property. The rotation is in degrees like the other angles in the API.
A strength of zero, the default, leaves the generated shader unchanged
for existing materials. CustomMaterial can drive the effect through the
new ANISOTROPY_STRENGTH and ANISOTROPY_ROTATION keywords.

Anisotropy needs a tangent frame, which a mesh used from QML may not
have. The frame is requested whenever anisotropy is enabled, an
anisotropy map alone is enough to derive tangents from, and otherwise a
stable orthonormal basis is built from the normal. The same basis is
used when a map texel gives a zero direction, which would otherwise
turn the model black.

[ChangeLog][PrincipledMaterial] Added the anisotropyStrength,
anisotropyRotation and anisotropyMap properties, which stretch the
specular highlight along one direction of the surface.

Task-number: QTBUG-148677
Change-Id: If95f1f1f5a34371b5df970e3b0034b0533f1d3eb
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
commit8ec50afafd7e41cbcd5776a64168a4584e433097
parent2db4e25339151027c4ef1b63c0fe8c65758134e9
authorAndy Nichols <andy.nichols@qt.io>
committerAndy Nichols <andy.nichols@qt.io>
commit timeTue, 29 Sep 2026 11:22:26 +0000