Page 1 of 1

Write render result to Texture node

PostPosted: Thu Dec 06, 2018 12:21 pm
by PolderAnimation
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 )
    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

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

Re: Write render result to Texture node

PostPosted: Thu Dec 06, 2018 12:42 pm
by PolderAnimation
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.