changed the definition of the geometry texture(normal + depth) using a GL_RGBA16 texture.

tuned some parameters in ssao.frag and added a control on blur.frag to remove white fragments
This commit is contained in:
Paolo Cignoni cignoni 2009-07-28 16:44:56 +00:00
parent 4fb905ca58
commit 0ecb9530b0
3 changed files with 9 additions and 5 deletions

View File

@ -17,6 +17,10 @@ void main() {
if(scale.y == 0.0)
gl_FragColor = color;//vec4(color.xyz, 0.5);
else
gl_FragColor = vec4(color.xyz, 0.5);
if (color.x > 0.8)//{
discard;
else
gl_FragColor = gl_FragColor = vec4(vec3(0.0), (0.8 - color.x));
//gl_FragColor = vec4(color.xyz, 0.0);//(0.5 - color.x));
}

View File

@ -3,7 +3,7 @@ uniform sampler2D normalMap;
varying vec4 texCoord;
const float totStrength = 5.38;
const float totStrength = 5.0;
const float strength = 0.7;
const float offset = 18.0;
const float falloff = 0.000002;

View File

@ -84,7 +84,7 @@ void SSAO::runShader(MeshModel& m, GLArea* gla){
RenderMode rm = gla->getCurrentRenderMode();
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m.Render(rm.drawMode, vcg::GLW::CMNone, vcg::GLW::TMNone);
m.Render(vcg::GLW::DMSmooth, vcg::GLW::CMNone, vcg::GLW::TMNone);
//this->printColorMap(this->_normalMap, "_normalMap.png");
//this->unbind();
glUseProgram(0);
@ -117,7 +117,7 @@ void SSAO::runShader(MeshModel& m, GLArea* gla){
m.Render(rm.drawMode, rm.colorMode, vcg::GLW::TMNone);
//this->printColorMap(this->_ssao, "_ssao.png");
this->printColorMap(this->_ssao, "_ssao.png");
//this->unbind();
/*glEnable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
@ -247,7 +247,7 @@ bool SSAO::setup()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F_ARB, this->_texSize, this->_texSize, 0, GL_RGB, GL_FLOAT, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_texSize, this->_texSize, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, this->_texSize, this->_texSize, 0, GL_RGBA, GL_FLOAT, NULL);
//attacco al FBO la texture di colore
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, this->_normalMap, 0);