roughness
The amount the surface of the 3D object scatters reflected light.
Declaration
var roughness: PhysicallyBasedMaterial.Roughness { get set }Mentioned in
Discussion
The roughness property represents how much the surface of the entity scatters light it reflects. A material with a high roughness has a matte appearance, while one with a low roughness has a shiny appearance.
[Image]
Specify this property using a Float to represent a uniform roughness for the entire entity, or a UV-mapped grayscale image that uses shades of gray to represent the roughness of different parts of the entity. When using an image, black pixels represent areas that have a low roughness and appear shiny, while white represents areas that have a high roughness and display a matte finish.
If you initialize this property with a color image rather than a grayscale image, RealityKit only uses the intensity of the image’s red channel.
The following example uses a single value to specify roughness:
material.roughness = PhysicallyBasedMaterial.Roughness(floatLiteral: 0.0)The following example uses an image to specify roughness:
if let roughnessResource = try? TextureResource.load(named:
"entity_roughness") {
let roughness = MaterialParameters.Texture(roughnessResource)
material.roughness = PhysicallyBasedMaterial.Roughness(texture:roughness)
}