Planetside Software Forums

Support => Terragen Support => Topic started by: gfwilliams on July 14, 2010, 08:21:09 am

Title: Command-line render with specific renderer/camera
Post by: gfwilliams on July 14, 2010, 08:21:09 am
Hi, apologies if this has been asked before, but I wasn't able to find any information...

I have the Windows version of Terragen Deep, and I wanted to use it to create some high-res skyboxes. I'm all sorted for doing this manually, however as each frame's going to take an hour to render, I'd like to automate the rendering of 6 frames and leave it overnight. I've seen you can do this with animation, but I just have Terragen deep, not deep + animation.

Anyway it seemed like it would be pretty easy to do with the command-line - just create a scene with 6 cameras and 6 renderers, then run terragen for each one in turn in a batch file. Only as far as I can tell you can only render using the 'master' renderer...

Am I missing something here? Is there some command-line switch that isn't documented, or can I control this some other way?

At the moment the only solution I can see is to write a script to modify the TGD file between each render...
Title: Re: Command-line render with specific renderer/camera
Post by: gfwilliams on July 14, 2010, 08:49:18 am
Actually sorry for asking and then answering, but I just did it in a hacky way instead...

I have a Linux Server that I use for most of my work, and it runs Terragen 2 under a command-line just fine (even if the UI isn't usable as some other folks mentioned). The rough script I use is this:

#!/bin/bash
DIR=`pwd`
FILE="Terragen Cubemap.tgd"
echo in $DIR
cd /home/gw/.wine/drive_c/Program\ Files/Terragen\ 2/
pwd
sed -e "s/\tcamera = \".*\"/\tcamera = \"Camera Front\"/" "$DIR/$FILE" > temp.tgd
wine tgd.exe -p temp.tgd -r -o $DIR/terragen_front.bmp
sed -e "s/\tcamera = \".*\"/\tcamera = \"Camera Back\"/" "$DIR/$FILE" > temp.tgd
wine tgd.exe -p temp.tgd -r -o $DIR/terragen_back.bmp
sed -e "s/\tcamera = \".*\"/\tcamera = \"Camera Left\"/" "$DIR/$FILE" > temp.tgd
wine tgd.exe -p temp.tgd -r -o $DIR/terragen_left.bmp
sed -e "s/\tcamera = \".*\"/\tcamera = \"Camera Right\"/" "$DIR/$FILE" > temp.tgd
wine tgd.exe -p temp.tgd -r -o $DIR/terragen_right.bmp
sed -e "s/\tcamera = \".*\"/\tcamera = \"Camera Up\"/" "$DIR/$FILE" > temp.tgd
wine tgd.exe -p temp.tgd -r -o $DIR/terragen_top.bmp
sed -e "s/\tcamera = \".*\"/\tcamera = \"Camera Down\"/" "$DIR/$FILE" > temp.tgd
wine tgd.exe -p temp.tgd -r -o $DIR/terragen_bottom.bmp
rm temp.tgd
cd $DIR


'sed' is just a program that runs a regular expression over a file - you can get it in windows too (via mingw at least) so the script could probably be turned into a batch file. It only works because of terragen's formatting of its files, so if Terragen changes, this could break. You could probably use XSLT to do something much better than sed if you actually cared :)

also looking at the file, you could infact skip the slightly laborious job of setting up 6 cameras, and change the script to instead set up the 'rotation' attribute to "0 90 0", etc...
Title: Re: Command-line render with specific renderer/camera
Post by: Oshyan on July 14, 2010, 10:54:43 pm
There is a -master commandline switch that will be available in the next version which should address this need. Glad you got it figured out in the mean time.

- Oshyan