PDA

View Full Version : I Wish....



RonB
12-22-2008, 02:55 PM
some good guy scripter would write a "Shadow Catcher" script for Layout. A virtual plane that caught the shadows from objects on it and turned the rest transparent. Would make setup and composites much easier for blending objects with backgrounds.

Whaddya think?

Cheers, Ron

Stooch
12-22-2008, 06:53 PM
why do you need a script? just make a plane, go into advanced surface tab and set opacity to shadow density.

RonB
12-22-2008, 08:43 PM
Well Stooch because I have never been able to get it to work.
Where this is coming from is I took Hypershot out for a test drive. It has an auto ground plane that casts a shadow on a invisable virtual plane. No muss, no fuss, no set up, move the object around in an environment, set the lighting how you like and render. An alpha is saved and the shadow appears and the virtual ground plane is always invisible.
I got spoiled and wondered why everybody doesn't have one?

So I thought I ask here...

Ron

shrox
12-22-2008, 10:44 PM
why do you need a script? just make a plane, go into advanced surface tab and set opacity to shadow density.

I have never even used it. What will it do and how does it work? One thing I like about Lightwave is how there is always something new to discover that has always been there the whole time.

RonB
12-23-2008, 12:53 AM
shrox - Unless I am wrong here...and I may very well be...what it does is adds the shadow density, the shadow itself, to the alpha channel you save as a separate file along with the RGB file that's also saved as a separate file.
Then you use them to make a composite image.

The whole point of having a shadow catcher is to get away from all the separate rendered files and channels and just do it all at once!

Here's an example image of what I am talking about. This is a model rendered against a spherical background map that is also providing the illumination. The shadows are being cast onto a shadow catcher plane that is not visible to the camera. The shadow catcher moves with the bike and you don't see it, only the shadows under the bike. Makes placing the model anywhere in the scene really easy. There was no compositing done here, this was the final image rendered in a single shot. See what I mean?
http://www.dahothouse.com/work/bikebuilding.jpg

faulknermano
12-24-2008, 07:50 AM
not a one-touch solution, but check this thread out.

http://www.newtek.com/forums/showthread.php?p=799185

RonB
12-24-2008, 04:36 PM
faulknermano - Thanks man...that is very interesting and maybe could lead to an all in one script...who knows? Thanks again, good stuff. So many great people working on things in our community!

Cheers, Ron

zapper1998
12-24-2008, 05:37 PM
wow nice bike, image..

RonB
01-03-2009, 10:54 AM
Not much interest in this around here I guess. I keep hoping to get someone involved though.

I found this older script that looks as if it was designed to do just what I am looking for. But it does not work, for me anyway. It is unsupported and I do not know who the author is or if there are any proprietary issues with something like this. None the less I thought it would be permissible to post as an exercise at least. I certainly cannot make heads or tails of it, maybe one of you can?

Cheers, Ron

//set surface transparency if pixel is not in shadow.


var mylight;
var sa;
var myPos;
var hit;
var direction;
var color;
var PreviousLight;
var mylight;
var mylightname;



create
{
mylight=0;
mylightname=0;
myPos = <0.0,0.0,0.0>;
//mylight = getfirstitem(LIGHT);
setdesc("The shadow thing"); // set panel button text

}

flags
{
return( COLOR,
TRANSPARENT,
RAYTRACE);
}


process: sa
{
if (mylightname>0)
{
mylight = getfirstitem(mylightname);

myPos.x = sa.wPos[1];
myPos.y = sa.wPos[2];
myPos.z = sa.wPos[3];

if (mylight!= nil){
(hit,direction,color) = sa.illuminate(mylight,myPos);
}

//the documentation says that the return value of illuminte is 0 if no light is hitting, but i'm
//not entirely sure what that means
if (hit!= 0)
{
//the idea, anyway, is to set transparency if light is hitting the surface
sa.transparency = 1;
}
} //end ( if mylightname > 0)


}













options {
//display options requester

if(!reqbegin("The shadow thingy"))
return; // no Panel Services plug-in

if (mylightname>0)
{c1 = ctllightitems("select light",mylightname);} //adds a dropdown control
else
{c1 = ctllightitems("select light");} //adds a dropdown control


reqpost();

mylight = getvalue(c1);
if (mylight > 0)
{mylightname = mylight.name;}
else
{mylightname=0;}
return;



}










save: what, io
{
if(what == OBJECTMODE)
{
if (mylightname>0)
{io.writeString(mylightname);} //i'm not sure why, but it evaluating this during previews.
}
}



load: what, io
{
if(what == OBJECTMODE)
{
mylightname = io.readString();


}
}

Red_Oddity
01-03-2009, 12:31 PM
why do you need a script? just make a plane, go into advanced surface tab and set opacity to shadow density.

Unfortunatly, in all their wisdom, NT decided that GI/FG/AO shadows are not really shadows, only raytraced shadows from light primitives influence the Shadow Density setting in the surface tab.

Now, you have two very simple solutions though, you can either create a node based network where you connect a Lambert Color Ouput to a Math Clamp node's In and connect the Clamp 's Output to the Luminosity channel and Connect a 2D Image node (with the camera set to Front projection offcourse if you want to do the comp on a Background Image) to the Color input of the Surface .

Or, and this basically simulates the Shadow Density setting, you create the same Lambert setup but instead of connecting the Clamp's output to the Luminosity channel you connect it to the Transparency channel and you leave the Color of the Surface black, when you have no Background Image in your render but just render on a black background you can now composite the render with the shadow (which is now in the alpha channel) in a compositor (say Fusion or AFX).


I have to note though that you need enough light to prevent your plane from becoming too dark, so it's not a complete Shadow Density replacement per se.

RonB
01-03-2009, 02:12 PM
Thanks for taking the time Red...much appreciated. But me point here was to get away from doing post render composites, if you take a look at the earlier entries in the thread.

I am thinking there must be a way..nodal...to make the surface of the plane transparent except for the shadow, in the render with a background image in place. Front projection won't work because I am using a texture map wrapped to a sphere enclosing the scene. Actually I am using Blochi's sIBL rig for lighting, reflection and BG images.

I am way behind as far as nodes go and a bit discouraged trying to learn. Got Angel Nieves book on texturing and the Essential LW 9 sitting in front of me but I am basically math illiterate and struggling. Still, I have seen what people have produced here and am convinced it can be done...but not likely by me.

As an example, I have not been able to make what you posted above work! My node previews look nothing like yours with the same settings....

Thanks for any help,
Ron

RonB
01-03-2009, 04:44 PM
Still working on it...thought I had found it....

I can get the shadow to punch a hole in the plane but cannot figure out how to invert the effect so that it is the plane that is transparent....

Stooch
01-06-2009, 12:41 PM
Well Stooch because I have never been able to get it to work.
Ron

ok thats a reasonable clarification. although im kind of perplexed why you didnt even mention that you tried this solution in your original post. so i assumed you didnt know about it. I use it all the time and i dont even have to break it out either, i can lump it with the object layer.

anyway it does have lots of issues so i would like a more robust solution as well.

while it doesnt support all the GI features, i find that using lights (like globe) is a good way to make it look good enough. but still. it should be more seamless. i think this goes with my request for one click render passes.

RonB
01-06-2009, 01:54 PM
Yes, I agree there Stooch, one click render passes would be great. Seems something as simple as an invisible ground plane would be part of the package. Other programs have a shadow catcher at it doesn't interfere with composite issues. Sorry I wasn't clearer in my original post about the shadow density...guess that's going to be the way I'll have to deal with it.

Still, I am a little puzzled why there doesn't seem to be much interest in having a shadow catcher available here a bouts?

It reminds me of the story about the guy that asked his wife why she always cut the tip off the roast and put it in a separate pan to bake. She answered that that's the way her mother did it and that's how she was taught. Curious she went to her mother and asked her why they always cut the tip of the roast and put it in a separate pan? Her mother said that her mother always did it that way and she should ask her. So she went to her grand mother and asked. The grand mother explained that when the wife's mother was young they had a small stove and a whole roast wouldn't fit in it so she cut the tip off put it in another pan and cooked it on a rack below the other. But she quit doing that when she got a better stove.

Seems like a lot of what we do is because that's the way it's always been done...

Kevbarnes
01-10-2009, 11:57 AM
Hi RonB

This may be what you are looking for - Check the Link to my recent post

http://www.newtek.com/forums/showpost.php?p=805927&postcount=20

Regards Kev

RonB
01-10-2009, 04:53 PM
Thanks Kev...it seems that's exactly what I am looking for ...great job! and thanks for the preset!!!

You ought to post all this info over at the iSBL forum as well. I had started a thread over there at the same time and Blochi was looking into a shadow catcher as well.

Big Cheers,
Ron

Kevbarnes
01-10-2009, 05:11 PM
Ok I'll post it over

I havn't had time to check out the sIBL forum yet - been reading about HDRI and how to go about making them.

Usefull stuff

RonB
01-10-2009, 09:27 PM
Yeah good stuff! Get his book...It ought to be required reading for anyone doing any kind of imaging be it trad or digital photography, print, web or especially HDRI illumination for 3D. The guy explains it all like a walk through the park!

Cheers, Ron

Kevbarnes
01-11-2009, 02:57 PM
Posted Today to the hdrlabs forum

http://www.hdrlabs.com/cgi-bin/forum/YaBB.pl?num=1231677170/5#5

Regards

Kev