Jump to content

vex shaders include statement


danilo2

Recommended Posts

Hi!

I'm creating my custom vex surface shader and in the first line I'm writing

#include /home/wojtek/tests/01.vfl

Of course the file exists and it is eqal:

#define VOP_SHADING
#define VOP_SURFACE

#pragma opname vopsurface1
#pragma oplabel "Local Vop Code"
#pragma opmininputs 0
#pragma opmaxinputs 0
#pragma label   parm    Parameter
#pragma hint    parm    color
#pragma label   parm2   Parameter
#pragma hint    parm2   color
#pragma label   parm3   Parameter
#pragma range   parm3   0       1

surface
vopsurface1(vector parm = { 1, 0, 0 };
            vector parm2 = { 0, 0, 0 };
            float parm3 = 0)
{
    int bound_parm;
    int bound_parm2;
    int bound_parm3;

    bound_parm = isbound("parm");
    bound_parm2 = isbound("parm2");
    bound_parm3 = isbound("parm3");

    Cf = parm;
    Of = parm2;
    Af = parm3;
}

The problem is that when I hit the button "Test Compile" in Operator Type Properties window I get an error:

error cpp error: "stdin":1 unable to include ....

So can I test shaders this way or every time I have to compile it command like style and then load manually into houdini with

vcc -l shaders.otl shader.vfl

So generally - how to test shaders written in external files quick?

Thank you :)

Edited by danilo2
Link to comment
Share on other sites

Guest Swann

Maybe when you write it like this

#include </home/wojtek/tests/01.vfl>

it will work better. Ofcourse if this is proper path to this file.

As for testing shaders, why not just write shader in normal .txt (or whathever extension you put there) file, include and testCompile it ? Why not to follow convention and write it as 01.h include TestCompile and you are ready to go. If you change something in code just comment apply and uncommet apply to reload code.

Link to comment
Share on other sites

Well, first of all, as SWANN says, #include directive should go with < >. Next.All yours custom functions you should keep in your "library" file (e.g. myShaderLib.h) Write All you custom function there, and in .vfl file just #include <myShaderLib.h> . And notice, .h and .vfl should be in place, where "HOUDINI_VEX_PATH" env. variable is looking for. Next, for compile, the best way to do that is to write python script , witch will call compiler with proper arguments, and make an .otl for you. And then, just fire up houdini and test your shader.. Its a very streamline process : tweak code >> run python script for compiling >> delete old shader node in houdini, and drop a new one. :) Good luck.

Edited by Stalkerx777
Link to comment
Share on other sites

If you vcc compile to .otl and the name doesn't change, just do File > Refresh Asset Libraries and your shader should update. Shouldn't have to delete the SHOP node in Houdini...

Yes, true. Fore me, deleting works sometime faster. :rolleyes:

Link to comment
Share on other sites

If you vcc compile to .otl and the name doesn't change, just do File > Refresh Asset Libraries and your shader should update. Shouldn't have to delete the SHOP node in Houdini...

Or have a remote script compile and then refresh otls through python houxmlrpc module to send a houscript command 'otrefresh -r' to your houdini session after compiling the shader. The houxmlrpc workflow is described in the sesi python vid. I have this set up with bash+python with pythonrc.py opening the port on houdini startup, if you are interested leme know

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...