-
Notifications
You must be signed in to change notification settings - Fork 913
get_sphere_uv
does not correspond to its explanation
#533
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
Comments
Thanks for reporting! If you would like, feel free to submit a pull request of your suggested changes to the |
Sure, very solid work by the way. I am also porting the Weekend version to opengl with compute shaders in here |
The PR that was suppose to change the code for implementing the formula above is closed now, because most of the sources I have cited there favor the existing implementation. The wording in this section might be improved to show how we arrive to the implementation of |
Suggest punting to 3.2 |
Also, get_sphere_uv() is in sphere.h for book 2, but hittable.h for book 3. This change also moves the function to sphere.h for book 3. Resolves #533
Fixed in text and code. This addresses the following problems: - Confusion between UV space and texture image space. There were places that assumed Y/V grows, down, others where Y/V grow upwards. Correct UV coordinates have Y/V growing upwards, as in regular 2D Cartesian coordinates. The V coordinate is flipped for texture-map lookup, left alone for all other coordinate uses. - The Y and Z coordinates were confused in several equations. - The text had Y = sin(theta), where it should have been Y = -cos(theta). - There was nothing in the text to explain the rearrangment of atan2() arguments in order to get a continuous 0->2pi return value. I introduced the equivalence formula to get continuous return values. - get_sphere_uv() was in sphere.h for book 2, but hittable.h for book 3. This change also moves the function to sphere.h for book 3. - get_sphere_uv() moved to be a private static method on class sphere. - I am used to (and therefore prefer) phi corresponding to latitude, and theta corresponding to longitude, where the text and code flip these two angles. In a quick search of definitions, it looks like this is yet another case of competing conventions with both sides roughly equal in size. Thus, no clear winner, so I'm leaving this as is. Resolves #533
The function
get_sphere_uv
in NextWeek listing 42 at section Texture 6.1, is given aswhereas in the formula given in the explanation is:
The problem also exist in
dev-major
branch.The text was updated successfully, but these errors were encountered: