logo
    
p3

Batch Rendering on Windows: Part 1

May 8th, 2010

This question is being asked quite often: how to render a series of boxes or books using the series of images. Of course you may render them one by one by replacing side images, but an easier way exists.

Let’s start from the simple scenario: you have a number of images and you need to render the same number of boxes, with those images on the front side. Create a “batch” folder somewhere, for instance on the desktop. Then create an “images” subfolder there and copy your images to that subfolder.

Now create a project that will be used for rendering or copy an existent one to the “batch” folder. Name it “project1.box3d” (you may use different name, of course, just replace “project1″ with your name in the script below).

Create an “out” subfolder in the “batch” folder. It will be used for rendering results.

Now, the most important step. You need to create a batch file that will render boxes with your images. To do that start notepad or any other editor that allows to save plain text files (Word is not good for that). Then put the following two lines to your file:

SET BOXSHOT="c:\program files\BoxShot3D\BoxShot3D.exe"
FOR %%p in (images\*.jpg) DO %BOXSHOT% -side Front %%p -t out\%%~np.png -q 1 project1.box3d

The first line defines a path to the Box Shot 3D executable. Modify it if you install Box Shot 3D to another location. The second line is a bit complex. It does the following: for each JPEG-file in the “images” subfolder it runs Box Shot 3D and asks to render project “project1″ with that JPEG as a front side image and save the result with the same name to the “out” subfolder.

It looks tricky, but it is actually quite easy. The “-q 1″ parameter overrides project’s quality setting and asks Box Shot 3D to render boxes with low quality. This is useful for fast checking of the script, because low-quality rendering is performed much faster than the production one. When you check the script and see that it renders everything as you need, just remove “-q 1″ from the second line and run the script again. This time rendering will last much longer, but you will get the production quality images.

Now save the file as “go.cmd” to the “batch” folder and run it. Box Shot 3D should start, load the first image, render the project and then quit. Then it should start for the second image and so on. You will see the results in the “out” folder.

By default, Box Shot 3D doesn’t take size of image into account and use size of the object from the project file. You may override this by adding “-fit” option just before “project1.box3d” to the second line of the script. But be careful with this option, because automatic resize doesn’t take camera’s field of view into account and the object may not fit the screen after resizing.

If Box Shot 3D doesn’t start at all, you need to check the first line of script. Perhaps the path is defined with errors. If Box Shot 3D starts, but doesn’t load images or doesn’t quit after rendering, you need to check the second line for errors. And do not forget that the script renders project for every JPEG file. If you need to render PNG, TIFF or PSD files, you need to modify the mask in the second line.

What if you need to define Left and Top sides as well? I’ll explain this a bit later. Mac-people will get something to read as well.

Feel free to ask questions and suggest scenarios for batch rendering. This is a quite complex topic, but as it allows to get a very interesting results, it is worth learning.

Your Comments:

1. Draugmot  [+]
May 9th, 2010 at 2:56 am
 

Thanks, it can be very useful.
Will it be realised in gui later?

2. Vitaly [Box Shot 3D]  [+]
May 9th, 2010 at 12:44 pm
 

Draugmot, there are too many situations that may require batch rendering. Starting from rendering several boxes for the list of images and ending by server-based rendering on demand, as some of my customers do.

I believe that any GUI application that allows to perform all the rendering types will be at least as complex as the script above :)

So, my idea is quite simple: to describe the cases that are used most often, so you may use them as quick start guides.

3. Sam
May 19th, 2010 at 5:22 pm
 

It does not work for me?????? I have done everything you said and still nothing seems to work.

4. Vitaly [Box Shot 3D]  [+]
May 19th, 2010 at 5:38 pm
 

Sam, in that case it seems that you have made an error somewhere. How to check what’s wrong? It is quite easy. You need to open a command prompt window (shell) in the “batch” folder. To do that open that folder in explorer, hold the “Shift” key and perform a right button click in the window. In the context menu select the “Open Command Prompt Here” item (step-by-step guide is here).

Now type go.cmd and press ENTER. You should see the text from the file and, perhaps some information about error. If this doesn’t help to understand the problem, feel free to post it here, so I can take a look at it too.

5. Sam
May 19th, 2010 at 6:36 pm
 

I think I might have done it as there all loading on the screen!! However I don’t what I pressed!

6. Diego
September 2nd, 2010 at 1:41 pm
 

Hello

I’m having problems with side names when using command calls for batch rendering. Different shapes has different side names, and two-word side names (“Cover Back”, “CD Front” ,etc) don’t work when I try setting the parameter -side . It seems that can’t include spaces. I’ve tryed several things like CoverBack, Cover_Back, and so, but can’t find the correct one.
Where can I find a list of side names for each shape to use with -side parameter?
Thankyou.

7. Vitaly [Box Shot 3D]  [+]
September 2nd, 2010 at 1:47 pm
 

Diego, -side “Cover Back” works fine for me. Did you try it?

8. Diego
September 2nd, 2010 at 2:15 pm
 

Really didn’t try including the quotes. Works perfectly.
Thankyou for your time.

Leave A Comment:

Name: *
E-Mail (private): *
Website:  
Comment: *
   
Version 3.0.2, Size: 15.2Mb
Windows XP/Vista/7
Version 3.0.2, Size: 7.72Mb
Universal binary, OS X 10.5+
Order the full version of
Box Shot 3D securely online
© 2005-2010 BoxShot3D.com