Tuesday, June 16, 2009

DNA 3

If you need to retain the relative atomic sizes and shading, you can use the jPivToParticle script to convert each atomic group. You could ungroup and run the script on the carbon, hydrogen, oxygen, phosphorous and nitrogen groups one at a time, and then re-group the resulting 5 particle objects together. If you set the particle render type to blobby surfaces or spheres, you can also set a radius and shading for each of these atom types. This is what I did for the anthrax toxin model pictured here.



fig 6: Anthrax toxin rendered as four different particle objects, one for each type of atom.

Part Three: Adding Dynamic Interactions and Deformations to the Molecule

When this article was first published in Highend Magazine, Maya 6.0 had not yet been released and thus you were not able to deform particle objects. If you have Maya 6.0 or higher you can add a deformer to the particle oblect, such as a lattice or a non-linear deformer, and deform the blobby surface version of the DNA model to your hearts content. If however, you are using Maya 5.0 or earlier you can use the script I describe in the next section to deform the particle version of the model.


Another terrific script allows you to add the ability to deform the entire particle object as you would a piece of geometry. This is also useful if you'd like to add collisions to your molecules. The script creates a crude, simple polygon object based on the positions of the individual particles in your particle shape. You can set this object as a goal for the particles and then deform or animate the poly object. The particles will follow. Additionally, you can turn the poly object into a rigid body and have it collide with other objects.

The script is particleDeformationPoly.mel by Alex Bigott, which you can download from www.highend3d.com. To use it, go back to the dna2.mb file saved before you centered the pivot of the particle object or moved it. Select the particle object and then use the script editor to open the particleDeformationPoly.mel that you downloaded into your scripts directory. Run the script, and the crude polygon object should appear in a few seconds. Select the particle object, then the polygonal object, and under the dynamics menu select Particles>Goal. Set the goal for the particles to 1.



fig 7: particleDeformationPoly.mel applied to the DNA particle object

If you move your polygonal object, you'll notice that the particles don't move. You're in dynamics land now so you have to remember that the particles won't update until you hit play AND you'll have to always rewind and play from the beginning, you can of course cache you rparticles as well. If you're making an animation, remember to give yourself some extra frames at the beginning so that the particle object can snap to the polygonal goal. Try putting a non-linear deformer like bend or twist on the poly object, animate it, and then press play.



fig 8: A bend deformer applied to the polygon object. The result is a bent DNA.

If you make the crude polygon objects rigid bodies, you can easily animate molecules bumping into each other. Apply a transparent lambert shader to the poly object so it doesn't show up in the render. Also keep in mind that the collisions will be calculated based on these polygons and not the particles themselves, so there may be some intersection of the particles at the point of collision.

An alternative to the particleDeformation.mel script is a little more mundane. You can "model by hand" a simple polygon object that roughly describes the shape of the molecule. Then parent the particle object to this dummy geometric object. Assign a transparent lambert shader to the dummy object and make it a rigid body. Deforming the polygon object using this method won't give you the same results as the particleDeformationPoly.mel script will, but it can help prevent strange intersections of the particles at the point of collision.

Creating a Ball and Stick Model

There is another script available that will automatically generate bonds between the atoms of a molecular model. It is called ballAndStick.mel and it was written by Geordie Martinez after this article was first published in Highend magazine. You can download the script from Geordie at his site www.negative13.com. He did make some small modifications to the pdbReader.mel script so please read his documentation when using the script.

After working through this tutorial, you should end up with at least three different versions of DNA and several options for working with molecular data. I've included renderings of several of my favorite molecules to demonstrate some creative ways Maya can be used to enhance the macromolecular structures. If you've worked through this tutorial carefully, I hope you'll have enough of an appreciation for the proper structure of DNA to cringe the next time you see it misrepresented in a movie or an advertisement! (I'm looking at you trailer for "DOOM")

No comments:

Post a Comment