IIRC, that plug-in already uses a shader to produce its effect.
Anyhow, here's a short example I've thrown together ... I haven't touched shaders in far too long
limb alpha.fx:
float4 diffuse={1.0, 1.0, 1.0, 1.0};
float alpha=1.0;
float4 gendiffuse()
{
diffuse.a=alpha;
return diffuse;
}
technique t0
{
pass p0
{
MaterialAmbient = {1.0, 1.0, 1.0, 1.0};
MaterialDiffuse = gendiffuse();
AlphaBlendEnable = TRUE;
SrcBlend = BOTHSRCALPHA;
AlphaOp[0] = SELECTARG1;
AlphaArg1[0] = DIFFUSE;
}
}
limb alpha.dba:
sync on
sync rate 60
` Make a cube mesh
make object cube 1, 1
make mesh from object 1, 1
delete object 1
` create a texture
box 0, 0, 256, 256, rgb(255, 0, 0), rgb(0, 255, 0), rgb(255, 255, 0), rgb(0, 0, 255)
get image 1, 0, 0, 256, 256
` Load the effect
load effect "limb alpha.fx", 1, 0
` Create a multi-limbed object
begin new object
add new limb from mesh 1
set new limb texture 1
add new limb from mesh 1
set new limb texture 1
set new limb offset 2.0, 0.0, 0.0
finish new object 1
` Apply the effect to the limb
set limb effect 1, 1, 1
` Background object to ensure blending is correct
make object plane 2, 100.0, 100.0
position object 2, 0.0, 0.0, 10.0
point object 2, 0.0, 0.0, 0.0
color object 2, rgb(0, 255, 255)
` Position the camera
position camera 1.0, 1.0, -10.0
point camera 1.0, 0.0, 0.0
alpha = 255
do
if upkey() and alpha < 255 then inc alpha
if downkey() and alpha > 0 then dec alpha
set effect constant float 1, "alpha", (alpha / 255.0)
set cursor 0, 0
text 0, 0, "Limb alpha level = " + str$(alpha)
sync
loop
[edit]
Minor change to shader to use defined constants instead of numbers on SrcBlend and DestBlend for readability.
And another to remove unnecessary operations, plus minor improvement to the demo code (background object).