PixelCG Tutorials are now on iTunes

I’ll be placing all my HD video tutorials on iTunes.
Now you can learn on the go :)
iTunes Link



September 22nd, 2010 by Ashraf | 7 Comments »

How to fix the final gather rebuild issue in Maya 2012

This glitch will appear in Maya 2012 with mental ray Final gather
Once FG map was enabled and giving a specific name, our render will come out as expected such as this

However when we turn off the final gather Rebuild to use the already built map

The render will come out as if we turned off the final gather completely

There are 2 solutions for this
Solutin A:
Add a secondary final gather map, and type in the Name of your map
This will force Maya to go and fetch the map

The MEL script would be
setAttr -type “string” miDefaultOptions.finalGatherMergeFiles[0] “AshManDu”;
Where AshManDu is the name of the FG map.
Note: the MEL doesn’t update the UI. It just adds the map

Solution B:
Use FG legacy approach
To do so:
In the command line run
select miDefaultOptions;
The attribute editor will load some mental ray options.  Scroll down and expand the “String Options” category and click “Add New Item”
Scroll down to the bottom of the list to see the new empty options.  Enter the following.

Name: finalgather legacy
Value: True
type:Boolean

Now we should have our render back with FG

September 2nd, 2011 by Ashraf | 1 Comment »

How to fix the Ptex display in Maya

When you create a Ptex file in Mudbox the resolution will look nice in your viewport.

However once you send the file to Maya and change to Viewport 2.0
The texture will look as if’s low quality

The solution will come in 2 parts

1- You need to open the VP 2.0 settings by clicking on render > viewport 2.0 option box
Adjust the color texture slider under “Bake Resolution for Unsorted Textures”

2- The final step is to force Maya respect this change by running the simple MEL
ogs -reset;

Now you should have a proper display of your Ptex inside Maya

August 3rd, 2011 by Ashraf | 1 Comment »

Fix the Invalid use of Maya object error

Disclaimer: the following is based on my personal experience, altering Maya native scripts should be handled with care as it might break the application.
Test on your own risk.

In some occasions when using render layers, switching between these layers will give the following error:
// Error: Invalid use of Maya object “persp”. //
This errors can sometimes stops the render layer from being rendered specially if the render manger was not set up correctly to bypass errors and just report them

Open the mel scrip createMayaSoftwareCommonGlobalsTab.mel found in here
“install location”\Autodesk\Maya2012\scripts\others

The lines in questions are
Line 1558 >
scriptJob -parent $parent -attributeChange “renderLayerManager.currentRenderLayer” $maskCommand;
Line 1566 >
scriptJob -parent $parent -attributeChange “renderLayerManager.currentRenderLayer” $depthCommand;

Commenting these lines out seems to work as a workaround.
For example:
// scriptJob -parent $parent -attributeChange “renderLayerManager.currentRenderLayer” $maskCommand;

While using this workaround, I didn’t get any serious side effects of this modifaction.
Please let me know if someone might find this un-useful.

June 27th, 2011 by Ashraf | 6 Comments »

The mystery behind shadow passes – Tutorial

Maya render passes can output the following shadow passes:
1.    Shadow
2.    Shadow Raw
Each one is unique in the way it will be used when composited.

Once we create a shadow pass, we will notice that the buffer type is set to 16 bit float. This gives us the indication for the need of a floating points solution otherwise the values will be clamped.

We need to make sure that our frame buffer will support this type of frame buffer.  For this exercise, we will choose RGBA (HALF) 4*16 floating and image format is TIFF.

For this tutorial we will render the following passes

  1. Diffuse
  2. DiffuseWithoutShadow
  3. Shadow
  4. DirectIrradiance
  5. DirectIrradianceNoShadow
  6. RawShadow
  7. DiffuseMaterialColor

The first thing we will notice is the difference between shadow and shadow raw


Master beauty


Shadow


Shadow Raw

In the shadow raw pass, the shadow is “pure”.   We will also notice it’s not affected by the ground colors.

Shadow pass
The shadow equation is as such:
Diffuse=DiffuseWithoutShadow-Shadow
which means you will need to use a “minus” operation and composite the ‘shadow’ pass to ’diffuse without shadow’ pass.


Photoshop composite


Nuke composite

Note: the reason I have a grade node in NUKE, is simply to view my passes as they were sRGB.
You can ignore it for now.

Shadow Raw pass
The shadow equation is as such
DirectIrradiance=DirectIrradianceNoShadow-RawShadow


Photoshop composite

Diffuse=DiffuseMaterialColor∙(DirectIrradianceNoShadow-RawShadow)


Photoshop composite


Nuke composite

To insure a proper workflow we used a floating point framebuffer, to illustrate the outcome of a clamped framebuffe (8 bit) I comped the same tree using 8 bit files in Nuke.

We immediately notice that the shadow is very faint.

A typical fix is to add a color correction node to the shadow. In this scenario I used a grade node.

However,  it won’t give us the exact shadow as the diffuse.

In conclusion, it is recommended to use  a floating point solution when using shadow passes.

 

May 1st, 2011 by Ashraf | 3 Comments »

How to fix reflection spikes in mental ray Maya 2010 – Tip

This problem appear when using a combination of mia_material , HDRI and floating point framebuffer.
One would get very high spike in the reflected area of the Shader.

A first look will appear as it’s a bad filter, but it’s actually the camera that could not handle the reflection high value .
since we already have advanced lense shader in mental ray, the fix will be utilizing one of them.
In this case, we will use the  mia_exposure_simple which will solve the problem by clamping or damping color values of the exposure control .

Note that the mia_exposure_simple default gamma value  is 2.2, so we need to drop to 1.00 to match the original render.


Now we have a nice render with no spikes/artifacts.

The good news is : Maya 2011 and 2012 renders it with no render artifacts.:)

Note: I like to thank Renzo Gavino for allowing me to use his model for this post.

April 14th, 2011 by Ashraf | 2 Comments »