Page 1 of 1

octane_render_utils_lua

Posted: Mon Jul 11, 2022 7:05 pm
by rrbarb
This script is called a require in batch render script- And in working with AWS Deadline- They claim it ships with Octane.
I find no trace of this in any installed folders- Where is it?- Where can I get a copy of it?

./rrb

Re: octane_render_utils_lua

Posted: Tue Jul 12, 2022 6:30 am
by bepeg4d
Hi,
it should be shared by Thinkbox Deadline directly, not by us.

Anyway, please try with the following LUA script for AWS Thinkbox:
download/file.php?id=85243

ciao,
Beppe

Re: octane_render_utils_lua

Posted: Tue Jul 12, 2022 10:55 am
by rrbarb
bepeg4d wrote:Hi,
it should be shared by Thinkbox Deadline directly, not by us.

Anyway, please try with the following LUA script for AWS Thinkbox:
download/file.php?id=85243

ciao,
Beppe
Thank You for the response. AWS does supply a version of the cmdbatch as you have shared here.
What I am after is what is being called on line 26: require("octane_render_utils_lua")
octane_render_utils
./rrb

Re: octane_render_utils_lua

Posted: Tue Jul 12, 2022 2:49 pm
by jobigoud
I find no trace of this in any installed folders- Where is it?
It is inside the engine and loaded by it. It's not a separate file.
Do you have a particular error?

Re: octane_render_utils_lua

Posted: Tue Jul 12, 2022 3:12 pm
by rrbarb
jobigoud wrote:
I find no trace of this in any installed folders- Where is it?
It is inside the engine and loaded by it. It's not a separate file.
Do you have a particular error?
2022-07-12 11:08:39: 0: STDOUT: Started logging on 12.07.22 11:08:34
2022-07-12 11:08:39: 0: STDOUT: OctaneRender Enterprise 2021.1.5 (11000500)
2022-07-12 11:08:39: 0: STDOUT: [string "octane_render_utils_lua"]:200: bad argument #3 to 'gsub' (string/function/table expected) (line: 200)
2022-07-12 11:08:39: 0: STDOUT: Stopped logging on 12.07.22 11:08:39

This is from deadline log- the selected output format is exr- all passes- single file - I can't solve if I cant see line 200 or whatever it may be- has to be a way to print or dump these utils

I have found a solve for this. From the research entailed in the quest, and from the @jobigoud clue- octaneRenderUtil must be a compiled C script- I can see part of through lua- but not line by line. The solve was to change the functions that handle fileFormat/imageSaveFormat and exrCompression type to use their index number as in API.

Re: octane_render_utils_lua

Posted: Wed Jul 13, 2022 2:59 pm
by rrbarb
rrbarb wrote:
jobigoud wrote:
I find no trace of this in any installed folders- Where is it?
I can't solve if I cant see line 200 or whatever it may be- has to be a way to print or dump these utils
I have found a solve for this. From the research entailed in the quest, and from the @jobigoud clue- octaneRenderUtil must be a compiled C script- I can see part of through lua- but not line by line. The solve was to change the functions that handle fileFormat/imageSaveFormat and exrCompression type to use their index number as in API. This is working- but the cause is not clear to me.

IT would be very helpful to have a digest of the expected content that ocataneRenderUtils expects to be present.

Re: octane_render_utils_lua

Posted: Thu Jul 14, 2022 12:14 am
by abstrax
`octane_render_utils_lua` contains internal helper functions shared between various render scripts / jobs. We are not making those public as we can't/don't want to guarantee that the interface won't change in the future. If we would make it public, then we would not be able to update/modify it easily since otherwise existing user projects might get screwed.

The function you are having trouble with is octaneRenderUtils.createFilename():

Code: Select all

-- Creates a filename based on a passed in filename template.
-- 
-- @param[in] template
--  Filename template with embedded %? chars which are substituted by something else.
-- @param[in] renderTargetIx
--  Index of the render target.
-- @param[in] frameIx
--  Frame index.
-- @param[in] subFrameIx
--  Sub-frame index.
-- @param[in] name
--  Name of the render target node
-- @param[in] imageSaveFormat
--  Type of the output image (in octane.imageSaveFormat)
-- @param[in] pass
--  Name of the current render pass.
function octaneRenderUtils.createFilename(template, renderTargetIx, frameIx, subFrameIx, name,
        imageSaveFormat, pass)
    assert(template, "expected template")
    assert(renderTargetIx, "expected renderTargetIx")
    assert(frameIx, "expected frameIx")
    assert(subFrameIx, "expected subFrameIx")
    assert(name, "expected name")
    assert(imageSaveFormat, "expected imageSaveFormat")
    assert(pass, "expected pass")

    -- round to integer value incase frameix has a float value
    frameIx = math.floor(frameIx + 0.5) 
    
    -- common extension for our image output types
    local fileExtensions = 
    {
        [octane.imageSaveFormat.PNG_8 ] = "png",
        [octane.imageSaveFormat.PNG_16] = "png",
        [octane.imageSaveFormat.EXR_16] = "exr",
        [octane.imageSaveFormat.EXR_32] = "exr",
    }
    local s = template
    -- %i -> index of the render target
    s = string.gsub(s, "%%i", string.format("%d", renderTargetIx))
    -- %f or %F -> frame number prefixed with zeroes (i.e. 1 -> 001)
    s = string.gsub(s, "%%f", octaneRenderUtils.prefixWithZeroes(frameIx, 4))
    s = string.gsub(s, "%%F", octaneRenderUtils.prefixWithZeroes(frameIx, 4))
    -- %s -> sub frame number
    s = string.gsub(s, "%%s", string.format("%d", subFrameIx))
    -- %n -> name of the node
    s = string.gsub(s, "%%n", name)
    -- %e -> extension
    s = string.gsub(s, "%%e", fileExtensions[imageSaveFormat])
    -- %t -> timestamp (h_m_s)
    s = string.gsub(s, "%%t", os.date("%H_%M_%S"))
    -- %p -> render pass name
    s = string.gsub(s, "%%p", pass)
    return s
end
Particularly this line:

Code: Select all

    s = string.gsub(s, "%%e", fileExtensions[imageSaveFormat])
I guess you used an invalid enum value for imageSaveFormat.

EDIT: I just had a look at your script. It would have been better to just write a script from scratch using only functionality from our Lua API instead of taking an older batch render script and then ripping out all the GUI stuff and then hacking the rest to try to make it work something totally different than what it intended to do.

Re: octane_render_utils_lua

Posted: Thu Jul 14, 2022 11:12 am
by rrbarb
abstrax wrote: EDIT: I just had a look at your script. It would have been better to just write a script from scratch using only functionality from our Lua API instead of taking an older batch render script and then ripping out all the GUI stuff and then hacking the rest to try to make it work something totally different than what it intended to do.
This is not my script. The use is same as intention- however I will take you advise and look into that. ThankYou!
./rrb