peliosis Posted August 6, 2006 Share Posted August 6, 2006 There are two nice functions in sig02.course16.pdf paper page 59 listing 3.3 : float bias(varying float value, b) { return (b > 0) ? pow(value, log(b) / log(0.5)) : 0; } float gain(float value, g) { return .5 * ((value < .5) ? bias(2*value, 1-g) : (2 - bias(2-2*value, 1-g))); } Everything is ok, I created a file with them, but one thing bugged me from the beginning: "varying float value"???? And soon I noticed that this bastard busted my shader because the file couldn't be included. As soon as I delete the word "varying", everything works like a charm apart from me not being sure if I haven't messed things up:) Could you explain what is a varying float, is it a valid C++ type (I believe the functions are in C++?) and why it doesn't work. Is it possible that deleting the word changed the function a bit? Sincerely yours Quote Link to comment Share on other sites More sharing options...
AlexPaes Posted August 7, 2006 Share Posted August 7, 2006 Hi peliosis, In Vex i think there is no 'varying' keyword, in renderman if i'm not mistaken it is meant to diferentiate from a variable that is actually constant along the surface (or in renderman 'uniform') from one that actually varies along the surface and as such 'varying' i believe Vex and Mantra make no such distinction. One possible example of a non-varying variable or 'uniform' is the Specular color for instance assuming a constant color is passed while a texture map will be a 'varying' variable. As far as i can see you are not breaking anything in the shader as the use of these keywords even in renderman is at least most of the times not a requirement. Cheers Quote Link to comment Share on other sites More sharing options...
peliosis Posted August 7, 2006 Author Share Posted August 7, 2006 You are right, there is varying float, but it rarely exists in rman data type lists. Thanks for the answer, I'm completely satisfied if it doesn't change the look of my surface Quote Link to comment Share on other sites More sharing options...
TheUsualAlex Posted August 7, 2006 Share Posted August 7, 2006 You are right, there is varying float, but it rarely exists in rman data type lists.Thanks for the answer, I'm completely satisfied if it doesn't change the look of my surface I thought 'uniform' and 'varying' types were hints to renderman in how it should optimize shading across the surface, no? Quote Link to comment Share on other sites More sharing options...
Gordon Posted August 8, 2006 Share Posted August 8, 2006 I thought 'uniform' and 'varying' types were hints to renderman in how it should optimize shading across the surface, no? That is correct, a uniform variable is simply one that doesn't change across a surface, so renderman only needs to store it once. Consider it like a detail attribute. I'm pretty sure that in vex shaders everything is considered "varying" ie. it's assumed to be non constant and vary on a per point basis. Quote Link to comment Share on other sites More sharing options...
crunch Posted August 9, 2006 Share Posted August 9, 2006 That is correct, a uniform variable is simply one that doesn't change across a surface, so renderman only needs to store it once. Consider it like a detail attribute.I'm pretty sure that in vex shaders everything is considered "varying" ie. it's assumed to be non constant and vary on a per point basis. Actually, the VEX optimizer performs static analysis at runtime to automatically determine uniform/varying status of variables. So the uniform/varying keywords are redundant. Quote Link to comment Share on other sites More sharing options...
Gordon Posted August 9, 2006 Share Posted August 9, 2006 Actually, the VEX optimizer performs static analysis at runtime to automatically determine uniform/varying status of variables. So the uniform/varying keywords are redundant. Well that works too 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.