Skip to content

Commit

Permalink
UPBGE: Temporary fix for parallax discard option
Browse files Browse the repository at this point in the history
Since parallax refactor, the discard option didn't worked as expected.
This commit restores the previous behaviour of discard option.

Later, we'll maybe work on a better discard option that takes into account
other geometry than planes (parallax on square surfaces)
  • Loading branch information
youle31 committed Dec 15, 2016
1 parent bf451ca commit 20be643
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/blender/gpu/shaders/gpu_shader_material.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -3845,12 +3845,12 @@ void parallax_out(vec3 texco, vec3 vp, vec4 tangent, vec3 vn, vec3 size, mat3 ma
vec2 finaltexuv = mix(texuv, texuvprelay, weight);

// Discard if uv is out of the range 0 to 1.
const vec2 clampmin = vec2(0.0);
const vec2 clampmax = vec2(1.0);
const vec2 clampmin = vec2(-0.5);
const vec2 clampmax = vec2(0.5);

if ((discarduv == 1.0) &&
(finaltexuv.x < clampmin.x || finaltexuv.x > clampmax.x ||
finaltexuv.y < clampmin.y || finaltexuv.y > clampmax.y))
(finaltexuv.x - 0.5 < clampmin.x * size.x || finaltexuv.x - 0.5 > clampmax.x * size.x ||
finaltexuv.y - 0.5 < clampmin.y * size.y || finaltexuv.y - 0.5 > clampmax.y * size.y))
{
discard;
}
Expand Down

0 comments on commit 20be643

Please sign in to comment.