git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10993 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
rem..om 11 years ago
parent dd1fdd6bce
commit 926b634b6e
  1. 9
      engine/src/core-data/Common/MatDefs/Light/Lighting.frag
  2. 2
      engine/src/core-data/Common/MatDefs/Light/Lighting.vert

@ -211,11 +211,14 @@ void main(){
// *********************** // ***********************
#if defined(NORMALMAP) && !defined(VERTEX_LIGHTING) #if defined(NORMALMAP) && !defined(VERTEX_LIGHTING)
vec4 normalHeight = texture2D(m_NormalMap, newTexCoord); vec4 normalHeight = texture2D(m_NormalMap, newTexCoord);
vec3 normal = normalize((normalHeight.xyz * vec3(2.0) - vec3(1.0))); //Note the -2.0 and -1.0. We invert the green channel of the normal map,
//as it's complient with normal maps generated with blender.
//see http://hub.jmonkeyengine.org/forum/topic/parallax-mapping-fundamental-bug/#post-256898
//for more explanation.
vec3 normal = normalize((normalHeight.xyz * vec3(2.0,-2.0,2.0) - vec3(1.0,-1.0,1.0)));
#ifdef LATC #ifdef LATC
normal.z = sqrt(1.0 - (normal.x * normal.x) - (normal.y * normal.y)); normal.z = sqrt(1.0 - (normal.x * normal.x) - (normal.y * normal.y));
#endif #endif
//normal.y = -normal.y;
#elif !defined(VERTEX_LIGHTING) #elif !defined(VERTEX_LIGHTING)
vec3 normal = vNormal; vec3 normal = vNormal;
#if !defined(LOW_QUALITY) && !defined(V_TANGENT) #if !defined(LOW_QUALITY) && !defined(V_TANGENT)

@ -171,7 +171,7 @@ void main(){
vec3 wvTangent = normalize(g_NormalMatrix * modelSpaceTan); vec3 wvTangent = normalize(g_NormalMatrix * modelSpaceTan);
vec3 wvBinormal = cross(wvNormal, wvTangent); vec3 wvBinormal = cross(wvNormal, wvTangent);
mat3 tbnMat = mat3(wvTangent, wvBinormal * -inTangent.w,wvNormal); mat3 tbnMat = mat3(wvTangent, wvBinormal * inTangent.w,wvNormal);
//vPosition = wvPosition * tbnMat; //vPosition = wvPosition * tbnMat;
//vViewDir = viewDir * tbnMat; //vViewDir = viewDir * tbnMat;

Loading…
Cancel
Save