Sunday, February 7, 2010

Variety is the Spice of Life

In my last post, I sort of skipped over any efforts to add variation to leaves my tress process. Today, I'll show you how to do this in Mental Ray, and follow up with how to do it in V-Ray (which is much easier IMHO).

Lets start off with a look at the previous rendering.



Not bad huh?


Most xfrog plants that you come across will use a multi/sub-object material which has the same leaf or bark textures applied to various channels. In order to keep things simple, I corrected one material and instanced it throughout the map channels. This is fast and easy but it means that all of your leaves will look the same. What I want to do now is to de-instance those materials and add a little variety to each material. Generally speaking, I think this is kind of a pain in rear but it's probably worth it.



I've seen tutorials which suggest that you open your diffuse map in Photoshop, tweak the color, save as option b, c, etc. repeating
as many times as you like. I guess that's all fine and well but it means that you have more maps saved to disk and you have more maps to load into memory. I'll suggest a method that relies on one instanced map (but may not give you all the control you'd get by tweaking in photoshop).

We're going to use an RGB tint map to affect the color of our leaves. We'll use
this map type on all of our leaf textures so while the leaf materials are still instanced apply the RGB map to your diffuse texture (be sure to "keep old map as sub map").



At this point, if we go though and make all of our leaf materials unique we can begin to add variation to the leaf color By tweaking the RGB tint map.

When we made all of our
materials unique we broke the instance that occurred between each of the maps. Mental Ray will now load the diffuse, bump and opacity textures into memory six times each. Its not a big deal in this scene (15.72 meg vs. 2.62 meg) but if I'm working on something much more complicated where memory limitation can become a problem, I want to be sure that I'm being efficient with my maps. So I'll run the "Instance Duplicate Maps..." utility found in the material editor.


NOW we can go and tweak the RGB tint map to add color variation. I'd recommend that you try something more subtle. For example: pull 20 points out of the red on one leaf, 20 points out of the green on another, 20 points out of the blue and then make some combinations where you take a few points out of mutiple colors.

At this point we may or may not be done. Let's say that your xfrog has five leaf materials and you've gone through and tweaked the color of each. You might find that you get an uneven distribution of leaf colors. This is because the material IDs are not evenly distributed through the leaf geometry. Luckily, I found a handly little script that will take care of this problem.

Michael Quist wrote a unique random material ID generator script. What makes it unique is that you can specify a start and finish range for the IDs. Most of the other scripts I have found generate a unique ID for every element for as many elements as there are in the model. With Michael's script I can still apply my multi/subobject material to the leaves and not worry about the bark textures being applied to them.

You can get Michael's script here:
http://www.3idee.nl/3d/html/layout.php

Before you run the random ID script you are going to need to detach all of the leaves from the tree model. This way the script won't change the IDs for the trunk, branches, etc. Once you've run the script you can reattach the leaves to the tree model.

So what does all of this look like? To illustrate the amount of variation we have achieved I created the render below using some pretty wacky colors.



And now something more subtle:



For this particular tree I didn't think it was appropriate to have dramatic differences in color. I don't think you'd really see that from a real tree during the spring or summer. If you were working on an autumn tree you might want to pump it up a little. In addition, I think that the benefits of this process will be more readily realized if you are working on a project where you have multiple plantings of the same type of tree.

I'm not nuts about this process. Its much easier in V-Ray (post coming soon) because of some simple, free plugins that will randomize color values. I really, really wish I could find something similar for MR but there doesn't seem to be an option.

No comments:

Post a Comment