Skip to content
mestela edited this page Dec 29, 2013 · 13 revisions

Wip tutorial...

bunnytest.jpg

Add a scenereader

First download the big buck bunny scene from this location:

http://imageengine.github.io/gaffer/resources/caches/bigBuckBunny_001.scc.gz

Unzip it, start gaffer, create a scenereader node. Point it at the .scc file you just unpacked, mmb drag the scenereader node into the viewer, hit 'f' in the viewer to frame the scene.

To start with you'll see a few bounding boxes. This is by design, Gaffer will only load geo when you ask it to.

01_scc_load_bboxes.png

Expanding and collapsing geo

Click in the scene hierarchy panel, note that it has 2 entries:

  • set_GRP
  • chars_GRP

Both have triangles next to them, implying there's more goodies inside. Click on chars_GRP, and press right-arrow on your keyboard. This will expand it out, revealing a rabbit_GRP within. Use your arrow keys to navigate down rabbit_GRP, right-arrow to expand, until you get to the rabbit node. Move your cursor over to the 3d viewer, hit 'f', You should now see a bunny in all its meshy glory. Scrub the timeline to see him go about his morning routine. Gaffer uses the maya keyboard shortcuts to manipulate the camera, so hold down alt and left-mouse-button drag to rotate the camera, alt+middle mouse to pan, and alt+right to zoom.

02_bunny_and_scene_heirarchy.png

Focus back on the scene hierarchy panel, and use the arrow keys to move back up to the chars_GRP and left-arrow to collapse it. The bunny will return to a bounding box. Right-arrow again, there's the bunny. Have a quick spin of collapsing and expanding the hierarchy, you'll find more layers of geo under the set_GRP.

To focus the camera on geo, you can select in the scene hierarchy panel as we've just done, or click meshes/bounding boxes in the 3d viewer and hit 'f'.

To expand EVERYTHING in one hit, you can select a bbox in the 3d viewer and hit down-arrow. If the bbox represents a large hierarchy, you might have to wait a bit while gaffer expands it.

(anim gif here?)

Create a camera, render setup, 2d viewer

To get the 3delight stuff underway, lets add a few nodes. Add a camera node, then shift select the camera node and scenereader node, and add a group node. Mmb drag the group node into the 3d viewer, and expand the scene hierarchy so that you can see the camera and the bunny.

Select the camera, and adjust its transform properties so that it frames the bunny. Here's some values to get you started:

  • translate: 1 3 8
  • rotate: 0 7 0
  • scale: 1 1 1

03_cam_transform.png

With the group node selected, append a standardOptions node, a displays node, and a rendermanRender node, and next to the rendermanRender node add a display node. This will function as the 2d image viewer to see the render (note the difference between display and display_s_!)

03a_render_nodes.png

Select the standardOptions node, expand the camera section, click the small toggle to enable the camera attribute, then click the folder icon to set the path to your camera in your scene. This brings up a scene selection dialog, in its default state you double click to browse the hierarchy. If you're lazy like me click the top left button which will let you toggle to a tree view, which you can browse with single clicks or your arrow keys. When you have the path '/group/camera', click OK.

On the displays node, hit the + icon, and use the context menu to set it to interactive->beauty.

On the 3d viewer, click the panel icon in the top right, choose 'split right', click the panel icon of the new split region and choose 'viewer', and mmb drag the display node into it. Nearly done!

04_panel_icon.png

Finally save your scene as 'bunnydemo.gfr' (remember to type the name at the bottom of the file dialog!), select the rendermanRender node, hit Execute. After a short pause you should see a grayscale render appear in the 2d viewer. Hooray!

05_grayscale_render.png

assign a shader, a light

We'll assign a basic shader to the entire shot, and a single light. The default gaffer install assumes you have 3delight installed, so lets use some of their example shaders and lights to help setup this scene.

Tab in a plastic shader node, and a shaderAssignment node. Insert the shader assignment node immediately after the sceneReader so that it assigns it to everything, and drag a connection from the plastic shader to the assignment node.

For the light, tab in a physicalsun node, which will adjust its intensity and colour based on its rotation. Once created, connect it to the group node, and set its rotation to 45, -90, 0. Render, you should get a high contrast shadowy image.

reorganise the graph using groups, node names vs scene names

While we could keep adding more and more inputs to our single group node, that would get unwieldy quickly. Lets impose some order here, and have 3 groups; one for geo, one for the lightrig, and one for the scene.

Select the light, and tab in a group node, it will automatically insert itself. In the node editor pane, set the name to 'light_GRP'. If you look in the scene hierarchy panel (its still pinned to the group node right?), you can see that the light has been moved into a group called light_GRP. Note that the name in the nodes pane is 'group1'. You can rename this to 'Group_lights' if you like (use the field at the top of the node editor), but note that node names can (and often will) be different from the scene hierarchy names.

Similarly for neatness, select the main group node, and set its name parameter to 'scene', and name the node itself 'Group_scene'. If you look in the scene hierarchy panel, it will have collapsed itself up again. Expand it out to see that the top group is called 'scene', then beneath it is 'camera', 'chars_GRP', 'light_GRP', 'set_GRP'.

Look at the StandardOptions node, and the camera parameter. Note that its still '/group/camera' which is incorrect. Set its value to be '/scene/camera'.

Nodes to toggle geo display

When doing lighting development, its important to get fast feedback. We can achieve that by reducing the amount of geo we're rendering during testing, and reduce the quality of the render. Lets look at how to do both these things.

First, lets setup a node that will hide everything except the bunny. After the ShaderAssignment node, append a 'isolate' node. Go to its Filter tab, hit the 'Add...' button, select 'Pathfilter', which will create and attach a Pathfilter node. The pathfilter takes a path to an object or group, and the Isolate node will remove anything that doesn't match that path. We can setup the pathfilter in 2 ways:

  1. Select the pathfilter, go to the Filter tab, click the plus, and type in 'chars*' for the path. If you unpin the scene hierarchy panel, and select the Isolate node, you can see that it only includes the chars_GRP. Expand it out, and you'll find the geo inside. Select the ShaderAssignment node, see that the Scene Hierarchy includes set_GRP again. Similar to viewing different parts of a nuke comp, when panels are unpinned, they show you the state of the graph at that current selection.

  2. Select the 'chars*' path, click the - key to delete it. This time, expand the scene hierarchy until you see the rabbit geo, then lmb drag it directly from the scene hiearchy panel to the + button on the node editor. It will automatically add the path for you.

With the filter in place, mmb drag the Group_scene node into the viewer, and to the Scene Heirarchy panel, expand it out to see everything. You should now only see the camera, light, bunny. Select the Isolate node, hit 'd' to disable it, you'll see the rest of the set appears (at least in bounding box form). Try a test render with the Isolate node enabled and disabled, you'll see that you've now setup a simple toggle to hide geo we don't need while testing.

Nodes to toggle quality

Similarly, lets setup some nodes we can toggle to control shading rate and pixel samples.

Select the Group_scene node, append a RendermanAttributes node. Open the Shading section, click the toggle to enable 'Shading Rate', set it to 8. Append a RenderManOptions node, open the Quality section, enable 'Pixel Samples', set it to 1 1. Do a test render, you'll see you now have faster feedback, at the expense of quality. Drag a box around those 2 node, hit d, render again, see quality is back to normal.

Tearing off often used panels

You might find hunting for the RenderManRender node annoying each time you want to render. Select the RendermanRender node, hold down shift and double click the node again. This will pop out a floating panel. Resize it so its small enough to just see the execute button, and put the window somewhere easy to reach whenever you want to start a test render.

better shaders, better lights

Lets swap to a nicer overall shader. Tab in a architectural shader, put it near the plastic shader in the graph. Drag the top of the noodle just after the plastic shader, and drag it to the architectural shader. As you'd expect, its swapped the shader out.

Its default state is a little shiny, lets knock it down a bit. Set reflectivity to 0, make the i_diffuse_color a light green (just so we can see its effect), hit render.

The physicalsun is a little harsh, lets add an environment light to soften things off a bit. Create an envlight2, position it near the physicalsun node, and connect it to the Group_lights node. If you drag the Group_scene node to the Scene Hierarchy pane and expand out light_GRP, you'll see the 2 lights are named 'light' and 'light1', which isn't very nice. Make the scene name of the physicalsun 'key', and the envlight2 'env'.

Envlight2 requires a latlong hdri to work, so download this example skydome ( https://raw.github.com/wiki/ImageEngine/gaffer/images/bunnyTutorial/skydome.exr ), and paste the full local path into the envmap parameter. If you disable the physcalsun and hit render, you should see a rather bland ambient light effect. To make this look a little better, we'll make the light calculate ambient occlusion. Sett the Kocc parameter to 1, samples down to 8 for speed, render again. Bit better.

Turn the sun back on, and use the Kenv parameter on the env light to adjust its intensity until it looks nice (I've set mine to 0.4). Disable the isolate node to turn the set back on, hit render to see how its all looking so far.

specific shaders

  • tree, bunny, ground

pass splits

  • prune/isolate nodes

render stats

  • matte
  • cast shadow

todo

  • add indirect light, tune (current example a bit naff)
  • aovs? ben has example setup script
  • bucket size?
  • render geo as subdiv?
  • rgb mattes?
  • stopping 3delight mid preview-render?
  • queueing a bunch of renders locally?
  • sending stuff to a farm manager? try with something free like deadline
  • keeping a history of renders for comparison? (eg, the way it/mplay store all previous preview renders)
  • make nicer (read: correct) interfaces for the 3delight shaders?
  • better gizmo for lights to read orientation (even as simple as parenting a cone shape or similar to indicate this, then mark it unrenderable)?
  • construct a basic bash comp out of gaffer image nodes
  • get a better handle on wildcards; how to make them work beyond '/' delimiters

done

  • upload images, gfr scenes to gitub, link to wiki
  • a switch node? (in v0.87)

Clone this wiki locally