Destinations

Destinations

Not enough ratings
Authoring PBR Materials
By Rectus
The VR shaders in Destinations allows authoring of photorealistic materials using a Physically Based Rendered (PBR) workflow.
   
Award
Favorite
Favorited
Unfavorite
Introduction
The Source 2 engine used in Destinations comes with a few feature packed shaders. The vr_standard shader accepts reflectance and gloss maps, allowing for specular materials to be created using a PBR workflow. This guide aims to show how to use these features.

The shader settings do not fully match either the Reflection/Gloss nor the Metalness/Roughness workflows, so a kind of hybrid approach is needed. It's not possible to use a direct metallness workflow without a reflectivity map due to the metalness map not affecting reflectivity, and there is no way to make separate diffuse and specular color maps, neccesitating the use of the metalness map to pick which areas receive specular coloring from the albedo.

The Renderer in Destinations seems to use a relatively simple lighting model with only direct lighting from light sources, and ambient lighting from pre-placed cubemaps. Make sure to build cubemaps in the level, or the specular effects will not render properly.

There are a lot of guides about PBR materials available on the Internet, here are some of good ones:
https://docs.google.com/document/d/1Fb9_KgCo0noxROKN4iT8ntTbx913e-t4Wc2nMRWPzNk/edit
http://www.marmoset.co/toolbag/learn/pbr-practice
http://www.marmoset.co/toolbag/learn/pbr-conversion



Gamma correction
The reflectance and gloss maps (and likely the other maps for non-color information) seem to expect a texture with a linear color space, while most tools that export textures do so in the sRGB color space. Source 2 does not seem to be able to detect the color profile embedded in the image, so it will not display sRGB maps correctly. This causes the maps to be interperted with too high values, resulting in extremely specular materials. To fix this, the textures can be linearized before importing them.

http://therenderblog.com/how-to-linearize-textures-in-photoshop/
Material Parameters
To enable specular rendering, check the box for the Specular setting.

By default, only specular highlights from direct lightsources are rendered. To enable ambient specular lighting, set the Specular Cube Map setting to In-game Cube map. For this to work, your game need to have a cubemap entity with a baked cubemap texure in the level.

If metalness or ambient occlusion maps are used, enable these options as well.





Color
The color texture specifies the diffuse colors or albedo for the material, as well as metal colors if a metalness map is used.

When making PBR materials, the color map should preferably not have lighting information like ambient occlusion baked in, and instead supplied as a separate map. If ambient occlusion is baked in, it will not affect ambient specular reflections, rendering occluded areas brightly, and if a metalness mask is used, the metallic areas will render too dark.

If a metalness map is not used, fully metallic parts should be colored dark.


Normal Map
Normal maps are very useful for small details, but the lack of parallax in larger and deeper features is very noticable when used in VR applications, making them look unnaturally flat. Things like protruding bolt heads or deep cavities should be modeled instead.


Ambient Occlusion
The ambient occlusion map darkens both diffuse lighting and the ambient specular lighting from cube maps.









Reflectance
Reflectance is a greyscale map that controls what percentage of light is reflected specularily. A value of 0 (black) means only the diffuse color is used. A value of 1 means only the specular reflection is used. When only a single type of material is used, it is often possible to use a single value for the reflectance.

Reflectance values should only be selected based on the type of the material visible at the top layer. Effects like wear that don't affect the surface material should be put in the gloss map instead.

Most non-metallic materials should have this set very low, no more than a value of 0.2 for the most reflective objects. Metallic objects on the other hand should have this set high. Shiny materials like chrome should have it set to 1.

Expects a linear map.


Glossiness
This greyscale map controls the microsurface smoothness. Bright areas are smooth and dark areas are matted.

This map should represent any suface features too small to be put in a normal map. Wear and dirt should affect this map.

Some PBR workflows and toolsets use an inverted version of this map, often called a roughness map.

Expects a linear map.

Metalness
While the VR shader does not seem to support a proper metalness workflow, an optional metalness map is provided for the purpose to allow coloring of metal highlights. Bright areas in the metalness map take their specular coloring from the color texture. Metallic areas should in genaral be set to 1, and non metallic to 0.

For this to work properly, the color texture needs to be bright enough. If it is set too dark, the lighting will have dark blotches and look unnatural. Bare metals should be set to sampled values from a chart.





Plastic and metallic horn comparison. Both use the same albedo and gloss, but differnt reflectivity and metalness.

Tips and Tricks
Make sure to use properly lit map to test the materials on. A cubemap with flat lighting can make metallic refletions look unnatural.

The game will update on the fly when material parameters are changed. This can be very useful for testing. To test specific values of a parameter, the texture can quickly be changed to a flat color and back using the button on the lower left of each parameter panel.
6 Comments
The Mask 3 May, 2017 @ 11:51am 
huh, how ironic.
thanks for the quick answer.
Rectus  [author] 3 May, 2017 @ 11:48am 
It's not possible as far as I know. It only seems to be possible to select full RGB images or flat colors for the maps. It really would be a nice feature to have though, and not having it makes porting over Source 1 textures a lot harder.

Fun fact, the asset compiler actually merges the texture maps to different channels in the resulting .vtex textures.
The Mask 3 May, 2017 @ 11:22am 
thanks for the useful additional infos.
i'd just like to know something:
do i really need a texture file for every single shader effect (specular, metalness, ao etc.) as a standalone image or is RGB usgae supported? like for example having the metalness map in the alpha channel of the albedo or the ao in the blue channel of the normal map. or like an entirely custom made masking psd/tga for different effects as a pre-setup for further usage on other assets.
Ben Dover 30 Oct, 2016 @ 1:42pm 
Good job, Rectus! Always nice to see you sharing your intermediate-advanced guides with people like me, helping us gain further knowledge. We really appreciate it!
TOG | K1CHWA 19 Oct, 2016 @ 6:59pm 
:Fistofdosh:
Jules 19 Oct, 2016 @ 5:55pm 
Bravo Rectus, thanks for sharing. :KneelingBow: