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 | 2 Comments »

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 | 11 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 | 4 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 | 4 Comments »

How to create a background pass – Tutorial

When rendering your render passes you will notice that the background gets calculated (appear) only in the beauty pass.

But what if we want the background as a separate pass for composting purpose.
There are some basic methods, for example,
A- Adding the IBL in a different layer.
Or
B- Using a poly sphere with Shader assigned to it, this way the pass will be calculated as according to that Shader.

In this tutorial we will look into getting it as a render pass from the IBL node.

Since we already know that the background gets calculated in beauty, now all we need to create and empty beauty pass.
For this we will need to create a Pass Contribution Map (you can refer to my Render passes tutorial to see How to)
However Maya will ignore any empty PCM and renders them out black.

The trick is to add a dummy object that will be behind the camera. It won’t appear in render but it will force Maya to calculate the PCM

Simply add the only the dummy object in the PCM

Add a new beauty pass (I renamed mine) and assign it to the PCM

Now when you render you will get the background, but still we have the car as a black silhouette.

The fix is very simple; we will need to disable the “hold out “option in the render pass AE.

Now when we render, we will get the background as a separate pass.

April 5th, 2011 by | 1 Comment »