puma.snyder Posted January 15, 2004 Share Posted January 15, 2004 How is the lightmask parameter for the illuminance loop vop supposed to work? If I add a parameter vop for lightmask it only works for one lightname, using "*" or "light1 light2" does not work. Here is a quick example file Thanks again Achim lightmask.rar Quote Link to comment Share on other sites More sharing options...
stevenong Posted January 15, 2004 Share Posted January 15, 2004 Hey Achim, It could be a bug. The workaround is to create a string parameter called "light_mask" then connect it to the lightmask input of the Illuminance VOP. Cheers! steven Quote Link to comment Share on other sites More sharing options...
puma.snyder Posted January 15, 2004 Author Share Posted January 15, 2004 Hey Steven, thats what I did, and it still doesnt work. Can it have something to do with my illuminance loop? Quote Link to comment Share on other sites More sharing options...
stevenong Posted January 15, 2004 Share Posted January 15, 2004 Hey Achim, I can't look at your file at the moment. I'll take a look at it when it's convenient & get back to you. Cheers! steven Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 15, 2004 Share Posted January 15, 2004 Hi Achim, Well.... it's a half-bug-half user-error thing The good news: it's got nothing to so with the light mask The general idea in an illuminance() loop is that you accumulate into some variable, and what you're feeding it is a constant (i.e: a "number"). And if we were talking VEX, then that would be the end of the story -- your code, would look something like this: #define light 0 illuminance(....) { light = light + Cl; } Cf = light; Don't try that at home! It makes no sense and furthermore, won't even compile. But this is the equivalent of what you're asking VexBuilder to make sense out of, and the best it can come up with is something like: vector light = 0; vector sum1 = 0; illuminance(...) { sum1 = light + Cl; sum = sum1; } Cf = sum; Everytime through the loop, you're adding Cl to a constant (whose value is 0.0), so the result after the loop is simply the color of the last light that was sampled (red in this case). And VexBuilder treats "light" as though it were a constant by assigning the addition to a third variable (sum1). But here's the "bug" part of it: you only get this problem if you have an angle wired into the illuminance vop. If you disconnect the angle input, you get the behaviour you're expecting (even though the way you're using it is still wrong). This is because we're in the wonderful and crazy land of VOPs, and VexBuilder is trying to make sense of your inputs (even when they don't), and because the "Constant" VOP is not really a constant at all, and.... well; let's say you're confusing the heck out of it So; to recap: you shouldn't be feeding it a constant as an accumulator to begin with. But, by accident, VexBuilder will work as expected even with a constant, as long as nothing else is connected (again, this is by accident -- it could have gotten confused before that). Use a variable instead. (unfortunately, in VOPs, you don't create a variable, you create a parameter -- hehe; your turn to be confused ) Here's the file with all three versions: 1. "bla" -- your original 2. "bla_FixedButWrong" -- should-be-broken-but-isn't 3. "bla_Fixed" -- fixed using a variable lightmask.zip Quote Link to comment Share on other sites More sharing options...
puma.snyder Posted January 16, 2004 Author Share Posted January 16, 2004 thanks a lot Mario!! one question regarding your fixed version. Why do you wire a constant vop into the paramter vop instead of just using the parameter vop? And, in the help for the illuminance vop it says If no input is specified, the light mask specified in the parameters for the object being rendered is used. So I disconnected the lightmask parameter vop (which then allways screws up the connections inside the illuminance loop), set the objects lightmask value to red, but still all lights are used. Is this again a user error? Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 16, 2004 Share Posted January 16, 2004 Hey Achim, Why do you wire a constant vop into the paramter vop instead of just using the parameter vop? Just so it doesn't show up in the parameter dialog (set to "use input if connected"...). In your original you had used a constant (i.e: non user-editable quantity), so I figured I'd keep the spirit of the original and change as little as possible. In a "real" context though, yes, I'd likely use a global (which is still a variable and not a constant). And, in the help for the illuminance vop it says If no input is specified, the light mask specified in the parameters for the object being rendered is used. So I disconnected the lightmask parameter vop (which then allways screws up the connections inside the illuminance loop), set the objects lightmask value to red, but still all lights are used. Is this again a user error? Nope; that'd be what we call a bug... errr... how about "misdocumentation".... OK; how about: "the help is wrong". If you look at the code ("view code" from RMB menu), you'll see that what it defaults to when no input is given is actually "*" (i.e. all lights); where it really should be the empty string "" (i.e. don't override the settings in the object)..... Nope.... mmmmmnnnope..... no sir... uh-uh .... I don't use VOPs much, no.... (Just kidding; they *are* cool!) Cheers! Quote Link to comment Share on other sites More sharing options...
puma.snyder Posted January 16, 2004 Author Share Posted January 16, 2004 thanks very much Mario!! so if I wire a constant vop into a parameter vop, it becomes a variable, hmm Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 16, 2004 Share Posted January 16, 2004 so if I wire a constant vop into a parameter vop, it becomes a variable, hmm Yes because you're telling it to use the input as its value. And that in itself doesn't suddenly turn it into a constant -- i.e: it's getting its value from a constant but it remains a parameter. Hey; nobody said it had to be intuitive! Cheers. 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.