lisux Posted December 30, 2004 Share Posted December 30, 2004 Hi all. I'm creating some shaders using the inline code VOP. When i try to create a new function to be used by the main shader, coding it in the same inline VOP, i get a compiler error: "function declaration within a VEX shader is not supported in VEX" How can i declare my own functions to use them into VOP's?, moreover if i've my own header file with this functions, how can i include it? i cannot include it in the Inline VOP because then the functions will be declared into the shader. Thanks Quote Link to comment Share on other sites More sharing options...
maysd Posted January 3, 2005 Share Posted January 3, 2005 How can i declare my own functions to use them into VOP's? File\New Operator Type... Operator Name : myfunction Operator Label : Myfunction Operator Style : VEX Builder Type And then Accept! At the next window, Basic\ Set VopNet Mask: * If you were creating a renderman shader function, VopNet Mask may set to rsl_*, If you had set nothing at VopNet Mask, you could not see your function builder in the VOPs. Parameters\ Create New Direction Vector and Name it N, Label it Normal Vex Code\Innder Code\ $diff=diffuse($N); Input/Output\ New Input: Normal Name it N, it use by the codes $N New Output : Color , name it diff and also it use by the code $diff Now, you have create a new vops builder doing diffuse function! At the vops, type Operator Label : Myfunction , you could use this builder! cheers! Quote Link to comment Share on other sites More sharing options...
lisux Posted January 4, 2005 Author Share Posted January 4, 2005 How can i declare my own functions to use them into VOP's?File\New Operator Type... Operator Name : myfunction Operator Label : Myfunction Operator Style : VEX Builder Type And then Accept! At the next window, Basic\ Set VopNet Mask: * If you were creating a renderman shader function, VopNet Mask may set to rsl_*, If you had set nothing at VopNet Mask, you could not see your function builder in the VOPs. Parameters\ Create New Direction Vector and Name it N, Label it Normal Vex Code\Innder Code\ $diff=diffuse($N); Input/Output\ New Input: Normal Name it N, it use by the codes $N New Output : Color , name it diff and also it use by the code $diff Now, you have create a new vops builder doing diffuse function! At the vops, type Operator Label : Myfunction , you could use this builder! cheers! 15662[/snapback] Thats great! thanks Quote Link to comment Share on other sites More sharing options...
Dries Posted November 3, 2006 Share Posted November 3, 2006 I tried this and although the custom diffuse function seems to work for poly's, Nurbs are resulting in black. Any idea why? D. Okay, I'll answer my own question again: You need to normalize N. Not sure why the problem didn't show with polys, but for a diffuse function, normalize is what is needed, right? 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.