[ScriptGraph] Question: store texture pixels value?

Forums: [ScriptGraph] Question: store texture pixels value?
Forum for OctaneRender Lua scripting examples, discussion and support.

[ScriptGraph] Question: store texture pixels value?

Postby Renart » Sat Aug 04, 2018 5:55 pm

Renart Sat Aug 04, 2018 5:55 pm

I'm creating a new post instead of bumping the previous one since the subject starts to be different.

I'm trying to create a scriptgraph that reads an input texture (any kind of texture input) and stores the pixel value in an array.

For example, if I plug a black and white image of a checker 9*9 pixels, the array I get would be:
1, 0, 1, 0, 1, 0, 1, 0, 1

Multiple questions about that:

- I'm not sure where to fetch the right information to get the pixel color.
I'm using something like that at the moment. where IN_TEXT_MASK is the linker to the texture input.
Code: Select all
local textMask = IN_TEXT_MASK:getInputNode(octane.P_INPUT):getAttribute(octane.A_BUFFER)

But the value that I get doesn't make sense for me. I realized they were values from 0 to 255 but when I check the invert option in the texture node, nothing happen. It looks like the Buffer attribute may be not the thing I'm looking for.

- How to print things with a script graph?
It would be very useful for me to check what kind of data I'm dealing with and it's very hard to check that easily. The print function doesn't work but I can see a Script Output windows. How to use it?

- I would love to make this thing works with procedural texture, like fractal node etc. But I image it would be a bit more complicated since they have no limit of size. Any idea how to do that?

Thank you very much for your help!
Licensed Customer
Licensed Customer
Posts: 68
Joined: Mon Jul 04, 2016 8:21 pm

Re: [ScriptGraph] Question: store texture pixels value?

Postby roeland » Thu Aug 09, 2018 3:28 am

roeland Thu Aug 09, 2018 3:28 am
Output from script graphs usually goes to the log viewer. Go to the menu » Windows » Create log window.

You can't at the moment get the pixel values from the attributes of an image texture node. That's an oversight in the Lua API. You can go the other way around already using octane.image.fillImageNode.

For prodedural textures you can't use Lua, you have to write an OSL shader to generate the pattern inside the render engine.

User avatar
OctaneRender Team
OctaneRender Team
Posts: 1738
Joined: Wed Mar 09, 2011 10:09 pm

Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 2 guests

Sun Jun 16, 2019 10:34 pm [ UTC ]