textures - Cubemap rendering in panda3d python -
I seem to have a problem in rendering a cubemap image on a cube in panda3d. It appears that al distribute my images To create a colorful but unfortunately unwanted design, go to the top right corner:
The code by which I created cubes and tried to present the cubemap:
panda3d.core income * Import from random class to direct.showbase.ShowBase Import * MyApp (ShowBase): def __init __ (self): ShowBase .__ init __ (self) self.cube = self.loader.loadModel ("cube.egg") Self.tex = loader.loadCubeMap ('face_ # jpg.') Self. Cube.setTexture (self.tex) (50) in range for: self.placeholder = self.render.attachNewNode ("placeholder") self.placeholder.setPos (random.randint (1,100), random.randint (1,100) , Random.randint (1,100)) self.cube.instanceTo (self. Placeholder) self.cube.reparentTo (self.render) app = myapp () app.run ()
By default, a cube map will be applied according to the set of U, V, W texture coordinates specified in the model. Regular U, V coordinates are not suitable for showing solid maps because they lack W coordination and therefore some faces will appear. Instead the automatic texture coordination generation is commonly used where the general vector or some of its changed version is used to generate the proper coordinates for the cube maps - for this to be assigned a model cube map coordinates in a modeling program Is unusual for (but possible) sample.
In Panda 3D, this can be done with the setTexGen
function. Depending on the type of cube map, the Panda3D cube can make the map coordinate, it has several methods (such as a reflection cube map, or a constant, etc.) Example:
self. Cube.setTexGen (TextureStage.getDefault (), TexGenAttrib.MEyeCubeMap)
More information can be found on the related manual pages:
Comments
Post a Comment