init(scale:texture:)
Creates a roughness object from a color or texture.
Declaration
init(scale: Float = 1.0, texture: PhysicallyBasedMaterial.Texture? = nil)Parameters
- scale:
The roughness value.
- texture:
An optional image texture.
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]
Use this initializer to create a new object from a single roughness value, from an image texture, or from both.
If you specify texture, RealityKit calculates the roughness for the entity by UV-mapping texture onto the entity and multiplying the value of each mapped pixel by scale. If you don’t specify texture, then RealityKit uses scale as the entire entity’s roughness. If you provide a color image for texture rather than a grayscale image, RealityKit only uses the intensity of the image’s red channel.