Let's go ahead and add a bloom filter to our game so we can see how to set these guys up. The bloom filter automatically integrates with glow maps, so it's easy to use it to make halos around glowing objects.
Open a
WorldClass_01.py
.We need to import the filters before we can use them, so add this code to our import section at the top of the file:
from direct.filter.CommonFilters import CommonFilters
Now that we're importing
CommonFilters
, we need to create an instance of it. Add this code right before therender.setShaderAuto
call. It doesn't really have to precede that call, but that's as good a place as any.self.filters = CommonFilters(base.win, base.cam)
Next, we'll turn on the bloom filter and give it some parameters to work with. Add these lines right below the line we added in step 3:
filterok = self.filters.setBloom(blend=(0,0,0,1), desat=-0.5, intensity=3.0, size=2)
Okay, now we just need something to bloom. We've got a glow effect in...