The last week or so has been a detailed study into Sod’s Law, or rather The Tendency For Maya To Suddenly Break When You Have A Deadline Approaching.
First, there was the Mental Ray Proxies issue. I mentioned in a previous post that the proxies did not seem to like being moved around, and had a tendency to disappear from the scene – however, using Instanced proxies on particles seemed to work fine.
All well and good, except that I later found out that the Goals method I spoke of earlier ONLY seems to work when the geometry is in this configuration, i.e. straight up and down. Otherwise, the orientation of the nucleosomes was completely wrong. Not very useful. So I watched some of Gnomon Workshop’s Grass and Plant Instancing in Maya/Mental Ray with Alex Alvarez, and tried out two possible solutions to this.
The first involved emitting from a black and white texture, giving instructions to Maya to “emit from dark” only, using a surface emitter. Unfortunately the random nature of the Surface Emitter still came through, with some vertices emitting more than one piece of geometry and others emitting none at all.
The second involved MEL scripting and a built-in Maya plug-in called nearestPointOnMesh to align the Y-axis of the particle with the surface normal of the emitter.
And if anyone’s interested, here’s the script:
// sets the orient axis for the instance
particleShape1.aimUp = <<0,1,0>>;
// get surface normal at particle position
vector $p = particleShape1.position;
vector $normal = `nearestPointOnMesh -ip ($p.x) ($p.y) ($p.z) -normal -q pPlane1`;
// orient the instance
particleShape1.aimDir = $normal;
At this point I really thought that I might have cracked it. Sadly, it turned out that while the instances were oriented correctly in Y, there was nothing binding the orientation of the X-axis the the edgeflow, and once I started to bend the plane in the X and Z axes intead of just the Y, the orientation again got messed up.
I know that using MEL there will be a way to orient the X-axis according to edgeflow – Alex Alvarez could probably do it in a heartbeat, but I would probably need a whole extra year to figure it out, and I have a film to make.
So I went back to my original method of simply duplicating the geometry, with the aim of finding out what it was that was making the Proxies disappear.
As with so many of these problems, it would seem that a single button was the cause of my woes.
Mental Ray Proxies do not like to have their Transformations Frozen.
When I froze the transforms, it reset the translation of the proxied geometry to the origin. Bit inconvenient.
Hopefully now I’ve figured that one out, I can finally get on with my film.