Hi, it’s me again.
So I’ve been wanting to get rid of the filtermanager to handle multiple shader passes for me.
It’s really simple, the render-to-texture example helped.
from panda3d.core import Texture, Shader, NodePath, ColorBlendAttrib
loadPrcFileData('', 'textures-power-2 none')
loadPrcFileData('', 'gl-coordinate-system default')
RenderNode = NodePath("RenderNode")
RenderTarget = self.win.makeTextureBuffer("RenderTarget", 1600,1000)
RenderTexture = RenderTarget.getTexture()
RTCam = self.makeCamera(RenderTarget,sort=-100)
RTCam.reparentTo(RenderNode)
base.camLens.setFov(70)
FSQ = loader.loadModel("plane.egg")
FSQ.reparentTo(RTCam)
FSQ.setPos(0,1,0)
FSQ.setShader(Shader.load(Shader.SL_GLSL, vertex="blav.glsl", fragment="blaf.glsl"))
global Screen
Screen = loader.loadModel("plane.egg")
Screen.reparentTo(base.camera)
Screen.setPos(0,1,0)
Screen.setShader(Shader.load(Shader.SL_GLSL, vertex="blablav.glsl", fragment="blablaf.glsl"))
Screen.setShaderInput("bla",RenderTarget.getTexture())
This worked perfectly fine until I added the multipass. The plane I found on the net,
I think rdb posted it and I changed it to center around (0,0,0). It’s added at the bottom.
My issue is that for some reason not only texture coordinates are wrong. Under certain setups,
when I moved the camera, the two triangles were split up.
The issue, which didn’t happen before, can be seen here:
This is simply …
gl_FragColor = vec4(texcoord0.xy,1,1);
… which should actually look like …
This is the plane.egg:
<CoordinateSystem> { Z-Up }
<VertexPool> vpool {
<Vertex> 0 {
-0.5 0 -0.5
<UV> {
0 0
<Tangent> { 1 0 0 }
<Binormal> { 0 0 1 }
}
<Normal> { 0 -1 0 }
<RGBA> { 1 1 1 1 }
}
<Vertex> 1 {
-0.5 0 0.5
<UV> {
0 1
<Tangent> { 1 0 0 }
<Binormal> { 0 0 1 }
}
<Normal> { 0 -1 0 }
<RGBA> { 1 1 1 1 }
}
<Vertex> 2 {
0.5 0 0.5
<UV> {
1 0
<Tangent> { 1 0 0 }
<Binormal> { 0 0 1 }
}
<Normal> { 0 -1 0 }
<RGBA> { 1 1 1 1 }
}
<Vertex> 3 {
0.5 0 -0.5
<UV> {
1 1
<Tangent> { 1 0 0 }
<Binormal> { 0 0 1 }
}
<Normal> { 0 -1 0 }
<RGBA> { 1 1 1 1 }
}
}
<Polygon> {
<VertexRef> { 0 3 2 <Ref> { vpool } }
}
<Polygon> {
<VertexRef> { 2 1 0 <Ref> { vpool } }
}
I don’t know what’s going on.
What’s wrong?