Jeff Lait
jlait
About Me
専門知識
Developer
Connect
LOCATION
Not Specified
ウェブサイト
Houdini Engine
Availability
Not Specified
My Badges
SideFX Staff
Since 7月 2005
チュートリアル
Recent Forum Posts
Copernicus: How to do fisheye distortion? 2024年8月9日11:33
The problem is we did too good a job making VEX easy to write :>
We've done a lot to make OpenCL less painful, so hopefully you can start to transition for Copernicus nodes.
Here's your code transformed to OpenCL, starting from the default OpenCL node...
Note the use of M_PI rather than PI. VEX also supports M_PI, and I'd recommend you get in the habit of M_PI as it is a lot more portable outside of VEX.
There is a lot more explicit boilerplate in OpenCL, thus the #bind commands to define your interface to the code.
One change you can make in both VEX and OpenCL is to use sinpi(). sinpi() is in 20.5 VEX and allows you to avoid needing to work with Pi. This isn't just an improvement in typing, but also is useful mathematically as PI/2 isn't an exact number, while sin(PI/2) is an exact number.
We are definitely missing all the nice helper functions that VEX has... You often have to go down to mix() or similar. fit01 is luckily present from interpolate.h, but a lot of your other gotos will be missing :<
This is my go-to for references for raw OpenCL functions.
https://www.khronos.org/files/opencl-1-2-quick-reference-card.pdf [www.khronos.org]
We've done a lot to make OpenCL less painful, so hopefully you can start to transition for Copernicus nodes.
Here's your code transformed to OpenCL, starting from the default OpenCL node...
#bind layer src? val=0 float #bind layer !&dst float @KERNEL { float ang = fit01(@src,0,M_PI/2); float result = @src * sin(ang); @dst.set(result); }
Note the use of M_PI rather than PI. VEX also supports M_PI, and I'd recommend you get in the habit of M_PI as it is a lot more portable outside of VEX.
There is a lot more explicit boilerplate in OpenCL, thus the #bind commands to define your interface to the code.
One change you can make in both VEX and OpenCL is to use sinpi(). sinpi() is in 20.5 VEX and allows you to avoid needing to work with Pi. This isn't just an improvement in typing, but also is useful mathematically as PI/2 isn't an exact number, while sin(PI/2) is an exact number.
#bind layer src? val=0 float #bind layer !&dst float @KERNEL { float ang = fit01(@src,0,0.5); float result = @src * sinpi(ang); @dst.set(result); }
We are definitely missing all the nice helper functions that VEX has... You often have to go down to mix() or similar. fit01 is luckily present from interpolate.h, but a lot of your other gotos will be missing :<
This is my go-to for references for raw OpenCL functions.
https://www.khronos.org/files/opencl-1-2-quick-reference-card.pdf [www.khronos.org]
Houdini Color Schemes 2023年10月19日11:20
It is very nice to see cool colour schemes being built despite the clunkiness of the current system.
As for the green line, I'm afraid I must report that colour isn't actually part of the schema :cry:
I've submitted Bug: 132255 regarding this, as we do not like such hard coded colours.
As for the green line, I'm afraid I must report that colour isn't actually part of the schema :cry:
if(myViewport->manager()->getViewportBorders()) { if(myViewport->manager()->isCurrentPort(myViewport->getPortIndex())) r->setColor(UI_Color(UT_RGB, 0.0F, 0.6F, 0.0F)); else r->setColor(UI_GREY20); r->rect2DS(x, y, x+w-1, y+h-1); }
I've submitted Bug: 132255 regarding this, as we do not like such hard coded colours.
Expression Short Circuiting 2022年12月26日14:23
You are correct that VEX doesn't short circuit. I can't say we are happy with that, as it is very useful and expected to short circuit. I'd say we want to reserve the right to fix this some day, so please do not write code that requires us to not short circuit in the meantime.