Saturday, May 9, 2009

The Ups and Downs of Subdividing

Today, I decided to run some tests in taking the scene I've been texturing lately, and rendering it with Mental Ray instead of RmF. As you know, the main advantage I've been seeing in RmF is its ability to subdivide geometry at render time. However, the downside is that it has limited control over certain attributes (namely, ambient occlusion) and is not supported by studios at which I may be rendering. My goal today was the following:
1. Convert all of the tagged "convert to subdivision" polygon objects into subdivision surfaces, and render with Mental Ray in Maya 2008.
2. Render with Mental Ray in Maya 2009, and allow this newer version of MR to subdivide the specified polygons at render time.

#1 was a fairly straightforward process: Select all of the necessary polygon objects via RmF's Shared Global Attributes (which I utilized in this quick runthrough.) As simple as it sounds, it became a massive headache very quickly. Every other time I converted a poly object to subD, it would either reject the operation because the resulting object's name already existed (it would rename anything to a default "polyToSubdShape1," rather than retaining the name of the object from which it originated), or it would flat out not do anything at all. This was making it a hardship for me to even convert literally five objects, and I knew I would not have time to troubleshoot and manage the hundred+ others in my scene. Since this didn't work, I moved on to goal #2.

My second goal of entering Maya 2009 was a multi-step process. Since we do not currently have the Maya 2009 version of RmF, attempting to open a file with existing RmF nodes freezes Maya 2009. In my case, such nodes were the tag for subdividing, among other default ones that are written into a file when you even happen to have RmF loaded when you are working on a file, regardless of whether you use any RmF features. There are multiple ways of helping to get 2009 to open the scene files, which I learned after attempting them tonight:
a. Open the file in Maya 2008, as usual, and delete any tags you might have in your RmF Shared Geometric Attributes window. Save as a new file. However, Maya 2009 still freezes when you try opening this scene.
b. Open the file in Maya 2008, and then export all of the geometry, cameras, etc. into a new Maya file. Open this exported file in Maya 2009. This works.

So back to subdividing. I finally had my scene in Maya 2009, and wanted to take advantage of Mental Ray's ability to subdivide at render time. I rendered out the brick facade of one of the buildings, and let's just say it was like trying out a new sushi restaurant because everyone ele said it was good, then eating there and finding out how crappy the food is, and then being told you have to pay extra to make up for all the other times you ate at your favorite sushi joint and not at this new one. Mental Ray was actually re-mapping my UVs at render time so that my textures were skewing horribly, to the point I would have to lay them out again, making all of my bitmapped textures completely useless. MR interprets poly objects very differently from the way in which RmF does, unfortunately.

Luckily, I had only planned on using RmF for the exterior shots, and was using MR for the interior ones, and I could still work on the UVs in the other shots because the texture maps were not yet completed. However, I still needed to somehow subdivide the geometry so that I would have smooth surfaces and "beveled" edges. I also wanted to stay in Maya 2008, for rendering support reasons, and I also wanted to get rid of any RmF nodes in my file, so that I would have no problem bringing my files to studios that did not have RmF. To help make sure I did not have any such nodes, I disabled RmF via my Plugin Manager, opened the file and read the error messages that appeared in my Script Editor. For example, it would read:
// Warning: file: /G:/.../scenes/groundfloor_2009-04-06_v6.ma line 246705: Unrecognized node type 'RenderMan'; preserving node information during this session. //

Even after saving as a new file, and opening that new file, these error messages would still appear. I had to use a different approach from steps a and b mentioned before:
c. Open the file in NotePad in Windows or TextEdit on a Mac, assuming you've got the file in Maya ascii (.ma) format. Find anything that says "renderman," and delete its entire section of code. Save the file and open in Maya 2008. This works.

This method actually requires a little bit of scripting experience, but it was very easy. I hadn't coded anything since taking a Java class nearly 7 years ago, and I got by just fine. To comment out a line of code, you simply type
//
before that line. So, for example, if the original code is:
createNode RenderMan -s -n "renderManGlobals";

Your commented-out line of code would be:
//createNode RenderMan -s -n "renderManGlobals";

However, even after commenting out every single line of code that had "renderman" or "rman" in it, the file would still open with errors. My only solution was the very delicate approach of completely deleting any sections of code involving renderman. Surprisingly, this didn't corrupt the file, and actually allowed it to open without any problems.

Again, back to subdividing. I decided to give converting poly's to subD's another go. It actually worked, and I went on to rendering it. Again, it was skewing my textures because the new subD object was given a different UV layout from the original poly object. Fearing I would be stuck in RmF permanently if I wanted to subdivide my objects, I resorted to doing a Smooth on my polygon object, which worked just fine. The only downside of this I can foresee right now is that I will have to smooth things at various resolutions depending on the camera angle. Additionally, editing UVs becomes pretty much unmanageable after the poly count goes up. But if it gets the job done, I guess this is where I'll just have to deal with it.

No comments:

Post a Comment