This is what I have:
VERTEX:
void main()
{
//entity matrix
mat4 entitymatrix = entity.matrix[gl_InstanceID];
mat4 entitymatrix_ = entitymatrix;
entitymatrix_[0][3]=0.0;
entitymatrix_[1][3]=0.0;
entitymatrix_[2][3]=0.0;
entitymatrix_[3][3]=1.0;
//model position
ex_vertexposition = entitymatrix_ * vec4(vertex_position,1);
gl_Position = projectioncameramatrix * ex_vertexposition;
//clip
float cam = cameraposition.y;
float c = 2 * (cam - ex_vertexposition.y);
vec4 e = ex_vertexposition;
e.y += c;
clipspace = projectioncameramatrix * e;
//normals
mat3 nmat = mat3(entitymatrix_);
ex_normal = normalize(nmat * vertex_normal);
ex_binormal = normalize(nmat * vertex_binormal);
ex_tangent = normalize(nmat * vertex_tangent);
ex_texcoords0 = vertex_texcoords0;
}
FRAGMENT:
void main()
{
//Normal
vec3 normal = ex_normal;
normal = normalize(texture(texture1,ex_texcoords0).xyz * 2.0 - 1.0);
normal = ex_tangent * normal.x + ex_binormal * normal.y + ex_normal * normal.z;
normal = normalize(normal);
vec4 clip = clipspace;
clip.xyz *= vec3(1,-1,1);
clip.x = (clip.x / clip.w) * 0.5 + 0.5;
clip.y = (clip.y / clip.w) * 0.5 + 0.5;
//Reflection
vec4 reflection = texture(texture10,clip.xy)*0.8;
//Diffuse Output
fragData0 = reflection;
}