Built in static cubemap support?

I’ve been browsing through the manual and noticed Panda has built-in support for static cube maps, but the docs are incomplete. Does anyone have
an example which illustrates from beginning to finish how starting with 6 jpgs
to display it as a cubemap using the native commands?

If by static you mean the textures are not generated during run-time- here’s some code from my program.:

#Prepare TextureStage for reflections
self.ts = TextureStage('ts')
cubemap = loader.loadCubeMap('models/reflections/tohu_#.png') 
self.ship.setTexGen(self.ts, TexGenAttrib.MWorldNormal)
self.ship.setTexture(self.ts, cubemap)

Also see this page: panda3d.org/manual/index.php/Cube_Maps

Your reflection mapping example is too complex for me at the moment.
I’m only after a static-skybox-type cube map. So something like

cubemap = loader.loadCubeMap(‘models/reflections/tohu_#.png’)
newnode = render.attachnewnode(cubemap_maker(cubemap))

is what I’m trying to figure out how to do.

You need a box model and a cubeMap texture set…

cubeMap = loader.loadCubeMap('texture_#.jpg')
self.spaceSkyBox = loader.loadModel('models/box.egg')
self.spaceSkyBox.setBin('background', 0)
self.spaceSkyBox.setTexture(cubeMap, 1)

Basically to load and display a cubeMap, you need three commands.

the rest of the commands in the sample above are there to make it a proper skyBox (deactivate depth write and place it in the background of everything).

Note that, if you’re loading your own box model anyway, there’s no particular reason to use a cube map to texture it. You could just as easily use regular texturing, and put a different texture on each of the faces yourself.

Furthermore, note that there’s nothing about cube maps that requires you to apply the texture to a cube. You could apply it to a sphere, a doughnut, or a martian just as easily as to a cube.

Cube mapping is really designed for certain special-purpose effects that can’t be achieved with regular texturing, especially reflections (“environment mapping”). By the way, I apologize for the broken link in the manual: a wiki vandal had broken the menu link to cube map environment mapping some time back, and we didn’t notice the damage until you said something about the cube map pages being incomplete. I just repaired it.

If all you want is a skybox, probably cube mapping is not the right tool. Of course, you could do the skybox with a cube map; there’s no real reason not to, other than that it’s the hard way to do it. Since cube maps require 3-d texture coordinates (instead of the more usual 2-d coordinates), you’ll either have to create your box model with 3-d texture coordinates, or use Panda’s mechanism for generating 3-d texture coordinates on-the-fly.


If you’re building a skybox- don’t use cubemapping. There’s no reason.

If you want to build your own it’s easy. Or you can download my software- I have a skybox model (see the link in my signature)

If you want to build your own in say blender:

Create a cube. Reverse the normals with the “Flip Normals” button - in Edit I think. Then use the UV mode to texture each face. You’ll have to scale up the box a lot once in your program and most likely you’ll need a little function to recenter the box around the camera every frame. Parenting (at least normally) won’t work because it will rotate with you- which isn’t what you want.

You could also use egg-trans to scale up your box- but scaling it in your script is fine/easier.

i had problem with cubed map skybox. I think the 3d texture takes up more memory then the 6 2d faces… or it might have been my own hardware.

Some older cards lack support for cubemaps altogether, or do them very poorly. Sometimes, in this case, the driver will kick into software rendering to handle the cubemap, which makes it r-e-a-l slow.


mine was that is started says fireGL memory allocation field after i load the sky box… but they work now… i don’t know driver/panda version change …