Better 'Global Illumination' in maya |
Yes, lucky people, GI!! In
our attempt to fake GI, Francois Zarroca wrote the skyLightControl mel
script. The
major problem with ambient lights used for direct illumination (with the
ambientShade attr. set to 1) is that any bump assigned to a shader lit
by ambient lights is almost invisible (or you have to set very high values
to see it, and it's most of the time a pain to set) This was for the skyLight mel script (kinda pros and cons).
I'm about to show you a very simple shading network which makes maya enter in the medium of GI renderers. (bah, I'm kidding..!! ;-)) This
method has a major limitation in the fact that the point or dir light's
speculars highlights are still visible if you have a very glossy material
(spec very sharp and bright). Well,
it's pretty simple. - Create a simple
skyLight with the skyLightControl (64 lights, whatever dir or points for
the shadows). Don't forget to uncheck the re-use shadows attr. - Select the ambientLight group and delete it. - Select the point or dir lights group, open the spreadSheet window, and go to the keyable tab. Select the color attr. (RGB) and set 1 1 1 (it's an example, but you're free to enter other values!!) - Set the shadowColor to 0 0 0. - Render an ipr session. This time, you should get something like this: At
that particular moment, once again you're thinking :"What the hell
this bloody french frog is doing!!??" - Create a directional light, and orient it like below: Wow, this is so... wet!!. Intense!! ;-) This is exactly the kind of problem we've had to deal with during the writing of the skyLight and why we've chosen ambientLights to illuminate an object. Now, in order to 'remove' all these little specs we don't want (updated from here) - Create a samplerInfo
and a plusMinusAverage node. Drag the samplerInfo to the plusMinusAv.
node, and connect the rayDirection to the input3D. - Then connect the normalCamera to the (nextAvailable) input3D. - Turn the operator of the PMA node to 'substract', then drag it to your shader and connect the output3d to the rayDirection. Your shading network should look like this: And here is what you get with that shading network:
Compare the image above and the one before, the difference is really noticable.
After few adjustements of the specular attribute of my blinn, here's is the 'final image':
This tutorial is now almost finished and I hope this will help you soon. Anyway,
a last word about the connections, I wrote a little mel script that creates
and connects automatically the nodes to your shader. You can download
the updated version of spec_GI.mel here. To
use it, source it first, then select your light FIRST, then your shader
and execute the script. If you need to add the connection to another shader,
just select it and execute it again. Here is a very basic sample scene you can download to see the connections
Limitations: The connection shown above doesn't work at all with the AM_glossy, AM_velvet, and works 'correctly' with the anisotropic when the x and y angle are almost of the same value. The lower the rougness is, the most you'll see the specular highlights. You
got to understand that the specular highlights actually are dimmed by
the samplerInfo, not really 'removed' like I said.
My last sentence will be for Maya 4 which I can't wait to get my hands on. Francois
and I have planned to re-write completely the script, to use the new light's
features of this new version. But this is another story I'll talk to you later... |
GI in maya - Emmanuel Campin / March 5th 2001 |