Setting color space pin value

Forums: Setting color space pin value
Forum for OctaneRender Lua scripting examples, discussion and support.

Setting color space pin value

Postby MB » Wed May 31, 2023 12:34 pm

MB Wed May 31, 2023 12:34 pm
How do I set the color space pin on an image node to linear sRGB + legacy gamma

Spent hours on this, getting nowhere, thanks for your help.
FYI, this runs, but appears to do nothing, I would prefer to set the pin value without actually creating a colorspace node and connecting it.

-- OCIO Color Space Node
print("Creating Color Space Node")
nodeColorSpace = octane.node.create{ type = octane.NT_OCIO_COLOR_SPACE, name = "OCIO Color Space", position = { 900, 200 } }
--nodeColorSpace:setPinValue(octane.P_COLOR_SPACE, 2, true)
nodeColorSpace:setAttribute(octane.A_OCIO_COLOR_SPACE_NAME , "Linear sRGB", true)
Windows 11, 2x Intel I9, 64GB Ram, 2x GTX 1080 TI, 1 x RTX 380 TI, Oculus Quest 2
User avatar
MB
Licensed Customer
Licensed Customer
 
Posts: 168
Joined: Tue Jan 15, 2013 3:41 am
Location: Washington, D.C.

Re: Setting color space pin value

Postby bepeg4d » Thu Jun 01, 2023 6:56 am

bepeg4d Thu Jun 01, 2023 6:56 am
Hi,
I have not tried, but, by default, the OCIO pin is set to None (sRGB) in the NT_IMAGER_CAMERA node, while the Linear color space is chosen in the Response curve popup:
IMG_8689.jpeg


So, try to only change the P_RESPONSE pin to Linear/off, in the NT_IMAGER_CAMERA node, without creating the NT_OCIO_COLOR_SPACE node.

ciao,
Bppe
User avatar
bepeg4d
Octane Guru
Octane Guru
 
Posts: 9939
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy

Re: Setting color space pin value

Postby jobigoud » Thu Jun 01, 2023 8:58 am

jobigoud Thu Jun 01, 2023 8:58 am
MB wrote:I would prefer to set the pin value without actually creating a colorspace node and connecting it.


Something like this:

Code: Select all
local nodeImage = octane.project.getSelection()[1]

local nodeColorSpace = nodeImage:getConnectedNode(octane.pinId.P_COLOR_SPACE, false)
nodeColorSpace:setAttribute(octane.attributeId.A_COLOR_SPACE, octane.namedColorSpace.LINEAR_SRGB)

(first line just grabs the selection so select the image node to test this).

If the P_COLOR_SPACE might be nil you will need to create the node in advance. You can't use `setPinValue` on the image node because this is not a value type, it's more complex than a simple enum. (A hint is that it doesn't have a single A_VALUE attribute).
User avatar
jobigoud
OctaneRender Team
OctaneRender Team
 
Posts: 229
Joined: Sat Aug 15, 2015 1:28 pm

Re: Setting color space pin value

Postby MB » Thu Jun 08, 2023 6:23 pm

MB Thu Jun 08, 2023 6:23 pm
Thank you all, that worked well.
Windows 11, 2x Intel I9, 64GB Ram, 2x GTX 1080 TI, 1 x RTX 380 TI, Oculus Quest 2
User avatar
MB
Licensed Customer
Licensed Customer
 
Posts: 168
Joined: Tue Jan 15, 2013 3:41 am
Location: Washington, D.C.

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 2 guests

Tue Mar 19, 2024 7:02 am [ UTC ]