SceneSkybox

Attributes

SceneSkybox(win[, tex, ori, axis])

Class to render scene skyboxes.

Details

class psychopy.visual.SceneSkybox(win, tex=(), ori=0.0, axis=(0, 1, 0))[source]

Class to render scene skyboxes. This is a lazy-imported class, therefore import using full path from psychopy.visual.stim3d import SceneSkybox when inheriting from it.

A skybox provides background imagery to serve as a visual reference for the scene. Background images are projected onto faces of a cube centered about the viewpoint regardless of any viewpoint translations, giving the illusion that the background is very far away. Usually, only one skybox can be rendered per buffer each frame. Render targets must have a depth buffer associated with them.

Background images are specified as a set of image paths passed to faceTextures:

sky = SceneSkybox(
    win, ('rt.jpg', 'lf.jpg', 'up.jpg', 'dn.jpg', 'bk.jpg', 'ft.jpg'))

The skybox is rendered by calling draw() after drawing all other 3D stimuli.

Skyboxes are not affected by lighting, however, their colors can be modulated by setting the window’s sceneAmbient value. Skyboxes should be drawn after all other 3D stimuli, but before any successive call that clears the depth buffer (eg. setPerspectiveView, resetEyeTransform, etc.)

Parameters:
  • win (~psychopy.visual.Window) – Window this skybox is associated with.

  • tex (list or tuple or TexCubeMap) – List of files paths to images to use for each face. Images are assigned to faces depending on their index within the list ([+X, -X, +Y, -Y, +Z, -Z] or [right, left, top, bottom, back, front]). If None is specified, the cube map may be specified later by setting the cubemap attribute. Alternatively, you can specify a TexCubeMap object to set the cube map directly.

  • ori (float) – Rotation of the skybox about axis in degrees.

  • axis (array_like) – Axis [ax, ay, az] to rotate about, default is (0, 1, 0).

draw(win=None)[source]

Draw the skybox.

This should be called last after drawing other 3D stimuli for performance reasons.

Parameters:

win (~psychopy.visual.Window, optional) – Window to draw the skybox to. If None, the window set when initializing this object will be used. The window must share a context with the window which this objects was initialized with.

property skyCubeMap

Cubemap for the sky.


Back to top