I was under the impression that if one had two identical alpha’d sprites on the screen (same pos,scale) each with an alpha of .5 they would look like a single sprite with an alpha of 1…This does not appear to be the case, and I was wondering if there was a way to make it so both sprites are there but only looks like one…eventually I want to be able to fade text this way, by putting text on the texture/in front of the sprites.
An example:
from pandac.PandaModules import *
import direct.directbase.DirectStart
def createSprite():
vdata = GeomVertexData('', GeomVertexFormat.getV3t2(), Geom.UHStatic)
vertex = GeomVertexWriter(vdata, 'vertex')
uv = GeomVertexWriter(vdata, 'texcoord')
prim = GeomTriangles(Geom.UHStatic)
vertex.addData3f(0, 0, 1)
vertex.addData3f(0, 0, 0)
vertex.addData3f(1, 0, 0)
vertex.addData3f(1, 0, 1)
uv.addData2f(0,0)
uv.addData2f(0,1)
uv.addData2f(1,1)
uv.addData2f(1,0)
prim.addVertices(3,2,0)
prim.addVertices(1,0,2)
prim.closePrimitive()
geom = Geom(vdata)
geom.addPrimitive(prim)
nodepath = NodePath(GeomNode('gnode'))
nodepath.node().addGeom(geom)
nodepath.setTransparency(1)
return nodepath
base.setBackgroundColor(0,0,0,0)
#c1 and c2 are overlayed...together should have an alpha of 1??? (upper right)
c1 = createSprite()
c1.setScale(.5,1,.5)
c1.setAlphaScale(.5)
c1.reparentTo(render2d)
c2 = createSprite()
c2.setScale(.5,1,.5)
c2.setAlphaScale(.5)
c2.reparentTo(render2d)
#alpha of 1 (upper left)
c3 = createSprite()
c3.setScale(.5,1,.5)
c3.setPos(-.51,0,0)
c3.reparentTo(render2d)
#single sprite alpha .5 (bottom left)
c4 = createSprite()
c4.setScale(.5,1,.5)
c4.setPos(-.51,0,-.51)
c4.setAlphaScale(.5)
c4.reparentTo(render2d)
run()