# 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.

## 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.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your Docs generative AI assistant. Ask me anything about HOOPS Visualize Web or choose a sample question below to start a conversation:

What is HOOPS Visualize Web?
What are the latest release notes for HOOPS Visualize Web?
How do I start evaluating HOOPS Visualize Web?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...