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

Assignment 4 #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

katvonseggern
Copy link

No description provided.

Please put your name here:
**Name:** .......

**Name:** Katrin von Seggern & Jordan Streete
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear Katrin, dear Jordan, I asked you to submit separate solutions. I will count this submission only as the submission of Katrin.

@@ -35,7 +35,8 @@ Proceed as follows:
6. Extend your code in ```CSolidSphere``` constructor in such a way that the triangles will be created with the additional normals. Calculate these normals (_e.g._ using the spherical coordinate system) and pass them within the triangles' and quads' constructors.
7. Test your implementation on the scene from Problem 1. Compare the difference between the Solid and Primitive spheres. Explain below why smoothed cone looks strange. How would you fix it?

**Explanation and Suggestion:** ...
**Explanation and Suggestion:**
For the top vertex, we would take quads but since it is not in this code, it chooses a triangle. The smoothed cone was actually not completely smooth and even when we added in the height segment from the sample code, it was a bit bumpy. This might be because there are some areas of the original cone that are already smoothed but are then smoothed again. By adding the bool "smooth" in it as in the sample code, we would check for this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that you can assign only one normal to the top vertex, per triangle. Thus smooth transitions are not possible. To reduce the effect of faced shape, one can use the technique of multiple height segments. This will reduce the the effect of faced shape to the top segments.

if (isnan(phi)) {
phi = 0;
}
return Vec2f((Pif + phi) / (2 * Pif), theta / Pif);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be return Vec2f(-0.5f * phi / Pif, theta / Pif); here

size_t height_segments = sides / 2;
for (int h = 0; h < height_segments - 1; h++) {
float h1 = static_cast<float>(h + 1) / height_segments; // Next height: [1/height_segments; 1]
add(std::make_shared<CSolidQuad>(pShader,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually you do not need to use quads in construction of the cone. I think this is exactly the reason why texturing did not work.

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

Successfully merging this pull request may close these issues.

2 participants