self.pipeline = simplepbr.init(render_node=scene, enable_shadows=True)
# self.pipeline.use_normal_maps = True
scene is a node directly under ‘render’
To simplify things, I’ve started on a test-app that gets rid of all my dependencies. (I haven’t run it on the test machine yet. build issues. ) Will update soon.
pbrtest.py
from direct.showbase.ShowBase import ShowBase
from panda3d.core import Material, NodePath, DirectionalLight, AmbientLight, BitMask32, load_prc_file_data
import simplepbr
load_prc_file_data(
‘’,
‘texture-minfilter mipmap\n’
‘texture-anisotropic-degree 16\n’
“audio-library-name null\n”
)
class MyApp(ShowBase):
def init(self):
ShowBase.__init__(self)
render = self.render
render.setShaderAuto()
self.pipeline = simplepbr.init(render_node=render, enable_shadows=True)
box1:NodePath = self.loader.loadModel("models/box")
box = box1.instance_under_node(render, "box")
floor = box1.instance_under_node(self.render, "floor")
floor.set_scale(100, 100, 10)
floor.set_pos(-50, -50, -12)
mat = Material()
mat.set_roughness(.5)
mat.set_ambient((0,0,0,1))
mat.set_diffuse((1,1,1, 1))
mat.set_specular((.5, .5, .5, 1))
mat.set_metallic(1)
floor.set_material(mat)
box.set_pos(0, 12, -2)
mat = Material()
mat.set_roughness(.45)
mat.set_ambient((0,0,0,1))
mat.set_diffuse((1,1,1, 1))
mat.set_specular((.5, .5, .5, 1))
mat.set_metallic(1)
box.set_material(mat)
dlight = DirectionalLight('my dlight')
dlight.setColor((10,10,10, 1))
dlnp = render.attachNewNode(dlight)
dlnp.set_pos(15, 0, 10)
dlnp.look_at(box)
dlight.setShadowCaster(True, 2048, 2048)
render.setLight(dlnp)
light = AmbientLight('ambientLight')
light.setColor((0.03, 0.03, 0.03, 1))
render.setLight(render.attachNewNode(light))
app = MyApp()
app.run()