Intended for Unity Free
Simple Physical Shader is a general-purpose physical shader that is intended for users who are new to Physically Based Rendering (PBR) and want a simple shader that can be mixed and matched with the Unity default shaders.
Watch the demo video on YouTube
Simple Physical Shader works on Unity Free, on any devices that support Shader Model 3.0, and was developed to provide a usable PBR shader for projects that don't use HDR or linear lighting and for users who don't want to worry about baking out cubemaps. It uses maps that are human readable and easy to generate.
Simple Physical Shader takes 5 main inputs:
- Main Color
- Smoothness
- Metallicity
- Normal Map
- RSRM (radially symmetric reflectance map)
It also uses a generalized Light Wrap term that's used to fake subsurface scattering and ambient bounced light.
Main Color represents the general color of the object for that texel, just paint what you see -- even for metals.
Smoothness represents how rough or smooth the object is (white is smooth -- black is rough), it also determines how blurry reflections are.
Metallicity represents how much the object behaves like an ideal conductor vs an ideal dielectric. Dielectrics (black) refer to things like chalk, fabric, skin, and plastic -- objects with desaturated specular highlights and a significant fresnel reflection term. Conductors (white) refer to metals like gold, bismuth, copper. Partially metalic objects like water, oxidized aluminum, or multimaterial sythetics can be represented with gray values.
Normal Map does the same thing it normally does; offsets the normal of the pixel being lit.
RSRM is used as an ambient relfection for sky vs ground lighting. The left side of the texture is what is reflected on very smooth materials and the right side is for rougher materials. When authoring these, the left should have sharp contrast with a clear horizon and the right should be blurry with and average brightness equivalent to 50% gray. This map is tinted by the Unity Ambient Lighting term, so you shouldn't need to change this map during gameplay (unless you also change out the skybox).
I originally wrote this as a sort of experiemnt to help me wrap my head around Physically Based Rendering, and I hope it does the same for you. Feel free to experiment with it -- it's free for a reason.
1.2 Update
New shader variations have some new inputs.
The "Retro" shader is meant to handle materials with edge and core retroreflectivity, it takes a black and white "Retro Map" that is multiplied against a "Retroreflectivity" property. Postitive retroreflectivity values will produce a velvet or "peach fuzz" effect to simulate little hairs or threads catching light around the edge of an object. Negative retroreflectivity values will produce an effect similar to roadsign paint or traffic safety vests (which should also be at least partially metallic for best effect).
The "Coat" shader is meant to handle wet or laminated materials. It takes a "Clear Coat" and "Clear Coat Map" input as well as a "Coat Smoothness" slider value to render an additional specular lobe on top of an existing effect. This can be used in carpaint shaders (where the undercoat is rough and metallic paint and the overcoat is clear and smooth plastic) as well as recreating a variety of unusual specular effects and composite materials. It's actually suprisingly useful for skin, where the second lobe is used to model the relativly small impact of the oil on the surface of the skin.