Repository navigation
fix: preserve vertex attributes with smooth normals - #9233
davepagurek merged 10 commits into
Conversation
davepagurek
left a comment
There was a problem hiding this comment.
Logic looks good! To confirm that the normals themselves haven't changed since before, would you be up for adding a visual test with maybe normalMaterial() on a shape with computeNormals(SMOOTH) applied so that we can more easily visually inspect it? If you need some example geometry, there's an example sketch in the "smooth shading" section of https://p5js.org/tutorials/custom-geometry/ that we could borrow.
| uniqueVertices.push(vertex); | ||
| } | ||
|
|
||
| originalToUnique[i] = vertexIndices[key]; |
sure |
hey @davepagurek added the requested visual test for computeNormals(SMOOTH) using normalMaterial() on the warped tube geometry from the smooth shading example. |
|
Hi @Srinidhi444! When you add visual tests, you have to run them locally and commit the image files that get added to the project. The idea is that those images remain checked into source control so that when future changes happen, the tests are rerun and compared to those images to make sure that nothing breaks. |
hey @davepagurek my bad didn't knew that i have committed the necessary changes let me know if they are correct. |
|
davepagurek
left a comment
There was a problem hiding this comment.
Good catch, thanks @Srinidhi444! I think this is good to go.
|
@all-contributors please add @Srinidhi444 for code |
|
I've put up a pull request to add @Srinidhi444! 🎉 |
|
@Srinidhi444 are you interested in making follow-up issues for the next steps mentioned in #9205 ? Feel free to do so + also work on them if you're up for it! |
@davepagurek yes sure i will understand them first properly and then will come with a approach and then will let you know |
|
Hey @davepagurek! I wanted to confirm my understanding of the remaining improvements mentioned in #9205 before creating the follow-up issues. From what I understand, there are two main changes left: 1. Rename The first change would be to introduce Just wanted to clarify one thing here: is the plan to keep 2. Introduce The second change would be to implement actual flat shading, which, from my understanding, is somewhat the opposite of what we did for My current understanding of the approach is:
Something like this, if I'm understanding it correctly: 3. Selective smoothing / sharp edges I also saw your suggestion about allowing some edges to remain sharp while others are smoothed, possibly through an additional options object. I haven't explored this part deeply yet, as I think it would require some more thought and investigation. For now, I was planning to focus on the first two improvements and revisit this later. Regarding the follow-up issues and PRs: I was thinking of creating two separate issues and two separate PRs:
Thanks! |
Right, we could then remove it in the net major version of p5 (3.0) whenever that happens (sooner than 2.0 came after 1.0 though!) Generally we try to not make breaking changes in minor or patch versions, so while we can nudge people off of old things, people can update minor versions without worrying about having to update old sketches. Your understanding of SEGMENTED matches mine. Thanks for the diagram too! Possibly we could create another issue as well for the idea of keeping some edges hard while smoothing others, but we can also wait until we have a more concrete idea. (Could also be worth posting in Discord about it casually in case anyone else has one or is interested in thinking about it.) Anyway everything you mentioned sounds good, go ahead! |
Got it, thanks for the clarification @davepagurek! I'll start working on the first two issues. Regarding the selective smoothing idea (keeping some edges sharp while smoothing others), I was thinking of bringing it up on Discord after the first two changes are done. That way, we can avoid potentially overlapping implementations or unnecessary merge conflicts if someone starts working on it simultaneously. I'd also be happy to take up that issue later maybe. Let me know if that sounds good! |






Resolves #9205
Changes:
computeNormals(SMOOTH)so it no longer permanently deduplicates geometry vertices based only on position.Screenshots of the change:

PR Checklist
npm run lintpasses