Scripting Examples

In this page you will find KeyShot's predefined scripts and instructions on how to use them.  These scripts are listed under the Scripts tab inside the Scripting window.

Create Standard Views

Creates seven standard view cameras: front, back, top, bottom, left, right, and isometric.

How to use:

  • Select script and press Run. You will receive confirmation message: Successful!
  • Click OK.
  • You will find the seven standard views under Project > Camera.

Encode Video

Encodes video using an image sequence over a specific range of frames.

How to use:

  • Select script and press Run.  The user prompt appears.
  • Click the browse button and select a folder with the image frames.
  • For frame format, copy the name of the file, replacing the frame number with %d, e.g. my_new_animation.%d.jpg.
  • Enter the start frame – the number in the name of the first image, e.g. 1 on my_new_animation.0001.jpg.
  • Enter the end frame – the number in the name of the last image, e.g. 60 on my_new_animation.0060.jpg.
  • Enter FPS for the video.
  • Enter the video name.
  • Click OK to begin the process.

Random Scattering

Duplicates and random scatters the selected model.

How to use:

  • Select script and press Run.  The user prompt appears.
  • Select which model to duplicate & scatter
  • Select number of duplicates
  • Check axes to scatter along
  • Check if the object is to be rotated as well
  • Click OK to begin the process.

Render Ambient Occlusion

Renders an ambient occlusion pass of your scene.

How to use:

  • Select script and press Run.  The user prompt appears.
  • Click the browse button and if you wish to change your output folder.
  • Set the output image name.
  • Set the output width and height.
  • Set the render time. The default value is 20 seconds.  Increase the render time better quality.
  • Add to queue should be enabled if you wish to add your job to the local render queue. Otherwise your job will be rendered according to your render mode options: default, background, or network.
  • Decide if you wish to process your local queue after adding the job.  If you disabled the "Add to queue" checbox, then this box should also be disabled.
  • Click OK to begin the process.

Render Animation Passes

Renders your animation frames with the option to output "ambient occlusion" and/or "toon outline shading" passes. Please note that in order to run this script, you must first apply animations*1 to your scene.

How to use:

  • Select script and press Run.  The user prompt appears.
  • Click the browse button and if you wish to change your output folder.
  • Set the output file format. KeyShot uses %d to keep track of the frame number and you should leave this symbol in the name (e.g. my_new_animation.%d.jpg).
  • Set the output width and height.
  • Enter the start frame – the number in the name of the first image, e.g. 1 on my_new_animation.0001.jpg.
  • Enter the end frame – the number in the name of the last image, e.g. 60 on my_new_animation.0060.jpg.
  • Select the passes that you wish to render.
  • Add to queue should be enabled if you wish to add your job to the local render queue. Otherwise your job will be rendered according to your render mode options: default, background, or network.
  • Decide if you wish to process your local queue after adding the job.  If you disabled the "Add to queue" checbox, then this box should also be disabled.
  • Click OK to begin the process.

Render Images

Imports all CAD files within a folder and renders them one at a time. This script can be used to render an animation from an obj file sequence. Once your images are rendered, you may stitch them up and compile the video with the Encode Video script above.

How to use:

  • Select script and press Run. The user prompt appears.
  • Click the browse button and select the folder with the geometry (.obj) sequence.
  • For input, type the extension of the geometry without the dot (obj).
  • For output, type the extension of the image format without the dot (png).
  • Input the width and height of the output images in pixels.
  • If you created a material template for automatic material assignment, then select your template.  Otherwise, use "None".
  • Click OK to begin the process.

Render Panoramic Frames

Renders a series of frames that can be used to create a panoramic view of the product (that is, 360 degrees along the vertical axis Y). Once your images are rendered, you may stitch them up and compile the video with the Encode Video script above.

How to use:

  • Select script and press Run.  The user prompt appears.
  • Select which camera you'd like to use.  The center of the camera will be the pivot of rotation.
  • Set the number of frames to render. The default number of frames is 50. Since the camera rotates a full 360 degrees, this comes out to about 7 degrees per frame (360 / 50).
  • Set the output file format. KeyShot uses %d to keep track of the frame number and you should leave this symbol in the name (e.g. my_new_animation.%d.jpg).
  • Click the browse button and if you wish to change your output folder.
  • Set the output width and height.
  • Add to queue should be enabled if you wish to add your job to the local render queue. Otherwise your job will be rendered according to your render mode options: default, background, or network.
  • Decide if you wish to process your local queue after adding the job.  If you disabled the "Add to queue" checbox, then this box should also be disabled.
  • Choose the direction of rotation: clockwise (checkbox ON) or counterclockwise (checkbox OFF).
  • Click OK to begin the process.



*1 Animation is only available in KeyShot Pro edition.

On this page