This is a read-only mirror of pymolwiki.org

Difference between revisions of "Ray"

From PyMOL Wiki
Jump to navigation Jump to search
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
===DESCRIPTION===
+
==DESCRIPTION==
'''ray''' creates a ray-traced image of the current frame. This can take some time (up to several minutes, depending on image complexity).
+
'''ray''' creates a ray-traced image of the current frame. This command is used to make high-resolution photos fit for publication and formal movies.  Please note, the '''ray''' command can take some time (up to several minutes, depending on image complexity and size).
  
===USAGE===
+
For those who are making movies with PyMOL, '''Ray''' is one of the most commonly used last steps before stitching the frames together to compile the movie.  '''Ray''' has many powerful features such as setting the size of the image -- and it still works even if the [[Viewport]] or screen is smaller than the requested output file dimensions.
ray [width,height [,renderer [,angle [,shift ]]]
 
''angle''' and '''shift''' can be used to generate matched stereo pairs
 
  
===EXAMPLES===
+
==USAGE==
  ray
+
  ray [width,height [,renderer [,angle [,shift ]]]
ray 1024,768
+
'''angle''' and '''shift''' can be used to generate matched stereo pairs
ray renderer=0
 
  
===PYMOL API===
+
 
 +
==PYMOL API==
 
<source lang="python">cmd.ray(int width,int height,int renderer=-1,float shift=0)</source>
 
<source lang="python">cmd.ray(int width,int height,int renderer=-1,float shift=0)</source>
  
===SETTINGS===
+
==SETTINGS==
====Ray-Tracing modes====
+
===Modes===
ray_trace_mode = 0: normal color
+
Setting the '''[[Ray_trace_mode]]''' variable in PyMOL changes the way PyMOL's internal renderer represents proteins in the final output.  New modes were recently added to give the user more options of molecular representation.  New modes are: normal rendering, but with a black outline (nice for presentations); black and white only; quantized color with black outline (also, very nice for presentations; more of a ''cartoony'' appearance).
 +
 
 +
<source lang="python">
 +
# normal color
 +
set ray_trace_mode, 0
  
ray_trace_mode =  1: normal color + black outline
+
# normal color + black outline
 +
set ray_trace_mode,  1
  
ray_trace_mode = 2: black outline only
+
# black outline only
 +
set ray_trace_mode, 2
  
ray_trace_mode =  3: quantized color + black outline
+
# quantized color + black outline
 +
set ray_trace_mode,  3
  
set ray_trace_mode, 1 # (or 2 or 3; best with "bg_color white;set antialias,2")
+
set ray_trace_mode, 1 # (or 2 or 3; best with "bg_color white;set antialias,2")
These two new modes -- 2 and 3 -- are cool cartoon looking modes.
+
# These two new modes -- 2 and 3 -- are cool cartoon looking modes.
 +
</source>
  
 
Here are the example images for the new modes
 
Here are the example images for the new modes
[[Image:1l9l.png|thumb|center|Black and White (ray_trace_mode,2); click to see full image]]
+
<gallery>
# Black and White Script
+
Image:Ray_mode_1_ex.png|set ray_trace_mode,1
load /tmp/3fib.pdb;
+
Image:Ray_mode_2_ex.png|set ray_trace_mode,2
show cartoon;
+
Image:Ray_mode_3_ex.png|set ray_trace_mode,3
set ray_trace_mode, 2;  # black and white cartoon
+
</gallery>
bg_color white;
 
set antialias, 2;
 
ray 600,600
 
png /tmp/1l9l.png
 
 
 
 
 
[[Image:1l9l_2.png|thumb|center|Color mode (ray_trace_mode,3); click to see full image]]
 
# Color Script
 
load /tmp/thy_model/1l9l.pdb;
 
hide lines;
 
show cartoon;
 
set ray_trace_mode, 3; # color
 
bg_color white;
 
set antialias, 2;
 
remove resn HOH
 
remove resn HET
 
ray 600,600
 
png /tmp/1l9l.png
 
  
====Perspective====
+
===Perspective===
 
====Perspective Example Images====
 
====Perspective Example Images====
[[Image:No_persp.png|thumb|left|Example with Perspective Turned Off]]
+
<gallery>
[[Image:Persp1.png|thumb|left|Example with Perspective Turned On]]
+
Image:No_persp.png|Example with Perspective Turned Off
[[Image:Persp2.png|thumb|left|Example with Perspective Turned On and Field of View Set High (70).]]
+
Image:Persp1.png|Example with Perspective Turned On
 
+
Image:Persp2.png|Example with Perspective Turned On and Field of View Set High (70).
 
+
</gallery>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
=====Notes=====
 
=====Notes=====
Line 79: Line 57:
 
where 50<X<70.  Default is 20.  50-70 gives a very strong perspective effect.  Nb. the field of view is in Y, not X as one would expect.
 
where 50<X<70.  Default is 20.  50-70 gives a very strong perspective effect.  Nb. the field of view is in Y, not X as one would expect.
  
====Renderer====
+
 
 +
 
 +
===Renderer===
 
'''renderer = -1''' is default (use value in ray_default_renderer)
 
'''renderer = -1''' is default (use value in ray_default_renderer)
  
Line 86: Line 66:
 
'''renderer =  1''' uses PovRay's renderer.  This is Unix-only and you must have "x-povray" in your path.  It utilizes two temporary files: "tmp_pymol.pov" and "tmp_pymol.png".
 
'''renderer =  1''' uses PovRay's renderer.  This is Unix-only and you must have "x-povray" in your path.  It utilizes two temporary files: "tmp_pymol.pov" and "tmp_pymol.png".
  
====Ray Tracing Stereo Images====
+
==Examples==
 +
===Simple===
 +
<source lang="python">
 +
# ray trace the current scene using the default size of the viewport
 +
ray
 +
</source>
 +
 
 +
===Specify Image Size===
 +
<source lang="python">
 +
# ray trace the current scene, but scaled to 1024x768 pixels
 +
ray 1024,768
 +
</source>
 +
 
 +
===Specify Renderer===
 +
<source lang="python">
 +
# ray trace with an external renderer.
 +
ray renderer=0
 +
</source>
 +
 
 +
===High Quality B&W Rendering===
 +
[[Image:1l9l.png|thumb|center|Black and White (ray_trace_mode,2); click to see full image]]
 +
<source lang="python">
 +
# Black and White Script
 +
load /tmp/3fib.pdb;
 +
show cartoon;
 +
set ray_trace_mode, 2;  # black and white cartoon
 +
bg_color white;
 +
set antialias, 2;
 +
ray 600,600
 +
png /tmp/1l9l.png
 +
</source>
 +
 
 +
===High Quality Color===
 +
[[Image:1l9l_2.png|thumb|center|Color mode (ray_trace_mode,3); click to see full image]]
 +
<source lang="python">
 +
# Color Script
 +
load /tmp/thy_model/1l9l.pdb;
 +
hide lines;
 +
show cartoon;
 +
set ray_trace_mode, 3; # color
 +
bg_color white;
 +
set antialias, 2;
 +
remove resn HOH
 +
remove resn HET
 +
ray 600,600
 +
png /tmp/1l9l.png
 +
</source>
 +
 
 +
===Ray Tracing Stereo Images===
 
See [[Stereo_Ray]].
 
See [[Stereo_Ray]].
  
===SEE ALSO===
+
==SEE ALSO==
"help faster" for optimization tips with the builtin renderer. "help povray" for how to use PovRay instead of PyMOL's built-in    ray-tracing engine.  
+
"help faster" for optimization tips with the builtin renderer. "help povray" for how to use PovRay instead of PyMOL's built-in    ray-tracing engine.  For high-quality photos, please also see the [[Antialias]] command.  [[Ray shadows]] for controlling shadows.
 +
 
 +
 
 +
See also [[Ray Tracing]].
  
 
==USER Comments==
 
==USER Comments==
Line 97: Line 128:
  
 
[[Category:Commands|ray]]
 
[[Category:Commands|ray]]
 +
[[Category:Publication_Quality|ray]]

Revision as of 21:32, 13 November 2007

DESCRIPTION

ray creates a ray-traced image of the current frame. This command is used to make high-resolution photos fit for publication and formal movies. Please note, the ray command can take some time (up to several minutes, depending on image complexity and size).

For those who are making movies with PyMOL, Ray is one of the most commonly used last steps before stitching the frames together to compile the movie. Ray has many powerful features such as setting the size of the image -- and it still works even if the Viewport or screen is smaller than the requested output file dimensions.

USAGE

ray [width,height [,renderer [,angle [,shift ]]]

angle and shift can be used to generate matched stereo pairs


PYMOL API

cmd.ray(int width,int height,int renderer=-1,float shift=0)

SETTINGS

Modes

Setting the Ray_trace_mode variable in PyMOL changes the way PyMOL's internal renderer represents proteins in the final output. New modes were recently added to give the user more options of molecular representation. New modes are: normal rendering, but with a black outline (nice for presentations); black and white only; quantized color with black outline (also, very nice for presentations; more of a cartoony appearance).

# normal color
set ray_trace_mode, 0

# normal color + black outline
set ray_trace_mode,  1

# black outline only
set ray_trace_mode,  2

# quantized color + black outline
set ray_trace_mode,  3

set ray_trace_mode, 1 # (or 2 or 3; best with "bg_color white;set antialias,2")
# These two new modes -- 2 and 3 -- are cool cartoon looking modes.

Here are the example images for the new modes

Perspective

Perspective Example Images

Notes

PyMol 0.97 and prior used orthoscopic rendering -- that is, no perspective. Upon the arrival of 0.98 and later, we get perspective based rendering at a cost of a 4x decrease in render speed. If you want perspective

set orthoscopic, off

Otherwise

set orthoscopic, on

To magnify the effect of perspective on the scene,

set field_of_view, X

where 50<X<70. Default is 20. 50-70 gives a very strong perspective effect. Nb. the field of view is in Y, not X as one would expect.


Renderer

renderer = -1 is default (use value in ray_default_renderer)

renderer = 0 uses PyMOL's internal renderer

renderer = 1 uses PovRay's renderer. This is Unix-only and you must have "x-povray" in your path. It utilizes two temporary files: "tmp_pymol.pov" and "tmp_pymol.png".

Examples

Simple

# ray trace the current scene using the default size of the viewport
ray

Specify Image Size

# ray trace the current scene, but scaled to 1024x768 pixels
ray 1024,768

Specify Renderer

# ray trace with an external renderer.
ray renderer=0

High Quality B&W Rendering

Black and White (ray_trace_mode,2); click to see full image
# Black and White Script
load /tmp/3fib.pdb;
show cartoon;
set ray_trace_mode, 2;  # black and white cartoon
bg_color white;
set antialias, 2;
ray 600,600
png /tmp/1l9l.png

High Quality Color

Color mode (ray_trace_mode,3); click to see full image
# Color Script
load /tmp/thy_model/1l9l.pdb;
hide lines;
show cartoon;
set ray_trace_mode, 3; # color
bg_color white;
set antialias, 2;
remove resn HOH
remove resn HET
ray 600,600
png /tmp/1l9l.png

Ray Tracing Stereo Images

See Stereo_Ray.

SEE ALSO

"help faster" for optimization tips with the builtin renderer. "help povray" for how to use PovRay instead of PyMOL's built-in ray-tracing engine. For high-quality photos, please also see the Antialias command. Ray shadows for controlling shadows.


See also Ray Tracing.

USER Comments

How do I ray trace a publication-ready (~300dpi) image using PyMol?

This answer is in the Advanced Issues (Image Manipulation Section).