Tuesday 30 March 2010

Shader Built.

Today I finished my shader, I tried to build it with as much flexibility as possible. This shader will help with performance and save time in the future. When this shader is instanced the user can set the following options:

Optional Textures:
- Diffuse Texture
- Diffuse 2 Texture
- Diffuse Detail Texture
- Specular Texture
- Specular 2 Texture
- Normal Texture
- Normal 2 Texture
- Normal Detail Texture
- Mask Texture

All diffuse textures have colour, contrast, brightness and desaturation controls. All Specular textures have contrast and brightness controls. All normal maps intensity controls. The mask has colour, contrast, brightness and clamp controls. Each texture has their own UV coord settings and each texture can be turned off if not required.

Detail layer doesn't need a specular map, so to save memory I did not include it.

Another optional feature is rim lighting, which includes a falloff, colour and intensity controls.

The last feature is one of my favorites, by using the object world position and adding it the the texture coords the shader can offset the textures position. Controls include optional XY and/or Z movement depending if the user needs full or partial texture offset based on the objects XYZ movements. For example, a brick wall texture could be created so that it is seamless horizontally but not vertically, this could be intention due to additional texturing requirements utilizing the top or bottom piece of the texture, using my shader the user now has an object with the ability to texture offset horizontally without having to recreate the material.

Here's the overview of the shader in the material editor:


It's one of my largest shaders and my first truly flexible material using instancing. And here's all the options in the menu:



I have added the new shader to about half of the ruin objects, tomorrow I will finish the job. The new shader looks gd and improves the look of normals, I will post the results soon.

No comments:

Post a Comment