Author Topic: maxscript set bitmap output path in render batch  (Read 3108 times)

2022-07-26, 14:25:14

bertv

  • Active Users
  • **
  • Posts: 21
    • View Profile
Hi,

I had a problem with setting an output batch via code in Maxscript 3D studio max.
When creating the batch and output to a png file, the render crashes using the backburner system via netrendering.
Code: [Select]
batchRenderMgr.netRender = true
nameFile = getFilenameFile(maxfilename)

perspCamObj = getnodebyname "PERSP_CAM"
perspCamBatch = batchRenderMgr.CreateView perspCamObj
perspNameCam = nameFile + "_" + perspCamObj.name
perspCamBatch.name = perspNameCam
perspCamBatch.outputFilename = maxFilePath + perspNameCam + ".png"

When setting the output manual (via the max batch dialog), the system renders fine via netrendering.

I found someone with a simular problem, but he uses Vray.
https://forums.autodesk.com/t5/3ds-max-forum/maxscript-batchrendermgr-outputfilename-causing-backburner/td-p/4265968

I can't find a way to bypass the problem using the Corona Render Engine the same way described in the link above.
Here they suggest the following for Vray render engine =>

Found a solution via another scripted file name attribute problem.
You have to create a bitmap and then parse the filename property of the bitmap instance to the intended attribute.
Here is an example with a similar problem when scripting the filename output property of vray render elements:
Code: [Select]
vr = renderers.current
vr.output_on = true
vr.output_splitgbuffer = true
/*here is where the joy starts, setting the name of the path and filename*/
fileName = outputFilename + "." + extension
/*now we create a temporary bitmap in that location*/
screwedBitmapCreation = Bitmap 10 10 fileName:fileName
/*save it and close it*/
save screwedBitmapCreation
close screwedBitmapCreation
/*now using the bitmap instance we parse the filename of
the bitmap to the render attribute .......LAME!!*/
vr.output_splitfilename = screwedBitmapCreation.filename


Any help would be appreciated to do this in Corona:
corona = renderers.current    --This works
corona.output_on = true        --No idea how to do this
corona.output_splitgbuffer = true        --No idea how to do this
corona.output_splitfilename = filenameForBitmap       --No idea how to do this

Regards,
Bert
« Last Edit: 2022-09-21, 14:01:47 by bertv »

2022-09-22, 10:18:59
Reply #1

Frood

  • Active Users
  • **
  • Posts: 1902
    • View Profile
    • Rakete GmbH
Hi,

the example in your code section #1 works here. Do you really get a crash or just a frame error? If crash: check Max.log on the render node and/or see if there is a minidump created.

Backburner submission via UI works for you?


God Luck



Never underestimate the power of a well placed level one spell.

2022-12-14, 13:48:53
Reply #2

bertv

  • Active Users
  • **
  • Posts: 21
    • View Profile
Hi,

the example in your code section #1 works here. Do you really get a crash or just a frame error? If crash: check Max.log on the render node and/or see if there is a minidump created.

Backburner submission via UI works for you?


God Luck

Hi Frood,
This code is indeed working but only when running the render batch local. It crashes in the backburner render farm using batch rendering.
Code: [Select]
batchRenderMgr.netRender = true
nameFile = getFilenameFile(maxfilename)

perspCamObj = getnodebyname "PERSP_CAM"
perspCamBatch = batchRenderMgr.CreateView perspCamObj
perspNameCam = nameFile + "_" + perspCamObj.name
perspCamBatch.name = perspNameCam
perspCamBatch.outputFilename = maxFilePath + perspNameCam + ".png"

There seems to be a fix/workaround for the Vray render engine with splitbuffering (See the 2nd part code),
And was wondering if something simular could be done for the Corona render engine?

Regards
Bertv

2022-12-14, 19:19:43
Reply #3

Frood

  • Active Users
  • **
  • Posts: 1902
    • View Profile
    • Rakete GmbH
This code is indeed working but only when running the render batch local. It crashes in the backburner render farm using batch rendering.

Not sure if I get that correctly. To my understanding, you run the script to set up the batchRenderMgr locally. And by setting netRender to true, you create a BB job. So: script executes locally, rendering happens on BB, right? Or do you use 3dsmaxcmd at some point?

I did fire up my startup scene (it is located on a network share), saved it as "test.max" (also on a network share), renamed the cam to "PERSP_CAM", added "batchRenderMgr.render()" to the script and executed it. Then I got the Network Job Assignment window, connected to BB manager and submitted the job which came out as expected, no crash.

As far as I understand, the vray "fix" (your link) is just a matter of data types and affects the (custom) vray output. You cannot translate any of those properties to Corona.


Good Luck





Never underestimate the power of a well placed level one spell.

2022-12-15, 09:37:27
Reply #4

bertv

  • Active Users
  • **
  • Posts: 21
    • View Profile
Hi Frood,

Correct,
The code works, the jobs in the batch gets created by the script.
The problem is the save to png, jpg, etc... causing a crash when rendering in Backburner.
When rendering the batch locally, no problem.

Parentally this is common and the link below was an approach to solve this in Vray using the split buffer:
https://forums.autodesk.com/t5/3ds-max-forum/maxscript-batchrendermgr-outputfilename-causing-backburner/td-p/4265968

I have no clue how to start solving this in Corona render engine?

Regards,
Bert

2022-12-15, 10:17:30
Reply #5

Frood

  • Active Users
  • **
  • Posts: 1902
    • View Profile
    • Rakete GmbH
Hi,

causing a crash when rendering in Backburner.

Once again: Does it really crash? Or do you get a "no response" error in BB? What happens if you submit a/that scene to BB without using the batch render manager? Does it also happen when using the UI to create the batch job without using a script and submitting it to BB?

It does not help to provide that link (which of no use here) again and again without posting more information or answering questions (see Reply #1). First of all, what Max and Corona version are you using? As mentioned, I cannot replicate any issue, it just works as expected. Then have a look at the max.log on a failing BB render node if there is some hint and maybe quote a few of the last lines after the crash happened. And if it's a "real" crash there is maybe a minidump to be found on the BB server. See

https://knowledge.autodesk.com/support/3ds-max/troubleshooting/caas/sfdcarticles/sfdcarticles/Where-to-find-3ds-Max-LOG-files-for-review-and-troubleshooting.html

Good Luck



Never underestimate the power of a well placed level one spell.

2022-12-15, 12:02:09
Reply #6

bertv

  • Active Users
  • **
  • Posts: 21
    • View Profile
Hi Frood,

Sorry if I wasn't clear. I'll take another try ;)

The following link contains all the needed data for testing in 3Ds max (Download button at top left side)
If you submit the batch (2 *.png renders) of that scene to BB you'll have the same conditions as mine to try finding the issue.

=> https://ymmanagement-my.sharepoint.com/:u:/g/personal/bertv_kcc_be/EVqj1VUHaK1EnG3DMC0JvD4BQX_WaIB3TWKBcJw8xmg2rQ?e=QLuaGN


Quote
Does it really crash? Or do you get a "no response" error in BB?
After submitting from the batch render dialog to BB (BackBurner), the render node starts green, then the node turns red and keeps trying to render (I guess Max is crashing here)


This is what I see in the manager


This is what I see in the server node


Quote
What happens if you submit a/that scene to BB without using the batch render manager?
Not sure how you accomplish this in Max. Always used the batch Render to send camera's to BB.

Quote
Does it also happen when using the UI to create the batch job without using a script and submitting it to BB?
No, then it's fine. Because I set the output path manual (See below images)
This is where BB parentally has a problem creating / saving the image format for *.png, *.jpg, ... (Except for *.bmp)
Strange thing is, when I create the outputs with script, then go to the batch, open the "output path" dialog and close it again with save, all works fine when rendering with BB!

The same occurs with Vray, but they had a fix for this using the split buffer.



Quote
What Max and Corona version are you using?
I'm using
  • 3D studio Max 2023 (Same problem in 2021 and 2022, not tested with older versions)
  • with Corona render engine 9 (Same problem with Corona 7 and 8, not tested with older versions)

Quote
Then have a look at the max.log
This is a link to the log (characters exceed allowed post size) (Also in the link above)
=> https://ymmanagement-my.sharepoint.com/:u:/g/personal/bertv_kcc_be/EQKGxIwVAh1EvGLSjZm0ddwBMOoNFSnnd5AZq5zmYAWxTw?e=jYD4Ik

Regards,
Bertv
« Last Edit: 2022-12-15, 12:11:17 by bertv »

2022-12-16, 10:37:01
Reply #7

Frood

  • Active Users
  • **
  • Posts: 1902
    • View Profile
    • Rakete GmbH
Hi,

very useful that summary.

Quote
What happens if you submit a/that scene to BB without using the batch render manager?
Not sure how you accomplish this in Max. Always used the batch Render to send camera's to BB.

You just select "Submit To Network Rendering" at "Target" in Render Setup.

In your scene, there is no output defined, and that's exactly the difference and the reason why I could reproduce the issue only with your scene: it lacks the render output. Here is a quick fix without digging deeper. I don't know if you like it because it changes the scene by adding some output. But you can revert it after submission if you call batchRenderMgr.Render() in the script:

Code: [Select]
nameFile = getFilenameFile(maxfilename)
perspCamObj = getnodebyname "PERSP_CAM"
perspNameCam = nameFile + "_" + perspCamObj.name

-- Additionally:
sceneOutput=rendoutputfilename -- save for restoring later
--if sceneOutput=="" do ( rendoutputfilename=maxFilePath + perspNameCam + ".jpg") -- would be reasonable
if sceneOutput=="" do ( rendoutputfilename="doesnotmatter.jpg") -- but this also works, just has to be some valid file extention for output

perspCamBatch = batchRenderMgr.CreateView perspCamObj
perspCamBatch.name = perspNameCam

perspCamBatch.outputFilename = maxFilePath + perspNameCam + ".png"
batchRenderMgr.netRender = true

-- Additionally, if you do not want to leave the ouput changed:
batchRenderMgr.Render()
if sceneOutput=="" do rendoutputfilename="" -- restoring to empty string if no output was defined

Btw. the same happens with scanline renderer scenes so it's just another 3ds Max bug it seems.

Strange thing is, when I create the outputs with script, then go to the batch, open the "output path" dialog and close it again with save, all works fine


Question is: whatever happens here compared to scripting the filename, can it be scripted somehow.


Good Luck



Never underestimate the power of a well placed level one spell.

2023-01-03, 11:03:38
Reply #8

bertv

  • Active Users
  • **
  • Posts: 21
    • View Profile
Hi Frood,

Adding the output in the render settings solved the issue.
Renders also work in the batch render now.

Thanks for the fix.

Regards,
Bert
« Last Edit: 2023-01-03, 11:07:47 by bertv »