Jump to content

Light Id - Deep Rasters


aracid

Recommended Posts

hey all

i wonder if it would be possible to render lights

ie, key light, fill light, and back light, and kicker light, all in their own channel, with one renderpass - much like an object id render pass.

i know one can light the scene with the RGB lighting setup(to relight the shot in comps), but i'm thinking of using more than the standard 3 point setup and rather export some sort of light id pass inwhich i can modify the intensities of every channel. thus relight the scene with unlimited lights.

i hope im making myself clear

but does anyone know how to do this ?

thanks in advance

aracid <_<

Link to comment
Share on other sites

I believe you can do this by exporting attributes from your lights to your surface shader, calculate the lighting, then export those values from the surface shader.

Have a look at the limport() vex function or "Import Light Variable VOP" if you prefer

using the VOPs.

note: these functions are only avaiable in an illuminace loop.

let me know if you have any questions.

Luca

Link to comment
Share on other sites

Here's one approach that will do it without requiring your lights to export anything. This little test shader can accommodate up to 3 lights, which it splits into diffuse and specular:

#pragma hint   DiffTint   color
#pragma hint   SpecTint   color
#pragma hint   l1_diff    hidden
#pragma hint   l1_spec    hidden
#pragma hint   l2_diff    hidden
#pragma hint   l2_spec    hidden
#pragma hint   l3_diff    hidden
#pragma hint   l3_spec    hidden

surface testLightExport(
      //Reflectance
      vector DiffTint   = 1;
      float  DiffAmp    = 0.8;
      float  DiffRough  = 0;
      vector SpecTint   = 1;
      float  SpecAmp    = 0.2;
      float  SpecRough  = 0.05;
      //Light separation
      string l1_name    = "";
      string l2_name    = "";
      string l3_name    = "";
      export vector l1_diff = 0;
      export vector l1_spec = 0;
      export vector l2_diff = 0;
      export vector l2_spec = 0;
      export vector l3_diff = 0;
      export vector l3_spec = 0;
   ) 
{

   vector Nf   = normalize(frontface(N,I));
   vector V    = normalize(-I);

   vector diff = 0, spec = 0;
   illuminance(P,Nf) {
      shadow(Cl);
      vector Ln   = normalize(L);
      vector cd   = Cl*DiffTint*DiffAmp*diffuseBRDF(Ln,Nf,V,DiffRough);
      vector cs   = Cl*SpecTint*SpecAmp*specularBRDF(Ln,Nf,V,SpecRough);
      string lname = getlightname();
      if(lname==l1_name) {
         l1_diff = cd; l1_spec = cs;
      } else if(lname==l2_name) {
         l2_diff = cd; l2_spec = cs;
      } else if(lname==l3_name) {
         l3_diff = cd; l3_spec = cs;
      }
      diff += cd; 
      spec += cs;
   }

   Cf = diff+spec;
}

And here's a test hip that uses it (just render the "MANTRA" ROP):

testLightSplits.zip

Yup. It's awkward. It's a bit of a pain... but at least it can be done.

Let's keep our fingers crossed that this kind of thing will be made easier in H9 ;)

Cheers!

Link to comment
Share on other sites

The way things are going with deep rasters and ipr do you think the two will merge? Essentially the render process won't create a final image at all it will simply herd all the information into some sort of uber format, halo will then read it in and you could re-light re-texture change shadows everything except change the model.......

Link to comment
Share on other sites

The way things are going with deep rasters and ipr do you think the two will merge? Essentially the render process won't create a final image at all it will simply herd all the information into some sort of uber format, halo will then read it in and you could re-light re-texture change shadows everything except change the model.......

24294[/snapback]

Yes, I think you're right. We're using layers more and more these days, and realizing that it's too much of a time-saver (in terms of both client tweaking and "look exploration") to ignore. Although it also means making some deep changes in "the way things are done" (shading libraries, etc.)... but that's just growing pains.

When you read Pixar's "Lpics" paper, you realize that, at the heart of it, it's really a bunch of these layers (granted, with a lot of non-trivial caching and hardware-assisted-what-not thrown in)... so I agree that in maybe the not-so-distant future we'll be doing all the combinatorial/compositing aspects of shading (plus lighting and reflectance maybe) in Halo (?).

Bye bye monolithic renders. The times, they are a-changing... ;)

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...