Monday, June 12, 2006

Coloured volumetric shadows with Mental Ray

Category: rendering

Here is a good tutorial on how to set up volumetric lights with Mental Ray:
http://www.jhavna.net/main.php?page=scatter/

It's important to note that the shadow colour is affected by the _transparency_ attribute of the shadowing object's shader, rather than the _colour_ attribute. This has cost me a lot of headaches to figure out.

Thursday, March 23, 2006

Indexing into MFnMesh::getBinormals?

Category: API


MFnMesh::getBinormals dumps a mesh's binormals into a MFloatVectorArray, but its length is different from getNormals'. How do you index into this array? You can't. There's one binormal for each vertex-face pair. So if a vertex is shared by 4 faces, then it will have 4 binormals. getBinormals will go through all the vertices in the mesh in order, and output all their binormals in this long one-dimensional array. Therefore there is no way to index into this array without knowing the mesh's topology beforehand.

Use getFaceVertexBinormals instead.

Then what's the purpose for this function? It can be handy to be use it to dump all the binormal data to a file for exporting.

The samething goes for getTangents.

Thursday, March 16, 2006

Cannot convert edge selection to vertices after doing edge loop

Category: UI



Sometimes when selecting with edge loop, using the marking menu to convert the selection to vertices won’t work. Make sure that the selection tool is selected when trying to do "to vertices" on the marking menu.

Compositing layers with motion blurs alpha channels leave black halos.

Category: Rendering

Usually, the halo from motion blur is caused by compositing without pre-multiplied alpha. This means that the RGB value of the transparent pixels are affected by the background colour of that file. Here's a nice workaround in Photoshop, It should be able to be adopt the method to After Effects if linear-dodge is a layer filter option.
link

Tangent Space Calculation

Category: API


It’s possible to get mismatches ( seams ) due to doing normal averaging based on a tolerance of 30 degrees. Maya only share the normals if they are exactly the same.

Aliasing on the edge of foreground objects when using depth of field

Category: Rendering

This is caused by the sudden ending of depth of field's blur post filter in the middle of the object. It's a limitation of the Maya software renderer.There are several workarounds:

  • Try to set the focus plane a little before the focus object, and tweak the focus settings.

  • Use Mental Ray, which would give you much nicer results.

  • Render the scene with dof and the focus object separately, and composite them afterwards.

  • Fake dof in post by using a depth map.

Wednesday, March 08, 2006

MPxHwShaderNode::compute(writable) is not

Category: API

It seems that since Maya 6.5, the writable flag in

MPxHwShaderNode::geometry


is not supposed to be true, ever. No geometry from Maya should be writable anymore, this is when used in the hardware renderer, and in the regular viewport.

Tuesday, March 07, 2006

Rendering filename bug in 7.0.1?

Category: rendering

It seems that when directly renaming files using the new filenaming syntax in 7.0.1, Maya will automatically append a "_tmp" string to the end of the filename when "%c" is used.

For example, if the filename is "/u/user/renders/file_%c_%4n.%e", then the filename would turn out to be "/u/user/renders/file_camera_0001_tmp.ext". If the camera flag is not used, such as "/u/user/renders/files_%4n.%e", then the file would go under the the folder "$Project_Dir/images/u/user/renders/files_0001.ext". Sucks eh.

The workaround for now is only to correct the "_tmp" by renaming everything using a shell/batch script. ( Or don't use %c at all and have everything saved under $Project_dir/images ).

I don't recall seeing this problem in 7.0. Could this be something that's introduced by the 7.0.1 patch?

Wednesday, March 01, 2006

Don't use MFnMesh::object()

Category: api

It seems that MFnMesh::object() will not properly return the MObject to the node in the function set. So don't pass the function set object around functions, and pass the MObject instead. On more than one occasion I've found myself wanting to get the MObject to use on an iterator, but with no way to get to it.

Tuesday, February 28, 2006

Non keyable attributes can be keyed

Category: Hacks

It seems that even if an attributed is marked "not keyable", and no keys can be set to it directly via the UI, it's possible to manually animate it by MEL using setKeyframe.

Of course this may cause problems, but it's interesting to know that it's a possibility.

Finding edge directions for MFnMesh::split factors

Category: API

The docs for MFnMesh::split explains edgeFactors as:

"edgeFactors array of factors in the range [0,1] that represent how far along each edge must the split be done. This array must have the same number of elements as the edgeList array."

However, it doesn't explain how the order of the vertices are determined. This creates a problem where the way the edges are split becomes unpredictable when the function is used directly with factors other than 0.5.

The way to determine which vertex is 0 and which is 1 can be found as follows:

The order of the vertex is determined by how Maya stores the vertices internally. This order can be retrieve by using MFnMesh::getEdgeVertices( int edgeId, int2 &vertexList ).
The order the verticies appear in the int2 array is the way the edgeFactor should be determined. Where int2[0] is 0 and int2[1] is 1.