processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.11k stars 3.22k forks source link

Fix vertices with different texture coordinates in imported models getting collapsed #6923

Closed davepagurek closed 3 months ago

davepagurek commented 3 months ago

Resolves https://github.com/processing/p5.js/issues/6921

Changes

Previously, when importing models, p5.Geometry vertices were being reused whenever a vertex position + material gets reused in the OBJ code. However, vertex position + color alone are not all that's included in p5.Geometry vertices: it also includes texture position and normals. By not accounting for this, some vertex texture coordinates were being collapsed, leading to interpolation of textures and normals where there should be a seam.

Screenshots of the change

image

https://editor.p5js.org/davepagurek/sketches/Y1ui2XK_n

PR Checklist

Qianqianye commented 3 months ago

Thanks @davepagurek!