flashlight with projectTexture

Hi,

I’m trying to create a flashlight as explained in the Panda3D-17-Gamedevelopment book.
The code is as follows:

              self.proj = render.attachNewNode(LensNode("proj"))
              lens = PerspectiveLens()
              lens.setFov( 60, 60 )
              self.proj.node().setLens(lens)
              self.proj.reparentTo(base.camera)
              self.proj.setHpr(0, -5, 0)
              self.proj.setPos(0, 1, 0)
              tex = loader.loadTexture("flashlight.png")
              tex.setWrapU(Texture.WMClamp)
              tex.setWrapV(Texture.WMClamp)
              ts = TextureStage('ts')
              self.world.projectTexture(ts, tex, self.proj)  

This works well, but the ‘flashlight’ is very dim, almost impossible to see in the dark. Does anyone know how I can make the beam clearer ? I tried setting the color of the texture stage but this does not have any effect.

What does your flashlight.png look like? Is it already completely white in the middle?

Yes, see attachement

Well, you could also then simply make the rest of your scene brighter with setColorScale. Or, you could use a real Spotlight object instead.