Write render result to Texture node

Forum for OctaneRender Lua scripting examples, discussion and support.
Post Reply
User avatar
PolderAnimation
Licensed Customer
Posts: 373
Joined: Mon Oct 10, 2011 10:23 am
Location: Netherlands
Contact:

Hi all,

I'm trying to get the "Texture render job" scripted graph to work. I'm not sure if I'm using it correctly, but basically I want to use the render result of the connected renderTarget as a texture for a material nodes diffuse color.
My onEvaluate function looks as follows:

Code: Select all

function PTextureRenderJobScript.onEvaluate(self, graph)
    local inputNodes = self:getInputNodes()
    local renderTarget
    for _, inputNode in ipairs( inputNodes ) do
        if( inputNode.nodeType == octane.NT_IN_RENDERTARGET ) then
            renderTarget = self:getInputValue( inputNode )
            break
        end
    end
        
    PROPS_RENDER_RESULT = octane.render.start( { renderTargetNode = renderTarget } )

    local outputNodes = self:getOutputNodes()
    for _, outputNode in ipairs( outputNodes ) do
        if( outputNode.nodeType == octane.NT_OUT_TEXTURE ) then
            --< CONNECT IMAGE TO OUTPUT NODE >
        end
    end
end
The PROPS_RENDER_RESULT.image returns the image object, but I cannot figure out how to set that to the output pin.
There is no node connected to the output pin, I checked via "outputNode:getConnectedNodeIx(1)", it returns nil.
So I thought of creating a NT_TEX_IMAGE node to connect to it, but then I could not find a way to set the image to it.
The A_BUFFER attribute would seem the most likely candidate, but it only accepts data of type AT_BYTE array.
The octane.image.getRawPixels(image) returns a PROPS_C_ARRAY, but this is not accepted as valid data for the A_BUFFER attribute.

Can this be done, or do I have to save the PROPS_RENDER_RESULT.image to disk and then load it via the A_FILENAME attribute. Seems dirty.

Please help! ;)

Jean-Paul Tossings
Win 10 64bit | RTX 3090 | i9 7960X | 64GB
User avatar
PolderAnimation
Licensed Customer
Posts: 373
Joined: Mon Oct 10, 2011 10:23 am
Location: Netherlands
Contact:

Hi Again,

So apparently I cannot run "octane.render.start" from a scripted graph either, so how do I get this to render?

Sorry for the messy question.
Win 10 64bit | RTX 3090 | i9 7960X | 64GB
Post Reply

Return to “Lua Scripting”