Q100242: Creating a Katana launcher script for Windows

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 batch 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 Windows, please view the Installing on Windows 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 batch script) into a text editor, for example Notepad.
    An example file is also attached, so alternatively download the attached batch script. To edit the .bat file, right-click on the file and choose 'Edit'. 
  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.6v2.bat and close it.
  5. Now double-clicking the .bat file or right-click > Open 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 desktop icon to click and launch Katana from, you can add this in the following way:
  • Right-click on the .bat file > Create shortcut. 
  • Place the shortcut that is created on your Desktop.
  • Right-click the shortcut > Properties > Shortcut tab > Change Icon…
  • You may now see a warning saying the .bat file contains no icons. Click okay and you will get the option to choose an icon from a different location.
  • Click Browse… and browse to your Katana installation directory (KATANA_ROOT). Select the file WindowsIcon.ico and click Open. Click OK to close the Change Icon dialog and OK to close the Properties window.

    You should now have the Katana launcher script shortcut showing the Katana icon, available on your Desktop.

 

KATANA LAUNCHER SCRIPT

Key KATANA environment variables

KATANA_ROOT should point to your Katana installation directory.  
PATH is a Windows 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 batch file commands explained

rem marks a comment; lines beginning with this command will be ignored when Windows runs the script.
@echo off disables the display of the executed commands in a command prompt.
set is the command to set an environment variable. Multiple paths can be separated by a semicolon(;).

The final line,
"%KATANA_ROOT%\bin\katanaBin.exe", runs the Katana executable. Once the batch file has reached this line, a command prompt will appear echoing the commands executed by Katana.

 

Example launcher batch script

@echo off
rem --------------------------------------------
rem -------- How to use this script ------------
rem --------------------------------------------


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

rem -- KATANA_ROOT should point to your Katana installation directory. --
rem -- 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 --
rem -- DEFAULT_RENDERER is the environment variable that drives which renderer plug-in is expected by default in a Renderexporttings node. --

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


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

set "KATANA_TAGLINE=Foundry Support"

rem -- Define the install location for KATANA and add binaries to the PATH --
set "KATANA_ROOT=C:\Program Files\Katana3.6v2"
set "PATH=%PATH%;%DELIGHT%\bin"

rem -- Make the example projects like the PyMock asset plugins available in KATANA
set "KATANA_RESOURCES=%KATANA_RESOURCES%;%KATANA_ROOT%\plugins\Resources\Examples"

rem -- This line is a simple example of how custom shelf scripts can be sourced --
rem https://learn.foundry.com/katana/current/Content/tg/shelf_item_scripts/shelf_item_scripts.html
set "KATANA_RESOURCES=%KATANA_RESOURCES%;C:\path\to\katana_shelves"
set "KATANA_RESOURCES=%KATANA_RESOURCES%;C:\path\to\katana_tools"

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


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


rem --------------------------------------------
rem ----------- 3Delight Specific --------------
rem https://www.3delight.com/documentation/display/3DFK/Installation
rem --------------------------------------------

rem -- Location of where the main 3Delight package is installed --
set "DELIGHT=C:\Program Files\3Delight"

rem -- The 3Delight bin folder is needed in PATH  --
set "PATH=%PATH%;%DELIGHT%\bin"

rem -- Location of the 3Delight for KATANA plug-in --
set "KATANA_RESOURCES=%KATANA_RESOURCES%;%DELIGHT%\3DelightForKatana"


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

rem -- Where you have installed the KtoA plug-in --
set "KTOA_HOME=C:\Program Files\ktoa\ktoa-3.0.4.2-kat3.6-windows"

rem -- The KtoA bin folder is needed in PATH --
set "PATH=%PATH%;%KTOA_HOME%\bin"

rem -- This is how to load the KtoA plug-in --
set "KATANA_RESOURCES=%KATANA_RESOURCES%;%KTOA_HOME%"


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

rem -- Location of the RenderMan Pro Server installation --
set "RMANTREE=C:\Program Files\Pixar\RenderManProServer-23.4"

rem -- Location of the PRman plugin for KATANA --
set "RFKTREE=C:\Program Files\Pixar\RenderManForKatana-23.4-katana3.6"

rem -- This is what is required to load the RfK plugin --
set "KATANA_RESOURCES=%KATANA_RESOURCES%;%RFKTREE%\plugins\Resources\PRMan23"


rem --------------------------------------------
rem ----------- Redshift Specific --------------
rem C:\ProgramData\Redshift\Plugins\Katana\3.5v1\launchRedshift4Katana.bat
rem --------------------------------------------

rem -- Location of the RedShift bin folder --
set "REDSHIFT_HOME=C:\ProgramData\Redshift\bin"

rem -- Location of the RedShift plugin for KATANA --
set "REDSHIFT4KATANA_HOME=C:\ProgramData\Redshift\Plugins\Katana\3.5v1"

rem -- This is what is required to load the RedshiftForKatana plugin --
set "PATH=%PATH%;%REDSHIFT_HOME%"
set "KATANA_RESOURCES=%KATANA_RESOURCES%;%REDSHIFT4KATANA_HOME%"

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

rem -- Location of the V-Ray for KATANA install directory. --
set "VRAY_HOME=C:\Program Files\VRay\vray_adv_41002_katana3.0_x64"

rem -- Specific location to call out the plug-in to itsef --
set "VRAY_FOR_KATANA_PLUGINS_x64=%VRAY_HOME%\vrayplugins"

rem -- This is required to access the tools that parse all the shaders --
set "PATH=%PATH%;%VRAY_HOME%\RenderBin"

rem -- This is how the V-Ray plugin gets loaded --
set "KATANA_RESOURCES=%KATANA_RESOURCES%;%VRAY_HOME%"

rem --------------------------------------------
rem ------------ Deadline Specific -------------
rem https://docs.thinkboxsoftware.com/products/deadline/10.1/1_User%20Manual/manual/app-katana.html
rem --------------------------------------------

rem -- Location containing Tabs\DeadlineKatanaClient.py from [Repository]\submission\Katana\Client\DeadlineKatanaClient.py
set "KATANA_RESOURCES=%KATANA_RESOURCES%;C:\KatanaSubmitter"


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


rem --------------------------------------------
rem --------------- Start Katana ---------------
rem https://learn.foundry.com/katana/Content/tg/launch_modes/katana_launch_modes.html rem -------------------------------------------- "%KATANA_ROOT%\bin\katanaBin.exe"

 

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

 

ATTACHMENTS

We're sorry to hear that

Please tell us why