Auto Deferred Shader

Bad news is that shadows are still broken … and I think the shadows for the point/sphere lights are also kind of bad :cry:

Other bad news - you won’t be able to just import from deferred_render init it and be done, I’ve changed the light API, it’s not a 1:1 clone of the build in Panda3D Lights, but for my defence I’d like to say that I think I made it simpler.

Comparison:
Panda3D PointLight

plight = PointLight('plight')
plight.setColor(VBase4(0.2, 0.2, 0.2, 1))
plight.setShadowCaster(True, 512, 512)
plight.setAttenuation((1, 0, 1)) #how far will the light go...?
plnp = render.attachNewNode(plight)
plnp.setPos(10, 20, 0)
render.setLight(plnp)

Auto Deferred Shader SphereLight

self.plight=SphereLight(color=(0.2, 0.2, 0.2), pos=(10, 20, 0), radius=30.0, shadow_size=512)

Notice I put ‘self’ here, that’s because when the SphereLight goes out of scope it will get garbage collected and the light will vanish from the scene. That’s intended because now you can remove lights in a more pythonic way
Removing Panda3D PointLight

if plight.isShadowCaster():
    #this should work, but I say it's not working or not working always
    #plight.setShadowCaster(False)
    buff=plight.getShadowBuffer(base.win.getGsg())
    buff.clearRenderTextures()
    base.win.getGsg().getEngine().removeWindow(buff)
    plight.setShadowCaster(False)
render.setLightOff(plnp)#do I need this? better be safe... 	
plnp.removeNode() 

Removing a Auto Deferred Shader SphereLight

del self.plight

There’s SphereLight - that’s a point light, there’s ConeLight - that’s a spotlight and there’s SceneLight - that’s a directional light (at the moment there’s just one per scene, the shader is ready to render more, but the interface is not).

Good news - em… fog and depth of field is working. I’ve also made some presets so you don’t need to do all the configuring by hand (but you also can), just tell the renderer to use either ‘full’, ‘medium’ or ‘minimal’ oh, and also, you don’t need to keep a reference to the renderer, it installs itself in the buildins

DeferredRenderer(preset='full')

There are also some ways to configure shader inputs, reload shaders and put shader pre-processor values but I can’t say all that is stable API, so if someone is interested in that take a look at the code or ask me here or on IRC.