So I'm back again with the second part to my previous post, which you can see here. I will point out now that while all this stuff may already be findable on the internet, you kind of need to know what you are looking for. It is also worth noting that this is probably only going to be relevant to the intermediate/advanced Maya user.
So, this post is a compilation of examples, tips and techniques on how to use two very powerful attributes in Maya - outMesh and inMesh.
outMesh and inMesh
- What is outMesh and inMesh
So lets start with something simple. Whenever you create a polygon primitive with history, you are actually creating three nodes; the shape node, the transform node and also the creation node. The creation node is the node that contains all the initial settings for that primitive, such as radius and subdivision width etc, and its output is plugged into the inMesh attribute of the shape node.
All polygon shape nodes have an inMesh attribute, but also an outMesh attribute. It is possible to take the outMesh of one polygon shape and plug it into the inMesh of another shape.
This connection simply allows for one shape to use the mesh of another shape as its source, creating an exact duplicate. Because they are connected, any changes made to the source mesh, will cause the destination mesh to update. Now this might sound like it is doing a similar job to what 'duplicate instancing' does in Maya, however there is one very important difference.
Take a look at this short video.
- What about instances
Now 'duplicate instancing' is a nice idea in Maya but is almost completely useless in a production environment. Essentially it works by duplicating the transform node only, and making them all share the same shape node. So they all share the same mesh, the same UVs, and unfortunately the same shader and the same render stats, making it a pain to work with when rendering. The only other real benefit of Maya's duplicate instance is that it keeps the file size down. Here's an example to show what I mean.
You might have, lets say, a model of a crate (or maybe a couple), and you want to duplicate them a hundred times to create a space filled with crates. To randomise the look, you would want to create separate textures for each (or as many variations as you can come up with), and when it comes to rendering, you have, lets say, some foreground crates, a character, and some background crates. Like in the following scene from one of my most recent projects.
Still - The Place Where Lost Things Go
It makes sense to separate these into three layers, but you can't because the crates are all sharing the same render stats as they are all sharing the same shape node! How is one supposed to set 'primary visibility' 'off', or 'cast shadows' 'on' on certain crates etc... It's impossible. The only way around this is to have more ACTUAL duplicates, which isn't exactly keeping the scene optimised because it increases the file size unnecessarily. This of course is bad news for me because I increment my saves like mad!
- The benefits of inMesh and outMesh
Now going back to outMesh and inMesh; in this technique you're instead connecting one shape to another shape. The cool thing is that, unlike instancing, you now have a duplicate that has it's own shape node and will update with any changes you make to the source mesh, including topological changes to the mesh, UVs, and even deleting history, AND like instancing, does still keeps the file size down.
Of course, anyone who is using scene referencing in their pipeline can do a similar thing, except that it does require having separate files for each object. That would seem completely over the top if all you want to do is duplicate a screw to be used on a model 100's of times!
In this example, the hemispheres on this Dalek are all based off of one master hemisphere. Apart from allowing me to making slight tweaks to the existing mesh, it also demonstrates how quickly I am able to replace masses of geometry with a completely different mesh, by temporarily connecting in another object.
OK, so there is a better alternative to duplicate instance, so what?
Well, that car example I showed in the previous post is an example of what can be done with outMesh and inMesh. The key is in the construction history!
The rest of this post is going to go over some other examples of how you can use these attributes.
Before skinning any character, if you were to first make a connected duplicate (with outMesh to inMesh) and skin that duplicate, you can now work on that characters rig, without worrying about whether the UVs or the model are perfect. Using the source mesh you can, at any time change your characters UV layout, or even tweak the model (assuming you don't mess with the topology in this case), and then delete the history. All the changes will be carried through to the rigged version of the character.
It is worth noting that the UV editor sometimes fails to update, but saving, closing and re-opening the scene fixes this. While it is actually possible to change the UV's of any skinned object without this method, it's not exactly straight forward. This method simplifies it.
Another technique is to daisy chain a series of duplicates, and applying various deformers on each version. Effectively giving you a lot more control than if you just rely on applying a series of deformers to one object and messing with the history list. For example, you could start with your base model, then a duplicate for adding blendshapes to, then another duplicate which you then skin to joints.
Technically you can also make a connected duplicate, and re-model or re-sculpt it, without deformers, using traditional modelling techniques, without affecting the source mesh (as demonstrated in the very first video). Why would we do this? Maybe you want to apply corrective blendshapes to a character.
While working with blendshapes you can delete blendshape target meshes without removing the blendshape target itself to reduce file size, but you can't easily make a change to a blendshape once you've deleted the mesh.
The problems with keeping the blendshape meshes is that it obviously make the file bigger, and if you do make any changes to the source mesh, you would want all the blendshapes to have the same tweaks, on top of the tweaks that the blendshapes were made for!
So why not create a bunch of connected duplicates at almost no extra cost in file size, and re-sculpt them instead. And any slight changes to the base mesh will cause all the blendshape meshes will update too!
This video shows a better example of how you can connect meshes together.
It turns out that nDynamics and Maya Fluids both have outMesh attributes. If anyone has ever attempted a liquid sim with nParticles, one of the things you will end up doing is converting your particle sim to a mesh. The one little annoyance with using the official convert "nParticles to Polygons" operation is that it hides the original particles. The node is still there, but the display of the particles is gone. There may be a way to bring them back, although I gave up after hours of searching. So you guessed it; you can do the same thing by creating a shape node, and connecting the outMesh in the nParticle node to the inMesh of the shape node. Now we can see both the particles and the mesh at the same time to really fine tune the sim, and at any time hide the display of the mesh or particles, without anything permanently disappearing.
So this video demonstrates the same basic process applied to nParticles.
OK, this is the last set of examples! Every polygon shape node has an outMesh, but it also has an outSmoothMesh attribute! This outputs the smooth mesh preview version of the shape.
Why is this one worth mentioning?
So you've rigged a character, and you want to render it smoothed. Smooth mesh preview calculates so much faster than the smooth operation in the modelling section. It also means that your higher res character can have its own separate mesh, allowing you to have different shaders for it. ie - you can have simple colour shaders for better, and faster viewing in the 3D viewport on the low res mesh, and more complex shaders ( which may not look correct in the 3D viewport ) designed for rendering on the high res mesh.
As an extra, it also means that you can now render smooth mesh previews in Maya software renderer! Which is cool because this then gives us access to Maya's cool raytracing and direct illumination!
Seriously though, if we daisy chained a series of smooth mesh preview duplicates, we can then sculpt in a similar fashion to Mudbox with layers of subdivisions. Now all Maya needs is a faster viewport, some decent brushes, better Transfer Maps and you wouldn't need Mudbox!
OK, that was probably quite an exhausting read, and I'm guessing that only a few people will find this interesting, but if there is anyone who genuinely finds this useful, please leave a comment, and I may eventually create some Mel scripts to simplify some of these techniques.
So that is it for now. I'd be interested to hear if anyone else comes up with some interesting uses for this, and if anyone else knows of more information on outMesh and inMesh then feel free to share it.
Here is a list of websites that I've found for further reading.
A Flock of Pixels