This is a read-only mirror of pymolwiki.org

Difference between revisions of "Blender"

From PyMOL Wiki
Jump to navigation Jump to search
 
(29 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
<table style="border: 1px solid rgb(255, 204, 0); padding: 5px; background: rgb(255, 253, 223) none repeat scroll 0% 0%; text-align: center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 100%; margin-bottom: 0.2em;">
 +
<tr><td><b>HELP! : </b> Fellow Blenderheads please help improve this page!!!</td></tr>
 +
</table>
 +
 
== Introduction ==
 
== Introduction ==
 
An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.
 
An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.
  
 
Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/
 
Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/
 
  
 
== Examples ==
 
== Examples ==
Line 11: Line 14:
 
High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.
 
High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.
  
==== Step 1 ====
+
* '''Step 1'''
 
Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to "3IQS_cartoon" and "3IQS_surface" as shown in the image below:
 
Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to "3IQS_cartoon" and "3IQS_surface" as shown in the image below:
  
[[Image:Scr01.png|"upright=0.5"]]
+
[[Image:Scr01.png|center|350px]]
 +
 
 +
* '''Step 2'''
 +
Turn off the display of "3IQS_surface" as shown below:
 +
 
 +
[[Image:Scr02.png|center|350px]]
 +
 
 +
* '''Step 3'''
 +
Save the displayed "3IQS_cartoon" as a VRML file, as shown below:
 +
 
 +
[[Image:Scr03.png|center|350px]]
 +
 
 +
* '''Step 4'''
 +
Hide the "3IQS_cartoon" and display the "3IQS_surface". Again, save the displayed "3IQS_surface" as a VRML file, as shown below:
 +
 
 +
[[Image:Scr04.png|center|350px]]
 +
 
 +
* '''Step 5'''
 +
Start Blender (please see link in the Introduction to download and install). Assuming you are looking at the default scene and window layout, press '''7''' on '''numeric keypad''' and the view should change similar to the one below:
 +
 
 +
[[Image:Scr05.png|center|350px]]
 +
 
 +
Now select the '''cube''' in the center of the screen by '''right clicking''' on it and then press '''ctrl-x''' to delete it. This will give you a clean scene to import the protein structure you just exported from PyMOL as VRML 2 (.wrl).
 +
 
 +
* '''Step 6'''
 +
Now import the "3IQS_cartoon" into Blender by going to "File > Import > X3D & VRML97" as shown below:
 +
 
 +
[[Image:Scr06.png|center|350px]]
 +
 
 +
* '''Step 7'''
 +
Navigate to the folder where you exported the VRML 2 files from PyMOL and select the "3IQS_cartoon" file, thusly:
 +
 
 +
[[Image:Scr07.png|center|350px]]
 +
 
 +
Click the "Import X3D/VRML97" button after selecting the correct file and just click "OK" on the dialog that comes up.
 +
 
 +
* '''Step 8'''
 +
Doing the above should result in a display such as the one below:
 +
 
 +
[[Image:Scr08.png|center|350px]]
 +
 
 +
* '''Step 9'''
 +
Now you need to select the just imported cartoon and just that only, so '''right click''' on it so that it is the only object selected in the view:
 +
 
 +
[[Image:Scr09.png|center|350px]]
 +
 
 +
* '''Step 10'''
 +
With the cartoon object selected, hit the '''Tab'' key on your keyboard to enter into "Edit mode" in Blender. All the vertices  that make up this object will be selected and colored yellow, as shown below:
 +
 
 +
[[Image:Scr10.png|center|350px]]
 +
 
 +
* '''Step 11'''
 +
Now click on "Mesh > Vertices > Remove Doubles" in Blender to get rid of duplicate vertices, as shown in the two images below:
 +
 
 +
[[Image:Scr11.png|center|350px]]
 +
[[Image:Scr12.png|center|350px]]
 +
 
 +
* '''Step 12'''
 +
Now hit the '''Tab'' key again, to exit the "Edit mode" to see a nice smooth cartoon object:
 +
 
 +
[[Image:Scr13.png|center|350px]]
 +
 
 +
* '''Step 13'''
 +
This cartoon is too big to be visible in the Blender's camera viewport while rendering, so we need to scale it down by hitting the "S" key once, then moving the mouse so that the object becomes smaller in size and then clicking the left mouse button to accept the new size:
 +
 
 +
[[Image:Scr14.png|center|350px]]
 +
 
 +
The final size should be small enough to completely fit in the "Camera view" in Blender. You can enter the "Camera view" by hitting the zero '''0''' key on the '''numeric keypad'''. Scale the object so that it fits within the camera boundaries:
 +
 
 +
[[Image:Scr15.png|center|350px]]
 +
 
 +
* '''Step 14'''
 +
Now import the "3IQS_surface" VRML 2 file and process it the same way (steps 6 to 13):
 +
 
 +
'''NOTE:''' You may hold off doing "Step 13", the scaling, until you have imported and processed all objects that you exported from PyMOL. It is best to import and process all the objects and then scale them together to maintain the same scaling ratio for all. You can select multiple objects in blender by holding down the '''Shift''' key while right-clicking on individual objects.
 +
 
 +
[[Image:Scr16.png|center|350px]]
 +
[[Image:Scr17.png|center|350px]]
 +
 
 +
* '''Step 15'''
 +
In order to assign different colors ("materials" in Blender-speak) to each object, it is easier to go to camera view (num-pad 0), toggle into "wireframe view" ('''Z''' key) and select an object by right-clicking with the mouse. In the following image, the "3IQS_cartoon" is selected in the wireframe view:
 +
 
 +
[[Image:Scr18.png|center|350px]]
 +
 
 +
* '''Step 16'''
 +
Now select the "3IQS_surface" and toggle back into "solid view" mode ('''Z''' key). Make sure the two buttons with spherical icons are clicked in the bottom panel and the click on the color pad next to the "Col" button to bring up the color selector. You may select any color, in this example a greenish color is asigned.
 +
 
 +
[[Image:Scr19.png|center|350px]]
 +
 
 +
* '''Step 17'''
 +
In order to make the surface translucent and have short rendering times, it is easiest to change the Z-transparency of the surface by clicking the '''Z-transp''' button on the panel, followed by changing the '''A''' (or alpha) value to below 1.0, as shown in the two images below:
 +
 
 +
[[Image:Scr20.png|center|350px]]
 +
[[Image:Scr21.png|center|350px]]
 +
 
 +
* '''Step 18'''
 +
You may similarly select the just the cartoon object and assign it another "material"/color. To render the scene, hit the '''F12''' key on you keyboard, this will render the image in a new "render" window. You can then save the rendered image by hitting '''F3''' key in the render window and then specifying a location and filename.
 +
 
 +
[[Image:3IQS_final.png|center|500px]]
 +
 
 +
Play with other parameters and use the Blender manual/wiki to learn more about this awesome complement to PyMOL.
 +
 
 +
To get you started, here is the final Blender (.blend) file: [[File:3IQS_example.blend.zip]]
 +
You'll need to use a program like bunzip2 (Linux) or 7-zip (Windows) to uncompress it first.
 +
 
 +
== Why Blender? ==
 +
 
 +
* Blender is FREE (as in beer)
 +
* Blender is Open Source and therefore FREE (as in freedom)
 +
* Blender is an extremely capable 3D graphics program and perhaps the only FOSS program capable of taking on similar commercial software head-to-head (Maya/Max/Modo etc.)
 +
* To see some examples of what Blender can do check out:
 +
** http://www.elephantsdream.org/
 +
** http://www.bigbuckbunny.org/
 +
** http://www.yofrankie.org/
 +
 
 +
== Blender Help ==
 +
Blender is a perfect complement to PyMOL for creating high quality images and animation, but has a pretty steep learning curve. The following are a few resources that may be of help along the way:
 +
 
 +
* http://www.blender.org/education-help/
 +
* http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Beginner_Tutorials
 +
* http://forums.cgsociety.org/forumdisplay.php?f=91
 +
* http://blenderartists.org/forum/
  
 
== References ==
 
== References ==
 
* Blender : http://www.blender.org/
 
* Blender : http://www.blender.org/

Latest revision as of 18:52, 31 October 2015

HELP! : Fellow Blenderheads please help improve this page!!!

Introduction

An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.

Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/

Examples

Representative examples. Please change/improve.

1. Translucent Surfaces

High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.

  • Step 1

Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to "3IQS_cartoon" and "3IQS_surface" as shown in the image below:

Scr01.png
  • Step 2

Turn off the display of "3IQS_surface" as shown below:

Scr02.png
  • Step 3

Save the displayed "3IQS_cartoon" as a VRML file, as shown below:

Scr03.png
  • Step 4

Hide the "3IQS_cartoon" and display the "3IQS_surface". Again, save the displayed "3IQS_surface" as a VRML file, as shown below:

Scr04.png
  • Step 5

Start Blender (please see link in the Introduction to download and install). Assuming you are looking at the default scene and window layout, press 7 on numeric keypad and the view should change similar to the one below:

Scr05.png

Now select the cube in the center of the screen by right clicking on it and then press ctrl-x to delete it. This will give you a clean scene to import the protein structure you just exported from PyMOL as VRML 2 (.wrl).

  • Step 6

Now import the "3IQS_cartoon" into Blender by going to "File > Import > X3D & VRML97" as shown below:

Scr06.png
  • Step 7

Navigate to the folder where you exported the VRML 2 files from PyMOL and select the "3IQS_cartoon" file, thusly:

Scr07.png

Click the "Import X3D/VRML97" button after selecting the correct file and just click "OK" on the dialog that comes up.

  • Step 8

Doing the above should result in a display such as the one below:

Scr08.png
  • Step 9

Now you need to select the just imported cartoon and just that only, so right click on it so that it is the only object selected in the view:

Scr09.png
  • Step 10

With the cartoon object selected, hit the 'Tab key on your keyboard to enter into "Edit mode" in Blender. All the vertices that make up this object will be selected and colored yellow, as shown below:

Scr10.png
  • Step 11

Now click on "Mesh > Vertices > Remove Doubles" in Blender to get rid of duplicate vertices, as shown in the two images below:

Scr11.png
Scr12.png
  • Step 12

Now hit the 'Tab key again, to exit the "Edit mode" to see a nice smooth cartoon object:

Scr13.png
  • Step 13

This cartoon is too big to be visible in the Blender's camera viewport while rendering, so we need to scale it down by hitting the "S" key once, then moving the mouse so that the object becomes smaller in size and then clicking the left mouse button to accept the new size:

Scr14.png

The final size should be small enough to completely fit in the "Camera view" in Blender. You can enter the "Camera view" by hitting the zero 0 key on the numeric keypad. Scale the object so that it fits within the camera boundaries:

Scr15.png
  • Step 14

Now import the "3IQS_surface" VRML 2 file and process it the same way (steps 6 to 13):

NOTE: You may hold off doing "Step 13", the scaling, until you have imported and processed all objects that you exported from PyMOL. It is best to import and process all the objects and then scale them together to maintain the same scaling ratio for all. You can select multiple objects in blender by holding down the Shift key while right-clicking on individual objects.

Scr16.png
Scr17.png
  • Step 15

In order to assign different colors ("materials" in Blender-speak) to each object, it is easier to go to camera view (num-pad 0), toggle into "wireframe view" (Z key) and select an object by right-clicking with the mouse. In the following image, the "3IQS_cartoon" is selected in the wireframe view:

Scr18.png
  • Step 16

Now select the "3IQS_surface" and toggle back into "solid view" mode (Z key). Make sure the two buttons with spherical icons are clicked in the bottom panel and the click on the color pad next to the "Col" button to bring up the color selector. You may select any color, in this example a greenish color is asigned.

Scr19.png
  • Step 17

In order to make the surface translucent and have short rendering times, it is easiest to change the Z-transparency of the surface by clicking the Z-transp button on the panel, followed by changing the A (or alpha) value to below 1.0, as shown in the two images below:

Scr20.png
Scr21.png
  • Step 18

You may similarly select the just the cartoon object and assign it another "material"/color. To render the scene, hit the F12 key on you keyboard, this will render the image in a new "render" window. You can then save the rendered image by hitting F3 key in the render window and then specifying a location and filename.

3IQS final.png

Play with other parameters and use the Blender manual/wiki to learn more about this awesome complement to PyMOL.

To get you started, here is the final Blender (.blend) file: File:3IQS example.blend.zip You'll need to use a program like bunzip2 (Linux) or 7-zip (Windows) to uncompress it first.

Why Blender?

Blender Help

Blender is a perfect complement to PyMOL for creating high quality images and animation, but has a pretty steep learning curve. The following are a few resources that may be of help along the way:

References