haki Posted February 28, 2021 Share Posted February 28, 2021 Hi, I've some experience with VEX in SOP land but I'm new to Mantra shading and I want to get better at writing vex shaders. What would be the modern way of doing that? In particular, I'm not entirely sure if I could simply write my code and hit compile (the way I would with OSL in RenderMan) without ever leaving Houdini or restarting the renderer for that matter. For instance, I managed to compile the following from a vfl (a modified sidefx example) into an HDA (.\vcc -l "%HOME%\houdini18.5\vex\hcartoon.hda" "%HOME%\houdini18.5\vex\hcartoon.vfl") and it's available under /SHOP/Digital Assets and it works. #include <shading.h> #pragma opname hcartoon #pragma oplabel "HCartoon" #pragma opicon SHOP_surface #pragma label colora "Color A" #pragma label colorb "Color B" #pragma hint colora color #pragma hint colorb color #pragma hint Cd hidden surface hcartoon( vector colora={0.2, 0.5, 0}; vector colorb={0, 0.2, 0.8}; vector Cd=1; ) { vector Cx; illuminance(P){ Cx = Cl; shadow(Cl); if (Cl == Cx){ Cf = colora; } else{ Cf = colorb; } } } However, isn't there a more straightforward way? Do I always have to compile to HDA and write all those pragmas? I was hoping for something like an attribute wrangler approach. So, there's the Surface Shader Builder (vopsurface) that I have to admit I don't quite get as far as writing code goes. Snippet? Inline? How about inputs and outputs in it? Surely not with pragmas in there, right? I tried with a snippet, got a compile error 'Invalid return type (surface)'. If anyone can help me with it, that'd be awesome! Thanks, Hristo Quote Link to comment Share on other sites More sharing options...
Librarian Posted February 28, 2021 Share Posted February 28, 2021 @haki Use Inline code Ex from Fiola + you have here on Odforce(topic shader each day) + +++ allot more .You have here on odforce nice ex about that Topic. BookofShaders_Examples_v00.02.hiplc 1 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.