Buffers and Alphas

I’m projecting a texture composed in a texture buffer and now I’d like it to have a fuzzy border.

I tried to do this like this:

altBuffer.getTexture().setAlphaFilename('mask4.png')

but it has no apparent effect.

I could project another texture but that’s just one to many for my gpu

        mask=loader.loadTexture('mask6.png')
        mask.setWrapU(Texture.WMBorderColor  )
        mask.setWrapV(Texture.WMBorderColor  )
        mask.setBorderColor(Vec4(0,0,0,0)) 
        fog_ts=TextureStage('ts')
        fog_ts.setMode(TextureStage.MModulate) 
        self.terrain.projectTexture(fog_ts , mask, self.altCam)
:gobj(error): created-shader: (21) : error C5102: output semantic attribute "TEX
COORD" has too big of a numeric index (8)
:gobj(error): Shader encountered an error.

…but even if I could, I can’t because my frame buffer texture has some strange alpha data anyway (even with alpha-bits 0)
Screen:

So… how can I remove all alpha data from a texture buffer (spawned with makeTextureBuffer())? Or even better how can I replace the alpha channel from said buffer with a image (loaded from a file)?

I can provide the whole program that I’m working on if what I’m saying ain’t clear.

So far I’ve tested:
-alpha-bits 0 in prc
-framebuffer-alpha #f in prc
-fbp=FrameBufferProperties() fbp.setAlphaBits(0) and passing it to makeTextureBuffer()
-setAlphaFilename() on the texture returned from makeTextureBuffer()
-setFormat(Texture.FRgb) on the texture returned from makeTextureBuffer()

The frame buffer still reports 'depth_bits=1 color_bits=1 alpha_bits=8 stencil_bits=1 force_hardware=1’the texture still is ugly.

I’m not sure if I’m encountering a bug of some sort, or am I (again)trying to do something that I should not.

You should set the background colour of the buffer to a colour with non-alpha value.

What do you use for applying the texture onto the terrain? If you’re using a shader, make sure it’s writing 1 as alpha value of the fragment.

No shaders, at least no custom shaders.

The texture is something (layers of simple textured planes with alpha masks) viewed by a camera, put to a buffer and projected onto the terrain mesh:

altBuffer=mainWindow.makeTextureBuffer("modulate_tex_buffer", 2048, 2048)
self.altCam=base.makeCamera(altBuffer)
self.terrain.projectTexture(TextureStage('color'), altBuffer.getTexture(), self.altCam)

…and I’m not sure how to set a background color for the buffer.

What I have is this (modulate texture from the buffer):

what I’d like to have is this, but with color (white texture with alpha, loaded from file):

Maybe there’s some other trick to do this?

Solved!
I so proud of myself, I’ve written my first, very own fragment shader!

void fshader(float2 l_texcoord0 : TEXCOORD0,
             out float4 o_color : COLOR,
             uniform sampler2D k_tex : TEXUNIT0,
             uniform sampler2D k_mask : TEXUNIT1)
{
    float4 c = tex2D(k_tex, l_texcoord0);
    float4 a = tex2D(k_mask, l_texcoord0);
    
    o_color = float4(c.x, c.y, c.z, a.a);
}

Not sure if it’s the best way to replace the buffers alpha channel with one loaded from a file, but hey! It works!

I’ll post a demo of what I’ve made, just few more tweaks.