In Panda3D, it is possible to use cubemap, but their use seems to be marked as x-files. This code shows how to load a cubic texture by analogy with this tutorial.
from direct.showbase.ShowBase import ShowBase
from panda3d.core import Texture, TexturePool, LoaderOptions, TextureStage, TexGenAttrib, TransformState
class TetsCubeMap(ShowBase):
def __init__(self):
ShowBase.__init__(self)
# The options when loading the texture, in this case, does not make any sense, just for demonstration.
lo = LoaderOptions(flags = LoaderOptions.TF_generate_mipmaps)
# Let's create a texture named "world_cube_map" and configure it.
texture_cube_map = Texture("world_cube_map")
texture_cube_map.setup_cube_map()
texture_cube_map.read(fullpath = 'right.jpg', z = 0, n = 0, read_pages = False, read_mipmaps = False, options = lo)
texture_cube_map.read(fullpath = 'left.jpg', z = 1, n = 0, read_pages = False, read_mipmaps = False, options = lo)
texture_cube_map.read(fullpath = 'bottom.jpg', z = 2, n = 0, read_pages = False, read_mipmaps = False, options = lo)
texture_cube_map.read(fullpath = 'top.jpg', z = 3, n = 0, read_pages = False, read_mipmaps = False, options = lo)
texture_cube_map.read(fullpath = 'front.jpg', z = 4, n = 0, read_pages = False, read_mipmaps = False, options = lo)
texture_cube_map.read(fullpath = 'back.jpg', z = 5, n = 0, read_pages = False, read_mipmaps = False, options = lo)
# You can add texture to the pool if you need to.
TexturePool.add_texture(texture_cube_map)
skybox = loader.load_model('sphere.bam')
skybox.reparent_to(render)
skybox.set_texture(texture_cube_map)
# Necessary manipulations with the transformation of texture coordinates.
ts = TextureStage.get_default()
skybox.set_tex_gen(ts, TexGenAttrib.M_world_cube_map)
skybox.set_tex_hpr(ts, (0, 90, 180))
skybox.set_tex_scale(ts, (1, -1))
# We will remove rendering effects that will be unnecessary.
skybox.set_light_off()
skybox.set_material_off()
app = TetsCubeMap()
app.run()
sphere.bam (236.2 KB)