Showing posts with label shaders. Show all posts
Showing posts with label shaders. Show all posts

Monday, August 19, 2013

50% Grey Midpoint in Maya Diplacement

Maya displacement is something that I avoid using as much as possible.

I've always maintained that my reluctance is because I don't have much experience with sculpting (Though I've used Mudbox a little bit), and that no matter how I do it, greyscale displacement maps never look as nice as a normal map.

That being said, I've discovered that greyscale normal maps don't import into Maya correctly (to my view).

Logically, I would expect a value of 50% grey to not change the displacement of an object at all, while white would be the equivalent of 100% displaced up, and black 100% displaced down.

Maya by default takes black as no displacement and white as 100% displaced up.

In order to fix this, you need to put the following formula into the Alpha Offset slot of the file node which holds the displacement image:
=-0.5*%FILE%.alphaGain
Where %FILE% is the name of the file node (or texture node if you're not using a file). We use the value of -.5 to shift the midpoint down 50% from white to mid grey. 

Your displacement should now work correctly.

Tuesday, June 21, 2011

An Introduction to the Facing Ratio Property.

This is probably an old trick, but it can be a bit confusing how to hook it up, so I thought I'd pop a brief outline on here.

The Facing Ratio trick is a great way to simulate lots of things where a lighter colour is required around edges. It's good for making glass, velvet, car paint and fake subsurface scattering out of standard Maya shaders, and I'm sure there are other uses for it too.

I'm just going to give you the basics of how to hook this up.

You need a sampler info node from the Utilities rollout in your hypershade, and a ramp texture.

It's all really simple, middle mouse drag the sampler info node in your work area to the ramp texture node.

A menu will appear, asking how you want to connect the nodes, just click other. The connection editor will pop up, and you want to click facingRatio on the left and connect it to uCoord or vCoord (expand the uvCoord rollout) depending on how your ramp is set up (vCoord for a V Ramp, uCoord for a U Ramp, doesn't matter which way you do it).

This will now place the top colour of your ramp facing the camera, and the bottom colour just around the edges facing sideways from the camera.



From here you can plug it into anything you like, Incandescence and colour works well for velvet, but play around with it and see how you go. It can probably be used in conjunction with mia shaders for some cool effects too.

Don't forget you can map each selected colour in your ramp with other nodes!