-
Notifications
You must be signed in to change notification settings - Fork 6
True PBR
About True PBR
PBR (physically based rendering) approximates how real materials react to light and is used in most modern games. True PBR is a (work in progress) part of Community Shaders that allows the usage of metallic workflow PBR materials in Skyrim. The biggest upside to using PBR materials is the available tooling and workflow for texture creation. Most modelling and texturing tools also use a PBR workflow, and therefore what you create in e.g. Blender will look the same way in Skyrim; there is no need for experimenting to make your textures as bright as vanilla, or for messing with env masks to try replicating a metallic look. Additionally, there are many free PBR materials available online, and it is easy to mix and modify them while retaining realistic and consistent visuals.
The base textures for True PBR are albedo, normal, roughness, metallic, ambient occlusion and specular. Parallax and emission are also supported. Additionally the material can use two-sided foliage or subsurface shading, which require subsurface color map.
True PBR only cares about meshes marked with a specific flag, everything else is rendered as usual. True PBR mods therefore contain meshes marked for PBR and a set of PBR textures.
Frequently Asked Questions
- Do I care about this as a user? No, it just works. There may be some settings in the CS menu that you can customize. If a mod doesn't come with its own meshes or you have custom meshes that you want to apply the textures to, you might want to use the PBR Mesh Patcher.
- Do I care about this as a modder? If you create custom meshes or textures, you might want to switch over to True PBR. The upside is easier workflow and potentially better quality. The downside is that your creations will only work with Community Shaders (it is possible methods of fallback will be available though).
- What about Complex Materials? Complex materials are totally separate from True PBR and there would be no point in combining them. You can still use complex materials on non-pbr objects as usual.
- Can I convert vanilla shaded textures to True PBR? If you originally had PBR textures that you somehow converted for Skyrim, you can use those easily. Otherwise it is impossible to do without assumptions, because Skyrim textures contain fundamentally different data. For example, many objects using enviornment mapping are metallic, but not all of them. You can do manual work or use some AI to make the necessary textures, but it is unlikely that it will be a meaningful visual improvement over vanilla.
- My materials ingame look wrong? There is many possibilities for this, I will list the common ones. If the material is really shiny, the mesh probably isn't marked for PBR, so is vanilla shaded with specularity 1. If the material is too dark in the shadows, you might have too dark ambient occlusion. If the material gets black when you walk to it with a torch, your normal maps might be wrong - either flipped, or wrong format (opengl).
Reference - Everything you need to know
Shader implements roughness-metallic workflow closely following Unreal. In base version it requires base color, opacity, normal, roughness, metalness, AO and nonmetal reflectance (specular in Unreal) to be provided. Additionally it supports emission if emissive color map is provided and parallax occlusion mapping if displacement map is provided. Two additional shading models are implemented (also following Unreal):
Two-sided foliage which simulates transmission of light through foliage. Requires subsurface color to be provided.- Subsurface which approximates subsurface scattering with provided subsurface color and opacity.
- Multilayer Parallax which approximates a semitransparent surface above a hard surface.
- Base color in RGB, opacity in A.
- Normal in RGB, A unused.
- Emissive color in RGB, A unused.
- Displacement in R, GBA unused.
- Unused.
- RMAOS - Roughness in R, metallic in G, AO in B, specular in A.
- Unused.
- Subsurface color in RGB, subsurface opacity in A.
Color maps are assumed to be in SRGB format. If the actual colors are sRGB (gamma in Mixer), use sRGB flagged dds. If the actual colors are linear, use linear dds.
Three flags of BSShaderProperty are replaced:
- Byte 55 (Unused01 in NifSkope) - enables PBR for this BSGeometry
- Byte 57 (Soft_Lighting in NifSkope) - enables two-sided foliage shading
- Byte 58 (Rim_Lighting in Nifskope) - enables subsurface shading in NifSkope
Some parameters of BSShaderProperty are reused:
- Specular Level (replaces Glossiness) - linear multiplier for nonmetal reflectance. Should be 0.04 for meshes which do not have specular map (and have 1 in alpha of RMAOS map) or 0.08 for meshes which have specular map created for Unreal.
- Subsurface Color (replaces Specular Color) - used in Two-Sided Foliage and Subsurface models. If subsurface map is provided it's used as linear multiplier for its RGB.
- Roughness Scale (replaces Specular Strength) - linear multiplier for roughness.
- Subsurface Opacity (replaces Lighting Effect 1) - used in Subsurface model. If subsurface map is provided it's used as linear multiplier for its alpha.
- Displacement Scale (replaces Lighting Effect 2) - linear multiplier for displacement.
Enabled by: MultilayerParallax flag + MultilayerParallax shader type
Base parameters:
- Coat strength - strength of coat layer contribution from 0 to 1. Equals to subsurface opacity field * alpha of slot 8 texture (if present)
- Coat roughness - roughness of coat layer. Equals to parallax inner layer thickness * alpha of slot 7 texture (if present)
- Coat specular level - reflectance of coat layer. Equals to parallax refraction scale (just set to 0.04)
Three more flags are used:
- EffectLighting - enables diffuse contribution. Color of top layer is then taken from specular color field * rgb of slot 8 texture (if present)
- SoftLighting - enables interlayer parallax. I.e. with it enabled displacement works as displacement between upper and lower layer to simulate vanilla multilayer parallax
- BackLighting - enables own normal map for coat layer. It's then taken from rgb of slot 7 texture
Landscape texture is assumed to be PBR if its record's EDID contains _PBR substring. Landscape material requires base color, normal, roughness, metalness, AO and nonmetal reflectance to be provided.
If any of textures in quad is PBR quad is rendered as PBR so in order to avoid issues with blending between PBR and non-PBR textures all land textures in worldspace need to be converted to PBR together. That seems to be okay since mods replacing land textures usually replace them all. Also land LOD also need to be rendered as PBR to avoid issues with blending with non-LOD textures (that could be made optional).
- Base color in RGB (assumed to be in SRGB format), displacement in A.
- Normal in RGB, A unused.
- RMAOS - Roughness in R, metallic in G, AO in B, specular in A.
- Unused.
- Unused.
RMAOS - Roughness in R, metallic in G, AO in B, specular in A.- Unused.
- Unused.
Some parameters of TXST record are reused:
- Roughness Scale (replaces Shininess) - linear multiplier for roughness.
- Displacement Scale (replaces Parallax Scale) - linear multiplier for displacement.
- Specular Level (replaces Decal Min Width) - linear multiplier for nonmetal reflectance. Should be 0.04 for textures which do not have specular map (and have 1 in alpha of RMAOS map) or 0.08 for textures which have specular map created for Unreal.
Preparing Meshes
For a mesh to be recognized as PBR, it must have in BSLightingShaderProperty:
- Default shader type
- In Shader Flags 2 have Unused01 (or PBR) flag set
For texture slot setup and additional settings scroll down to Reference.
To set up PBR meshes in batch, you can use PbrNifPatcher. It is useful especially when remaking vanilla textures that are used in many meshes.
To get descriptions for PBR properties and correct rendering of PBR in Nifscope, add these files into your Nifscope folder: TODO insert link
Texture Creation Workflow
Many programs can be used to work with PBR textures. To generate textures from scratch, you can use for example Substance Designer or Material Maker (free). To edit, mix and apply materials to meshes, you can use Quixel Mixer (free), ArmorPaint (free) or Substance Painter. In this short guide I will show the workflow I use to retexture vanilla meshes.
- When installing, you can select the sample packs, which contain textures you can freely use. Do NOT select the Unlimited Megascans option - it is only free if your end product is in Unreal Engine. Though do inform yourself, I am not a lawyer.
- Get some free PBR textures for example from polyhaven.com or ambientcg.com, or make your own. Import them using Library -> Import Custom Asset.
- Make sure to fill out the correct albedo - one is for specular and one for metalness workflow. Most available textures use metalness workflow.
- Make sure to use the correct normal map - Mixer uses the OpenGL variant. If you use the DirectX variant, normals may look wrong in Mixer.
- You can add texture names to autofil in Edit -> Configure Autoload Map Names
- Edit and mix textures however you want. Mixer has official tutorials on Youtube.
- Export the PBR textures. You can create a preset that exports according to your needs.
- Pick image format according to preference. I use PNG.
- I usually export albedo, RMAOS, normal, and displacement textures.
- Take note if you export albedo in Gamma or Linear space. This will be important later.
- You can directly export a RMAOS (roughness, metallic, ambient occlusion, specular) texture. In most cases you won't need specular and can save as RGB.
- If you indeed worked with opengl normal maps, set Normal Y (green channel) to be inverted. This transforms it into DirectX format which Skyrim uses.
- Use another program to convert the exported files to DDS format. This is the node setup to do it in Chainner (TODO link):
- Add a Directory node for selection of the exported textures directory
- Add Load Images nodes for each of your texture types, use expressions to select the file based on suffix set in Mixer, normal could be *_n.png
- Add Save Image node for each of your texture types, pick DDS format and pick a fitting compression based on the next chapter (About Texture Compression)
- If you exported your albedo as Gamma, you need to select compression with sRGB, if you exported Linear, select linear. Other textures than albedo should be always linear.
- Optionally add Resize nodes or similar to downscale or edit your textures before saving.
About Texture Compression
There is a number of compression format for DDS textures with various properties such as number of channels, quality and file size. Not all of them are supported by Skyrim. The following list should be sufficient in most situations:- BC1: RGB colors + 1bit alpha (fully opaque or fully transparent). It has reasonable file size and quality. Use for opaque or cutout albedo textures, and RMAOS textures if you don't need specular. In case of visible banding or squarish artifacts, use BC7.
- BC4: One channel (grayscale). Has the same file size as BC1, but only one channel with better quality. Use for parallax textures.
- BC7: RGBA colors. Has good quality and twice the file size of BC1. Use for normal maps and albedo with full transparency.