I wanted to share a new shader with you guys. First off, a big thank you to my colleague Niklas Hansson
whom I created this shader with. He's the guy with the theoretical know-how of the inner workings of this shading method, he helped out with guiding me through the shader creation in Mental Mill as well as some MSL(HLSL like) coding for custom shader components in Mental Mill.
So I give you, TGA_Physically_Based_Lighting_Shader
. A realtime CGFX shader for the Maya viewport.
This shader uses a whole new way of handling lighting and in particular the specular and reflection contribution. Instead of the traditional specular, gloss and reflectivity you now use a substance and roughness texture to define your materials in a more realistic manner. There's also familiar textures such as Albedo(Diffuse), Tangent Space Normal map, Cube Map and Ambient Occlusion. This way of shading is already adopted by several triple A studios in the industry. For instance Treyarc's COD Black Ops
Here's the highlight features of the shader.
- A real life material based fresnel term that alters specularity and reflections.
- A substance texture to mimic how materials reflect and refract light in real life.
- A roughness texture to define a materials surface structure(smooth/rough).
- Image based lighting via a cube map for reflections and ambient lighting.
- Roughness controlled pre-blurred mip levels of the cube map for reflections.
- Blended Normals to give a subtle skin effect in conjunction with normal maps.
- Emissive Texture to fake emissive surfaces.
- Fully linear shading pipeline.
- A bundled cheat sheet image with color swatches for several substance values.
- Shadow Map(pre-baked) support fully integrated with the shader (This feature is experimental and only works with 1 direct light source).
- Added transparency support. Use the albedo texture alpha channel.
You can Download
the shader from my website
ATI users should be aware that CGFX shaders in general do not seem to work well in Maya with ATI cards. I have not been able to verify if this one works or not, I'm assuming it does not.
I created some examples to show the shaders capabilities. I started of with a gold bar, and continued making variations of it.
Feel free to ask questions and discuss the shader in this thread.