This is a read-only mirror of pymolwiki.org

Light

From PyMOL Wiki
(Redirected from Light4)
Jump to navigation Jump to search

Overview

Lighting is important for high-quality shots. PyMOL supports of up to 10 virtual lights. You can turn the lights on/off and also position them where you want (behind the camera).

Light2..Light9 control where the other lights go.

Syntax

# set the light to some position.  The 'position'
# must be a vector specifying the XYZ location
# to put the light.
set light, position

# for example
set light, [ -0.55, -0.70, 0.15 ]

User Hint

:

One neat trick, for rendering a "sunset" on your protein is to turn off all the lights, then render the scene as you move the light across the scene. The shadows move across the protein based on the light position and it looks like the sun is setting.


The Code

Here's the code for the animated GIF shown above.

python
cmd.set("light", ll)
for x in range(10):
        l = [ -0.4 + 2*float(x/10.), -0.4, -1  ]
        print l
        cmd.set("light", l)
        cmd.ray()
        cmd.png("lll" + str(x) + ".png" )
for x in range(10):
        l[0] -= 2*float(x/10.)
        print l
        cmd.set("light", l)
        cmd.ray()
        cmd.png("llll" + str(x) + ".png" )
python end

Then, in the shell do

convert lll* llll* light_movie.gif

See Also

Ray