Monday, June 22, 2009

particle


In this tutorial, I am going to explain how to make twinkling effects.
I explain the method of making twinkling effects from Shader
and the method of making from light.


maya tutorials twinkle effects shader particle shader for particles and objects
maya tutorials twinkle effects shader particle
Assign a material to the object,
set over 0 value to the Glow Intensity.
(Any material is good if there is Glow Intensity)

maya tutorials twinkle effects shader particle
In this case, I assigned a Blinn material to a sphere object.
The above figure is an rendered image. .

maya tutorials twinkle effects shader particle
There is the shaderGlow1 in Hypershade,
double-click it and open the Attribute Editor.

maya tutorials twinkle effects shader particle
The shaderGlow1 has two group of the Glow Attributes and the Halo Attributes

maya tutorials twinkle effects shader particle
Set
Glow Type - Linear
Halo Type - None
you get the effects by only Glow.
The above figure is an rendered image.

maya tutorials twinkle effects shader particle
Set
Glow Type - None
Halo Type - Linear
you get the effects by only Halo.
The above figure is an rendered image.

The shine near the shining object is the Glow.
Parting from the object and extending is the Halo.

maya tutorials twinkle effects shader particle
In this case, we set
Glow Type - None
Halo Type - Linear
and we will set the attributes of Halo.
(Because Glow and Halo of the shaderGlow1 have the same attribute,
you may set it by either.)

The attributes are the following.
Star Points - the number of points on the star
Halo Intensity - the brightness of halo
Halo Spread - the size of the halo
Halo Eccentricity - the brightness of halo
Halo Star Level - set over 0 value, halo will be star shape

maya tutorials twinkle effects shader particle
Star Points 4
Halo Intensity 5
Halo Spread 0.3
Halo Eccentricity 0.1
Halo Star Level 0.7

maya tutorials twinkle effects shader particle
Star Points 4
Halo Intensity 5
Halo Spread 0.3
Halo Eccentricity 0.1
Halo Star Level 2
The star shape changed.

maya tutorials twinkle effects shader particle
Star Points 6
Halo Intensity 5
Halo Spread 0.3
Halo Eccentricity 0.1
Halo Star Level 2
The star points became 6.

maya tutorials twinkle effects shader particle

maya tutorials twinkle effects shader particle
If you put the check in Hide Source of the material,
the rendering only of the halo effect is done.


You do the same setting for the particles.
I set Blobby Surface to the Particle Render Type, and assigned a Blinn material,
the above figure is an rendered image.

Please refer to the following for the setting of the particles.
Maya Tutorials:basics of particle

You can set the shaderGlow1 only by one per one scene.
If you want to set two or more shape of the glow or halo,
you should individually do rendering, and composite them later.



maya tutorials twinkle effects shader particle light effects
With Point Light, Spot Light, Area Light
you can make light effects by setting
Light Effects > Light Glow

maya tutorials twinkle effects shader particle
Click maya tutorials twinkle effects shader particle of Light Glow

maya tutorials twinkle effects shader particle
Then opticalFX1 will be made.

It is set in default as follows,
Glow Type - Linear
Halo Type - None
Glow Star Level - 3

It will be rendered as a star shape.
The difference between Glow and Halo is the same
as the shaderGlow1.

maya tutorials twinkle effects shader particle
Star Points - 4 (default)

maya tutorials twinkle effects shader particle
Star Points - 6

You cannot express the star with Halo
because there is no Star Level attribute in the Halo of the light effects.

Tuesday, June 16, 2009

DNA final


DNA Polymerase


Transfer RNA


The Nucleosome


Close up on the nucleosome



Anthrax Toxin


Green Flourescent Protein - makes jellyfish glow green in the ocean!
.

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")

DNA 2



fig 1. The pdbReader.mel interface with the DNA pdb file loaded.

The interface has a sample row from the PDB you're loading. Below this are fields for you to enter the atomic symbol and the X, Y, and Z coordinates of the atoms in the file. There are default numbers in these fields, but you may have to change them depending on how the particular PDB file you're using has been written. It's safe to assume that the default numbers are NOT correct for your file. The simplest way to figure out what to put into these fields is to count over from the left in the example row and plug in the appropriate coordinates. So our example would look like this:

ATOM 5 O5* C A 1 18.935 34.195 25.617 1.00 64.35 1BNA 6
1 2 3 4 5 6 7 8 9 10 11 12 13

Weird spacing can make it a bit tricky to tell where one column ends and the next begins. Be prepared to try this a few times before you get it right.

In this example row, the atom is column 3 (O for oxygen), and the X, Y and Z coordinates are columns 7, 8, and 9, respectively.

How do I know that the atom is in column 3 and not column 4? After all, "C" could stand for carbon. In this case, I've looked at the rest of the PDB file and noticed that column 4 contains ONLY "C","G","A", or "T". Since this is DNA we're dealing with, I surmised that the author of the file is using these symbols to indicate base pairs (Cytosine, Guanine, Adenine, and Thymine, respectively) and not atomic symbols. Therefore, I guessed that O5* stands for a particular oxygen atom in the structure. A little background info on your molecule's structure can go a long way in figuring this stuff out (as well as quite a bit of trial and error). Getting the right numbers into the right fields is the hard part; the rest is easy.

You can adjust the number of sections and spans in the spheres pdbReade.mel will create with the fields at the bottom of the interface. However, it's best to keep the resolution of the spheres as low as possible. If it's a big model, you don't want to bring your machine to a grinding halt because each of the 3,000 or so spheres has 8 sections and 16 spans.

Try running the script with our DNA pdb file loaded and see what happens. Type "3" in the Atom Field and "7," "8," and "9" in the X, Y, and Z fields. Make sure you hit enter after you put each of these values in. Occasionally, I've typed in the correct number, forgotten to hit enter, and gotten very strange results.

If you look at the original PDB file you may find a group of rows at the end of the file that start with "HETATM". The script can read these rows but you may notice that the columns are shifted and thus the numbers the script are using for X,Y,and Z, are now off. The best way to fix this is to cut and paste these rows into another file and save that as a separate PDB which you can add to the scene once you have the molecule loaded. You may not need or want this data, ask you local science nerd if you're not sure. The DNA PDB file we're using for this example does not have these rows.

Go ahead and run the script.

Calculating the molecular structure can take some time if it's a big model. Even on a fast machine, I've waited up to 5 minutes while it was building the molecule. This particular DNA structure is not big, so it should be quick.



fig 2: DNA successfully loaded into Maya as NURBS spheres.

Once it's done, you may see nothing on your screen. The molecule may be very large and behind the camera, so zoom out to see if there is something there or not (Shift-A will focus the camera on the whole scene, of course).

If you look in the outliner, you'll see that the spheres are arranged in groups according to atomic symbol (nitrogen, carbon, oxygen, hydrogen and phosphorus). A phong shader has been automatically created and assigned for each type of atom. Congratulations - you've got your DNA. Save the model as dna1.mb, and now let's have some fun with it.



fig 3: The Outliner shows the atoms in groups.

Part Two: Space Filling Models Using Particles

There are several ways scientists represent molecular structure. These include wireframe, stick, ball and stick, space-filling, ribbon, and backbone. If you open a PDB file in Chime or one of the other PDB displaying programs I've mentioned, there are usually display modes that allow you to chose from one of these types of representations. The pdbReader.mel script only brings molecules in as spheres, which is pretty close to the space-filling representation. There are no options for adding sticks or for an alternative representation. In this section, I'll show you how to convert the model into a particle object which you can then render as blobby surfaces. Later, I'll talk about another script you can use that will generate bonds between the atoms if you need to create a "ball and stick" version of the model.

Save your file as dna2.mb and make sure you have downloaded and installed the jPivToParticle script from www.highend3d.com (under the MEL scripts section>dynamics/FX) in your scripts directory. Select all the groups in the outliner and ungroup everything so that the outliner lists all the spheres in the model. Select them all and then type in the command line jPivToParticle "DNA_"; . The script will take a moment to run. It will rename all the spheres DNA_1, DNA_2, DNA_3, etc. and will add a particle object. The script places a particle at each of the pivot points for all the spheres. Select all the NURBS spheres and either hide them or delete them. Save this file, and then save it again as dna3.mel. We want to have one version of the model saved at that last stage.



fig 4: DNA as blobby surfaces

Center the pivot and move the object to the center of the grid. Scale it down a bit if you want to. I'm fond of rendering my molecule particle objects as a blobby surfaces. To do this, set the particle render type to blobby surface and hit the "Add attributes for current render type" button in the attribute editor for the particle shape node. Play with the radius and threshold attributes until you get something you like.

One trick I like is to add a radiusPP attribute and then write a short creation expression to randomize the per-particle radius. To do this, go to the attribute editor for the particle shape node, scroll down and hit the "General" button under "Add Dynamic Attributes." In the dialog box, choose the particle tab and select radiusPP from the list. In the particle shape node per particle array attributes list in the attribute editor, you'll now see a new field for radiusPP. Right-click on the field and choose "Creation expression." In the expression editor, type an expression like particleShape1.radiusPP=rand(.5,1.5);. If you rewind and play the animation a bit you should see a randomization of the sizes of the particles. If you include this technique in an animation, just remember to render starting on frame 1 or higher instead of 0 so you don't have any weird resizing at the beginning of the animation.

This technique spices up the look of the model. But it also (artistically) compensates for the fact that by using the jPivToParticle script to turn the model into a single particle object, we've lost the relative sizes of the individual carbon, hydrogen, phosphorus, and oxygen atoms. We've also lost the individual shading for the atoms as well. What this means is that we've reduced our technical accuracy for the sake of aesthetics, but in some cases that might be OK (depending on what you're trying to show in your animation). Adjusting the threshold on the blobby surface render attributes will add that blobby look; when combined with an interesting shader and some lighting effects, this can yield some cool (but less accurate) results.



fig 5: DNA as a single particle object, rendered as blobby surfaces.

DNA

By Eric Keller

Scientific animation is a great source of work, and also a great opportunity to flex your creative muscle. It's often a challenge to create something that is simultaneously instructive, visually engaging, and scientifically accurate. However, accuracy in scientific animations is a tricky thing. More often than not, accuracy means creating a non-misleading visual metaphor rather than a perfect atom-for-atom representation. Many times this translates into sacrificing realism for visual and conceptual clarity. That being said, when the situation does call for accuracy in the form of a molecular model, it's good to know that you can achieve this in Maya fairly painlessly, with the help of a few scripts, some free applications, and enough artistic license as the situation will allow.

This tutorial is broken down into several mini-tutorials designed to give you some techniques to build on when bringing macromolecular data into Maya. Specifically, we'll be working with the ever-popular, and often misrepresented, DNA. Of course these techniques can also be used on any of the thousands of molecules and proteins whose structure is freely available online at the Protein Data Bank website (www.rcsb.org/pdb/).

Most of the time the DNA depicted in movies, on TV, and even in publications, is wrong. DNA is often portrayed as a simple twisted ladder. Other times its structure is shown twisting to the left instead of to the right, or its has too many or too few nucleotides per bend. Sometimes it is shown with some horrible combination of all three mistakes. The structure of DNA is very important -- so important, in fact, that it earned James Watson and Francis Crick a Nobel Prize for discovering it. Think of it this way: you wouldn't throw an F-16 flying backwards in to a World War 2 movie would you? So why be just as careless with the way you represent DNA? As an animator, you are responsible for correctly representing DNA's structure; fortunately, this doesn't require a Ph.D. By bringing in the actual DNA crystallography data from the protein databank, you can start out with the real McCoy and be assured that your final DNA animation should turn out to be correct.

OK, let's get to it...
Here's what you need to complete this tutorial:

1) Maya 6.0+ any platform (I believe any platform should work, and I've tested this on NT, XP, and OSX)

2) These MEL scripts:

- pdbReader.mel v1.4 by Tom Doeden available on highend3d.com.

- jPivToParticle.mel by Julian Mann available on highend3d.com.

- particleDeformationPoly.mel by Alex Bigott but only if you're using Maya 5.0 or earlier available on highend3d.com.

- ballAndStick.mel by Geordie Martinez available at www.negative13.com

3) One of these (free) programs:

- Chime (www.mdl.com/downloads/downloadable/)
- RasMol (www.umass.edu/microbio/rasmol/)
- Protein Explorer (http://molvis.sdsc.edu/protexpl/frntdoor.htm)
- RasMac (http://mc2.cchem.berkeley.edu/Rasmol/)
- PyMol9 (http://pymol.sourceforge.net/).

4) A PDB file of DNA

5) This website:

- www.rcsb.org/pdb/


6) And an intermediate level understanding of Maya, especially regarding installing and using MEL scripts and some experience with dynamics. Knowing how to write MEL scripts is not necessary.

Part One: Getting Macromolecular Data into Maya

I am NOT a scientist, but I've often worked on projects that have placed me in a position in which there's was a scientist nearby. And that's great when I have questions or need to have something checked out. You'll definitely want to find a knowledgeable person to proofread the structure of your molecule, and it would be even better if he or she can help you find the molecular structure you need in the protein databank.

So where do you get this data? The protein data bank located at www.rcsb.org/pdb/ is an online database populated with thousands of molecules (22,516 at last I counted). These files are uploaded by scientists and are accessible to anyone. The files contain the actual crystallography data (meaning they contain the positions of the atoms in the molecules). The files themselves are just text files with comments and coordinates. Most often, scientists use a program like Chime, RasMol, or Protein Explorer to view these structures. Thanks to a handy script by Tom Doeden called pdbReader.mel, you can easily import the data into Maya.

Using the script is easy. However, before I get to that, let me give a few words of advice on using the protein databank. It's a good idea to know what exactly you're looking for before downloading the files. Plugging in a general term like "DNA" in the search field on the website is going to generate hundreds of results, many of which include molecules and data you may not want or need. This is true for any protein structure you may look for. The best advice I can give is to get some help from a scientist on your search. For instance, if you're working for a scientist, make sure he or she is very specific in what he or she wants. Furthermore, the databank has a lot of stuff, but it doesn't have everything. Some molecules haven't been structurally analyzed and entered in the database yet.

The databank website also has a great feature called "Molecule of the Month" that is definitely worth a read. The archives contain articles on DNA, bacteriaphage, p53, and many of your other favorites. I found the article on DNA to be particularly useful. In-depth information on what a PDB file is can be found on the site at www.rcsb.org/pdb/info.html.

It's also a good idea to get one of the free programs used to view the PDBs (Chime, RasMol, RasMac, or PyMol9). I use PyMol on a Mac to both view the structure (to verify what I bring into Maya) and to strip out unnecessary data like comments (I just save the file under a new name and it often automatically removes extra code). Chime allows you to view the structure into a web browser, like Internet Explorer.

To make this tutorial easier to follow, I have linked to a pdb file of DNA. Please feel free to download it. I've already stripped out the comments so you can bring it in to Maya without doing anything extra.

Okay, let's really get to it. Download dna.pdb and open it in a text editor. Take a look at how the file is arranged. Some typical rows from our PDB file look like this:

ATOM 21 P G A 2 22.409 31.286 21.483 1.00 58.85 1BNA 83
ATOM 22 O1P G A 2 21.822 31.459 20.139 1.00 78.33 1BNA 84
ATOM 23 O2P G A 2 23.536 32.157 21.851 1.00 57.82 1BNA 85
ATOM 24 O5* G A 2 22.840 29.751 21.498 1.00 40.36 1BNA 86
ATOM 25 C5* G A 2 23.543 29.175 22.594 1.00 47.19 1BNA 87
ATOM 26 C4* G A 2 23.494 27.709 22.279 1.00 47.81 1BNA 88
ATOM 27 O4* G A 2 22.193 27.252 22.674 1.00 38.76 1BNA 89
ATOM 28 C3* G A 2 23.693 27.325 20.807 1.00 28.58 1BNA 90
ATOM 29 O3* G A 2 24.723 26.320 20.653 1.00 40.44 1BNA 91

Each row in the file corresponds to a single atom in the structure. All we're really interested in is the atom' s symbol and its X,Y, and Z coordinates. This is what PDB Reader translates into coordinates for the spheres it will create when you run the script. The atomic symbol (C for carbon, H for hydrogen, N for nitrogen, P for Phosphorus, and O for oxygen) determines which shader will be applied to these spheres and their relative size. The rest of the data is ignored.

Tip 1: What does "C3*" mean? In this case, the author of the PDB file has put an asterix next to the atoms representing the backbone of the double helix. The numbers are merely a reference which pdbReader.mel ignores. If you strip the rows with the asterixes out of the PDB file along with the rows containing P, O1P, and O2P (a repeating Phosphorous with two oxygens), you'll be left with just the base pairs of the DNA model. Save these out to a new PDB file if you decide you want to do something special with them later. Remember to also make reciprocal PDB files of the data you've stripped out so you can have PDB files with just the backbone and no base pairs.


Tip 2: I have found that some atomic symbols, like Si (for silicon), will cause the script to choke. When this happens, I edit the PDB file itself and replace the atoms with an atomic symbol I know it will accept but doesn't occur too often in the molecule (like phosphorus) and then I change these phosphorous molecules back to whatever atom I need once the file has been loaded. It's an ugly work-around but it gets the job done.

It's important to know that all PDB files are not formatted exactly the same way and that sometimes these numbers appear in different columns. A little bit of testing will most likely be necessary in some cases.

Run the pdbReader.mel script in Maya and click the "Get PDB File" button. Browse to find the dna.pdb file you downloaded and select the file.

canvas brush

When we work on image in canvas mode one an image, often we needs to erase a part or in transparency the effect of brush which one has just pose.

In this case the technique of brush by restoration of the basic image and not of the background proves to be necessary.
This type of brush is on Eclipse or StudioPaint.
This example shows how in Paint Effect we can produce this type of brushe

Here, we will take the example of the modification of a mapping of file on a surface.

NOTICE ON THE PREPARATION OF THE MAPS:

It is more practical to create two files of the image than you will use:
One for the map.

(In our example : MapRuisdael_Raleigh_Spruces_warefall.jpg ).

One other for the sroke

( In our example : StrokeRuisdael_Raleigh_Spruces_warefall.jpg ) .



MAP AN IMAGE ON A SURFACE

* Go in perspectiv vue
* Create a plan: Create-> NurbsPrimitive
* Create a directional lighte : LIGHT>CreateDirectional Light
* Direct the lumiƩre ( rendering mode : key7, and keyT)
* Open HYPERSHADE, Choose a " material Blinn " and map on the color the file which
you prepared :

click for larger version

* Apply this shader on the surface

CREATE THE BRUSH RESTORES

* On the perspective window activate Effect Paint by activating key 8
* The cursor positioned in this window press on the right key of mouse
* and choose the option Paint->PaintCanvas to test the manufacture of
your brush.
* First,You can initialize the values of a brush: Paint Effects->ResetTemplateBrush
* Open the window of Brushes attributs :



* If for example you want a brush of this type:



* You must have the parameters of following attributes:






* Save this brush like new " preset " in a shelf : Paint Effect-> Save Brush Preset



* Clean the canvas, thendesactivate the canvas window of paint Effect while pressing on key 8.
OPENING OF PAINT EFFECT WINDOW and PERSPECTIV VIEW

* Divide your space of work into two parts : Panel->Layouts>2 side by side
* On the right-hand window activate Effect Paint by key 8
* The cursor positioned in this window press on the right key of mouse
* Choose option Paint->PaintCanvas
* From Window->Visor click and dragg the file of map on the Canvas window

click for larger version

* Thus, in the window of right-hand side you have your geometrie with the map, in the canvas the map which you can work :

click for larger version

* You can work in the surface of the canvas:

click for larger version

* The update of the file map is done by activating the icone folder of the canvas window :



* The brush restores makes it possible to erase the parts which one has just worked by finding the bottom that one has map on surface:

click for larger version


from :http://www.highend3d.com
.