Contents

bentNormal

The bent normal map for the entity.

Declaration

var bentNormal: PhysicallyBasedMaterial.BentNormal { get set }

Discussion

Bent normal mapping describes the average direction of least occlusion at each surface point. This is used to modulate lighting intensity and direction of the material. Use with ambient occlusion to improve the accuracy of indirect diffuse lighting. You can generate bent normals maps from a 3D software package.

The following code loads a bent normal map texture and uses it to set this property:

if let bentNormalResource = try? TextureResource.load(named:"entity_bentNormalMap") {
    let bentNormalMap = PhysicallyBasedMaterial.Texture(bentNormalResource)
    material.bentNormal = .init(texture: bentNormalMap)
}

See Also

Configuring occlusion shading