Jump to content

Generate shadow matte in vex for lights of specific category


Recommended Posts

Hi,

 Does anyone have thoughts on how I might be able to access the direct_shadow component on a light by light basis in VEX?

 

 I'm using PBR, and need to do some shadow compositing in render rather than in post.

 

 I can use the shadowmatte vop to give me a matte to use, but it doesn't appear to allow me to restrict which lights contribute to the matte.

 

 My current thinking is to use an illuminance loop with categories, but I'm unsure if/how I can query the lights for shadowing info.

 

 Is that data exported from lights, or in PBR is it all lumped into one output by the integrator? (I see the pbrlighting vop exports direct_shadow as one vector...)

 

 

any ideas?

Ben

Link to comment
Share on other sites

when you say you need to do shadow compositing, what do you mean?

 

inside an illuminance loop, i think you just need to call shadow() to get the light coming thru and invert that to get the amount of shadow (probably should call it with a {1,1,1} light value).

Link to comment
Share on other sites

Thanks - shadow() did the job. I'd been skirting around that in my first stab at things, but couldn't quite get my head round its usage.
 
For the record this is doing the job for me (as an inline piped into the Ce of a computelighting):
 
 

vector shad = {0,0,0};

illuminance(P,N,1,"categories","A")
{
 shad += shadow({1,0,0});
}

illuminance(P,N,1,"categories","B")
{
 shad += shadow({0,1,0});
}

illuminance(P,N,1,"categories","C")
{
 shad += shadow({0,0,1});
}


$out = 1 - shad;

 
 
 
All I want it for is generating some shadow mattes so I can 'grade' a backplate projected on to a grid for a turntable setup. Just want to avoid having to do it in comp after the fact. Much better if it can be live.
 
Thanks again
Ben

post-14772-0-17932200-1446936190_thumb.p

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...