I am trying to test my shaders, lights and materials, but I got some issues can’t solve during test.
Thank for anyone help!
as you can see, the models are all red
here are the full code:
from panda3d.physics import *
from panda3d.core import *
from direct.showbase.ShowBase import ShowBase
from panda3d.core import Material
class Game(ShowBase):
def __init__(self):
ShowBase.__init__(self)
cube = loader.loadModel("models/man/block.egg")
cube.setPos(0, 0, 0)
cube.reparentTo(self.render)
glass = loader.loadModel("models/man/thinglass.egg")
glass.setPos(0, 0, 1)
glass.setScale(0.1, 0.1, 0.1)
glass.reparentTo(self.render)
floor = loader.loadModel("models/man/floor.egg")
floor.setPos(0, 0, -10)
myMaterial = Material()
myMaterial.setShininess(5.0) # Make this material shiny
myMaterial.setAmbient((0, 0, 1, 1)) # Make this material blue
floor.setMaterial(myMaterial) # Apply the material to this nodePath
floor.reparentTo(self.render)
plight = PointLight('plight')
plight.setColor((1, 1, 1, 1))
plight.setShadowCaster(True, 512, 512)
plnp = render.attachNewNode(plight)
plnp.setPos(0, 0, -8)
render.setLight(plnp)
render.setShaderAuto()
a = Game()
a.run()
Am I using wrong lighting/ material ? (the shaders works quite well.)
The effect I expect is like this
is there anyway to change my code into something like this?