Jump to content

Shadow() Question


ivan

Recommended Posts

okay, a little clarification-

this does not work:

if (receiveshadows){

shadow(red);

shadow(Cl);

}

the red color will get shadows, but the regular lights will not.

If I try this:

if (receiveshadows){

shadow(Cl);

shadow(red);

}

the lights get shadowed, the red color does not.

I suppose this might work:

vector white = set(1,1,1)

if (receiveshadows){

shadow(white);

}

Cl *= white;

red *= white;

the shadow() function takes as an argument Cl.... anybody know if there's a reason for this?

could I perhaps call it with my own color and get a shadow value? would it still attenuate the Cl value?

Link to comment
Share on other sites

ok, so here we are... with a 3 l(or 4) ight setup, this seems to work:

illuminance(P, {0, 1, 0}, PI)

{

if (receiveshadows){

shadow(whitelite);

Cl *= whitelite;

}

clr += Cl;

if(i==0){

RGBclr.r += whitelite.r;

}

if(i==1){

RGBclr.g += whitelite.g;

}

if(i==2){

RGBclr.b += whitelite.b;

}

i++;

//...... USE Cl OR RGBclr HERE AS NEEDED...

}

now if you compute your surface color with Cl you'll get your actual light colors, and if you use RGBclr, you'll get the light passes in each channel. Of sourse, this only works if you already know how many lights there are in the scene...

Link to comment
Share on other sites

oops! an error on my part- you MUST set whitelite = 1 just before you call shadow()....

illuminance(P, {0, 1, 0}, PI)

{

whitelite = set(1,1,1);

if (receiveshadows){

shadow(whitelite);

Cl *= whitelite;

}

...

otherwise you keep accumulating shadows...

ok, so here we are... with a 3 l(or 4) ight setup, this seems to work:

illuminance(P, {0, 1, 0}, PI)

{

if (receiveshadows){

shadow(whitelite);

Cl *= whitelite;

}

clr += Cl;

if(i==0){

RGBclr.r += whitelite.r;

}

if(i==1){

RGBclr.g += whitelite.g;

}

if(i==2){

RGBclr.b += whitelite.b;

}

i++;

//...... USE Cl OR RGBclr HERE AS NEEDED...

}

now if you compute your surface color with Cl you'll get your actual light colors, and if you use RGBclr, you'll get the light passes in each channel. Of sourse, this only works if you already know how many lights there are in the scene...

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