Thursday, April 18, 2013

Render Buddy

Download RenderBuddy. 



Since the Maya swatch viewer can be painfully slow, inaccurate and limited in what it actually shows, I wrote my own swatch viewer, RenderBuddy.

Calling it a swatch viewer is a bit of a misnomer as it is really a render with a specific render layer.  The UI lets you connect shaders and textures to specific RenderBuddy geometry plus a few extras that I'll discuss below.

The idea is that you turn off the Maya swatch thumbnails, assign a shader or texture of choice to a piece of geometry and do an isolated render.  Since the scope is narrowed, the render times are very fast.  If you have a plugin like SprayTrace, then the feedback is realtime.



Installation
  1. Download RenderBuddy from the link at the top.
  2. Extract the files from the .zip
  3. Place the RenderBuddy.mel in a local or facility folder:
    1. Local scripts folder: C:\Users\YOURNAME\Documents\maya\MAYA_VERSION-x64\scripts
    2. Facility location of your choice.
  4.  Place the render_buddy_v#.mb in a local or facility folder.
  5. Start Maya.
  6. Source the script from the local or facility location.  You can make a shelf button too.
  • source "/your/local/path/to/renderbuddy/RenderBuddy.mel"; 
  • - OR -
  • source "/your/facility/path/to/renderbuddy/RenderBuddy.mel";
Use
When the RenderBuddy(RB) UI launches it will look similar to the image above. Let's look at the UI from top to bottom and see how to use RB.

Thumbnails 
 
This turns on/off the Maya swatch thumbnails.  "Thumbs ON" in green ( as pictured above ) means that the thumbnail updates are turned on.  "Thumbs OFF" in red means that the thumbnails updates are turned off.


Geo World Space Size

By default the RB stage and geo are 1 unit in size.  When you are testing shaders and textures that depend on size in your scene, then you can scale RB up and down.

For example, let's say you are working with a skin shader.  Mental Ray's skin shader has radius values that are in world space units.  If your character's head is roughly 50 units x 50 units, then you would set the RB "World Space Units" to 50.  Now when you look at the RB render the results should approximate what you will see with the shader on your character.

If you want RB to calculate the average size of a piece of geometry in your scene, select the geometry and hit
"Match Render Buddy's World Space Size to Selection".  You'll notice the slider value changes and RB should now be larger or smaller depending on your selection.


Render Buddy Camera
 

The sliders are connected to the RB camera and change the focal length and 2d zoom attributes.  I put them in for convenience so I wouldn't have to select the camera and edit the attributes in the attributeEditor.


Shader and Texture Assignment

This is where the bulk of the time will be spent.  There are three lists: Geo, Shader and Texture.
  • When you highlight a piece of geometry from the "Geo List", RB makes that one visible and hides all the others.  
  • When you highlight a shader from the "Shader List", RB assigns that shader to the highlighted geo in the "Geo List".  You have to have something highlighted in the "Geo List" for a shader assignment to happen.
  • When you highlight a texture from the "Texture List", RB assigns a special RB shader ( it's a surface shader ) to the highlighted geo in the "Geo List".  I use a surface shader to eliminate all lighting so you can see 100% of your texture.  You have to have something highlighted in the "Geo List" for a texture assignment to happen.
    • There is a gamma node attached to the RB surface shader, I may add buttons to edit the gamma, but for now you will have to edit it by hand.

Refresh Buttons

As you add, rename and remove shaders and textures, use the buttons to refresh single lists or all of them.


List Buttons
  • Dup Geo and Add to List
    • If you want to use your custom piece of geometry in RB, then:
      1. Select your geo in your scene.
      2. Hit "Dup Geo and Add to List".
      3. Your geo will show up in the "Geo List".  If it does not, then hit "Refresh Geo List".
  • Edit Geo
    • Selects the geometry that is highlighted in the "Geo List".
  • Assign Selected Shader
    • If you have a shader selected in Hypershade or in your scene and want to assign it:
      1. Make sure you have a shader seleted in your scene.
      2. Make sure you have geometry highlighted in the "Geo List".
      3. Hit "Assign Selected Shader".
  • Edit Shader
    • Selects the highlighted shader in the "Shader List",
  • Assign Selected Texture
    • If you have a texture selected in Hypershade or in your scene and want to assign it:
      1. Make sure you have a texture selected in your scene.
      2. Make sure you have geometry highlighted in the "Geo List".
      3. Hit "Assign Selected Texture".
  • Edit Texture
    • Selects the highlighted texture in "Texture List".

 Render Buddy Layer and Set Render Resolution

RB uses it's own render layer to limit the visible geometry and lights.  When you want to switch to the RB render layer, hit "Switch to Render Buddy Layer".

The "Set Render Resolution" buttons are convenience buttons that set the size of the rendered image.  They set the resolution to:
  • hd = 1920x1080
  • hhd = 960x540
  • 2ksq = 2048x2048
  • 1ksq = 1024x1024
  • 512sq = 512x512
  • 256sq = 256x256

Render Buddy Location
  • Path 
    • RB only searches for RB specific nodes when you launch the window.  
    • If RB finds nothing, then it will search the path for "ender_buddy_v#.mb" using the specified location in "Path".  
    • If RB cannot find the file it will pop up a window asking for the path to "render_buddy_v#.mb".
  • Save Render Buddy
    • If you have added geometry, lights or what-have-you to RB and would like to use that as your default RB setup, then hit "Save Render Buddy".
    • It will save the next version number to the location specified in "Path".  For example if "Path" is "/your/path/to/rb" and the latest version of RB is "render_buddy_v13.mb", then "Save Render Buddy" will save "/your/path/to/rb/render_buddy_v14.mb".
  • Load Render Buddy
    • Loads the latest version of RB using the location in "Path".
  • xx Delete Render Buddy xx
    • Deletes all RB nodes and layers.


3 comments:

  1. Awesome blog! I cant wait to try this out, looks way faster than the standard route!

    ReplyDelete
  2. file does not exist, or died (RenderBuddyMenu.mel)

    ReplyDelete
    Replies
    1. Thanks for pointing that out. The instructions at the top of the post were when I had 2 mel file. I have since consolidated the code to a single file RenderBuddy.mel. I'll update the instructions.

      Delete