Theme:

Material

The global Material class is a custom material class which is used by default within Unia's rendering pipeline.


const props = {
    name: String,
    side: U.FrontSide or U.BackSide,
    opacity : 0-1,
    transparent: true/false,
    roughness: 0-1,
    metalness: 0-1
    lighting: 0-1, // 0 is flat shading, 1 is PBR
    alphaTest: 0-1,
    flipY: true/false, // whether to flip the map side vertical
    map: U.Texture,
    normalMap: U.Texture,
    envMap: U.Texture,
    color: U.Color or hex string e.g. '#FF0F0A'
}

object.material = new Material({color: '#ffaabbcc', lighting: 0.5})

to set make an object use a new material use:

object.setMaterial(someNewMaterial);

to update an material after changing any properties use:

object.material.lighting = 0.75;
object.material.transparent = true;
object.material.opacity = 0.5;
object.material.map = someTexture;

// use:
object.material.update();

You can still use other standard U materials but they will be automatically convered to use this class.