For the past two years I've been learning to create real-time vertex and pixel shaders for use in video games. I've learned the basics of both HLSL for DirectX and Cg that was developed by Nvidia. I've been blown away by how much control an artist can have over the exact appearance of the surface of an object just by writing a few lines of code. Especially when using DX9 class hardware, we can now make real-time surfaces that look just like they were rendered in software.
Now that 3DS Max supports the use of DirectX Shaders in the real-time viewport, I decided to post some of the shaders that I've written so that other people can use them.
Note: All of these shaders were written in HLSL which is the DirectX standard shading language. That means that they can be used together with any game engine or graphics program that supports the DirectX FX format for shaders. Having said that I'd better tell you that I've only ever used these shaders in 3DS Max and I've had to make some adjustments to them so they would work correctly in Max (Things like making up for the fact that DirectX standard is "Y up" and 3DS Max is "Z up.") If you plan on using these shaders in software other than 3DS Max, you may not get the exact results I was intending, but feel free to use them for whatever you want.
Click on the images or titles below to learn more about each of the shaders I've posted and download them.
Updated 3/16/06
|
|
|
|
Simple Normal Map Shader
This shader uses a normal map for per-pixel lighting - to give the illusion that the model surface contains more detail than is really there. The shader looks very similar to a lambert shader.
|
|
|
|
|
Normal Map Specular Shader
This shader is similar to the first normal map shader. It also adds a specular component for shiny objects and options for controlling how shiny the surface is.
|
|
|
|
|
Normal Map Specular Shader - 3 Lights
This shader is identical to the Normal Map Specular Shader except it allows you to use three points lights instead of just one. With support for 3 point lights you get much nicer results, but the shader is also more expensive so it's slower in the viewport.
|
|
|
|
|
Offset Mapping Shader
This shader has all of the features of the Normal Map Specular shader plus one additional feature that makes the normal mapping look much more convincing. It's called Offset Normal Mapping or Parallax Mapping. It's a feature that is exhibited in the Unreal Engine 3 Tech Demo.
|
|
|
|
|
Car Paint Shader
Some car paint appears to change color based on your viewing angle. The paint looks like one color when you're looking straight at the surface and another color when the surface is parallel to your view. This shader imitates that effect.
|
|
|
|
|
Light Attenuation Shader
This shader has all the features of the Normal Map Specular shader plus light attenuation. In the real world, light gets scattered as it travels further away from the source. The attenuation feature in this shader simulates this effect by dimming the brightness of the light based on distance.
|
|
|
|
|
Normal Map Maker
You can create normal maps with this shader! Just apply it to your high res model and take a screen shot. You get an instant normal map instead of having to wait an hour like with most normal map renderers.
|
|
|
|
|
Global Illumination Shader
I got the idea for this shader from Dan Lemmon of Weta Digital. It simulates global illumination and ambient occlusion to create more realistic lighting.
|
|
|
|
|
Skin Shader
This shader mimics some of the properties of skin such as sub-surface sacttering, variable glossyness, subtle surface detail, and rim lighting. It's especially tailored for use on faces, but can also be used for skin in general.
|
|
|