Changing Fog colour in a Task

Hi all,

A fairly simple issue, but one that has been persistent regardless; I have a linear-fog object that I attach to the camera like this:

   colz=base.getBackgroundColor()
   linfog = Fog("fogNode")
   linfog.setColor(colz.x, colz.y, colz.z)
   linfog.setLinearRange(0, 300)
   fogNp=camera.attachNewNode(linfog)
   fogNp.setName("linearFogMain")
   self.mainFog=fogNp

I’m testing changing the fog colour in a task this way:

def fogTaskTest(self,task):
    self.mainFog.node().setColor(random.uniform(0,1),random.uniform(0,1),random.uniform(0,1))
    print(self.mainFog.node().getColor())
    return task.cont

Now, while the values being printed out indicate that the fog is changing colour, the actual colour of the fog on the screen stays the same, or changes once before remaining the same. Is there more to changing the colour of a fog after it has been created, say within a task?

Thanks in advance.

That should do it, smells like a bug. Does it make a difference whether you have the auto-shader generator enabled or not?

This turned out to be trivial to fix.

Will be in 1.10.13.

1 Like

Yes, I had it on: render.setShaderAuto() to enable shadow casting, not turning it on did resolve the issue.