Forums
You are not logged in.
#1 2011-10-04 03:47:10
- TokeJepsen
- Member
- Registered: 2011-09-12
- Posts: 13
shadow matte workflow
hi there,
i have a scene where I need to render the background and characters seperately. I have seperate out the lights, but I need athe characters to cast a shadow on the background.
tried the matte object for visibility, mip_matte_shadow and useBackground shader, none seem to give me the shadows cast onto the background in the alpha. is there a workflow for this?
Offline
#2 2011-10-04 04:26:59
#3 2011-10-04 05:58:51
- TokeJepsen
- Member
- Registered: 2011-09-12
- Posts: 13
Re: shadow matte workflow
i tried that method with useBackground, but I'm not getting the shadow
Offline
#4 2011-10-04 07:14:14
- TokeJepsen
- Member
- Registered: 2011-09-12
- Posts: 13
Re: shadow matte workflow
it seems that as soon as I start using lightshaders and shadowmaps, i dont get the shadow information anymore
Offline
#5 2011-10-05 12:49:15
- TokeJepsen
- Member
- Registered: 2011-09-12
- Posts: 13
Re: shadow matte workflow
i have tested out this on multiple maya files now, and as soon as you use a lightshader with the shadow maps, the shadow information is lost in the aov pass.
do i need to have a special shader for it to work?
Offline
#6 2011-10-05 14:51:50
Re: shadow matte workflow
The predefined AOVs in 3Delight for Maya are implemented in the files used to support the Hypershade nodes. So if you are using a RenderMan shader for your light and want it to work with the predefined AOVs, you'll need to modify it accordingly. Same thing if you use a RenderMan shader on your geometry; it will not output the predefined AOVs unless you modify it to do so.
Offline
#7 2011-10-05 15:48:08
- TokeJepsen
- Member
- Registered: 2011-09-12
- Posts: 13
Re: shadow matte workflow
cool, cheers for that. is there any documentation for the modifying the shaders for aov support?
Offline
#8 2011-10-05 16:33:55
- elvis75k
- Member
- From: Italy
- Registered: 2007-12-04
- Posts: 105
Re: shadow matte workflow
Sometime i use the search button (adding aov).
Here is the link to the first one.
http://www.3delight.com/en/modules/PunB … hp?id=3024
Enjoy
Computer-generated imagery
Offline
#9 2012-02-10 03:24:25
- TokeJepsen
- Member
- Registered: 2011-09-12
- Posts: 13
Re: shadow matte workflow
Right, I havent been very active lately, but I would like to elaborate on this topic and findings we made.
First of I would say that I'm quite a novice when it comes to 3delight and renderman shading language, so I cant garantee any claims I make, but the following worked for our production.
The process of using the useBackground shader for seperating characters from the background works a treat. Our main issue was that we wanted to reuse some shadowmaps alongside rendering new live shadowmaps. For this we needed to use the lightshaders to combine the shadowmaps. When introducing default lightshaders to light the scenes you lose the option of using the useBackground shader, because the default lightshaders dont recognize the shadow information from the useBackground shader. Or to be more precise you cant output the shadow AOV anymore.
So you will have to modify the lightshaders to accommodate for this. Below is the modified maya directional lightshader:-
Code:
#include "light_utils.h"
light
maya_custDirectional(
// Inputs:
color lightColor = 1;
float lightIntensity = 1;
color shadowColor = 0;
string shadowmapName_A = "";
uniform float shadowFilterSize_A = 1.0;
uniform float shadowBias_A = 0;
float shadowBlur_A = 0;
float shadowSamples_A = 16;
string shadowmapName_B = "";
uniform float shadowFilterSize_B = 1.0;
uniform float shadowBias_B = 0;
float shadowBlur_B = 0;
float shadowSamples_B = 16;
string shadowmapName_C = "";
uniform float shadowFilterSize_C = 1.0;
uniform float shadowBias_C = 0;
float shadowBlur_C = 0;
float shadowSamples_C = 16;
// Outputs:
output varying float __3dfm_shadowing = 0;
output varying color __3dfm_unshadowed_cl = 0;
)
{
extern color Cl;
color lcolor = lightColor;
vector dir = vector "shader" (0,0,1);
solar(dir, 0.0)
{
//shadow_A
color shad_A;
uniform float filterwidth_A = shadowFilterSize_A;
uniform float samples_A = shadowSamples_A;
if( shadowFilterSize_A > 1 )
{
uniform float shadingrate = 1;
attribute("ShadingRate", shadingrate);
filterwidth_A = 2.5 * shadowFilterSize_A / sqrt(shadingrate);
if( filterwidth_A < 1 )
{
filterwidth_A = 1;
}
if( shadowFilterSize_A > 2 )
{
samples_A *= 2 + shadowFilterSize_A / 10;
}
}
if( shadowBias_A == 0)
{
shad_A = shadow(
shadowmapName_A, Ps,
"blur", shadowBlur_A,
"width", filterwidth_A,
"samples", samples_A );
}
else
{
shad_A = shadow(
shadowmapName_A, Ps,
"bias", shadowBias_A,
"blur", shadowBlur_A,
"width", filterwidth_A,
"samples", samples_A );
}
//shadow_B
color shad_B;
uniform float filterwidth_B = shadowFilterSize_B;
uniform float samples_B = shadowSamples_B;
if( shadowFilterSize_B > 1 )
{
uniform float shadingrate = 1;
attribute("ShadingRate", shadingrate);
filterwidth_B = 2.5 * shadowFilterSize_B / sqrt(shadingrate);
if( filterwidth_B < 1 )
{
filterwidth_B = 1;
}
if( shadowFilterSize_B > 2 )
{
samples_B *= 2 + shadowFilterSize_B / 10;
}
}
if( shadowBias_B == 0)
{
shad_B = shadow(
shadowmapName_B, Ps,
"blur", shadowBlur_B,
"width", filterwidth_B,
"samples", samples_B );
}
else
{
shad_B = shadow(
shadowmapName_B, Ps,
"bias", shadowBias_B,
"blur", shadowBlur_B,
"width", filterwidth_B,
"samples", samples_B );
}
//shadow_C
color shad_C;
uniform float filterwidth_C = shadowFilterSize_C;
uniform float samples_C = shadowSamples_C;
if( shadowFilterSize_C > 1 )
{
uniform float shadingrate = 1;
attribute("ShadingRate", shadingrate);
filterwidth_C = 2.5 * shadowFilterSize_C / sqrt(shadingrate);
if( filterwidth_C < 1 )
{
filterwidth_C = 1;
}
if( shadowFilterSize_C > 2 )
{
samples_C *= 2 + shadowFilterSize_C / 10;
}
}
if( shadowBias_C == 0)
{
shad_C = shadow(
shadowmapName_C, Ps,
"blur", shadowBlur_C,
"width", filterwidth_C,
"samples", samples_C );
}
else
{
shad_C = shadow(
shadowmapName_C, Ps,
"bias", shadowBias_C,
"blur", shadowBlur_C,
"width", filterwidth_C,
"samples", samples_C );
}
///////////////////////////////////////////////////////////////////////////////////
__3dfm_shadowing = luminance(max(shad_A,shad_B,shad_C));
lcolor = mix( lcolor, shadowColor, max(shad_A,shad_B,shad_C));
__3dfm_unshadowed_cl = lightIntensity * lightColor;
Cl = lightIntensity * lcolor;
}
}Of course this needs to be converted to a sdl file for 3delight to recognize it. but this lightshader will recognize the shadow information from the useBackground shader and put that into the shadow AOV. The lightshader has several shadowmaps that you can input and tweak, and they will get layered ontop each other.
Of other really useful features of 3delight we used was the "Display Subset" under the advanced tab of the Displays. Using the above method and creating a set of your background, you can isolate the background shadows into an AOV pass. Even better is that the shadows generated in the AOV are not masked out by the foreground elements (characters/props), so you'll end up with a full shadow that you can mess around with in comp.
Hope this is useful information for someone else aswell.
Offline

