kenziemac130-github.io

View the Project on GitHub

Extending MTL with Subsurface Scattering

Version 1.0.2

This post proposes an extension to MTL to transmit subsurface scattering parameters across applications.

Introduction

MTL is a highly extendable text-based material file format that is supported by many applications. MTL is also a very old file format that was defined in a relatively early stage of computer graphics. Over the years different applications have introduced extensions, such as emission support or even PBR support, to keep up with the needs of modern computer graphics.

Subsurface scattering is an important component to rendering believable organic materials such as foliage, food, and characters. Subsurface scattering simulates the way light bounces around and is absorbed inside of an object’s volume. This important rendering feature is currently not properly defined in MTL.

In order to create this proposal, a wide variety of offline renderers and game engines were investigated to better understand common features and limitations. Upon investigation, it became clear that each had different options and techniques when approaching subsurface scattering. However, a common set of artistic parameters to control the general results of the final image were present. This patch focuses on transmitting those parameters via MTL. It also became clear that this proposal should only focus on homogenous volumes. It is not standard enough among various renderers to support heterogeneous subsurface scattering, such as layered physical materials or volumetric textured interiors. Renderers that do support some form of heterogeneous subsurface scattering vary too widely in approach to find significant common ground. In findings, many real-time programs were fundamentally incapable of heterogeneous subsurface scattering, as they “baked” surface profiles into look-up tables. Some applications also allow specifying another source for the surface’s color when using subsurface scattering. This proposal suggests that the primary subsurface color should always be overruled by the “Kd” parameter to ensure compatibility with software that doesn’t support loading subsurface scattering.

In order to achieve these goals, three new parameters will be introduced: “Sf”, “map_Sf”, and “Sr”. “Sf” is the subsurface factor that blends between a diffuse shading model and a subsurface scattering shading model. “map_Sf” is the texture map for the “Sf” parameter. “Sr” is a subsurface radius vector which defines how far light is allowed to scatter through the medium. This convention was chosen after investigating existing support for transmission using the “Tr” and “Tf” parameters for transmission factor and transmission filter.

Specification

Prerequisites

Sf: Subsurface Factor

Sf 1.0

map_Sf: Subsurface Factor Texture

map_Sf -imfchan l Textures/CharacterSkinMask.png

Sr: Subsurface Radius

Sr 2.0 0.4 0.2
Sr spectral MilkScatter.rfl 1

Conversion to Color/Distance

/* Convert subsurface color, and distance into a radius vector. */
vec3 sss_radius = sss_color.rgb * sss_distance;
/* Convert radius vector into subsurface color, and distance scalar.
*  FLOAT_EPSILON is a tiny number to prevent divide by zero errors.
*  It is acceptable to replace FLOAT_EPSILON with 1.0 as seen fit. */
float sss_distance = max(max(sss_radius.r, sss_radius.g), max(sss_radius.b, FLOAT_EPSILON)));
vec3 sss_color = sss_radius.rgb / sss_distance;

map_Sr: Reserved