Bugs around cube maps

Hi,
I’m playing around with cube maps and reflections and I think I found a bug or two.

from pandac.PandaModules import *
import direct.directbase.DirectStart

env = loader.loadModel("environment")
env.reparentTo(render)
env.setZ(-3)

smiley = loader.loadModel('smiley')
smiley.reparentTo(render)
 
rig = NodePath('rig')
buffer = base.win.makeCubeMap('env', 128, rig)
rig.reparentTo(smiley)

ref_ts = TextureStage("reflection")
ref_ts.setMode(TextureStage.MDecal)
smiley.setTexGen(ref_ts, TexGenAttrib.MWorldCubeMap)
smiley.setTexture(ref_ts, buffer.getTexture())

# light
d = DirectionalLight("dir light")
dn = render.attachNewNode(d)
dn.setColor(1,1,1,1)
dn.setHpr(30, -50, 0)
render.setLight(dn)

# doesn't work
#render.setShaderAuto()


base.cam.setY(-10)
base.bufferViewer.toggleEnable()

run()

The first thing you see is that the generated cube map is wrong (the first side is equal to the last one).

The second thing is that from decal mode I’d actually expect the first texture to be overwritten. Instead the texture stage behaves as if it was set to half alpha.

Third thing is the shader generator, which disables the custom texture stage. Is this intended?

The shader generator doesn’t support MWorldCubeMap. If someone would tell me how to calculate those coordinates, then I could add it very easily.

Both MEyeCubeMap and MWorldCubeMap apply glTexGen(GL_REFLECTION_MAP), multiplied by the appropriate transform (into eye space or world space).

GL_REFLECTION_MAP is, for some reason, not described on the man page for glTexGen() at opengl.org/registry/specs/AR … be_map.txt :

David