Skip to content

Commit

Permalink
Fix texture shift computation
Browse files Browse the repository at this point in the history
  • Loading branch information
tansly committed Jan 5, 2020
1 parent f2c2d75 commit 74757af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assignments/hw3/src/shader.vert
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ out vec3 VertexNormal;
vec3 ComputeNeighbor(in vec3 Offset)
{
vec3 NeighborPosition = Position + Offset;
vec2 NeighborTextureCoordinate = vec2((-NeighborPosition.x + TextureHorizontalShift) / TextureWidth,
-NeighborPosition.z / TextureHeight);
vec2 NeighborTextureCoordinate = vec2(-NeighborPosition.x + TextureHorizontalShift / TextureWidth,
-NeighborPosition.z);
vec4 NeighborHeightMapColor = texture(HeightMap, NeighborTextureCoordinate);
float Height = HeightFactor * NeighborHeightMapColor.r;
NeighborPosition.y = Height;
Expand Down

0 comments on commit 74757af

Please sign in to comment.