i' m implementing real time skin rendering using lightmap blurring like in ATI Ruby demo, i have found presentation slides from GDC 04-05, and a chapter in GPU gems1 about that
http://ati.amd.com/developer/gdc/Gosselin_skin.pdf
http://ati.amd.com/developer/siggraph04/Sander_SkinSketch.pdf
and discussed in thread
http://www.beyond3d.com/forum/archive/index.php/t-10661.html
here is UV parametrization of the mesh( it is not perfect )
pic1:
alpha channel of a texture used in blur shader to know where sampling outside boundaries
pic2:
my problems come after blurring lightmap: due to large filter kernel 9x9 and subsequent blur pass, texture seams become evident (black eyes and mouth countours)
pic3:
relevant code snippet of lightmap computation fragment shader
alphaMap is pic2
blurring fragment shader(vertical same as horizontal):
skinSamp1 is the light map
i implemented dilation filter like explained in ATI presentation but with wrong result.
alphaMap is same resolution of lightMap
any ideas to remove these artifacts due to several blurring pass?
thanks
http://ati.amd.com/developer/gdc/Gosselin_skin.pdf
http://ati.amd.com/developer/siggraph04/Sander_SkinSketch.pdf
and discussed in thread
http://www.beyond3d.com/forum/archive/index.php/t-10661.html
here is UV parametrization of the mesh( it is not perfect )
pic1:
alpha channel of a texture used in blur shader to know where sampling outside boundaries
pic2:
my problems come after blurring lightmap: due to large filter kernel 9x9 and subsequent blur pass, texture seams become evident (black eyes and mouth countours)
pic3:
relevant code snippet of lightmap computation fragment shader
alphaMap is pic2
Code:
gl_FragColor.rgb = AshikShirDiff(NdotL, dot(N, V), lightColor );
gl_FragColor.a = texture2D(alphaMap, gl_TexCoord[0].st).a; //1 outside texture boundaryes
skinSamp1 is the light map
Code:
vec4 weight[5] = {
{0.021, 0.0, 0.0, 1.0},
{0.07, 0.0, 0.0, 1.0},
{0.13, 0.086, 0.086, 1.0},
{0.179, 0.244, 0.244, 1.0},
{0.2, 0.33, 0.33, 1.0},
};
vec4 mainCol = texture2D(skinSamp1, vec2(gl_TexCoord[0].s,gl_TexCoord[0].t)) * weight[4];
vec4 OutCol = mainCol;
float flag = OutCol.a;
vec4 currCol = texture2D(skinSamp1, vec2(gl_TexCoord[0].s+ TexelIncrement * 4.0,gl_TexCoord[0].t)) * weight[0];
OutCol += currCol ;
flag = max(flag, currCol.a);
if (currCol.a < mainCol.a)
mainCol = currCol;
currCol = texture2D(skinSamp1, vec2(gl_TexCoord[0].s+ TexelIncrement * 3.0,gl_TexCoord[0].t)) * weight[1];
OutCol += currCol ;
flag = max(flag, currCol.a);
if (currCol.a < mainCol.a)
mainCol = currCol;
currCol = texture2D(skinSamp1, vec2(gl_TexCoord[0].s+ TexelIncrement * 2.0,gl_TexCoord[0].t)) * weight[2];
OutCol += currCol ;
flag = max(flag, currCol.a);
if (currCol.a < mainCol.a)
mainCol = currCol;
currCol = texture2D(skinSamp1, vec2(gl_TexCoord[0].s+ TexelIncrement * 1.0,gl_TexCoord[0].t)) * weight[3];
OutCol += currCol ;
flag = max(flag, currCol.a);
if (currCol.a < mainCol.a)
mainCol = currCol;
currCol = texture2D(skinSamp1, vec2(gl_TexCoord[0].s- TexelIncrement * 1.0,gl_TexCoord[0].t)) * weight[3];
OutCol += currCol ;
flag = max(flag, currCol.a);
if (currCol.a < mainCol.a)
mainCol = currCol;
currCol = texture2D(skinSamp1, vec2(gl_TexCoord[0].s- TexelIncrement * 2.0,gl_TexCoord[0].t)) * weight[2];
OutCol += currCol ;
flag = max(flag, currCol.a);
if (currCol.a < mainCol.a)
mainCol = currCol;
currCol = texture2D(skinSamp1, vec2(gl_TexCoord[0].s- TexelIncrement * 3.0,gl_TexCoord[0].t)) * weight[1];
OutCol += currCol ;
flag = max(flag, currCol.a);
if (currCol.a < mainCol.a)
mainCol = currCol;
currCol = texture2D(skinSamp1, vec2(gl_TexCoord[0].s- TexelIncrement * 4.0,gl_TexCoord[0].t)) * weight[0];
OutCol += currCol ;
flag = max(flag, currCol.a);
if (currCol.a < mainCol.a)
mainCol = currCol;
if (flag == 1.0)
gl_FragColor = vec4(mainCol.xyz, 1.0);
else gl_FragColor = vec4(OutCol.xyz, 0.0);
alphaMap is same resolution of lightMap
any ideas to remove these artifacts due to several blurring pass?
thanks
Last edited by a moderator: