Good for gamers..!!
Well, here is a little tutorial on how to bake shadows at the same time you convert your shaders into solid texture files.
This can be pretty useful for gamers (low poly modeling and thirsty of quick texture mapping including... shadows)
I made a little scene to explain the workflow, and as you can see, that's a very basic scene.
Ok, the image above is my normal lighting. 5 lights casting shadows, and that's it.
Now, an attribute I won't introduce again (he's already well-known and famous), the lightShadowFraction. (See other light tips related to this node)
This node (once again) gives you the choice of affecting the lit part of an object (directly lit by a light source), and the part in penumbra or shadows of the same object. In a word, with this attribute, you can remap the shadows and only the shadows with whatever you want)
The lightShadowFraction works with depthmap shadows and ray-traced shadows, BUT in our very specific case (baking shadows), it only works with depthmap shadows.
So don't e-mail me to say "Oh you damn liar, it doesn't work!! Give me my money back you frog eater!!!" (Btw, you don't know what you miss!!! ;) )
Ok, the trick is then to use the lightShadowFraction attribute to tell your materials to have a different color depending the pixel is 'shadowed' or lit.
For that, I have created a plusMinusAverage node, and I have connected the lightShadowFraction of all my lights into the input1Ds of the plusMinus node.
Now select the plusMinusAverage, and change the operator from sum to average.
Create a blendColor, and a ramp (without its 2d placement).
As you have noticed (because you're all smart and dandy!! thanx Forrest), the walls are made in wood. So I have connected the outColor of the wood texture into the color2 of the blendColor node. Keep the connection editor open, and load as input the ramp node. Connect the outColor of the wood to the colorEntryList[0].color (the lowest color in pos). Delete the 2 other colors, and drag the ramp into the color1 of the blendColor.
Now, you just have to drag the blendColor into the color of your material, et voila!! (in english in the text).
Here is the shader network you have if everything works fine
In fact, the color2 of the blendColor node is the normal texture (which is lit by a light source), and color2 is the shadowed part of the object.
I render a little ipr session, and you still have your normal lighting. Now you begin to think "Or this guy is nuts, or it's time for him to quit the job and buy a transgenic cattle of lambs". I AM NOT CRAZY!!!
Just select the ramp, and apply a red color to the colorGain.
Oh!!! My shadows are red now!!! Thank you Emmanuel, you're not the stupid we thought!! (stupid as a stupid does!! Ok, SHUT UP Forrest now!!)
Ok, this was to demonstrate what lightShadowFraction does.
Now you need to simulate the density of the shadow 'within' the texture / shader, in order to bake correctly so I have set the colorGain to 0 (black color), colorOffset to -0.1 (these values are set to 'fit' with this scene, and can not be taken as 'must-be-like-that')
The image looks like this:
normal lighting /shadows
normal shadows + shader remapped with the lightShadowFraction
As you can see, the shadows are darker as I have darken the pixels not lit by the lights. This is normal, because if you set the light not to cast any shadows at that time, you'll have no shadows except on the walls!!
adjust the color attributes (colorGain and colorOffset) carefully because they will give the shadow colors of your baked texture!!)
Then I just have selected my surfaces (the 2 wood walls), my wood material, and I used the convertSolidTexture tool to bake the texture plus the shadows.
The lights's shadows (the real cast ones) must not be set to 1 (because no shadows on the rendering, no shadows on the baking)
Here are the 2 generated file maps of the 2 wood walls, and the resulting image of the baked shadows and textures (note that I have set the lights not to cast any shadows, that's why you just have the shadows on the walls)
right wall
left wall
baked shadows & texture on the walls
Repeat the same operations for your other materials, and bake'em!!
Ok, this is it!! I hope I didn't ridiculize myself too much, and most of all, the secret hope I learned you something useful. Now I'm going back to my transgenic lambs!! ;)
You can download the scene (including the file texture/shadows maps (jpg)) I made for this tutorial (Hey!! I have rights on the furnitures!!)
Page 1 of 1
Author: natgeo
Submitted: 2005-08-31 10:53:30 UTC
Tags:
Software: Maya
Views: 55,666
Related Items
-
Blonde woman in jeans and sweater - aXYZ design - AWom0004-CS / Rigged for 3D Max + Character Studio 3D Model
$49.00 (USD) -
Book of Shadows 3D Model
$20.00 (USD) -
Reel To Reel Player Untextured 3D Model
$115.00 (USD) -
Reel To Reel Player 3D Model
$210.00 (USD) -
"Rapid Rig: Poser" for Maya for Maya 2.0.9 (maya script)
$20.00 (USD) -
Animated Olympic Fire 2014 (Maya) 3D Model
$69.00 (USD) -
The Alchemy Tools for Maya for Maya 1.0.0 (maya script)
$20.00 (USD) -
Elephant 3d textured model 3ds max and maya scene files 3D Model
$30.00 (USD) -
Arab Rig for Maya with Ncloth simulation for Maya 0.0.1
$99.00 (USD)