Adverti horiz upsell
Faking outdoor illumination in maya
Faking outdoor illumination in maya
sdb1987, added 2005-09-08 10:02:28 UTC 82,386 views  Rating:
(1 rating)
Page 1 of 4

Download Tutorial Scenes

First I have to thank Tom Kluyskens for helping me on the hard part of this tutorial.

You'll learn here how to use a very powerful node: the closestPointOnSurface node. Tom has presented a course on that node during the rendering MasterClass at Siggraph 2000.

My concern was to force a light to emit the color of a texture file (such as environment file: sky...) at the light position.
At this point, the closestPointOnSurface is the 'man' of the situation.

A little technical note on the closestPointOnSurface node: (source maya docs)
This node returns the closest point of an (x,y,z) point (attribute "inPosition") to a surface (given by the attribute "inputSurface"). You can query the closest (x,y,z) point (attribute "position") or you can query the closest surface (u,v) point (given by attributes "parameterU" and "parameterV").

Now let's enter in the 'vif of the subject' (in frenglish in the text)

First, you have to create an hemisphere of light. Let's call it domeLight. Simply create one directional light.
Move the light from the origin of the world at say (it's just an example) 10 units from the center.

Now, open the options window of the Duplicate menu. Enter -10 in X and 9 in the number of copies. This will duplicate 9 times your light, and rotate it by -10 degrees in X.

Then, select your first light (directionalLight1) and duplicate it with the following values: 10 in rotate Y, and 35 in number of copies. This will create a circle of light with 10 degrees between each light.

Once this done, select the upper light (directionalLight2), and duplicate it with the values: 12 in rotY, 29 in num of copies.

Repeat the duplicate operation with all remaining lights (one by one of course)

Enter the values for the duplication: dirLight3: (rotY: 15, copies: 23) / dirLight4: (rotY: 18, copies: 19) / dirlight5: (rotY: 20, copies: 17) / dirLight6: (rotY: 24 copies: 14) / dirLight7: (rotY: 30, copies: 11) / dirlight8: (rotY: 36, copies: 9) and dirLight9: (rotY: 40, copies 8). The dirLight10 is alone, so let it like that.

Now we have a complete hemisphere of directional lights. Go to the hypershade, and display the lights. Select them, open the Attribute Spreadsheet (so useful!), and go to the ALL section.
Enter a very low value of intensity, ex: 0.00125. (normally the intensity should be 1 / number total of dirLights: in this case 175), but you may want to adjust the intensity as you need.
Set the lights to cast shadows (type 1 in use Depth Map Shadows), and set a value of .1 in the Dmap Bias field. The shadow resolution is very important here.
The higher you'll set the resolution (say 1k), the longer it'll take to render, but your shadows will be more accurate than a 64 resolution.
In this example, you'll keep the default resolution wich is 512.
Now your domeLight is ready.

To finish with lights, create one more directional light, rename it 'sunLight' and orient it as you want.

But this is not finished yet. The harder (unfortunately) is yet to come, and thanks once again to Tom 'cause I wouldn't have found out alone how to make a light emit the color of a texture (and NOT the texture itself) mapped onto a surface. Say thanks to Tom!! Thank you Tom :)

We may need a surface to map the texture that will be use to 'light' the scene.

Create a Nurbs plane with a Quadratic degree, 5 in U and V patches.Scale it so that it lies entirely with your scene scale. Rename it "sky_plane". Select the inner points and drag them in Y+ so that you got an object like this:

Now the shading is quite simple. Create a surface shader. Create a projection (and its placement), and a texture file. Drag the file into the color of the proj, and connect the outColor of the proj to the color of the surfaceShader. Assign the surfaceShader to the plane. Select the file texture you want.
Set the proj type to cylindrical and make the 3d placement fit with the object.

When you are satisfied with your 'environment' shader, select the surfaceShader and the plane, and convert the shader into a solid texture file (it only works with 2d textures, sorry!) Create a 2d placement node (rename it as 'skyf_p2d') and drag it to the file (maya will do automatically the connections)
Rename the 'solid' file as 'sky_file'.