Jump to content

Illuminance VOP


AndrewVK

Recommended Posts

Is there any possibility for the variable entering

the Illuminance VOP to not being returned

to it's initial value during each iteration?

I'm trying to create a VOP network from the following vex shader:

#include <math.h>

#pragma label shadow "Shadow Amount"

surface

BakeShd(float shadow = 1)

{

vector mask = {1,1,1};

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

{

shadow(mask);

}

Of = ({1,1,1}-mask)*shadow;

Cf = mask*Of;

}

And that's what I'm receiveing as a result:

/

/

/

/

/

vector _mask = mask;

vector color1 = { 0.0, 0.0, 0.0 };

illuminance(_P, _N, _angle, _lighttype, _lightmask)

{

color2 = _mask; !!!!_____RESET_____!!!!!

shadow(color2); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

color1 = color2;

}

/

/

/

/

Link to comment
Share on other sites

hi!

did the code work in vex as is?

the reason I'm asking is because the vex html docs specify (quoting):

"However, once the shadow shader has been called, the value of Cl will be changed for the duration of the surface shader"

and if I'm not mistaken you're trying to get a cumulative effect within the illuminance loop...

why don't you try including another variable from outside the illuminance loop that would act as a "memory" for the mask..call it "mem".

all you'd have to do is to multiply the result of shdow(mask) and "mem" before outputting it to "mem".. of course, mask gets reset at every iteration but at least you get the cumulated effect of the shadow call in mem (if that's what you're after....dynamically changing "mask" looks ...er...hard :) the only way would be to import it from the light shader...but then again, no cumulative effect in there either...)

are you trying to do shadow masking in the shader?....is it to get shader/object-centric shadow linking instead of specifying the mask in the lights (long and tedious list editing if you have a lot of objects)...am I warm?

does getlightname() help?..

sorry for the dumb questions, you must have considered all those options already, as for me, the whole shebang is kinda new...

cheers!

Link to comment
Share on other sites

>>did the code work in vex as is?

This particular shader is created for a very specific task,

such as "Crazy Shadows" and it ( raw vex) does exactly

what I need at this moment.

The object is totally transparent,

at places where the shadow does not fall on it.

>>all you'd have to do is to multiply the result of shdow(mask) and "mem" before outputting it to "mem"..

Thanx! This should work

:)

post-9-1035451632.jpg

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