NavBar

Tuesday, March 2, 2010

Nazis and Shaders!

Finally! Something visual to throw out into the world.

One of the options that caught my attention when I first started playing around with UDK's material editor was the Specular Power parameter. Specularity is essentially how shiny an object is. In reality, specular highlights are reflections of whatever is casting light. In CG, esp. for games, it's an approximation. The two control parameters given are Color and Power. Color is obvious, but the Power parameter is control over the spread of the highlight. Really shiny objects like polished metal have tight, bright highlights, while things like rough-textured plastics, unfinished wood, or other duller objects would have very wide, diffuse highlights. What first came to mind was how to control that across a surface? If you could control the SpecPower, you could simulate multiple material types without having to create and assign a new shader material for each material type. It took a few tries, but I think I have a basic working solution.

In addition to creating Diffuse, Specular Color, Bump, and Normal maps for a material, I worked out a way to make a Specular Power map. The way it works is it divides the texture into 4 color channels (RGBA) and assigns each one a specific specular power. It then adds each area back together, then divides the result by the sum of the original channels. Here's an image of this set up as a shader network in UDK:


The texture can't be applied directly to the Specular Power parameter because UDK sees each color channel as a value between 0 and 1, while the SpecPower parameter is a (relatively) unlimited number, and 1 creates a very very diffuse specular. By multiplying each channel by a fixed desired SpecPower, the artist can apply a range of specular intensities in the same material. Here's a quick example of the shader in action:


SpecPwr Shader Demo from Adric Worley on Vimeo.

As you can see, the reflected white highlight is larger and more diffuse on some areas, and smaller and more focused in others.

I don't know if this has any practical application in games, or if it's too expensive for too little payoff, but if was certainly a fun problem to try to solve.

Next up: Zombies!

Now that I have a working rig with a skinned mesh, I've finally gotten down to pumping out some animation. It's not great, it's not finished, but it's something. So far all I've done is a rough walk and run, but I'm slowly getting back into the groove. Emphasis on slowly. (Also, Vimeo, in its infinite wisdom, appears to have enabled frame blend on its upload encoding, so the vids aren't great quality. shame.)


NaziWalk from Adric Worley on Vimeo.



NaziRun from Adric Worley on Vimeo.

To be perfectly honest, I'm quite disappointed with animation here at Sheridan. I haven't done any animation of note in about two years. Most of the later work in 2nd year was all lip-sync, and as I've said before, character animation does not come easily. Combine that with my still-developing character-drawing skills, and you end up with a lot of meh work. Third year was a bust, too. My action analysis was terrible because I spent so much time trying to keep up in all the other classes that animation kept getting pushed to the side (a common problem here), and my group film went similarly. I wish that we'd been given more opportunity to focus on doing animation, or at least have enough time outside of schoolwork to explore it more on our own. My friends can attest that the time I took out of class work to explore Maya took its toll on my marks. With any luck (and dedication), I'll be able to do more animating on my own once all this film stuff is done.

EDIT: I've written more about this overly-complex SpecPower shader in this post, where I realize a more efficient solution.

1 comment:

Leisha-Marie said...

I feel the same about animation, Adric. The unless your focus is STRICTLY animation, and you were willing to ignore everything else for it - it's a huge task now.

Although I'm probably getting more benefit out of second year than you are, with a musical.