My opengl shader not working since latest revisions

I have written my own shader that composites 2 textures together using an alpha channel with some internal ramping/adjusting of the alpha values.



SInce the new revisions from alpha 3, it’s playing havoc with me.



This is my setup,

I have 2 viewports rendering into their own framebuffers, I use the textures from these to map onto 2 quads rendered in ortho to composite for final rendering.



ViewPort view1 = renderManager.createMainView(“view 1”, cam);

view1.setClearEnabled(true);

view1.setBackgroundColor(ColorRGBA.Black);

view1.setOutputFrameBuffer(frameBuffer1);



//same for view 2



(both views have fog enabled also)



When I’m rendering my 2 quads together, the top quad has my shader which only renders the texture sent to it using a separate texture sent to it as the alpha channel. The first big problem is that the shader is stoping the top quad being rendered at all! , but instead rendering into the quad below - which doesn’t have the shader attached to it.



this my shader code



// zblend.j3md

MaterialDef My MaterialDef {

MaterialParameters {

Texture2D Alpha

Texture2D Tex

}

Technique {

VertexShader GLSL100: MatDefs/zblend.vert

FragmentShader GLSL100: MatDefs/zblend.frag

WorldParameters {

WorldViewProjectionMatrix

}

}

}



// zblend.vert

uniform mat4 g_WorldViewProjectionMatrix;

in vec4 inPosition;

in vec2 inTexCoord;

out vec2 texCoord;

void main(){

gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);

texCoord = inTexCoord;

}



// zblend.frag

uniform sampler2D Alpha;

uniform sampler2D Tex;



varying vec2 texCoord;

const float mn=0.92;

const float mx=0.94;



void main(){

vec4 atex = texture2D( Alpha, texCoord.xy );

vec4 mtex = texture2D( Tex, texCoord.xy );

float val=atex.r;

float mul=1.0/(mx-mn);

float newval=val;



newval=(val-mn)*mul;

if (val>mx)

{

newval=1.0;

}

if (val<mn)

{

newval=0.0;

}

gl_FragColor = vec4(mtex.r,mtex.g,mtex.b,1.0-newval);

}



Like I said, it all worked okay before the latest revisions.

Thanks.

Do you have more than one light?

Could you try to undo the revision 6566 and see if it works?

http://code.google.com/p/jmonkeyengine/source/diff?spec=svn6566&r=6566&format=side&path=/branches/jme3/src/core/com/jme3/material/Material.java



I have a similar issue, maybe it’s the problem

I have no lights at all, all simpletextured materials (pre baked lit textures).



will try the revision now anyway.

erm sorry - how do I go about reverting to the previous version of this file?

actually - probably best I just write a new shader using one of the ones that already work as a starting point.