Skip to content

Commit

Permalink
glsl/parallax: apply offset on glowmap too
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed Mar 13, 2019
1 parent 6a5a84c commit 1419ca6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/engine/renderer/glsl_source/lightMapping_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void main()
vec3 viewDir = normalize(u_ViewOrigin - var_Position);

vec2 texDiffuse = var_TexDiffuseGlow.st;
vec2 texGlow = var_TexDiffuseGlow.pq;
vec2 texNormal = var_TexNormalSpecular.st;
vec2 texSpecular = var_TexNormalSpecular.pq;

Expand All @@ -61,6 +62,7 @@ void main()
vec2 texOffset = ParallaxTexOffset(u_NormalMap, texNormal, u_DepthScale, u_OffsetBias, viewDir, tangentToWorldMatrix);

texDiffuse += texOffset;
texGlow += texOffset;
texNormal += texOffset;
texSpecular += texOffset;
#endif // USE_PARALLAX_MAPPING
Expand Down Expand Up @@ -102,7 +104,7 @@ void main()
}
computeDLights( var_Position, N, viewDir, diffuse, specular, color );

color.rgb += texture2D(u_GlowMap, var_TexDiffuseGlow.pq).rgb;
color.rgb += texture2D(u_GlowMap, texGlow).rgb;

// convert normal to [0,1] color space
N = N * 0.5 + 0.5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void main()
vec3 viewDir = normalize(u_ViewOrigin - var_Position);

vec2 texDiffuse = var_TexDiffuse.st;
vec2 texGlow = var_TexGlow;

mat3 tangentToWorldMatrix = mat3(var_Tangent.xyz, var_Binormal.xyz, var_Normal.xyz);

Expand All @@ -97,6 +98,7 @@ void main()
vec2 texOffset = ParallaxTexOffset(u_NormalMap, texNormal, u_DepthScale, u_OffsetBias, viewDir, tangentToWorldMatrix);

texDiffuse += texOffset;
texGlow += texOffset;
texNormal += texOffset;
texSpecular += texOffset;
#endif // USE_PARALLAX_MAPPING
Expand Down Expand Up @@ -145,7 +147,7 @@ void main()
color.rgb += 0.7 * emission;
#endif

color.rgb += texture2D(u_GlowMap, var_TexGlow).rgb;
color.rgb += texture2D(u_GlowMap, texGlow).rgb;

// convert normal to [0,1] color space
N = N * 0.5 + 0.5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ void main()
vec2 texOffset = ParallaxTexOffset(u_NormalMap, texNormal, u_DepthScale, u_OffsetBias, viewDir, tangentToWorldMatrix);

texDiffuse += texOffset;
texGlow += texOffset;
texNormal += texOffset;
texSpecular += texOffset;
#endif // USE_PARALLAX_MAPPING
Expand Down

0 comments on commit 1419ca6

Please sign in to comment.