Hey,
I was wondering if there is a vex call that uses RAT files as a matte/holdout map?
Example… You want to render a simple element interacting with some complicated object. In order to avoid rendering the expensive object again and again, you render it once as a deep shadow from camera and then you use this map to matte out your other objects.
I've done this in prman, so I'm sure mantra has an equivilant….
Any help would be great!
Thanks,
Phillip
Deep Shadow holdout
4708 1 0- Phillip
- Member
- 17 posts
- Joined: 7月 2005
- Offline
- Phillip
- Member
- 17 posts
- Joined: 7月 2005
- Offline
Hey,
so it looks like a simple ‘shadowmap’ call does the trick…
- if our element is in shadow we simply modify its color and opacity accordingly.
… methinks this may be too naive ???
-p
/*
so it seems you could either embed the holdout code
inside whatever shader you want to modify or you could
run it as a separate pass …
*/
surface
shadow_holdout(
string filename = “”;
float spread = 0;
float bias = 0.0001;
float quality = 1;
vector myColor = {1,0,0};
float myOpacity = .8;
)
{
vector finalColor = 1;
float finalOpacity = 1;
vector Pndc = toNDC(P);
float occluded = shadowmap(filename, Pndc, spread, bias, quality);
if(occluded>0)
{
/* do some stuff to the color and opacity */
finalColor = myColor;
finalOpacity = myOpacity;
}
Of = finalOpacity*occluded;
Cf = finalColor*Of;
}
The image shows a test comp where a semi-transparent plane using the shader above was composited on top of a sphere.
so it looks like a simple ‘shadowmap’ call does the trick…
- if our element is in shadow we simply modify its color and opacity accordingly.
… methinks this may be too naive ???
-p
/*
so it seems you could either embed the holdout code
inside whatever shader you want to modify or you could
run it as a separate pass …
*/
surface
shadow_holdout(
string filename = “”;
float spread = 0;
float bias = 0.0001;
float quality = 1;
vector myColor = {1,0,0};
float myOpacity = .8;
)
{
vector finalColor = 1;
float finalOpacity = 1;
vector Pndc = toNDC(P);
float occluded = shadowmap(filename, Pndc, spread, bias, quality);
if(occluded>0)
{
/* do some stuff to the color and opacity */
finalColor = myColor;
finalOpacity = myOpacity;
}
Of = finalOpacity*occluded;
Cf = finalColor*Of;
}
The image shows a test comp where a semi-transparent plane using the shader above was composited on top of a sphere.
Thanks again,
Phillip
Phillip
-
- Quick Links