mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 22:09:19 +02:00
Cleanup of vertex shader by @tmj.
2-channel normalmaps with Z-component reconstruction. Normal vectors passed from fragment shaders to lightning calculations.
This commit is contained in:
@@ -33,6 +33,8 @@ uniform sampler2DShadow shadowmap;
|
||||
uniform samplerCube envmap;
|
||||
#endif
|
||||
|
||||
vec3 normal;
|
||||
|
||||
#define NORMALMAP
|
||||
#include <light_common.glsl>
|
||||
#include <tonemapping.glsl>
|
||||
@@ -44,7 +46,10 @@ void main()
|
||||
if (tex_color.a < opacity)
|
||||
discard;
|
||||
|
||||
vec3 normal = normalize(f_tbn * normalize(texture(normalmap, f_coord).rgb * 2.0 - 1.0));
|
||||
normal.xy = (texture(normalmap, f_coord).rg * 2.0 - 1.0);
|
||||
normal.z = sqrt(1 - clamp((dot(normal.xy, normal.xy)), 0.0, 1.0));
|
||||
normal = normalize(f_tbn * normalize(normal.xyz));
|
||||
//vec3 normal = normalize(f_tbn * normalize(texture(normalmap, f_coord).rgb * 2.0 - 1.0));
|
||||
vec3 refvec = reflect(f_pos.xyz, normal);
|
||||
#if ENVMAP_ENABLED
|
||||
vec3 envcolor = texture(envmap, refvec).rgb;
|
||||
|
||||
Reference in New Issue
Block a user