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.

2 comments:

  1. Yes, for some strange reason Maya reads displacement maps differently to every other program I know. A small gripe really, but something so simple it amazes me why they haven't just thrown in the towel on that one and done it the same as everyone else. Would be so much more simple.

    ReplyDelete
    Replies
    1. It sure would. I've found a number of cases where useful things are a simple line of MEL but they haven't bothered adding them in as built-in GUI options.

      Delete