I’m trying to get a volumetric lighting effect to work with the following code:
from direct.directbase.DirectStart import * from direct.filter.CommonFilters import CommonFilters class World: def __init__(self): base.setBackgroundColor(0, 0, 0) self.LoadModels() taskMgr.add(self.timer, "timer") def LoadModels(self): self.sun2 = loader.loadModel("models/sphere") self.sun2.reparentTo(render) self.sun2.setScale(0.9) self.filters = None self.filters = CommonFilters(base.win, base.cam) self.filters.setVolumetricLighting(self.sun2,32,0.7,0.99,0.05) self.sun = loader.loadModel("models/sphere") self.sun.reparentTo(render) def timer(self, task): self.sun.setShaderInput("time", task.time) return task.cont World = World() run()
And the result I’m willing to achieve is the one on the left of this pic. The one I’m getting is the right.
This code was taken from Demomaster’s sun example. When ran via the demomaster’s environment, the result is the one I want (left), and when run as a standalone panda script, I get the right result.
Anyone have any idea on how to fix this?