0

I am getting problems with point light render. What is the mistake? I am using Panda3D version 1.10.9. I first thought the texture might be transparent but it's JPG.

Without Point Light

With Point Light

The Texture File

The 3D Model

What is causing the problem?

The code is as follows:

from panda3d.core import loadPrcFile
loadPrcFile("config/conf.prc")

from direct.showbase.ShowBase import ShowBase
# from panda3d.core import NodePath
from panda3d.core import PointLight, AmbientLight
from math import sin, cos


class MyGame(ShowBase):
    def __init__(self):
        super().__init__()

        self.cam.setPos(0, -500, 0)
        self.setBackgroundColor(0,0,0)

        self.chara = self.loader.loadModel("planet_models/Earth")
        self.chara.setScale(0.2)
        self.chara.setPos(0, 0, -2.5)
        self.chara.reparentTo(self.render)
        self.charaNode = self.chara.node()

        self.sphere_light = self.loader.loadModel("models/misc/sphere")
        self.sphere_light.setScale(0.2)
        self.sphere_light.setColor(1, 1, 1, 1)
        self.sphere_light.setPos(0, -600, 0)
        self.sphere_light.reparentTo(self.render)

        plight = PointLight("plight")
        plight.setColor((1, 1, 1, 1))
        self.plnp = self.sphere_light.attachNewNode(plight)
        # self.plightNodePath.setPos(2, 0, 0)
        plight.setAttenuation((1, 0, 0))
        self.chara.setLight(self.plnp)

        alight = AmbientLight("alight")
        alight.setColor((0.04, 0.04, 0.04, 1))
        alnp = self.render.attachNewNode(alight)
        self.chara.setLight(alnp)

        self.taskMgr.add(self.move_light, "move-light")

    def move_light(self, task):
        ft = globalClock.getFrameTime()
        self.sphere_light.setPos(cos(ft)*400, sin(ft)*400, 0)
        return task.cont

game = MyGame()
game.run()

with the prc file being

win-size 1280 720
window-title First Trial
show-frame-rate-meter true
show-scene-graph-analyzer-meter true

0 Answers0