[GLSL] Bump map compression? - artefact

Started by
-1 comments, last by furrymaster 13 years, 7 months ago
Hi, i have next problem, now with bump mapping at deferred lighting. Heres screen with artefact:

As you can see my shader makes some kind of marks of bump mapping.

Do u have any advice what kind of my mistake can it be?

here`s my pre (pixel)shader:
varying vec3 normal;varying vec3 tangentS;varying vec3 tangentT;varying vec3 position;varying vec2 texCoord;varying float depth;uniform sampler2D baseTex;uniform sampler2D normalTex;void main() {		vec3 bumpNormal = texture2D( normalTex, texCoord).xyz * 2.0 - 1.0;//bump map load	vec4 base = texture2D( baseTex, texCoord);		bumpNormal = bumpNormal.x * tangentS + bumpNormal.y * tangentT + bumpNormal.z * normal;	bumpNormal = faceforward( bumpNormal, normalize(position), bumpNormal);	normalize(bumpNormal);	bumpNormal= bumpNormal* 0.5 + 0.5;	gl_FragData[0] = vec4( bumpNormal.xy,depth*(bumpNormal.z<0?-1:1),base.a);//here i keep xy normals and depth with sign of normals.z	gl_FragData[1] = vec4( base.rgb,1.0);//material	}


And my dirLight (pixel) shader:
#version 120#extension GL_ARB_draw_buffers : require#extension GL_EXT_gpu_shader4 : requireuniform sampler2D normalDepthTex;uniform sampler2D materialTex;uniform vec3 lightDir;//=vec3( 0.57735);uniform vec3 lightColor;//=vec3(0,1.0,0);void main() {        vec4 normal = texture2D( normalDepthTex, gl_TexCoord[0].xy);    vec4 mat = texture2D( materialTex, gl_TexCoord[0].xy);    normal.z=sqrt(1-normal.x*normal.x-normal.y*normal.y)*(normal.z<0?-1:1);//get real normal.z value from xy, because in normal.z i have coded depth, i`m only getting sign of z value(which is depth)    vec3 bumpNormal = normal.xyz* 2.0 - 1.0;;    float d = dot( lightDir, bumpNormal);    d = max( 0.0, d) + 0.2;    d = min( mat.w, d);        gl_FragColor = vec4( (d*mat.rgb )*lightColor,1.0);//lightColor is green as u can see at the screen}


Thanks for any useful advices(how should i resolve this problem).
If I helped you rate me

This topic is closed to new replies.

Advertisement