UDK Custom Lighting Material examples
Here are several material examples that I have of my UDK Cook-Torrance Direct Lighting shader. It works great for non-reflective surfaces. The images in the gallery below have more information as to what is shown in each.
One of the main things I want to show with these images is how the F0(SpecAlbedo) and Gloss value impact these materials. I have left up the material instance that is assigned the spheres shown so that the values can be seen for different looks.
I also have an image showing the 3blend material that I used on the Sphere with the grass, dirt and concrete. This isn’t an especially complicated shader but it does have threshold based vert painted blends. Another thing that I want to mention is how I am pulling my F0 values. Since one of the main advantages of a shader like this could be the physically based nature. If you pair a solid ruleset with this, you can control all of your specular response in your game/scene etc. I wasn’t able to find an easier way to setup a list to pull F0 values from so I made a 32 x 2 pixel image with each pixel being a different surfaces F0 value. Now that I have a controllable list to pull values from, I just offset my UVs a fraction. As the F0A parameter value goes up, so does the pixel that is being looked at on that texture.
Another part I would like to talk about on the 3blend material is how the glossMask works. In that image you will see description tags for glossMaskA, glossMaskB etc. These are textures that give me a 0 to 1 range in specular response across a surface. In a perfect world a surface might consist of just a single surface type but with games, being able to sell layered surface types can be a huge visual gain. This also allows for easy iteration since material tuning may only require adjusting some values instead of changing a texture! I now take this glossMask and use it to LERP between 2 parameters. For the Gloss this would be GlossValueA and GlossValueB. Wherever my glossMask is black I will have my B value and where white, the A value. Another thing is that this only needs to be a mask so you could combine several masks into a texture and save on texture fetches.
- Here is a Sphere in UDK with my custom lighting material being used. It is a 2blend material using a threshold based vertex paint blend. The textures being used are the same for each but the F0 and Gloss values change. The Gloss value range on this one is very low. To think of it in other lighting terms, this is a very rough surface. Most of the light hitting it is being diffused and therefore we have a very soft look.
- In this image I have increased the F0 and Gloss value to match the values needed for gold. In this example you can see how the glossValueA and F0A are still low and could be used to give the look of a dust coating.
- This shows the threshold based vertex paint output
- Here is the 3blend material. All of the custom Lighting nodes are contained within a material function on the far left(the one with the words “DirectComponent” above it)
- Here is the 3blend material being used on a sphere.
- This shows just the vertex paint that drive my threshold blends.
- This shows the threshold based vertex paint output. The colors correspond to the different textures being blended, Red – A, Green – B and Blue – C