Physically Based Rendering

Physically Based Rendering (PBR) is supported as of HOOPS Communicator SP1, enabling application developers to provide enhanced rendering realism by calculating the natural interaction of light and materials. PBR materials are created automatically for glTF files converted using the underlying HOOPS Exchange API. Currently supported parameters include occlusion, color, alpha mode, metallness, roughness, emissive factor and image based lighting.

By default, image-based lighting is enabled and should be visible on any model converted from glTF. The source image must be a cube map in KTX2 format with a space-separated list of spherical harmonics cooefficients stored under the “sh” metadata key. You can determine whether image-based lighting is enabled for physically-based materials with getImageBasedLightingEnabled().

You can load a model containing glTF occlusion maps into the Web Viewer. The additional shading and lighiting will be applied to the texture. When material has an occlusion map, the map will take priority over the screen ambient occlusion.

../../../../_images/occlusion_map_example.png

Metallic and roughness

For a set of nodes, you can set a metallic and roughness factor using Communicator.Model.setMetallicRoughness() and retrieve the values with Communicator.Model.getMetallicRoughness().

Set metallic and roughness factors

let nodeIDs = [20];
let metallicFactor = 1;
let roughnessFactor = 0.1;
 
hwv.model.setMetallicRoughness(nodeIDs, metallicFactor, roughnessFactor);

Providing the root node ID of a model will apply the metallic and roughness factor the the entire model.

Get metallic and roughness factors

let result = await hwv.model.getMetallicRoughness(nodeIDs);

If no values were set, then null will be returned.