Complexpbr did not render correctly

complexpbr renders it as gray black. but simplepbr renders correctly as green grass.

from direct.showbase.ShowBase import ShowBase
from panda3d.core import DirectionalLight, Vec4, Vec3, TextureStage, NodePath, AnimBundleNode
from panda3d.core import *
import simplepbr
import complexpbr
from direct.actor.Actor import Actor

import panda3d

class MyApp(ShowBase):
    def __init__(self):
        # Initialize the base class (ShowBase)
        ShowBase.__init__(self)

        #simplepbr.init(enable_shadows=True, use_normal_maps=True)
        complexpbr.apply_shader(self.render)
        
        

        model_path = self.loader.loadModel('grass_ground_1.glb')
        
        model_path.reparent_to(self.render)
        
        self.ambientLight = AmbientLight("ambientLight")
        self.ambientLight_Intensity=0.8
        self.ambientLight.setColor((self.ambientLight_Intensity,self.ambientLight_Intensity,self.ambientLight_Intensity, 1))
        self.render.setLight(self.render.attachNewNode(self.ambientLight))
        self.directionalLight = DirectionalLight("directionalLight_1")
        self.directionalLight_intensity=5
        self.directionalLight.setColor((self.directionalLight_intensity,self.directionalLight_intensity,self.directionalLight_intensity, 1))
        #self.directionalLight.setSpecularColor((.1, .1, .1, .1))
        self.directionalLight.setShadowCaster(True, 512, 512)
        self.dlight1=self.render.attachNewNode(self.directionalLight)
        self.render.setLight(self.dlight1)
        
# Run the application
app = MyApp()
app.run()

model link

I’m not sure what you would like to do. The Arena FPS Sample Program is the baseline program which contains all the actual model files and textures one needs to render a complexpbr environment correctly.

Please reference that program for proper complexpbr usage.

I set position and angle to the directional light. Now it’s working.
But without directional light and using only ambient light, it renders black.

Thats correct. When using complexpbr, never use AmbienghtLight. It uses IBL.

In general, you can and probably should use both an AmbientLight and something else like a Spotlight if you want to get an IBL scene lit properly (and with customization).

If you’d just like a quick lighting setup, you can also call complexpbr.apply_shader(self.render, default_lighting=True) for automatic lighting.

For other specific scene lighting setup, one can reference the Arena FPS sample program lighting file here: Panda3D-Arena-FPS-Sample-Program/arena_lighting.py at main · rayanalysis/Panda3D-Arena-FPS-Sample-Program · GitHub