Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maybe ground.vert.ts normal is wrong? #78

Open
ilimei opened this issue Dec 26, 2021 · 0 comments
Open

maybe ground.vert.ts normal is wrong? #78

ilimei opened this issue Dec 26, 2021 · 0 comments

Comments

@ilimei
Copy link

ilimei commented Dec 26, 2021

heightmap is corner.groundHeight + corner.layerHeight - 2.0
cliffHeightMap is corner.groundHeight

and ground.vert.ts

  float hL = texture2D(u_heightMap, vec2(base - vec2(1.0, 0.0)) / (u_size)).a;
  float hR = texture2D(u_heightMap, vec2(base + vec2(1.0, 0.0)) / (u_size)).a;
  float hD = texture2D(u_heightMap, vec2(base - vec2(0.0, 1.0)) / (u_size)).a;
  float hU = texture2D(u_heightMap, vec2(base + vec2(0.0, 1.0)) / (u_size)).a;

  v_normal = normalize(vec3(hL - hR, hD - hU, 2.0));

in hiveWE ground.vert.ts use cliffHeightMap general normal

  float hL = texture2D(cliffHeightMap , vec2(base - vec2(1.0, 0.0)) / (u_size)).a;
  float hR = texture2D(cliffHeightMap , vec2(base + vec2(1.0, 0.0)) / (u_size)).a;
  float hD = texture2D(cliffHeightMap , vec2(base - vec2(0.0, 1.0)) / (u_size)).a;
  float hU = texture2D(cliffHeightMap , vec2(base + vec2(0.0, 1.0)) / (u_size)).a;

  v_normal = normalize(vec3(hL - hR, hD - hU, 2.0));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant