pagefan Posted September 2, 2010 Share Posted September 2, 2010 Hi guys, I am stuck with my vex signature. It is a displacement shader and I want to return the new point coordinates. First obvious change would be to have my function a return type of GEO_Point but then the VEX_Vexop starts to complain heavily in gcc. That does make a bit of sense since in the vex environment there is no GEO_Point type. Closest thing there is a Vector4 but UT_Vector4 or the VEX_TYPE_VECTOR4 don't work either. So what's the trick here? static void hh_gnoise(int argc, void *argv[], void *data) { //...lot of code above... UT_Vector4 pos((pt->getPos().x() +f),(pt->getPos().y()+f),(pt->getPos().z()+f)); GEO_Point *pout; pout->setPos(pos,1); //return pos; } void newVEXOp(void *) { new VEX_VexOp("gnoise@*PPVFIFFFFFFFFFFF",hh_gnoise, VEX_DISPLACE_CONTEXT,NULL,NULL,VEX_OPTIMIZE_2,true); } And a 2nd question. After compiling the code, i just can copy the .so file to somewhere on my $HOUDINI_DSO_PATH and it gets picked up in Vex? Or do you also need to "register" it somewhere else? (which i thought you should; i thought i came across some post where you had to edit some file to make it all work but can't find it anymore). Thanks, Hans Quote Link to comment Share on other sites More sharing options...
Vormav Posted September 17, 2010 Share Posted September 17, 2010 You need to create a vex/VEXdso file in your houdini directory (i.e., ~/houdini11.0/vex/VEXdso) containing entries like, vex/my_dso_with_vex_declarations.so Basically, a relative path pointing to your dso within the dso directory (so, we'd have the dso at ~/houdini11.0/dso/vex/my_dso_with_vex_declarations.so) GEO_Point, like you said, isn't a vex type, so I wouldn't even bother exploring that avenue. Instead, try something like this: static void rand_test( int argc, void** argv, void* data) { UT_Vector4* result = reinterpret_cast<UT_Vector4*>(argv[0]); int seed = *reinterpret_cast<int*>(argv[1]); srand(seed); result->assign((rand()%100)/100.0, (rand()%100)/100.0, (rand()%100)/100.0, 1); } void newVEXOp(void*) { new VEX_VexOp( "rand_test@&PI", rand_test, VEX_ALL_CONTEXT); } Quote Link to comment Share on other sites More sharing options...
pagefan Posted October 3, 2010 Author Share Posted October 3, 2010 Thanks for the explanation Vormav. The VEXdso file was quite a hassle. I had to delete the VEXdso in $HH to get it working. Anyway, my vex operators do show up now with dsoinfo -V. Cheers, Hans Quote Link to comment Share on other sites More sharing options...
Vormav Posted October 14, 2010 Share Posted October 14, 2010 (edited) It's a pain, but the cool part is that you can query all of configured DSO symbols outside of Houdini: vcc -X SOP It's much easier to debug these problems when you don't have to wait for Houdini to load to see if your VEX functions are recognized or not. Edited October 14, 2010 by Vormav Quote Link to comment Share on other sites More sharing options...
pagefan Posted October 17, 2010 Author Share Posted October 17, 2010 It's a pain, but the cool part is that you can query all of configured DSO symbols outside of Houdini: vcc -X SOP It's much easier to debug these problems when you don't have to wait for Houdini to load to see if your VEX functions are recognized or not. Tyvm sir, that does indeed save me some time Cheers, Hans 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.