Batch Rendering Multiple Renderers in One File

Started by ackdoh, October 12, 2022, 01:23:07 PM

Previous topic - Next topic

ackdoh

Hi All,

Is it possible to use one .tgd file with multiple render outputs in them to render all at once in sequence? Or would they have to be all separate .tgd's with the Master setting checked. In either case, how would it be possible to batch render on Windows?

Senior Cinematic Artist
DMP/Lighting/Compositing
http://davidluong.net

WAS

#1
Sounds like something you'd write a bash script for and do on linux with the render node. You could then easily write a script, containing a list of your cameras, and other possible settings, and then loop through them, making dynamic changes to the TGD and then running the linux node, and once complete, running next loop iteration, etc, etc.

Kevin Kipper

Hi Ackdoh,

Great question.  Yes, as WAS indicated you can set up one master Terragen file and render them out in sequence via a .bat file on a Windows system.  Here's the command line documentation for Windows, and there's similar documentation for the other operating systems as well on the Planetside Wiki page.

https://planetside.co.uk/wiki/index.php?title=Windows_Command_Line_Reference_(TG4)

I'll try and post some examples of this process shortly.

WAS

Maybe something for the feature request list, is allow the node to accept a path, rather than file, and then run through and render every TGD in ascension (or descension). I could see that being useful.

Matt

To elaborate on this, see the -rendernode argument in the docs linked above. Each launch of the executable can override which render node is the master, thereby changing which one is rendered.
Just because milk is white doesn't mean that clouds are made of milk.

Kevin Kipper

Hi Ackdoh,

Here's a couple of quick examples of how to use a batch file (.bat) on a Windows system to render image sequences from one Terragen project with many renderers. 

Add a renderer for each shot you want to output files for. You can set up renderers for saving gicache files as well as for different resolutions or different combinations of Render Layers.  Set each of the renderer's parameters as you normally would to render the particular shot, and save your project.

30277_Renderers.JPG 30277_Renderers2.JPG

Using some form of text editor like Notepad, enter the command line syntax as described in the online documentation I noted in the previous post, then save that text file with the file extension .bat.  I usually save it to my desktop.  To start the render process, I double click on the file's icon on my desktop.

Below is an example of one of the batch files I've used to render from one Terragen project file with lots of renderers. 

When run, the "cd" command changes the directory to where the Terragen application was installed, which I've defined by system variable %TERRAGEN_PATH%.  Each line of the file gets sequentially executed by Windows.  Lines that begin with "REM" are ignored, so you can use them as reminders or comments.  Note, that I'm specifying the Renderer with the "-rendernode" option followed by the name of the render node.  The frame range and step is specified with the "-r -f 1-151/10" etc.  You can override the output paths here too; however I've not done that in this example, preferring to set the output paths up correctly in the renderer itself.  The "pause;" at the end of the batch script is so that Windows doesn't close the command prompt when done and I can see the results.


cd "%TERRAGEN_PATH%"

REM GI Cache batch 01
tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_giCache_v003.tgd" -rendernode "Render Shot01" -r -f 1-151/10 -hide -exit
tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_giCache_v003.tgd" -rendernode "Render Shot03" -r -f 1-121/10 -hide -exit
REM tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_giCache_v003.tgd" -rendernode "Render Shot04" -r -f 21-161/10 -hide -exit
REM tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_giCache_v003.tgd" -rendernode "Render Shot05" -r -f 191-291/10 -hide -exit
REM tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_giCache_v003.tgd" -rendernode "Render Shot06" -r -f 241-401/10 -hide -exit
REM tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_giCache_v003.tgd" -rendernode "Render Shot07" -r -f 291-421/10 -hide -exit
REM tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_giCache_v003.tgd" -rendernode "Render Shot08" -r -f 341-501/10 -hide -exit


REM Final Renders batch 01
tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_v003.tgd" -rendernode "Render Shot01" -r -f 1-144 -hide -exit
tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_v003.tgd" -rendernode "Render Shot03" -r -f 1-112 -hide -exit
REM tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_v003.tgd" -rendernode "Render Shot04" -r -f 29-159 -hide -exit
REM tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_v003.tgd" -rendernode "Render Shot05" -r -f 200-283 -hide -exit
REM tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_v003.tgd" -rendernode "Render Shot06" -r -f 251-400 -hide -exit
REM tgdcli.exe -p "P:\Dad\JetBlaster\TG\Shots\Astromaster_Landing\Astromaster_Landing_Shot01_TerrainLayout_v003.tgd" -rendernode "Render Shot07" -r -f 300-412 -hide -exit

pause;

ackdoh

This is all wonderful everyone. And thanks for the thorough example Kevin! I'll put this to use. Would this be something that could be wrapped up in a GUI within the program sometime in the future?
Senior Cinematic Artist
DMP/Lighting/Compositing
http://davidluong.net

Kevin Kipper

I've toyed around with writing an external python script to aid in the creation of the batch file, but in truth it's easier and faster to copy and paste the command line syntax into a text file, make the modifications as needed to a particular project, and save the file as a batch file.

If your computer system has enough memory and a high core count, like 64, you could divide the renderers across two instances of Terragen.  In other words, make two batch files and run them both.  You may have to figure out at what point Windows will allocate your cores to the two jobs efficiently, as you don't want both instances of Terragen running on the same 32 cores.  (See other forum discussions on Windows memory allocation i.e. NUMA).

If you have access to Deadline, or some other render manager, you can use the same technique to add all the renderers into one Terragen Project, then during the Deadline submission process choose which renderer to use for the submitted job.  I've found this to be very effective as well.


KlausK

That is another very helpful example of a not very well known capability of TG.
I have to keep this somewhere "visible" so I remember it and can stop copying around between machines.

CHeers, Klaus
/ ASUS WS Mainboard / Dual XEON E5-2640v3 / 64GB RAM / NVIDIA GeForce GTX 1070 TI / Win7 Ultimate . . . still (||-:-||)

WAS

Quote from: Kevin Kipper on October 12, 2022, 07:29:22 PMTerragen application was installed, which I've defined by system variable %TERRAGEN_PATH%

That's a great idea for windows users.

Matt

If you define the variable TERRAGEN_PATH, please be aware that Terragen itself looks for this variable to override where it loads plugins from. If you define this, you might prevent other versions of Terragen installed in other locations from running correctly (they will try to load the plugins from the wrong version).

Based on experience of troubleshooting the problems this has caused some users in the past, I would not recommend it. You could use a different variable though.
Just because milk is white doesn't mean that clouds are made of milk.