Procedural Tree MEL + Pixar's Renderman

Info
Statistics
Created: 08/18/12
Last Edited: 11/22/12
875
13
0
Description
Generating color varying leaves can be easily achived with the help of RSL, slim and an some MEL magic.
  • Procedural Tree

    In order to color a full set of leaves with different color variations we can take advantage of a simple shader in created in RSL to create a slim template that will allow us to create quick variations of multiple geometry a only using one main shader. 
  • Responsible for all aspects except tree trunk model.
  • TECHNICAL BREAKDOWN
  • Final Image.

    Modeled in Autodesk Maya
    Shaded and Rendered with Pixar's Renderman
    Composited in NukeX
  • For this tree grooming tool, I thought it was crucial to introduce a form of direct communication between the artist and the script. I used the "Vertex Paint" tool feature in Autodesk Maya to provide this dialog between artist and script. The main idea is that using vertex paint the artist can paint with the mouse or stylus the vertices on the mesh. In my case I made the convention that black is a candidate to have a branch grow and white is not. So this way the artist can interactively choose where the script is going to attempt to grow some branches.
  • The images show the different variations that can easily be achieved using this script. From a full set of trees to more individualized and art directed distributions, and even an Ivy type distribution.
  • How are the Branches Created?

    In this case i used a simple idea of translating the leaves on the normal of the face. So basically I create a leaf and then I move along the face normal where it was created by a spread amount. There I create the next one.

    How do the branches curve?

    One of the main flaws of moving along the normal is that we get these straight un-natural looking branches. To chance that I used a simple concept of usint the negative parabola of x^2 (x square). We can control the arching of this function dividing x^2 by a factor (or multiplying it by the inverse factor).
    Here is a visual example of what happens with this function:
  • So what we need to do is each time we move along the face normal, we change the y component for:
    y = -archingFactor*x^2.
  • Building the Leaf Shader

    We wanted to create a leaf shader that was a little more complex than just a texture on a plane. The basic parts we wanted to have after looking at some references were:

    Front and Back :Leaves have two differentiated parts in terms of texture, the back that is normally more shiny and the back that is normally lighter and more matte.

    Specularity: For the front part of the leaf as we said before we wanted to have some specularity.

    Translucence: Leaves are translucent when sunlight shines through them so we wanted to incorporate this to our shader.
  • Main texture used to create the double sided leaf shader
  • Capture of the Slim Shader Network created to simulate leaves
  • #1 Front Leaf Color
    • The texture for the front leaf color that will be combined with our utility shader.

    #2 ColorByName Shader
    • This is where all the magic happens. This node outputs a color based on the name of the object it is attached to and an average color decided by the user.

    #3 Back Leaf Color
    • For the back of the leaf we have a different texture file.

    #4 Leaf Alpha
    • We use this alpha to cut out the shape of the leaf from the plane where the shader is assigned.

    #5 Specular Map
    • We control the specularity of the front part of the leaf with this black and white maps.

    #6 Facing direction
    • This node is used as a mask to reveal the back leaf color file if we are looking at the back of the leaf.

    #7 Mix Colors
    • These two nodes mix the color from the ColorByName Shader with the two front and back leaf textures.

    #8 All Purpose shader
    • This is the main shader that combines everything. It has two layers (the back and the front of the leaves) revealed with the facing direction node. The back layer of the leaves has also translucency.
  • USING RIB ARCHIVES

    In order to speed the interaction with the tree mesh in the viewpor we've used the ability to load pre-baked rib files as our leaves to be rendered dring rendertime. But as this approach is valid for rendering one image, if we are rendering a sequence, or once we are happy with the distribution of our leaves, we want the posibility to not have to compute the creation of the leaves any more. So in essence what we've done is implemented the function to bake our rib files of the ditributions that we've created and then the ability to reuse these bakes rib files so we only have to compute the distribution of the foliage once. This is where the menu that we saw on the UI shines. I set to compute the rib file with the distribution is baked and then read to render. If it's set to reuse, we read this baked rib file and we render it and if it's set to off then we do nothing.

Discuss This Project: ( Comments)

You must to join the conversation.