Physically Based Rendering [Work in Progress]
What is it and Why is it used?
The term “Physically Based Rendering” or “PBR” is a technical term that may need some defining for most people since its use is unique to composing images in computer software. The term itself is an abbreviation for a collection of complex mathematical algorithms that attempt to accurately represent the ways that light reflects off and interacts with objects in the real world. In the real world, it is the behavior of light on a piece of metal that allows us, the observer, to recognize “that object is made of metal” without actually reaching out and touching it. The way a metal reflects light differs from that of a polished plastic or some other material, and these differences have been quantified by science. By mimicking real-world physics principles in the virtual world it allows for the creation of more immersive recognizable realistic spaces, but also it helps us relate to fantastical worlds a little better too. While we may not be familiar with what a newly imagined creation is, a metal's inherent metal-ness and aged wood's inherent wood-ness remain constant, making it easier to intuitively understand what we are interacting with in a virtual environment.
Because tying the mathematics to simulate materials in virtual spaces to how they behave in the real-world makes things more immediately recognizable, PBR has become the foundation for creating imagined worlds over the last decade. The metallic shine of exoskeletal armor in superhero movies is driven by a PBR workflow, as is the plastic sheen of toys or the glint of frozen ice in animated classics. Now we are moving to bring this standardized quality to your home in Second Life.
Bringing PBR to Second Life means updating the basic calculations of how light is represented and interacts with the world of Second Life. The goal is to integrate these changes while minimally changing how everything that presently exists in Second Life that was designed prior to the introduction of PBR. While the preservation of creative intent and the aesthetic appeal of items users have enjoyed for over two decades of Second Life is always a priority, Second Life is an ever-evolving platform, and to continue to do so, some changes are inevitable.
Lastly, while we are attempting to mimic real-world reflections and material properties, Second Life has to run on a wide variety of devices, so some shortcuts have to be made. Reflections are not mirror-perfect, as has often been a long-standing hope and request from Residents. While the addition of a reflection system does bring dreams of distortion-free mirrors for our avatars in Second Life closer to reality, unfortunately, due to the calculation requirements of doing perfect reflections, mirrors are sadly still, for the moment, not practical. Please see the note in the section below for more info.
What does this mean for Residents?
Changes to Existing Content
The largest change by far is the addition of an environmental reflection system to Second Life. For most existing items, this change shouldn’t have a drastic, immediately observable impact. A few things in your inventory that you already own may appear more reflective with the new graphics configuration, and those reflections should feel more realistic and immersive with your current environment. As a general rule, the “shinier” an object was before, the more environment reflections it will pick up, and the more visual difference there will be.
Another notable change is the addition of tonemapping to the viewer. Tonemapping is a way of representing an image with a higher native dynamic range than the display can support - tonemapping is a de-facto requirement of PBR pipelines. This means that colors in Second Life will generally appear more saturated and less detail will be lost in shadows and highlights.
Removal of Advanced Lighting Model ( ALM ) Graphics Option
There have been changes to the [Advanced Settings] Graphics Options as well, the most notable of which is the removal of the “Atmospheric Shaders” and “Advanced Lighting Model” options.
For those users on lower-end hardware who depended heavily upon these options to navigate Second Life with an acceptable framerate, we recommend the following settings:
Transparent Water: '''Disabled'''
Screen Space Ambient Occlusion: '''Disabled'''
Screen Space Reflections: '''Disabled'''
Reflection Detail: '''Static Only'''
Reflection Coverage: '''Manual only'''
What does this mean for Creators?
The PBR project represents a large step towards integrating standard rendering techniques used in the games industry. As such, the nomenclature of some items has changed, notably, what was once called Materials is now referred to as Blinn-Phong. This does not represent any changes to the underlying rendering techniques (beyond those mentioned above); and as such Blinn-Phong is not the same as PBR Spec/Gloss workflows, seen in some game engines such as Unity.
Importing PBR Materials from External Software:
For creators who work with external tools such as Blender, Adobe Substance Painter, Cinema4D, 3D-Coat, or have used the Unreal or Godot game engines, the use of PBR texture sets should already be familiar. In fact, some creators have been using tools that use PBR workflows to create content for Second Life and then have been forced to sacrifice visual quality to convert that information into Second Life’s existing Blinn/Phong materials system. Second Life is adopting the “Metallic / Roughness” PBR model, and in its ongoing commitment to using Open Source standards whenever it is practical to do so, the glTF 2.0 file format has been chosen as the upload format for PBR Material assets. One of the primary goals of implementing PBR Materials is to have more continuity from content creation applications towards Second Life, and have more consistent content behavior, once it’s ready to be placed in the world.
Using Imported Materials in Second Life
For people who build exclusively within Second Life, the addition of PBR also means that there will be a new inventory item type called a “Material”. These new "Materials" are also purchasable on Marketplace and exchangeable like any other texture in Second Life.
PBR materials come as a bundle of textures and primitive parameters, such as face tint and specular color. These all travel as a single unit and are applied all at once. If you wish to change tint, transparency or other similar parameters that used to be readily available, you’ll need to modify the Material item itself.
|Important: Meshes uploaded after the PBR release will look slightly different (and more accurate to your editor of choice) due to a change in the way Second Life handles mesh tangents (Previously, tangents were discarded at upload time - this is no longer the case). This will mean that a PBR material applied to a mesh uploaded before PBR launched (TODO: Put date of launch here) might look incorrect; a simple reupload of the mesh will solve this. This is not required, but recommended.|
Applying existing materials works similarly to existing textures; you have two means of doing so:
Drag and Drop
Simply drag and drop onto the face of a prim or a mesh. For example, if you have a tiled floor material, and you place it on a prim cube, that cube face will now look like a tile floor and reflect light like a tiled floor would as well; as if the flat face of the cube had all the bumps of a tiled surface.
Switch to PBR and select from Inventory
Alternatively, select a face on the prim or mesh you want to apply your material to and choose the “Blinn-Phong” drop-down and change it to “PBR Metallic Roughness”, then select “Choose an item from your inventory” and apply.
As the PBR system is new, it is expected that existing users may be confused at first on how everything works. As such, Linden Lab and some third parties have made some tutorials, which can be found here:
- Second Life University - PBR Materials
- Second Life University - How to create PBR Materials
- Allegorithmic (Adobe) PBR Guide
PBR Stand-In Textures and Outdated Viewers
It is worth mentioning that during the adoption period of a new system, a substantial portion of Second Life Residents view the world through third party viewers and mobile viewer solutions that will not have updated to be able to see the new content. Anyone viewing a PBR Material on a viewer that cannot display it will see the “underlying” non-PBR texture. By default, this is a pine box or a completely blank texture. Those who wish their content to be viewable by as many people as possible, might consider creating a Diffuse texture ( with baked lighting, the kind that is easily generated with tools like Substance Painter's “Baked Lighting Filter” ) and applying it as a regular texture to the object they’re placing the PBR material on, prior to applying the PBR material. While this is an extra step in content creation, and complicates things somewhat, if you wish for your content to be appreciated by all, it’s worth considering adding this extra step to your workflow. People designing PBR materials for distribution and sale might also consider offering a “Diffuse Only fallback” texture to accompany the PBR material specifically for people who cannot see the PBR content.
Understanding and Assisting the New Reflections System
Those creators that work at house-scale, or produce items that can be walked through, can gain additional control over the lighting in their creations by taking the time to fully understand the new toolkit that influences environmental reflections. There is a new type of volume that can be created and appended to object linksets specifically for scenes with these kinds of spaces. These volumes define a custom area where reflections are calculated, overriding the default solution. So-called “Reflection Probes” should be placed in a manner such that the fewest number of probes fills the largest amount of space possible with minimal overlap. One probe per room is a good reference point for a general living space like a house. If multiple probes exist in a given area they can cause visual artifacts and negatively impact performance (also known as viewer lag). Do not affix reflection probes to small creations such as furniture or decor. Small items such as tables, chairs, musical instruments, candle sticks etc should use the reflection sample volume in the space in which they are placed. They should not have one appended. It is strongly recommended that any object that contains a reflection sample probe be left as “modify”, so the positioning of the probe can be adjusted or even removed by the owner of the item should they wish.
Editor note: Reflection probes are not intended for use with planar mirrors, and will look incorrect when being used to do so. Planar mirrors have been flagged for future work, but are not directly in the scope of the PBR project.
When is it Recommended to Create a Reflection Probe?
Manually placed probes are good for cleaning up undesirable noise and lighting from automatically placed probes that may be visually disruptive or confusing. If you look in the image of the room in a house, on the left hand side of it, you can see a blue tint on the floor, which is the reflected blue light from the sky. The probe filling half the room blocks this, and when it is extended to completely fill the room and just slightly beyond the thickness of the walls, (lower copy of the image) the problem is solved. The probe does not need to be a part of the link-set for the rest of the room in order to function; however, once you have them placed it’s possible to add them into link-sets like any other prim.
Constructing a Reflection Sample Volume ( AKA Reflection Probe )
Start off in the Build Menu (Ctrl+3) by rezzing a basic prim. Under the
Features tab, at the bottom check the box labelled
- Reflection Probe: Enabling this creates a Reflection Sampling Volume within the bounding box of the prim.
- Box / Sphere Drop-down: Choose whether you want this sampler to project reflections within a box shaped volume or a spherical one.
- Dynamic: Forces the reflection sampler to update this one more frequently. Also adds the ability to capture avatars in the reflection.
- Ambiance: Affects how much objects within the volume are lit as if they have bounced light hitting them from faked indirect illumination.
- Near Clip: Sometimes, there will be a large obstruction in the center of the volume you wish to use as a reflection probe. For example, suppose that there is a large architectural supporting structure in the middle of the room, such as a column; if the probe gets placed internally inside this, it will reflect the internal surface of the column instead of the room in which it is placed. Increasing Near Clip will make the sampling volume exclude objects N meters from the center so they don’t get included in the reflection.
The viewer will then pop up a message warning you that this will change the prim to be invisible and phantom, and will change shape. Click
Select an appropriate probe shape for your scene. For example, if you want to create a reflection probe that covers a room, select a
Box shape, or for other objects a
Sphere shape is recommended.
Move the reflection probe and resize it as necessary to fit your desired purpose. For the room example, resize the box so the probe just touches the walls, ceiling and floor of the room.
Naming your probes is also recommended, so other people ( or yourself later on ) will remember why there’s a large transparent prim in the middle of your build.
If you wish to come back and edit the reflection probe later on, enable both
Show Reflection Probe Volumes and
Select Reflection Probes under
Build > Options.
Fine-Tuning Reflection Sample Volumes
Sample volumes do not react to prim parameter changes. Options such as “Hollow” or “Taper” or “Shear” do not change how the sampling area behaves. It may, however, be helpful to visualize “Near Clip” as the hollowing out of your reflection sample volume, but the hollow and near-clip are not in any way linked and doing so is purely a convenience. Reflection probe sample volumes only respond to changes in scale and position; however, different probe volumes behave differently when resized.
- Box Probes: These are affected by position and non-uniform scale.
Example: If I create a box reflection probe and scale it to 10m,30m,10m size, the full volume will be affected by the probe.
- Sphere Probes: These are affected by position and uniform scale only, otherwise the smallest dimension is used.
Example: If I create a spherical probe and scale it to 10m,30m, and 10m size , the probe will sample a 10 meter diameter spherical volume at the center of the probe. However, a 30m,30m,30m sphere will create a sampling volume of a 30 meter diameter sphere.
PBR Material Composition
PBR-defined values are measured by optical sensors and other capture tools and recorded in databases. These parameters are then put into commercial software to be used by content creators. Using software designed to create PBR content is always recommended; however, understanding how PBR materials are assembled can assist with editing and compiling them. Having a direct understanding of what each individual color channel contributes is essential for editing PBR textures without relying upon some of the more advanced toolkits available.
All PBR Values are listed from 0 to 1.0, though in an actual image, the values range from 0 - 255. PBR Materials are composed of a set of four specifically designed textures; they are as follows:
Base Color [ RGB ] + Transparency [ A ]
[RGB]: This is the unlit color of the surface. This differs from the “Diffuse” texture that Second Life uses. Diffuse textures often include faked reflection and specular information as well as added Ambient Occlusion shadows. Base Color textures do not get any of this added information. For metals ( as defined by the metalness value ), Base Color also determines specular reflection color, whereas, in non-PBR systems, this is defined by the Specular texture and tint. In certain PBR texturing applications, Base Color is sometimes also referred to as “Albedo”.
[ A ]: Alpha Channel, dictates the transparency of the entire material overall.
The Base color texture should be devoid of lighting information.
Occlusion [R] / Roughness [G] / Metalness [B]
This texture is composed of 3 unrelated grayscale images stored in 3 different color channels of an RGB texture.
[R]: (Ambient) Occlusion is lighting data, removing the need to bake down shadows on to the Base Color map.
[G]: Roughness data ranges from 0 to 1.0, but the actual range of physical surfaces ranges from approximately 0.05 to 0.985. No surface is perfectly smooth or completely rough. The rougher a surface is the less mirror-like it behaves.
[B]: Metalness values are mostly black or white. Either the material is a conductive metal like copper, or it’s a non-metal like fabric. 0.0 is Non-Metallic, 1.0 is Metallic. There are almost no materials with gray metalness values.
The alpha channel is ignored, as per the glTF 2.0 specification.
Editor note: The Occlusion map is not controlled by the "Screen Space Ambient Occlusion" toggle in the Advanced Graphics Settings. The Occlusion map is always enabled.
Emissive [ RGB ]
This determines the amount and the color of unlit (ignores ambient light conditions) areas of your material. When giving an object a white emissive map, the object will act as if the Blinn-Phong "Fullbright" option was checked. This map is useful for items which are expected to emit light, e.g. a table lamp, where the lamp shade would appear to glow when the lamp is turned on. If you wish to toggle the lamp on and off, it's recommended to change the Emissive Tint value to black (functionally disabling the emissive map, thus turning the lamp off), and then changing the tint back to your desired color to turn the lamp back on. Leaving the Emissive slot empty is recommended when it’s unused.
Note that glow (The postprocessing effect), is controlled by a separate parameter in the build floater and is intentionally not part of the PBR material window. Glow is modulated by the emissive map, so black areas of an object's emissive map will not glow, similar to how Blinn-Phong emissive maps and glow work.
As per the glTF 2.0 specification, the alpha channel is ignored.
Normal [ RGB ]
The normal maps generated by your baking application / normal map generation toolkit should be compatible with Second Life in most cases. The most common pitfall is using normal maps generated with “inverted” Green channels, such as those that are used for Direct3D and Unreal Engine. Normal texture data redirects light in a different direction based on the vectors indicated by the color, so if the green channel is backward, it’ll seem to be “pointing the wrong way”. To phrase the problem a different way, all the things that should be bumps look like dents, and vice versa. If this occurs, double check that your settings aren’t for Direct3D and try re-generating it. Also, taking it into image editing software and inverting the green channel only sometimes is a sufficient fix.
Normal map tangent spaces are an extremely technical subject that most users need not be concerned with as most modern applications default to the correct setting. However, if your normal maps look drastically different inside Second Life, compared to your source application, and you’ve already confirmed it’s not an inverted green channel, then checking which tangent space settings are being used is the next step. PBR Normals use Mikkelsen Tangent Space. (Often abbreviated MikkT) If you are unsure what this means, use similar workflows and settings for Second Life PBR as those that are generally recommended for the Godot 4 game engine.
As per the glTF 2.0 specification, the blue channel of a normal map is only allowed to contain values above 0.5 to a max of 1 (255).
As per the glTF 2.0 specification, the alpha channel is ignored.
Material Reference Libraries
As PBR is Physically Based, you may wish to know how to recreate a real-life material in PBR form. What color should you use? What metalness value should it have?
Fortunately, reference libraries exist which can tell you how to recreate a given material in a PBR workflow.
List of Reference Color Palettes & libraries
- Physically Based
- Select the Godot Engine, with the Color Space as sRGB Linear and Color Representation as 0-1 (Depending on what you are doing, you may need to convert the value into gamma-corrected sRGB space, which can be done here. Enter the value on the 3rd row.)
- Grzegorz Baran Library
- Dontnod Entertainment Library
- A very small library, but useful nonetheless.
- Studio 397
- A small collection of various materials.
- Polycount Wiki
- Not so much a library in itself, but links out to other libraries. See the Color Charts section.
There are two different methods of creating PBR material assets:
Method 1 : Direct Upload a glTF File
The most convenient method to create an entirely new material is to directly upload a glTF file from your computer.
This is accessible via
Build > Upload > Material
Select a .GLB or a .GLTF file from your computer and Open it: This will give the following window:
Because it is the goal of a material to be an easily applicable exchangeable unit, all of the primitive properties that most users are familiar with have now become integrated into the material UI itself. This includes Color Tint, Transparency and Emissive behavior. Once you have adjusted these settings to desired values click “Save” to pay your upload fee and create your Material asset.
Method 2 : Edit a Blank. Create PBR Materials without a glTF File
If you have the necessary textures to compose a PBR material but do not have a glTF file you will need to build a Material from inventory. Make sure your textures are in the correct format, with the correct data in the proper channels. This requires some understanding of how PBR materials work. Once you have that, upload your textures as you normally would.
- Find the "Materials" folder in your inventory, right click, and select "New Material" from the context menu.
- Name your new material something appropriate (E.g. "Red Bricks" for a red brick wall, etc.)
- Right click on your new material, and select "Open" from the context menu.
- Upload your PBR textures using the standard texture workflow (Usually, under
Build > Upload > Image).
- In the material window, select the appropriate maps that you just uploaded in their respective slots.
|Warning: While there may be a temptation to try and place a Blinn-Phong “Diffuse” texture into the “Base Color” slot and a Blinn-Phong “Specular" into the “Metallic/Roughness” slot, doing so will not produce desirable results. However, trying this won’t generate any warnings as there is no way to check that you’ve put the right texture type into the inputs, and the material will save and be applicable to objects. Unfortunately, what will be created is not a functional PBR material. Please do not do this.|
- Once done, verify the material parameters are correct (E.g. Base color tint, M/R factor, Emissive tint, etc.)
- Save your new material.
- EITHER: Drag and drop the material onto a rezzed prim, OR edit the prim, click the "Blinn-Phong" drop-down, select "PBR Metallic-Roughness", and click "Choose from Inventory", and select your new material.
Creating Color Variants
After you’ve uploaded your first Material for your project, if you’re a store owner who would like to release more than one color palate for your creation, as many clothing and furniture designers find it useful to do, it’s important to not upload a new glTF file for every single variant of your Material. Most variant materials, only the base color will change. The Occlusion, Roughness, Metalness, Emissive and Normal map texture slots will remain the same. Since these maps have already been uploaded once, if we upload a second glTF File, they will be duplicated. Having different copies of the same texture, with differing UUID’s means that they will clog up download bandwidth and video card memory (not to mention your inventory as well). This is very bad for Second Life. So, for this reason, it’s recommended that when you create texture variants, you upload the additional copies of the base-color texture separately. Then open your newly uploaded material in edit mode, choose the Base Color texture, and change it out for one of your newly uploaded Base Color textures, and click “Save As”. This will create a second copy of your material that uses all the correct texture maps without needlessly duplicating them and causing additional lag.
Double Sided Parameter : Uses and Dangers
“Double Sided” is a new property unique to Materials. When “Double Sided” is checked, the surface upon which this material is placed will be drawn twice; once for the outward-facing portion of the surface, and a second time for the inward-facing side of the surface that is normally invisible without a double-sided material. This option should only be used for very specific meshes that were designed to be used with double-sided materials, since placing materials with this parameter checked on normal objects will simply cause the viewer to draw it twice ( and thereby create additional viewer lag ) for no observable change. It is very strongly recommended that this option be unchecked for any material that is to be distributed for general use. Even more so if the “Modify” permission is revoked. If you wish to distribute a version of a material that has “Double Sided” checked, please include a second copy of the material that has “Double Sided” unchecked as well, with an accompanying explanation to the next user as to why this was done.
When designing mesh content for use with the double-sided material parameter, it is also very strongly recommended that you separate the triangles you intend to use the double-sided material upon into a separate mesh “face”, so as to not unintentionally render the portions of the mesh that already have triangles designed to represent the internal portion of the object a second time.
Recommended Application Settings
The glTF file format is widely adopted and many applications have export functionality for this type of file. Below is a non-comprehensive list of some of the more popular applications that export glTF files.
|Tip: The recommended HDRi for use in Second Life content creation is available at this Github repository. This HDRi will closely match the lighting of objects under the PBR "Midday" environment preset.|
|Warning: Older Blender versions have bugs in their glTF export tools which make their output incompatible with Second Life. Use of Blender versions of 3.3 and above are highly recommended to avoid issues.|
Upon starting your project:
Scene > Render Properties > Color Management:
View Transform: '''Standard'''
Sequencer: '''Linear ACEScg'''
Create your materials within Blender using Principled BSDF Shader Nodes and the glTF Settings node. Export them according to the official Blender Documentation.
|Important: Second Life does not support BSDF Clearcoat, Subsurface, Anisotropy or Transmission parameters at this time.|
For materials creation, 2 example .blend files are provided, one using separate Occlusion, Roughness and Metallic textures ("Long Form"), and one that handles a pre-packed ORM map ("Short Form")
The below files are intended for use with Blender versions 3.3 and above.
|Important: While Substance Painter is generally considered to be stable, in some (rare) situations Substance may output a malformed glTF which will be rejected by the viewer. If this happens, import your materials into Blender, then export a glTF from Blender - this should be fixed in a future version of Substance.|
When starting your project:
Template: '''PBR - Metallic Roughness Alpha-test (starter_assets)'''
Template: '''PBR - Metallic Roughness Alpha-blend (starter_assets)'''
Verify the following settings:
Document Resolution: '''1024'''
Normal Map Format: '''OpenGL (Y+)'''
Compute Tangents Per Fragment: '''YES'''
Under "Display Settings":
Tonemapping - Function: '''ACES'''
Output Template: '''glTF PBR Metal Roughness'''
Size: '''Based on each Texture Set's size'''
Padding: '''Dilation + default background color - 8 bit'''
|Important: Substance Designer does not support glTF output, unlike Substance Painter.|
Under preferences, verify the following Project settings:
Color Management: '''OpenColorIO'''
OpenColorIO Configuration: '''ACES 1.0.3'''
8 bit images: '''Utility - sRGB - Texture'''
16 bit images: '''Utility - sRGB - Texture'''
Floating point images: '''ACES - ACEScg'''
2D and 3D View Display Default: '''sRGB'''
When exporting (Export Outputs):
basecolor: '''sRGB IEC61966-2.1'''
If you use a custom node to output a pre-compiled ORM map, this should also be set to Raw.
Please follow the documentation provided in this blog post.
|Warning: As of version "2022-58", 3DCoat is unable to produce a spec-compliant glTF file, and thus should not be used for Second Life. Use at your own risk - you will have issues!|
glTF export has been implemented since 3DCoat version 2020 and is found in the
File >Export > Export to glTF > glTF Separate (gltf + .bin + textures)
Quixel Mixer has no glTF output, however, it does generate the functional textures, though they do need to be edited and combined in photo editing software.
Export them by going to
Export Target > Custom
Texture Preset: Metalness Maps
Albedo , Roughness, Normal, AO , Metalness and ( if need be ) Emissive.
Click “Export to Disk” and open the folder that the files were placed into.
Albedo is the Base Color texture in this case.
AO , Roughness , Metalness get combined into the ORM map as per this explanation.
Normal Map : Quixel generates Direct3D Normal Maps. The green channel needs to be inverted as per here.
Upload to Second Life using Method 2.
Autodesk just added the ability to create glTF files using their new glTF Material and glTF Export functionalities as outlined in Autodesk's official documentation. All prior versions of Autodesk software do not have this functionality.
Export your materials using the Godot 4 ORM export preset.
Upload to Second Life using Method 2.
While Photoshop is not officially a PBR authoring tool, the changes to Alpha Blending (changing into Linear space from sRGB) may require you to change your PS settings to get consistent results. Please see this article for more information. (See the section titled "A Partial Solution"). Alternatively, this Reddit post also gives a few options on how to achieve blending in the correct manner.
While GIMP is not officially a PBR authoring tool, the changes to Alpha Blending (changing into Linear space from sRGB) in Second Life will make textures created in GIMP display their alphas correctly (GIMP defaults to linear alpha calculation).