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

obj-image Masterclass
H18 Pyro | Building a Combustion Model
obj-image Masterclass
Vellum Cloth Updates | H18 Masterclass
obj-image Masterclass
64 Bit Processing | H18 Masterclass
obj-image Masterclass
Attribute Paint | H18 Masterclass
obj-image Masterclass
Vellum Cloth | H17 Masterclass
obj-image Masterclass
Vellum Drape | H17 Masterclass

Recent Forum Posts

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...

#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:

    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 Dec. 26, 2022, 2:23 p.m.

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.