|
|
@ -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) |
|
|
|