AndrewVK Posted October 23, 2002 Share Posted October 23, 2002 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; } / / / / Quote Link to comment Share on other sites More sharing options...
sirogi Posted October 23, 2002 Share Posted October 23, 2002 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! Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted October 24, 2002 Author Share Posted October 24, 2002 >>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 Quote Link to comment Share on other sites More sharing options...
sirogi Posted October 24, 2002 Share Posted October 24, 2002 The object is totally transparent,at places where the shadow does not fall on it. AAAAhhh gotcha! that got me scratching my head for a little while trippy!! I can picture this in a music video! (maybe it's the orange scheme) Cheers, Andrew. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.