I’ve learning to write postprocessing shaders with FilterManager, and rewrote the sample cartoon ink shader in glsl. However, when I setup my scene to render to texture with filter manager, MSAA doesn’t seem to work. I looked into CommonFilters and I thought I copied what was relevant to getting MSAA working, but it’s still jaggy compared to the scene without FilterManager. Is there something I’m totally missing?
I’m currently on panda 1.10.13
def loadScreenShader(self):
if self.quad is None:
manager = FilterManager(base.win, base.cam)
colortex = Texture()
depthtex = Texture()
fbprops = FrameBufferProperties()
fbprops.setMultisamples(8)
self.quad = manager.renderSceneInto(colortex=colortex, depthtex=depthtex, fbprops=fbprops)
self.quad.setShaderInput("tex", colortex)
self.quad.setShaderInput("depthTex", depthtex)
self.quad.setShaderInput("normalTex", self.normalsTexture)
camNode = manager.camera.node()
state = camNode.getInitialState()
state.setAttrib(AntialiasAttrib.make(AntialiasAttrib.M_multisample))
camNode.setInitialState(state)
self.quad.setShader(Shader.load(Shader.SL_GLSL, vertex="screen.vert.glsl", fragment="screen.frag.glsl"))
self.quad.setShaderInput("separation", LVecBase4(self.separation, 0, self.separation, 0))
self.quad.setShaderInput("cutoff", LVecBase4(self.cutoff))
I don’t know if it’s relevant, but I’m rendering the normals to a separate buffer like in the cartoon sample:
self.normalsTexture = Texture()
normalsBuffer = self.win.makeTextureBuffer("normalsBuffer", 0, 0, self.normalsTexture)
normalsBuffer.setClearColor(LVecBase4(0.5, 0.5, 0.5, 1))
self.normalsCamera = self.makeCamera(normalsBuffer, lens=self.cam.node().getLens())
self.normalsCamera.node().setScene(self.render)
tempnode = NodePath(PandaNode("temp node"))
tempnode.setShaderInput("prepass", True)
self.normalsCamera.node().setInitialState(tempnode.getState())
load-display pandagl
win-size 1440 900
multisamples 8
framebuffer-multisamples #f
framebuffer-srgb truein
show-frame-rate-meter #t
sync-video #f