Difference between revisions of "PBR Reference Guide"

From FreeSpace Wiki
Jump to: navigation, search
m (wikipedia ---> Wikipedia)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
==Introduction==
 
==Introduction==
As of release 3.8.0, the FS2 Open engine supports Physically Based Rendering. Along with it comes many new hurdles for asset creators, and the need for a guide on the matter. This article is designed mostly as a reference guide that can serve as a basis for workflows and as a refresher if needed.  
+
As of release 3.8.0, the FS2 Open engine supports '''Physically Based Rendering'''. Along with it comes many new hurdles for asset creators, and the need for a guide on the matter. This article is designed mostly as a reference guide that can serve as a basis for workflows and as a refresher if needed.  
  
 
===Key Concepts===
 
===Key Concepts===
The wikipedia pages on [https://en.wikipedia.org/wiki/Physically_based_rendering/ Physically Based Rendering] and [https://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function/ BRDFs] are particularly good to read and keep in mind when working on PBR assets.
+
The Wikipedia pages on [https://en.wikipedia.org/wiki/Physically_based_rendering Physically Based Rendering] and [https://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function BRDFs] are particularly good to read and keep in mind when working on PBR assets.
  
 
==The Basics==
 
==The Basics==
Line 16: Line 16:
  
 
===Specular/Reflectance===
 
===Specular/Reflectance===
This map has the format, ***-reflect. It contains the following information in it's channels:
+
This map has the format, ***-reflect. It contains the following information in its channels:
 
*RGB - Specular color.
 
*RGB - Specular color.
 
*Alpha - Gloss/shininess.
 
*Alpha - Gloss/shininess.
Line 45: Line 45:
  
 
===Substance Painter===
 
===Substance Painter===
[https://www.allegorithmic.com/products/substance-painter/ Substance Painter] is a 3D painting software created by Allegorithmic. It can be purchased under a multitude of plans (including a perpetual license), although an educational license is available.  
+
[https://www.allegorithmic.com/products/substance-painter/ Substance Painter] is a 3D painting software created by Allegorithmic. It can be purchased under a multitude of plans (including a perpetual license), although an educational license is available.
 +
 
 +
Updated presets can be found here: [https://sectorgame.com/fsfiles/repo/data/Axem/Other/SP_FreeSpace2_Presets3.rar Substance Painter presets]
  
 
===Quixel Suite===
 
===Quixel Suite===
Line 72: Line 74:
 
Essentially, metals should be very dark grays to black, with the exception of a few members of the Gold/Platinum group (Gold has a very dark orange-brown diffuse color), while dielectrics can be whatever color you want.
 
Essentially, metals should be very dark grays to black, with the exception of a few members of the Gold/Platinum group (Gold has a very dark orange-brown diffuse color), while dielectrics can be whatever color you want.
  
Additionally, the diffuse map should no longer contain any lighting information. The ambient occlusion map you bake for your asset should be in it's own texture now.
+
Additionally, the diffuse map should no longer contain any lighting information. The ambient occlusion map you bake for your asset should be in its own texture now.
  
 
===Specular/Reflectance===
 
===Specular/Reflectance===
This new map, denoted by the format ***-reflect.img, replaces the shine map used by old assets. Shine maps contained specular color information in the RGB channels, as well as an "environment reflectance" value in the Alpha channel, which determined the mip level or accuracy of environment reflections. Reflectance maps rearrange how this information is stored; The RGB channels store specular color as the overall color and "metalness" as the magnitude of the color value, while the Alpha channel now contains the Gloss of the material. That's right, you can now do per pixel gloss instead of the old -ogl_spec commandline parameter.
+
This new map, denoted by the format ***-reflect.dds, replaces the shine map used by old assets. Shine maps contained specular color information in the RGB channels, as well as an "environment reflectance" value in the Alpha channel, which determined the mip level or accuracy of environment reflections. Reflectance maps rearrange how this information is stored; The RGB channels store specular color as the overall color and "metalness" as the magnitude of the color value, while the Alpha channel now contains the Gloss of the material. That's right, you can now do per pixel gloss instead of the old -ogl_spec commandline parameter.
  
 
This texture should contain only color information for metallic materials. I shouldn't need to tell you what a metal is. Metals tend to be very bright white to gray, but can have some additional coloration like blue, although there's always copper and gold as notably colorful metals. Dielectrics should be dark to medium grays.
 
This texture should contain only color information for metallic materials. I shouldn't need to tell you what a metal is. Metals tend to be very bright white to gray, but can have some additional coloration like blue, although there's always copper and gold as notably colorful metals. Dielectrics should be dark to medium grays.
Line 82: Line 84:
  
 
===Occlusion===
 
===Occlusion===
This new map, denoted by the format ***-ao.img, contains all non-emissive lighting information for your asset. For this texture, only two channels are used, one contains Ambient Occlusion information, while the other contains Cavity Occlusion information.
+
This new map, denoted by the format ***-ao.dds, contains all non-emissive lighting information for your asset. For this texture, only two channels are used, one contains Ambient Occlusion information, while the other contains Cavity Occlusion information.
 +
 
 +
===Special Cases===
 +
So, say you're working with a model, and it's not clear whether a material is a metal or dielectric. Things like metalloids (elemental silicon might seem metallic at first, but looks can be deceiving), certain minerals and organics, and anodized metals don't fall clearly into either category. Generally speaking, you're gonna need to isolate the diffuse and specular colors of these materials and texture accordingly. Here's what I recommend you do:
 +
*Metalloids and Anodized Metals
 +
**Take a metal of your choice, copy the specular to the diffuse and darken it to about 80% to 90% of the specular value.
 +
*Special Minerals/Organics and Clearcoat/Metallic paints
 +
**Unfortunately, we would most likely need to implement a clearcoat shader to properly simulate most of these, but there is generally a clear difference between the diffuse and specular colors in this case, which should be sufficient for your use case.
 +
 
  
 
[[Category:Modding]]
 
[[Category:Modding]]

Latest revision as of 16:49, 23 January 2021

Introduction

As of release 3.8.0, the FS2 Open engine supports Physically Based Rendering. Along with it comes many new hurdles for asset creators, and the need for a guide on the matter. This article is designed mostly as a reference guide that can serve as a basis for workflows and as a refresher if needed.

Key Concepts

The Wikipedia pages on Physically Based Rendering and BRDFs are particularly good to read and keep in mind when working on PBR assets.

The Basics

The PBR workflow for FSO introduces two new texture maps, as well as some constraints on old texture types. Remember, PBR materials are (mostly) split up into two types:

  • Dielectric/Nonmetallic
  • Metallic

Technically, elements that we refer to as metalloids or semi-metals on the periodic table have some properties from both dielectrics and metals, but this will be covered later.

Diffuse/Albedo

Diffuse color information goes here. Basically, the only constraint you need to follow is that almost all metals are dark grays to black. Also, don't put your AO in here.

Specular/Reflectance

This map has the format, ***-reflect. It contains the following information in its channels:

  • RGB - Specular color.
  • Alpha - Gloss/shininess.

Occlusion

Contains ambient and cavity occlusion information.

Working with the Basics

You can make a simple PBR texture set from your old diffuse texture. If you wish to do so, try the following (I'll assume you're using photoshop):

1. Open up your diffuse texture and remove all lighting information

2. Make two groups and copy your diffuse texture into both of them.

3. Name one group Diffuse and one Reflect.

4. In the Diffuse group, create a fill layer containing all black (#000000). Select all the pixels you want to be metallic and copy that into the mask for the fill layer.(call this Mask 1). Voila, you now have a pretty good albedo texture.

5. In the Reflect group, create a fill layer containing all gray (#383838). Copy Mask 1 into the mask for the fill layer and invert it. You've now got yourself most of the Reflectance map.

6. Finally, create a new Alpha channel. Go back to your diffuse texture and select any pixels you want to have a specific gloss level, then use your selection as a mask for the gray value associated with the gloss you want. Darker grays are less glossy, lighter grays are more glossy.

Now, just export the Diffuse group as your new diffuse texture and the Reflect group plus the Alpha channel as your -reflect map.

Tools

There are many tools available to modders that can assist in the creation of assets.

Substance Painter

Substance Painter is a 3D painting software created by Allegorithmic. It can be purchased under a multitude of plans (including a perpetual license), although an educational license is available.

Updated presets can be found here: Substance Painter presets

Quixel Suite

Quixel Suite is a 3D painting tool created by Quixel that integrates with Adobe Photoshop CS4/5/6 and Creative Cloud. It is available under a perpetual license, with an educational discount available.

Quixel Suite's biggest feature is the Quixel Megascans material library, which provides thousands of scanned PBR materials, with several hundred being included with the suite and a large variety of packs available for purchase. The included materials provide everything you need to get started, but some of the Megascans materials and masks are incredibly useful.

QS provides the simplest transfer to FSO, as it features an export preset that produces textures compatible with the engine by default.

Other Tools

The following tools will be covered in later tutorials and additions to this reference guide.

The Not So Basics

This contains more in-depth explanations of the previously mentioned texture types.

Diffuse/Albedo

As before, the diffuse texture is supposed to contain diffuse color information. However, in the past, many people included color for metallic materials. With PBR textures, the diffuse map should contain only color information for dielectric materials. Dielectric materials are basically any material that has no metallic properties. This includes:

  • Paints
  • Plastics
  • Most organic materials
  • Most minerals

Essentially, metals should be very dark grays to black, with the exception of a few members of the Gold/Platinum group (Gold has a very dark orange-brown diffuse color), while dielectrics can be whatever color you want.

Additionally, the diffuse map should no longer contain any lighting information. The ambient occlusion map you bake for your asset should be in its own texture now.

Specular/Reflectance

This new map, denoted by the format ***-reflect.dds, replaces the shine map used by old assets. Shine maps contained specular color information in the RGB channels, as well as an "environment reflectance" value in the Alpha channel, which determined the mip level or accuracy of environment reflections. Reflectance maps rearrange how this information is stored; The RGB channels store specular color as the overall color and "metalness" as the magnitude of the color value, while the Alpha channel now contains the Gloss of the material. That's right, you can now do per pixel gloss instead of the old -ogl_spec commandline parameter.

This texture should contain only color information for metallic materials. I shouldn't need to tell you what a metal is. Metals tend to be very bright white to gray, but can have some additional coloration like blue, although there's always copper and gold as notably colorful metals. Dielectrics should be dark to medium grays.

No lighting information here either, unless you like screwy reflections.

Occlusion

This new map, denoted by the format ***-ao.dds, contains all non-emissive lighting information for your asset. For this texture, only two channels are used, one contains Ambient Occlusion information, while the other contains Cavity Occlusion information.

Special Cases

So, say you're working with a model, and it's not clear whether a material is a metal or dielectric. Things like metalloids (elemental silicon might seem metallic at first, but looks can be deceiving), certain minerals and organics, and anodized metals don't fall clearly into either category. Generally speaking, you're gonna need to isolate the diffuse and specular colors of these materials and texture accordingly. Here's what I recommend you do:

  • Metalloids and Anodized Metals
    • Take a metal of your choice, copy the specular to the diffuse and darken it to about 80% to 90% of the specular value.
  • Special Minerals/Organics and Clearcoat/Metallic paints
    • Unfortunately, we would most likely need to implement a clearcoat shader to properly simulate most of these, but there is generally a clear difference between the diffuse and specular colors in this case, which should be sufficient for your use case.