GlTF PBR

From OpenSimulator

Jump to: navigation, search


Automatically translated

Contents

GlTF PBR Materials in OpenSim

This page is inspired by the Secondlife.com wiki PBR Materials but is not a direct translation.

This guide aims to help you get started with PBR materials in OpenSim and help you utilize the full potential of this new technology. Have fun creating and exploring!

Introduction

Physically Based Rendering (PBR) allows for the creation of realistic materials by using physically based values. To recreate real-world materials in PBR, reference libraries can be used to provide the necessary values.

What is it and why is it used?

The term "Physically Based Rendering" (PBR) refers to complex mathematical algorithms that simulate the behavior of light in the real world. These algorithms allow for precise reproduction of how light is reflected and interacts with objects. This technology is crucial for creating realistic and immersive virtual environments, whether in films, games, or virtual worlds like OpenSim.

In the real world, we recognize a metallic object by its light reflections as "metallic." PBR allows these physical principles to be applied in the virtual world, enhancing the visual authenticity and understanding of materials in virtual environments.

Impact on Users

The introduction of PBR in OpenSim means a significant improvement in visual quality and immersion. Existing content can appear more realistic through an environmental reflection system and tone mapping. Objects that already had a shiny effect will now show environmental reflections, leading to a notable visual enhancement.

Tone mapping using the Academy Color Encoding System (ACES) improves color saturation and reduces the loss of detail in shadows and highlights. These changes are part of an ongoing process to modernize and standardize visual representation in OpenSim.

Changes for Content Creators

Name Changes: As part of the PBR project, some terms have been adjusted. Materials are now referred to as Blinn Phong. However, this does not reflect fundamental changes to the underlying rendering techniques, except for those mentioned above.

Material Editing: With the introduction of PBR materials, a new inventory category is available to creators, allowing them to create and edit materials. PBR materials are delivered as texture bundles that can be applied and adjusted as a unit.

Limited Advanced Graphics Options: Some advanced graphics options, such as atmospheric shaders and local lights, have been removed to optimize performance on various hardware configurations. Users with older hardware can adjust their settings to ensure acceptable performance.

Conclusion

The integration of PBR materials into OpenSim is a significant step towards improving visual quality and optimizing the creation process for content creators. This technology allows for the creation of realistic and immersive environments that benefit both users and creators.

Physically Based Rendering (PBR)

What is it and why is it used?

Physically Based Rendering (PBR) uses complex mathematical algorithms to realistically simulate the behavior of light. This technique enables precise representation of how light is reflected and absorbed by different materials. The goal is to create more realistic and immersive environments in virtual worlds that closely resemble our real-world experiences with materials.

Impact on Users

Changes to Existing Content

The most significant change is the introduction of an environmental reflection system in OpenSim. Existing objects may appear more reflective with the new graphics settings. Particularly shiny objects will benefit the most from the new environmental reflections and appear more realistic.

Tone mapping is another important innovation. It enables the display of images with a higher dynamic range, making colors richer and details in shadows and highlights more visible. The tone mapping method used is the Academy Color Encoding System (ACES).

Changes for Creators

Name Changes

As part of the PBR project, some terms have been adjusted. Materials are now referred to as Blinn Phong, although the underlying technique remains the same. However, Blinn Phong is not identical to the PBR Spec/Gloss workflows used in some game engines like Unity.

Material Editing

With the introduction of PBR materials, a new inventory category is available to creators. PBR materials are delivered as texture bundles and can be applied and adjusted as a unit.

Drag and Drop Functionality

PBR materials can easily be dragged and dropped onto the surface of a prim or mesh. For example, a tile floor material can be dragged onto the surface of a selected prim, making that surface look like a real tile floor and reflect light accordingly.

Alternatively, you can select the surface of a prim or mesh, change the dropdown menu from "Blinn Phong" to "PBR Metallic Roughness," and then select and apply a material from the inventory.

Texture Transforms

With PBR materials, texture transforms work slightly differently than Blinn Phong transforms. While Blinn Phong (and OpenGL) textures have their origin in the bottom left corner, glTF materials (and Vulkan) have their origin in the top left corner. This means that PBR materials are inverted in the Y-axis (glTF v). A simple solution for converting Blinn Phong texture transforms to PBR texture transforms can be found in this [forum thread](#).

Media on a Prim

Media on a Prim (MOAP) will continue to function as usual. If a MOAP is applied to a surface with a PBR texture, the media texture acts as an override for the base color and emission maps. To disable the emission map, you can set the emission color to black (<0,0,0>).

PBR Stand-In Textures and Outdated Viewers

During the introduction of a new system, many OpenSim users may use viewers that do not yet support the new PBR system. Such users will see the underlying non-PBR texture. It is recommended to create and apply a diffuse texture before applying the PBR material so that the object is visible to all users.

Important: Once a PBR material has been applied, the Blinn Phong textures cannot be updated. To fix this, the PBR material must be removed, the Blinn Phong textures changed, and then the PBR material reapplied.

Understanding and Utilizing the New Reflection System

Creators working on house-scale projects or producing walkthrough objects can gain additional control over the lighting in their creations by understanding the new toolkit that influences environmental reflections. There is a new type of volume that can be added to object linksets to define custom areas for reflections.

When Should a Reflection Probe be Created?

Manually placed probes are useful for cleaning up unwanted noise and lighting from automatically placed probes. Reflection probes should be placed in a way that the fewest number of probes cover the largest space with minimal overlap.

Creating a Reflection Probe Volume

1. Open the Build menu (Ctrl+3) and create a simple prim. 2. Under the "Features" tab, check the "Reflection Probe" checkbox. 3. Choose the shape of the probe volume (box or sphere) and adjust the size accordingly. 4. Name the probes for later identification.

Fine-tuning Reflection Probe Volumes

General Information

Reflection probe volumes are a powerful tool for creating realistic reflections in 3D environments. To use them optimally, there are specific guidelines and limitations to be aware of.

Behavior and Limitations

Scaling and Position: Reflection probe volumes respond only to changes in scaling and position. Parameters such as "Hollow," "Taper," "Shear": These options do not affect the sampling area. Near Clip: Can be visualized as hollowing out your reflection probe volume but is not linked to the hollow function.

Probe Types

1. Box Probes:

Affected by position and non-uniform scaling.
Example: A box probe scaled to 10m x 30m x 10m affects the entire volume within those dimensions.

2. Sphere Probes:

Affected by position and uniform scaling; non-uniform scaling uses the smallest dimension.
Example: A sphere probe scaled to 10m x 30m x 10m samples a spherical volume with a 10-meter diameter, while a 30m x 30m x 30m sphere samples a volume with a 30-meter diameter.

Reflection Probe Ambient

The reflection probe ambient controls the interaction between the ambient light in the environment and the content of the reflection probe:

0: Full intensity of the environment's ambient color. 0 < Value < 1: Mixes the environment's ambient color and probe irradiance (indirect lighting) in proportion to the defined value (e.g., 0.5 is a 50/50 mix). 1 or higher: Blocks the application of the environment's ambient color within the probe volume, and the irradiance is applied at full intensity (or with a multiplier for values over 1). 4 or higher: Works as above, but only indirect lighting from the sky is multiplied by a value over 4. Local lights are limited to 4.0.

Placing Complex Reflection Probes

Sometimes you want to place a reflection probe in an area where the probe types (sphere or box) do not fit the shape of the area. For example, a box probe in a loft space has a triangular shape, leading to "probe bleeding," where the influence volume affects a larger area than needed and bleeds into the exterior roof, which is undesirable.

In these cases, you may need to place multiple probes to mix the sampling volumes and achieve the desired result. In the loft space example, it's best to start with 3 box probes covering the floor and each side of the roof. Then use an additional box probe as a "fill" to close the gap between the 3 probes. The main fill probe may need to be rotated at an angle to achieve maximum coverage. If it's not possible to close the gap between the 3 probes with this fill probe, additional box probes as "secondary fill" should be added.

Alternatively, sphere probes can be used to achieve the same result. Sphere probes have a

reduced surface area but require more of them to cover the same volume. This results in cleaner but less accurate reflections. Be aware that multiple probes are needed to cover the same volume as a single box probe.

Method 1: Direct Upload of a glTF File

The most convenient way to create a new material is to directly upload a glTF file from your computer. This is accessible via: Build > Upload > Material...

1. Select a .GLB or .GLTF file from your computer and open it. 2. The layout of the PBR material creation and editing interface appears. 3. All editable material properties are integrated into a vertically scalable window. 4. By clicking on "Save," the upload fees are paid, and the material assets are created using the local file name. With "Save As..." you can give all assets unique names in the inworld name. 5. Textures are uploaded to the inventory in the "Textures" folder (NoMod, NoCopy, Transfer) with an added "type" in the name. The PBR object is uploaded in the "Material" folder (Mod, NoCopy, Transfer) with the added text (Material).

Important: Each individual texture used to create the material object is charged separately.

Method 2: Editing an Empty Material. Creating PBR Materials Without a glTF File

If you have the required textures to create a PBR material but no glTF file, you need to create a material from the inventory.

1. Make sure your textures are in the correct format, with the right data in the appropriate channels. 2. Upload your textures as usual. 3. Find the "Materials" folder in your inventory, right-click and select "New Material" from the context menu. 4. Name your new material accordingly. 5. Right-click on your new material and select "Open." 6. Upload your PBR textures using the standard texture workflow (usually under Build > Upload > Image). 7. In the material window, select the appropriate maps you just uploaded.

Warning: Do not attempt to place a Blinn Phong "Diffuse" texture in the "Base Color" slot or a Blinn Phong "Specular" texture in the "Metallic/Roughness" slot. This will not produce desired results and will not generate warnings, as there is no way to check if you inserted the correct texture type into the inputs.

8. Verify the material parameters. 9. Save your new material. 10. Either drag the material onto a rendered prim or edit the prim, click the "Blinn Phong" dropdown menu, select "PBR Metallic Roughness" and choose your new material from the inventory.

Creating Color Variants

If, as a store owner, you want to release more than one color palette for your creation, it is important not to upload a new glTF file for each variant. Since usually only the base color changes, you can upload the additional base color textures separately and change the material in edit mode.

Parameter "Double-Sided": Usage and Risks

"Double-Sided" is a new parameter that applies the material to both the outside and inside of a surface. This should only be used for specific meshes, as it can otherwise cause additional viewer lag.

OSSL Scripting

GLTF Material Script Guide for OpenSim

This allows setting GLTF material attributes of a prim in OpenSim.

Guide:

  • PRIM_RENDER_MATERIAL:
       Command: PRIM_RENDER_MATERIAL
       Parameters: [ PRIM_RENDER_MATERIAL, integer face, string render_material ]
       Description: Sets the render material of the prim. This command removes most other PRIM_GLTF_* properties of the surface, except repeats, offsets, and rotation_in_radians.
  • PRIM_GLTF_BASE_COLOR:
       Command: PRIM_GLTF_BASE_COLOR
       Parameters: [ PRIM_GLTF_BASE_COLOR, integer face ]
       Description: Sets the GLTF material base color mapping attributes of the prim. These settings are GLTF overrides.
  • PRIM_GLTF_ALPHA_MODE:
       0 - PRIM_GLTF_ALPHA_MODE_OPAQUE:
           Description: Ignores the alpha value and renders the material opaque.
       1 - PRIM_GLTF_ALPHA_MODE_BLEND:
           Description: Renders the material with transparency based on the alpha value. Blending is done in linear color space.
       2 - PRIM_GLTF_ALPHA_MODE_MASK:
           Description: Renders the material as opaque if the alpha value is greater than the alpha cutoff; otherwise as fully transparent.
  • PRIM_GLTF_NORMAL:
       Command: PRIM_GLTF_NORMAL
       Parameters: [ PRIM_GLTF_NORMAL, integer face ]
       Description: Sets the GLTF material normal map attributes of the prim.
  • PRIM_GLTF_METALLIC_ROUGHNESS:
       Command: PRIM_GLTF_METALLIC_ROUGHNESS
       Parameters: [ PRIM_GLTF_METALLIC_ROUGHNESS, integer face ]
       Description: Sets the GLTF ORM map attributes (occlusion, roughness, metallic) of the prim.
  • PRIM_GLTF_EMISSIVE:
       Command: PRIM_GLTF_EMISSIVE
       Parameters: [ PRIM_GLTF_EMISSIVE, integer face ]
       Description: Sets the GLTF material emissive map attributes of the prim.

Notes:

Ensure that you set the parameters correctly to achieve the desired appearance of the prim.

Follow the specific instructions for each parameter to achieve the desired effects.

Personal tools
General
About This Wiki