Q100272: Creating a Katana launcher script for Linux

Follow

SUMMARY

To launch Katana and work with the various renderer plugins available, you need to make sure that a few environment variables are set up correctly. The easiest way to manage these environment variables at present is to use a launcher shell script to start Katana.

This article provides and example script below that covers all the various renderer plugins, and is ready for usage. It is well commented and you only need delete the references to the renderer plugins you don't require in your workflow.

NOTE: If your paths are different for the various components used in this script then you have to update those paths to the correct location on your system. 

If you are yet to install and license Katana on Linux, please view the Installing on Linux User Guide.

 

CONFIGURING THE LAUNCHER SCRIPT

For instructions on how to modify and use this script, please follow these steps:

  1. Copy and paste the contents of the script below (Example launcher shell script) into a text editor, for example gedit. An example file is also attached, so alternatively download the attached script and open it with your favorite text editor. 
  2. Carefully read through the script, checking if the paths specified are the same on your machine. If not, update them so that they point to the right locations.
  3. Delete the sections specific to tools that you do not use, for example renderers or custom scripts.
  4. Save the file as Katana3.6v2Launcher.sh and close it.
  5. Now execute the file in the terminal by navigating to the folder where it is saved and entering ./Katana3.6v2Launcher.sh should run the commands and launch Katana with all the necessary environment variables set.

    You can check if they have been set correctly for example by running these commands in the Python tab:

    import os
    print os.environ['KATANA_RESOURCES']

    This should print the paths you have added to KATANA_RESOURCES in the launcher script.
  6. If you would like a shorter command to launch Katana, you can add this in the following way:
  • Locate your .bashrc file, typically located in your home directory, and open it in a text editor like gedit.
  • Add a line to the bottom, associating an alias with the path to the executable script you created:

    alias k3.6v2='~/Documents/Katana3.6v2Launcher.sh'

    Now entering k3.6v2 in a Terminal should run the script and launch Katana with all the environment variables set.

 

KATANA LAUNCHER SCRIPT

Key Katana environment variables

KATANA_ROOT should point to your Katana installation directory.  
PATH is a system variable specifying directories where executable programs are located.
KATANA_RESOURCES provides a list of paths under which to look for plug-ins and other customizations, for example shaders. For more information, please see the Katana Resources Install Guide.

Some script commands explained

'#' marks a comment; lines beginning with this command will be ignored when the script is run.
export is the command to set an environment variable. Multiple paths can be separated by a colon(':').

The final line ($KATANA_ROOT/katana) runs the Katana executable. Make sure that KATANA_ROOT matches the folder path to the Katana installation directory.

Example launcher shell script

#!/bin/bash
# --------------------------------------------
# -------- How to use this script ------------
# --------------------------------------------


# -- The KATANA Specific section shows some examples for how you can use the KATANA_RESOURCES environment variable --

# -- KATANA_ROOT should point to your Katana installation directory. --
# -- KATANA_RESOURCES drives what gets loaded at startup for KATANA. This is how you load tools and plug-ins, both custom and non-custom ones like commercial renderer plug-ins --
# -- DEFAULT_RENDERER is the environment variable that drives which renderer plug-in is expected by default in a Renderexporttings node. --

# -- Delete the settings for the renderers that you do not have installed or do not want to use at the same time. --
# -- The different renderer plug-ins' requirements for environment variables may change. Please refer to the installation instructions for each particular render plug-in for the most up to date information --


# --------------------------------------------
# ------------ KATANA Specific ---------------
# https://learn.foundry.com/katana/dev-guide/EnvironmentVariables.html
# --------------------------------------------

export KATANA_TAGLINE="Foundry Support"
export KATANA_ROOT=/opt/Katana3.6v2

# -- This line loads the example resources that ships with Katana --
export KATANA_RESOURCES=$KATANA_RESOURCES:$KATANA_ROOT/plugins/Resources/Examples

# -- This line is a simple example of how custom shelf scripts can be sourced --
# https://learn.foundry.com/katana/current/Content/tg/shelf_item_scripts/shelf_item_scripts.html
export KATANA_RESOURCES=$KATANA_RESOURCES:/path/to/katana_shelves
export KATANA_RESOURCES=$KATANA_RESOURCES:/path/to/katana_tools

# -- Change this to match the renderer you want to use by default. (arnold, prman, vray, dl) --
export DEFAULT_RENDERER=dl


# !!!!!!!!!!!!! Delete the tools you do not use from the section below !!!!!!!!!!!!!


# --------------------------------------------
# ----------- 3Delight Specific --------------
# https://www.3delight.com/documentation/display/3DFK/Installation
# --------------------------------------------
# -- Please note that 3Delight comes bundled with Katana 3.0+ and can be set up to run without
# -- a specific launcher script at install time --
# -- Source the .3delight_bash or .3delight_csh file from the location where the main 3Delight package is installed--
# -- Please note that 3Delight requires gcc 4.8.3 or higher to run --
# source /usr/local/3delight-2.1.24/.3delight_bash


# --------------------------------------------
# ------------- Arnold Specific --------------
# https://docs.arnoldrenderer.com/display/A5KTN/Installation
# --------------------------------------------

# -- Where you have installed the KtoA plug-in --
export KTOA_ROOT=/Autodesk/ktoa/ktoa-3.0.4.2-kat3.6-linux

# -- Without these KtoA will not function --
export solidangle_LICENSE=5053@your-server
export ARNOLD_PLUGIN_PATH=$KTOA_ROOT/Plugins
export KATANA_RESOURCES=$KATANA_RESOURCES:$KTOA_ROOT
export PATH=$PATH:$KTOA_ROOT/bin

# -- Optional Environment variables --
#export MAYA_PATH=/usr/autodesk/maya2020
#export MTOA_PATH=/opt/solidangle/mtoa/2020
#export PATH=$ARNOLD_PLUGIN_PATH:/path/to/Yeti/bin:${PATH}
#export ARNOLD_PLUGIN_PATH=/path/to/Yeti/bin:$ARNOLD_PLUGIN_PATH
#export KTOA_LOAD_VERBOSITY=debug


# --------------------------------------------
# --------- RenderMan 23 Specific ------------
# https://rmanwiki.pixar.com/display/RFK23/Configuring+Katana
# --------------------------------------------

# --This is the location of the RenderMan Pro Server installation--
export RMANTREE=/opt/pixar/RenderManProServer-23.4

# --This is the location of the PRman plugin for KATANA --
export RFKTREE=/opt/pixar/RenderManForKatana-23.4-katana3.6/plugins

# --These make sure that the programs can be found, shaders loaded, and all components used--
export PATH=$PATH:$RMANTREE/lib:$RMANTREE/bin

# --This is what is required to load the RfK plugin--
export KATANA_RESOURCES=$KATANA_RESOURCES:$RFKTREE/Resources/PRMan23


# --------------------------------------------
# ----------- Redshift Specific --------------
# --------------------------------------------

export LD_LIBRARY_PATH="/usr/redshift/bin:${LD_LIBRARY_PATH}"
export KATANA_RESOURCES=$KATANA_RESOURCES:/usr/redshift/redshift4katana/katana3.5v1

# By default, Redshift "local data" path is set to ~/redshift. 
#export REDSHIFT_LOCALDATAPATH=


# --------------------------------------------
# -------------- V-Ray Specific --------------
# https://docs.chaosgroup.com/display/VNFK/Installation
# --------------------------------------------

# --Location of the V-Ray for KATANA install directory.--
export VRAY_INSTALL_PATH=/opt/chaosgroup/vray_adv_42090_katana3.0_linux_x64_30320

# --Specific location to call out the plug-in to itsef--
export VRAY_FOR_KATANA_PLUGINS_x64=$VRAY_INSTALL_PATH/vrayplugins
export PATH=$PATH:$VRAY_INSTALL_PATH/RenderBin

# --This is how the V-Ray plugin gets loaded--
export KATANA_RESOURCES=$KATANA_RESOURCES:$VRAY_INSTALL_PATH


# !!!!!!!!!!!!! Stop deleting parts of the script. Leave the rest of this script alone !!!!!!!!!!!!!


# --------------------------------------------
# --------------- Start Katana ---------------
# https://learn.foundry.com/katana/Content/tg/launch_modes/katana_launch_modes.html # -------------------------------------------- $KATANA_ROOT/katana

 

For further reading on launching Katana and the different launch modes available, please refer to the Launching on Linux section of the Katana documentation.

 

ATTACHMENTS

We're sorry to hear that

Please tell us why