Author Topic: How to save the wireframe render images from the CTexmap in RenderElements?  (Read 379 times)

2023-02-02, 07:40:04

HMValin

  • Users
  • *
  • Posts: 1
    • View Profile
Hello, I need help saving the wireframe image generated when rendering. I made a script to automate the process of rendering multiple assets at the same time. In the script, the user can choose which folder to save the renders and the name of the .jpeg file is updated with a loop, so that the file does not overlap with the previous one. However, the wireframe image does not have its name updated and is not being saved in the folder chosen by the user. Is there any way to change this?

Explaining the code:

  • First the user selects the matrix asset that will serve as a "studio", where the lights and cameras are ready to render and where the CTexmap has been added.
  • Second, the user chooses the folder where the assets to be rendered are located.
  • Third, the user chooses the folder where he wants to save the .jpeg files generated by the render.
  • Then, through a loop, the program takes each asset from the list and makes a render with each camera in the scene, in addition to making a 360ยบ render.
  • When saving, the program uses the name of the asset + the name of the camera to name the .jpeg file and that's where the problem lies, as this is not happening with the wireframe image, in addition to not saving in the correct folder.


Code: [Select]
rendSaveFile = true

_frame = 0

studioFile = getOpenFileName caption: "Select the Studio Asset"
loadMaxFile studioFile

directoryParent = getSavePath caption: "Select the Parent Directory"

dirPath = directoryParent + "\*"
dirList = getDirectories dirPath
print dirList

renderPath = getSavePath caption: "Select a Folder to Save the Renders"

for dir in dirList do(

assetsPath = dir + "\*.max"
assetsList = getFiles assetsPath
print assetsList

for current in assetsList do(

xrefs.addNewXRefFile current
currentName = getFilenameFile current
makeDir (renderPath + "\\" + currentName)
finalPath = (renderPath + "\\" + currentName)

for c in cameras where classof c != Targetobject do(

render camera:c outputfile:(finalPath + "\\" + currentName + "_" + c.name + "_" + ".jpeg")

if c.name == "CAM_RENDER_TURN" then(

makeDir (finalPath + "\\" + "360")
turnPath = (finalPath + "\\" + "360")
render camera:c fromframe:0 toframe:10 outputfile:(turnPath + "\\" + currentName + "_" + _frame as string + ".jpeg")
_frame += 1

)

)

xrefs.deleteAllXRefs()

)

)

2023-02-08, 09:09:04
Reply #1

Avi

  • Corona Team
  • Active Users
  • ****
  • Posts: 507
    • View Profile
Hi,

The problem in your code is that you are calling your studio file only 1 time for every asset so the render paths are getting overwritten. I made some changes to your code and looped the studio file to be opened seperately for every asset and save the renders according to camera names.

Here is the code:

Code: [Select]
rendSaveFile = true

_frame = 0

studioFile = getOpenFileName caption: "Select the Studio Asset"

directoryParent = getSavePath caption: "Select the Parent Directory"

dirPath = directoryParent + "\*"
dirList = getDirectories dirPath
print dirList

renderPath = getSavePath caption: "Select a Folder to Save the Renders"

for dir in dirList do(

assetsPath = dir + "\*.max"
assetsList = getFiles assetsPath
print assetsList

for current in assetsList do(

loadMaxFile studioFile
xrefs.addNewXRefFile current
currentName = getFilenameFile current
currentAssetPath = (renderPath + "\\" + currentName)
makeDir currentAssetPath

for c in cameras where classof c != Targetobject do(

currentRenderPath = (currentAssetPath + "\\" + c.name)
makeDir currentRenderPath
render camera:c outputfile:(currentRenderPath + "\\" + currentName + "_" + c.name + ".jpeg")

if c.name == "CAM_RENDER_TURN" then(

turnPath = (currentRenderPath + "\\" + "360")
makeDir turnPath
render camera:c fromframe:0 toframe:10 outputfile:(turnPath + "\\" + currentName + "_" + _frame as string + ".jpeg")
_frame += 1

)

)

xrefs.deleteAllXRefs()

)

)

I hope this helps.
Arpit Pandey | chaos-corona.com
3D Support Specialist - Corona | contact us