Write render result to Texture node

Forums: Write render result to Texture node
Forum for OctaneRender Lua scripting examples, discussion and support.

Write render result to Texture node

Postby PolderAnimation » Thu Dec 06, 2018 12:21 pm

PolderAnimation Thu Dec 06, 2018 12:21 pm
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
Licensed Customer
 
Posts: 371
Joined: Mon Oct 10, 2011 10:23 am
Location: Netherlands

Re: Write render result to Texture node

Postby PolderAnimation » Thu Dec 06, 2018 12:42 pm

PolderAnimation Thu Dec 06, 2018 12:42 pm
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
User avatar
PolderAnimation
Licensed Customer
Licensed Customer
 
Posts: 371
Joined: Mon Oct 10, 2011 10:23 am
Location: Netherlands

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 4 guests

Thu Mar 28, 2024 6:52 pm [ UTC ]