Page 1 of 1

OSL camera compile

Posted: Sat Dec 21, 2024 12:16 pm
by michaelskripin
Hey everyone!

I’m experimenting with connecting different OSL scripts to the OSL camera from the Vectron Tools, but the ‘Compile and Build GUI’ button doesn’t seem to work. I also tried copying the code directly into the ‘OSL Code’ input, but no luck there either.

The scripts themselves work fine in the camera, but I can’t control them at all.

Has anyone else run into this? Any tips on getting the GUI to show up?

Appreciate any help!

Re: OSL camera compile

Posted: Sat Dec 21, 2024 2:15 pm
by ricky_otoy
Hi there!

OSL Camera seems to be working ok here, see if this works for you:

Code: Select all

shader OslCamera(
    float Distortion = 0.0
    [[
        string help = "Lens distortion",
        float min = -1.0,
        float max = 1.0
    ]],
    
    float Scale = 1.0
    [[
        string help = "View scale",
        float min = 0.1,
        float max = 2.0
    ]],
    
    output point pos = 0,
    output vector dir = 0,
    output float tMax = 1.0/0.0)
{
    pos = P;
    vector right = cross(I, N);
    
    // Apply scale and distortion to UV coordinates
    float uu = (u - 0.5);
    float vv = (v - 0.5);
    
    // Optional radial distortion
    if (Distortion != 0.0) {
        float r2 = uu * uu + vv * vv;
        float f = 1.0 + Distortion * r2;
        uu *= f;
        vv *= f;
    }
    
    // Apply scale
    uu *= Scale;
    vv *= Scale;
    
    dir = I + right * uu + N * vv;
}

Re: OSL camera compile

Posted: Sat Dec 21, 2024 4:50 pm
by michaelskripin
Just test it. Unfortunately, it doesn't work. I pasted the code and clicked the 'compile and build GUI' button, but nothing happened.

I tried reloading Houdini, but that didn't help.

MacOS Sequoia 15.1.1, Octane 2024.1.2.0, Houdini 20.5.445

Re: OSL camera compile

Posted: Mon Jan 20, 2025 3:57 pm
by marcikola
also not working for me

Re: OSL camera compile

Posted: Tue Jan 21, 2025 8:05 am
by ricky_otoy
Ok thanks will look into it further. It had worked my side but will see what the issue may be.

What builds are you using too @marcikola?

Re: OSL camera compile

Posted: Tue Jan 21, 2025 6:24 pm
by scaprendering
Here it worked, just be sure that octane live viewer is not paused or it won't compile !
Feel free to reach out directly if you have issues with V tools :)