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

Wrong direction of shading tangents in Triangle::GetShadingGeometry causing wrong bump mapping #61

Closed
z-boson opened this issue Sep 13, 2022 · 1 comment

Comments

@z-boson
Copy link

z-boson commented Sep 13, 2022

In Triangle::GetShadingGeometry the shading tangents ss and ts are calculated, but it seems they have the wrong direction, they point in the opposite direction of dpdu and dpdv.

ss = Normalize(dg.dpdu);
ts = Cross(ss, ns);
ss = Cross(ts, ns);

After the above cross products ss points in the opposite direction of dpdu and ts points in the opposite direction of dpdv. But ss is used as dpdu and ts as dpdv in the shading DifferentialGeometry.

p1 = p0 + u * dpdu + v * dpdv;
// using ss and ts in this formula results in p1 lying in the opposite direction

I have checked the code in pbrt-v4 and there the first formula was changed to ts = Cross(ns, ss); which fixes the problem (pbrt-v3 has the same problem).
Is this correct?

@mmp
Copy link
Owner

mmp commented Sep 18, 2022

Correct!

We left that unfixed in pbrt-v2 since fixing it would have changed rendered images and since many scenes were set up assuming the buggy behavior.

All the more reason to upgrade to pbrt-v3 (or v4!) :-)

@mmp mmp closed this as completed Sep 18, 2022
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