How do you create a good metal shader?
For different metals and say more or less eroded / rusty and so on.
I know that one difference from ordinary materials is that metal should 'colour' the specular light but when I do that with gold for example it just looks "yellow", not metallic at all.
Any help appreciated!
Answer
I have recently created shaders for both clean and brushed metals for my game in progress and I'm quite happy with the results.
Clean metal: The most important feature in my experiments was the environment reflections with cube maps. I implemented them with realtime render-to-texture environments, but also static images often gives good results and it's easier to blur them. The second most important feature was fresnel effect, which makes the silhuettes of the objects better. This for example gives a rounder look for balls. Specular lighting is not necessarily needed, as the cube map can provide the highlights directly. HDR rendering is also important to make the cube map reflections look good.
Brushed metal: For brushed metals you get good results quite easily by using a brush texture, something like this, together with anisotropic lighting. For anisotropic lighting you can find tutorials from the web, but I implemented my own by using blinn-phong as the base, but from the half-vector I eliminated 80% of the tangent direction. This means that you need tangents or bitangents in addition to normals in your models. The environment reflections are tricky for brushed metal. You can sample from multiple directions from the cube map based on the tangent/bitangent directions, but you might need lots of samples for good results. This however is not necessarily needed, as the texture and anisotropic lighting with multiple light sources already looks pretty nice. The end result in my case looks like this:
No comments:
Post a Comment