Volumetric lighting in latest build

Hi,

I I’m using the Panda3D-1.9.0-x64 version and try to implement the volumetric lighting filter.
I have this code:

    self.bulb = loader.loadModel("models/sphere")
    self.bulb.reparentTo(self.directionalLightNP)
self.filters = CommonFilters(base.win, base.cam)
    self.filters.setVolumetricLighting(self.bulb,32,0.5,1.0,0.05)
    self.bulb.hide()

but then I get the following error message:

File “c:\Panda3d-1.9.0-x64\direct\filter\CommonFilters.py”, line 170, in reconfigure
needtex[configuration[“VolumetricLighting”].source = True
TypeError: ‘set’ object does not support item assignment

I have the code from an example in an earlier version of Panda. Is it something related to a different specification in 1.9.0 ?

Thanks

I commented out lines 170/171 in CommonFilters.py, and then the volumetric lighting works.

Hmm, doesn’t look like ‘needtex’ even needs to be in that line and it’s an error to use dictionary access on a set object so this is definitely a bug. I’ve checked gitHub and the line is still the same so it looks like you’re the first to notice this. Anyways, try change the line:

# from
needtex[configuration["VolumetricLighting"].source] = True

# to
configuration["VolumetricLighting"].source = True

See if that works, though this is just a guess. And it seems odd that volumetric lighting would work simply by commenting out those lines, are you sure it’s working? I’ve never used this module so I can’t really say what should happen.

If I change

needtex[configuration[“VolumetricLighting”].source] = True

to

configuration[“VolumetricLighting”].source = True

I get the following errors:
:gobj(error): create-shader: (27): error C1008: undefined variable “k-txTrue”
:gobj(error): shader encountered an error

and the graphics are totally wrong (colours wrong, smaller viewport etc).

If | comment out those two lines, there’s not error message, and I definitely get VolumetricLighting effects (god rays).

The line is supposed to say:

needtex.add(configuration["VolumetricLighting"].source)

The dictionary was changed to a set at one point, and that line had simply been forgotten. I just checked in a fix.

Thanks for reporting!