Use specular factor of bumpspec map (alpha channel) to modulate reflection factor
This commit is contained in:
parent
d734e32bd5
commit
ee8d70b3bf
2 changed files with 6 additions and 6 deletions
|
@ -39,9 +39,9 @@ void main (void)
|
||||||
float NdotL, NdotHV;
|
float NdotL, NdotHV;
|
||||||
vec4 color = constantColor;
|
vec4 color = constantColor;
|
||||||
vec4 specular = vec4(0.0);
|
vec4 specular = vec4(0.0);
|
||||||
vec4 ns = texture2D(NormalTex, gl_TexCoord[0].st);
|
vec4 ns = texture2D(NormalTex, gl_TexCoord[0].st);
|
||||||
vec3 n = ns.rgb * 2.0 - 1.0;
|
vec3 n = ns.rgb * 2.0 - 1.0;
|
||||||
n = normalize(n.x * VTangent + n.y * VBinormal + n.z * VNormal);
|
n = normalize(n.x * VTangent + n.y * VBinormal + n.z * VNormal);
|
||||||
NdotL = max(0.0, dot(n, lightDir));
|
NdotL = max(0.0, dot(n, lightDir));
|
||||||
|
|
||||||
// calculate the specular light
|
// calculate the specular light
|
||||||
|
@ -97,7 +97,7 @@ void main (void)
|
||||||
reflFactor = (gl_FrontMaterial.shininess / 128) + transparency_offset;
|
reflFactor = (gl_FrontMaterial.shininess / 128) + transparency_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
reflFactor = clamp(reflFactor, 0.0, 1.0);
|
reflFactor = clamp(reflFactor, 0.0, 1.0) * ns.a;
|
||||||
|
|
||||||
// set ambient adjustment to remove bluiness with user input
|
// set ambient adjustment to remove bluiness with user input
|
||||||
float ambient_offset = clamp(ambient_correction, -1.0, 1.0);
|
float ambient_offset = clamp(ambient_correction, -1.0, 1.0);
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
varying vec4 rawpos;
|
varying vec4 rawpos;
|
||||||
varying vec4 ecPosition;
|
varying vec4 ecPosition;
|
||||||
varying vec3 VNormal;
|
varying vec3 VNormal;
|
||||||
varying vec3 VTangent;//////////////
|
varying vec3 VTangent;
|
||||||
varying vec3 VBinormal;/////////////
|
varying vec3 VBinormal;
|
||||||
varying vec3 Normal;
|
varying vec3 Normal;
|
||||||
varying vec4 constantColor;
|
varying vec4 constantColor;
|
||||||
varying vec3 vViewVec;
|
varying vec3 vViewVec;
|
||||||
|
|
Loading…
Reference in a new issue