FilterManager woes

Hi guys,
I want to try out some post-processing with the FilterManager, but I keep getting a “global name FilterManager is not defined”. But I can’t find what I’m supposed to import on the site anywhere. I’m using the code from the manual (and version 1.5.0):

    manager = FilterManager(,
    tex = Texture()
    quad = manager.renderSceneInto(colortex=tex)
    quad.setShaderInput("tex", tex)

oh, and another thing while I’m at it: what’s a good way to store the last five or so framebuffers? (I’m going to try and implement motion blur).

Well, as is usually the case, I fixed problem 1 moments after posting the message :confused: . I still have a problem that the scene is now rendered into a small part of the window, but I assume this is the texture padding (what’s the best way to tackle this?).

Question number two still stands though :slight_smile:

Sidenote: you do not need shaders for motion blur, actually. Take a look at how the Motion Blur example in the samples dir does it.

Could be, but I still want to do it through shaders :wink:

another thing I found:

    manager = FilterManager(,
    self.tex = Texture()
    self.dtex = Texture()
    quad = manager.renderSceneInto(colortex=self.tex, depthtex=self.dtex)
    quad.setShaderInput("dtex", self.dtex)

My attempt at rendering the depth buffer to screen, but I still get the color buffer instead. What am I doing wrong? (post.sha is just a passthrough filter that uses texunit0)

Yep, the problem is the texture padding. So the window is probably 800x600, and the texture it’s rendering into is probably 1024x1024. The lower-left 800x600 corner of the texture is the only part that’s being used.

So let’s say you create a full-screen quad, and then apply this texture to it using:

quad.setShaderInput(“mytex”, mytex)

The shader now needs to use the right texture coordinates when accessing the texture. Panda3D provides a shader input called texpad_mytex. This is the texture coordinate of the middle of the active region. To get the texture coordinate of the upper-right corner of the active region, you need (texpad_mytex*2). So this formula gives you exactly what you need:

texcoord = vtx_position.xz * texpad_mytex.xy + texpad_mytex.xy;

Try it, it works out exactly right.

After some fiddling that worked out real nice, thanks Josh :slight_smile:
Rendering the depth buffer is working out well now, but rendering normals to the aux buffer is still a bit strange: If I give the character a shader I see the shaded model instead of normals when visualizing the normal buffer (even though the environment is shown in normal values). If I give it a transparancy attribute it doesn’t show up at all. I’m using the models from the ralph example. And I’ve set the aux to normals with


which I’ve defined before I start loading geometry.

Another thing I noticed is the “shader generator does not support colorscale yet.” warnings I keep getting in the console window. Any ideas?