Specular, diffuse and ambient lighting per light |
Well, that time, for once I won't say like I use to (sorry for that) that I found a new way to better illuminate your pretty models. In my last light tip, I was claiming that I did find a shading network that kinda 'dim' the highlights of low intensities highlights. In french in the text, it means that if you use a skyDome base lighting for 'GI', you can (partially) get rid of those little annoying specular smudges topping your shiny shaders. This method works pretty well if your shader is not too shiny. So if you have a shader which has a strong and sharp specular highlight, heeehaaa, well done Emmanuel, once again, you really took us for fools... You still have your naughty small specular smudges. Not this time my friends.
I wasn't thinking of using that attribute, because all my tests I've done about it were unsuccessful. But the solution is in it. It's written in the doc, we can see it when we open the connection editor, but I always failed when I wanted to use this (actually these) attributes as they are! What
am I talking about? Maybe some of you are still unaware of some Maya 4
light features. I'm actually talking about diffuse and specular lighting. In my method, it's a bit more complicated, you need to create more shaders, and it's consequently longer to render (not that much anyway), but it's worth it until Maya 4's official release. Ok, 3d people, if you don't know it, on each light you work with, you have a particular attribute named lightData. And on each shader you work with, you also have a lightData attribute. The
thing is that if you connect the lightData attr. of a light into the lightData
of a shader, this shader will only be affected / lit by the light you
previously connected, no matter how many or what intensities are the other
lights. And this is just one thing. Now,
I imagine that I can set the lightData.diffuse of my shader to 0*, I'll
only have a specular highlight??!! The same for specular if I set the
lightData.specular to 0*, would I only have a diffuse lighting??!!!! Too
easy to be true, isn't it?? ;) *: Actually the
command setAttr shader.lightDataArray.diffuse or .specular or .ambient
doesn't work (message: // Error: No objects matches name: blinn1.lighDataArray.specular
0 //) The
fake is to create a shader for the specular lighting (and fortunately,
you do use as many lights for specular as for diffuse), and one for the
diffuse lighting. Assign the layerShader to your object, and you'll have a perfect diffuse lighting plus a (so alone) specular highlight. If you need to add more specular highlights, just repeat the operation for your others 'specular lights' (remember, one shiny shader per spec. light), and add the newly created shaders to your layerShader.
Here
is an example:
To get rid of the specular highlights you don't want, do what I explain above, create as many 'shiny' shaders as you have 'specular lights', and connect each lightData of those lights into the lightData of the shaders. Create a layerShader (like I said) and add all your 'shiny' shaders to it (set their transparency to 1) and just change the first (original) blinn material to lambert and add it (last shader layer). Assign the layerShader to your object, and render hot. Here is (for 3 area lights) the shading network you have with those connections (the presence of the 3d placement node is explained at the end of this tip) Now,
with your brand new shading network, this is what you can get (with your
maya 3 version!!) The
specular highlights of all the directional lights are removed because
only the lambert shader is affected by all the lights (including area
ones), but as a lambert material, there is no specularity. And one main advantage regarding Maya4 light's features is that with the same light, you can affect then the specularity of one shader (i.e. no specularity) and let another material be shiny. In Maya4, you'll have to duplicate the non-specular light, and uncheck specular (and check diffuse lighting) to have the same effect. (but you'll just need one shader) ;-) This is it folks!! You can download this example scene here...
Emmanuel
In the image shown above, the area lights's specular
highlights are slightly better than usual (less curved).
To
avoid that disaster (and by the way to be fired from your company), here
is the little trick I found (for still images only) Your lighting will differ then, so re-adjust it to get the cooler effect you can. Sorry you have to re-make your lighting, but the result is really really worth it. You specular shapes follow almost exactly the curvature of the object, and are less distorted like default area lights.
One last trick I've just found (and I hardly think this is normal) but as the effect is funny, let me share this with you. Here is what you can get with area lights only. Enter '-' (minus) in the value of scaleZ (i.e.: if scaleZ = 1, modify as follow: scaleZ = -1), and you'll have that perfect smooth border of specularity (The border depth vary depending the eccentricity of your blinn material)
Now this is really over. Have fun and wish me good night!! |
Emmanuel Campin - (c) May 2001 |