Ok, the real name of this post is “faking anisotropic shading for real-time rendering applications”, but that made even me yawn. But that’s what this post is about. It’s the first, in what I hope to be a series of tips and tricks revolving mostly around Alias Studio. I’ve found the documentation out there limited at best and this is my opportunity to give a little.
Just to set the expectations low – I seem to be blogging about once a month. So for what it’s worth – that’s my pace. On the other hand, if there’s anybody reading out there, please feel free to drop me a comment and let me know what you’re interested in and I’ll see what I can do.
So, when I was creating the shaders for the car renderings I posted about a while ago, I encountered a particular problem. One that I’ve encountered before, but never had the planets align to solve. Much of what I learn involves planets aligning and this time was no different. The problem was how to create a convincing anisotropic reflection effect that looks cool while tumbling the model live on the screen. If you’re not sure what this is all about Neil Blevins has a good explanation on his site here.
When I went to create a shader for the brake rotors, initially I used the same soft-chrome looking shader I created for the little rivets around the hub (and incidentally, this is the same shader the is used for the overall spoked portion of the wheel). It is just a basic Phong shader with the shininess turned down (broad highlights) and the reflectivity off to give it that bead-blasted look (no crisp reflections). But look at what I got on the rotor. Compared to the rivets, it was totally flat! Which makes sense I suppose, because the rotor itself is just a simple cylinder which is, well, totally flat on the ends.
While I was thinking about the problem, I started trying things. Things like using photographs to simulate the look – which works for static images, by the way, but I think it looks funny when you tumble the model. It’s a static image and thus loses all the luster of a real spun metal disc. Another approach was to use a bump map to actually create the tiny grooves on the surface of the rotor to get the effect. That has never worked for me – real-time or other wise. I consider it a brute force approach which tends to result in brutish end results.
I wanted the effect of an anisotropic reflection – not a physically accurate model of one. Of course, the answer was right in front of me. The hub portion of the rotor had a very dynamic highlight that responded to light in a very interesting way when the model was tumbled. The hub portion of the rotor was conical in section. The effect of light on metal with tiny circular ridges on it is also conical. So when in 3D rendering is the effect of a highlight in direct opposition to the surface geometry? When you use a bump map!
So, I added a simple ramp to the specular channel of my shader and got this. Sweet! It’s just a simple black to white ramp that follows the U direction of the surface. Since the end cap of the cylinder is essentially a revolve, the UV directions are circular and thus the ramp essentially shades the end cap like it was a cone – resulting the effect I wanted.
From there I started building a layered shader. The base layer was a simple gray Lambert. This would allow me to control the overall tone of the rotor. The next was to take my ramp-modified shader and tune it a bit. I made it 100% transparent with no color, no diffuse or anything else other than the specular with the bump mapped into it. Tweaking the shininess of the Phong shader controls the amount of “splay” in the highlight, while the intensity of the bump map controls the, um, intensity. I ended-up using a huge value (1000) for the intensity. This makes the virtual bump mapped cone quite tall. This may be somewhat related to the fact that I’m just using the default “Abstract IBL” rendering environment for this example – this scene just has a really strong single light coming down from the top. I’m sure if I used a scene with more complex side lighting, the value may not have to be so high.
As an experiment, I duplicated the anisotropic reflection shader I just made, layered that on top of the others and set the intensity of the bump map to -1000. So now I have two ramps layered on top of one another – one with a positive value and one of an equal, but negative value. This made the highlight symmetrical on either side of the center axis. It is hard to show in static images, but as you rotate the model, the effect is more obvious.
Lastly, I added yet another layer. This one has an image map of the cooling flutes. I used a solid projection for this. Three actually. One in specular to choke the highlight out of the holes, another in transparency to prevent the anisotropic shaders below from shining through and one as a bump map to get a highlight around each edge (this map had been blurred in Photoshop).
Here’s a slightly different view that shows how the conically shaped highlights travel across the rotor.
Cheers,
J.