Sample Cube Map

Don't mind the mess!

We're currently in the process of migrating the Panda3D Manual to a new service. This is a temporary layout in the meantime.

Top
Python C++

This page is not in the table of contents.

The following sample code loads up an environment, puts the camera in the center of it, and generates the six faces of a cube map from the point of view of the camera:

scene = loader.loadModel('bvw-f2004--streetscene/street-scene.egg')
scene.reparentTo(render)
scene.setZ(-2)
base.saveCubeMap('streetscene_cube_#.jpg', size = 256)

These are the six faces generated:

Right:

Streetscene cube 0.jpg

Left:

Streetscene cube 1.jpg

Front:

Streetscene cube 2.jpg

Back:

Streetscene cube 3.jpg

Top:

Streetscene cube 4.jpg

Bottom:

Streetscene cube 5.jpg

And when they are assembled into a cube map, it looks like this:

The six faces as a cube

Or, when we apply that cube map to a sphere, you can see there are absolutely no seams between the edges:

The cube map applied to a sphere

Top