Sunday, August 26, 2007

Understanding BSP Depth in Mental Ray


The golden rule of depth!
So here is the great secret:
What we are aiming for is a checker-like pattern of light orange hues.
I.Orange is best.
II.Yellow and green are acceptable.
III.Blue should be avoided.
IV.Pure red should be avoided as much as possible, before all other considerations.
V.Blue and green are preferred over red if you have to choose.


Now, do not expect any rendering to be of a consistent coloring, which would be the perfect scenario. In pretty much any production case, we are far from the perfect scenario. We will see in a moment that in some cases, solid red is acceptable and in fact, may render faster than orange, yellow and green.


In general, it can be assumed that higher depth will make rendering faster. That sounds logical, as it means less triangles need to be tested for intersection when a ray hits a BSP tree box. But we will see later that too many box subdivisions can actually slow down rendering. The right depth value will cause the BSP tree to do the right number of box subdivisions. The right number of box subdivisions will get the fastest rendering time. It lies at the point where the number of box intersection tests and the number of triangle intersection tests is perfectly balanced.


The meaning of colors
There is a lot going on in the diagnostic colors, which we shall explore throughout this article. For now, we will keep it simple.


1. Red means that we have reached the maximum depth of the BSP tree.

a)In very rare cases, when we reach the maximum depth of the BSP tree, we have in a box a triangle count inferior to the size parameter. That would be the perfect scenario.


b)In more realistic situations however, it means that we no longer subdivide the scene into boxes, but the triangle count still exceed the size parameter. Therefore, more triangles will have to be tested for intersection.


c)Since the triangle test takes longer than the box test, it is safe to assume that more red means longer render time.


d)Tip: Unless you have reached the point where the BSP tree is too subdivided, consider increasing the depth value.


2.Orange means the BSP tree is perfectly balanced, in a realistic way. It means that we are very close to the maximum depth but we have not reached it.


a)Tip: Change the depth value only if other values give you better render time when doing the real render. Otherwise leave it as it is.

3.Green and yellow mean that there is a sufficient balance, although we tend to use more memory than necessary.


a)Tip: It might pay to decrease the depth value, although it's not such a big deal. Follow the same advice as with orange.

4.Blue means that the BSP tree has way to many subdivisions for the amount of triangles it's mapping, the BSP is way too large compared to what it should ideally be. Such a BSP tree uses too much memory.


a)Tip: Decrease the depth value.


In most scenes that you will render, there is a mix of colors. This can make the choice of a depth value rather difficult.

-Courtesy Christian Bui - Autodesk Maya

Wednesday, June 20, 2007

STEPS FOR RENDERING FUR IN A RENDERFARM

1. Make sure when you open a scene file with fur characters, you have the project path and the folders right for fur maps.

E.g.: -
fur/furAttrMap
fur/furEqualMap
fur/furFiles
fur/furImages
fur/furShadowMap

Where fur is the main folder and others are the subfolders in the project directory.

2.Check in the fur render settings in the fur menu, if the Equalizer map is in default or Custom. If it is “default Equalizer Map” change it to “Custom Equalizer Map”. (This step is faster when the project dir is in the local machine).

3.In the scene file remove any namespaces in the characters, objects and fur node. using the script namespaceRemover.mel

4.Make sure you have the required fur descriptions in the scene for the characters in the scene.

5.Delete the unwanted fur descriptions using the script deleteUnusedFurDescriptions.mel

6.Use the upper_to_lower.mel to make sure all the sourceimages in the renderfarm
are in the same case as in the scene file.(This step is reqd. only if you are rendering in the Renderfarm with an OS which can be case-senitive like linux).

7.Check for textures and copy if they are not there in the respective path. E.g.: sourceimages directory of the project set using FileTextureManager.mel

8.Bake the fur descriptions for the respective characters and check if the fur looks fine in the viewport.

9.After baking, there will be expressions created. Check for the expression in the menu General-->AnimationEditor-->Expression Editor. Edit the expression to look like the example below..
eg: If the expression shows a path Y:/project/fur/furAttrMap/EP01......iff
change/edit it to fur/furAttrMap/EP01.....iff . In this step you are making the path relative.

10.Select the objects which has the fur descriptions and select the polySmooth node. Now change the Smooth Uvs option “off”. This helps in avoiding the fur flickering.

11.Save the scene file and launch the render.

Monday, March 12, 2007

Creating Fur in Maya

The following is the method, which i learnt. Please feel free to comment on it.

Creating Maya Fur on Poly mesh

  1. In Maya, Fur is created with respect to the UV information.
  2. Make sure if there is polySmooth node, the smooth UV option is OFF
  3. The Unwrap should occupy the complete 0 to 1 space in the UV texture editor.
  4. Try to maintain the basics of Unwrapping with respect to texturing. i.e., avoiding stretching of textures.
  5. Try to avoid UV seams at obvious regions on the model. If possible try to unwrap in a square or rectangular shape.
  6. Make sure that the Uvs are spaced according to the requirement of fur in the respective region.


Note
: Smaller the UV space – lesser fur will be generated, vice versa.

  1. After the UV unwrap is done, attach a new fur description and apply a preset on to it to understand the flow. This is a very good starting point.
  2. The polar attribute of the fur description corresponds to the direction of the fur flow.

Note: Tweak the polar attribute to check the flow of fur.

  1. Do a preview render to see the distribution of fur on the object.
  2. If there is less fur generated at certain regions, try to tweak the UV space to increase the fur count. Keep in mind to avoid texture stretching.
  3. Once the fur generation is uniform, start painting the direction of the fur.
  4. When painting the direction, turn off the color feedback this increases the performance.
  5. Use bigger brush radius and paint the overall direction on the object.
  6. Use a smaller brush radius while painting near the seams. Bigger brush causes flipping of fur at the seams.
  7. The UV samples in the fur feedback node can be increased according to the detail required on the map being painted. If the samples are increased the system performance goes down.
  8. The region where fur is not required in the object can be achieved by painting the baldness map. The effective method would be to remove those UV and transferring or copying it to a new UV set.

Note: Only one UV set can be attached to a fur description.

  1. For the color attributes a texture map (with flat colors painted in it) or a flat color can be used.
  2. In the details section of the attribute editor, you’ll find the Map Multiplier and other Noise attributes that can be used to tweak the maps painted on to the respective fur attributes.
  3. Global scale in the attribute editor helps to control the overall look of the fur.
  4. A custom equalizer map can be created to fill the areas where there is less fur generated even after tweaking the UV space.
  5. A 512 X 512 map for any attribute will suffice, the size can be increased with respect to the scene requirement.
  6. After Baking the fur attributes, make sure the expressions created during the process has a relative path.
  7. When you want to save the fur scene file onto another project directory or location. First copy all the fur attribute maps onto the respective folder in the target location and save the file.