My classmate created the model and I am a noob in blender.
(I have struggled with this problem for a period time, )
about the model:
material properties:
- Surface principled BSDF ;
- Base Color RGB ;
- Emission Black ;
Export:
gltf 2.0 embedded;
I select the “Selected Objects” and “Custom Properties”
I can see the model clearly in win10’s 3D software.
about the code:
from math import pi, sin, cos
from direct.showbase import DirectObject
from pandac.PandaModules import *
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
import simplepbr
import gltf
class MyApp(ShowBase):
def __init__(self):
# ShowBase.__init__(self)
super().__init__()
simplepbr.init()
# Load the environment model.
self.render.set_shader_auto()#!
self.scene = self.loader.loadModel("models/environment")
# Reparent the model to render.
self.scene.reparentTo(self.render)
# Apply scale and position transforms on the model.
self.scene.setScale(0.25, 0.25, 0.25)
self.scene.setPos(-8, 42, 0)
#loaing the chair into panda3d
chair = loader.loadModel("c4.gltf")
chair.reparentTo(render)
# Add the spinCameraTask procedure to the task manager.
self.taskMgr.add(self.spinCameraTask, "SpinCameraTask")
#light_test
# Create Ambient Light
ambientLight = AmbientLight('ambientLight')
ambientLight.setColor((0.1, 0.1, 0.1, 1))
ambientLightNP = render.attachNewNode(ambientLight)
render.setLight(ambientLightNP)
# Directional light 01
directionalLight = DirectionalLight('directionalLight')
directionalLight.setColor((0.8, 0.2, 0.2, 1))
directionalLightNP = render.attachNewNode(directionalLight)
# This light is facing backwards, towards the camera.
directionalLightNP.setHpr(180, -20, 0)
render.setLight(directionalLightNP)
# Directional light 02
directionalLight = DirectionalLight('directionalLight')
directionalLight.setColor((0.2, 0.2, 0.8, 1))
directionalLightNP = render.attachNewNode(directionalLight)
# This light is facing forwards, away from the camera.
directionalLightNP.setHpr(0, -20, 0)
render.setLight(directionalLightNP)
# Give chair some light
ambient = AmbientLight('ambient')
ambient.setColor((0.5, 1, 0.5, 1))
ambientNP = chair.attachNewNode(ambient)
# Define a procedure to move the camera.
def spinCameraTask(self, task):
angleDegrees = task.time * 6.0
angleRadians = angleDegrees * (pi / 180.0)
self.camera.setPos(20 * sin(angleRadians), -20 * cos(angleRadians), 3)
self.camera.setHpr(angleDegrees, 0, 0)
return Task.cont

app = MyApp()
app.run()
Thank you so much !