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

pa3 displacement mapping #6

Open
changshou83 opened this issue Sep 24, 2022 · 1 comment
Open

pa3 displacement mapping #6

changshou83 opened this issue Sep 24, 2022 · 1 comment

Comments

@changshou83
Copy link

我认为应该把displacement_fragment_shader中的这段

Vector3f n = (TBN * ln).normalized();
Vector3f p = point +  n * huv * kn;

根据注释修改为

Vector3f p = point +  normal * huv * kn;
Vector3f n = (TBN * ln).normalized();

然后将下面进行着色的代码中的normal修改成上面的n

diffsue[i] = kd[i] * intensity * std::max(0.0f,normal.dot(light_dir)); // 应该修改为n
specular[i] = ks[i] * intensity * std::pow(std::max(0.0f,normal.dot(h)),150); // 应该修改为n
@wheelmaker129
Copy link

我认为应该把displacement_fragment_shader中的这段

Vector3f n = (TBN * ln).normalized();
Vector3f p = point +  n * huv * kn;

根据注释修改为

Vector3f p = point +  normal * huv * kn;
Vector3f n = (TBN * ln).normalized();

然后将下面进行着色的代码中的normal修改成上面的n

diffsue[i] = kd[i] * intensity * std::max(0.0f,normal.dot(light_dir)); // 应该修改为n
specular[i] = ks[i] * intensity * std::pow(std::max(0.0f,normal.dot(h)),150); // 应该修改为n

正确的,因为点是沿着原来的normal方向移动的

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

2 participants