I've been working on some 2d soft shadows. It works ok on several ATI cards, tested on 4 different models so far.
But on NVIDIA (3 different models) it behaves differently
So first here's the problem
[attachment=7917:problem_ati_nvidia.png]
Here's how I'm doing it
//BeginDraw
//
// accumulate lighting in a texture
//
glClearColor(0.1f,0.1f,0.1f,0.0f);
// Set viewport to texture size
glViewport(0,0,512,512);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//loop all lights
glColorMask(false, false, false, true);
glClear(GL_COLOR_BUFFER_BIT);
// write shadow volumes to alpha
glBlendFunc(GL_ONE, GL_ONE);
glDisable(GL_TEXTURE_2D);
// Here I draw all the shadows projections
for (bsSize b = 0; b<_lightBlockers.size(); ++b)
{
renderShadow(light, _lightBlockers);
}
//// draw light
glColorMask(true, true, true, false);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE); // <--- I think this might be the problem
// Switching to glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); results in the image below this code
// I draw a quad with the light texture
//end loop lights
//
// copy lighting into a texture
//
glBindTexture(GL_TEXTURE_2D, texID);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 0, 0, 512, 512, 0);
// apply lighting by rending light texture on top
//
glBlendFunc(GL_DST_COLOR, GL_ZERO);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,texID);
// Simple quad drawing with the texture
However, switching to glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE); to glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);
gives me the same result on both cards, but obviously I don't want that effect, it's ugly
[attachment=7918:problem_ati_nvidia2.png]
Can anyone help me out?
Thanks