Jeff Lait
jlait
About Me
EXPERTISE
Developer
Connect
LOCATION
Not Specified
WEBSITE
Houdini Skills
Availability
Not Specified
My Badges
SideFX Staff
Since Jul 2005
My Tutorials
Recent Forum Posts
Matrix formatting difference between VEX and OpenCL Jan. 6, 2025, 11:17 a.m.
A float4 in OpenCL is laid out in memory as xyzw.
.lo refers to the front half of the vector, so xy, and .hi to the back half, or zw.
The same is with float16, so .lo is the first 8 floats in memory, and .hi the next 8 floats.
The second .hi / .lo then further grabs the first 4 floats or last 4 floats of those setups.
Thus .lo.lo refers to the FIRST four floats in memory. This is what would normally be called the "top row", row zero and columns zero through three. So I think OpenCL is already doing what you expected in VEX.
.lo refers to the front half of the vector, so xy, and .hi to the back half, or zw.
The same is with float16, so .lo is the first 8 floats in memory, and .hi the next 8 floats.
The second .hi / .lo then further grabs the first 4 floats or last 4 floats of those setups.
Thus .lo.lo refers to the FIRST four floats in memory. This is what would normally be called the "top row", row zero and columns zero through three. So I think OpenCL is already doing what you expected in VEX.
Copernicus: How to do fisheye distortion? Aug. 9, 2024, 11:33 a.m.
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 Oct. 19, 2023, 11:20 a.m.
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.