genmesh
genmesh copied to clipboard
Generate texture coordinates
This feature appears to me to be the most controversial, for the following reasons:
- there is no single way to generate UV unwraps, contrary to how positions and normals are generated
- handling UV seams is somewhat difficult/inconvenient from the implementation point of view
- users are very sensitive to how exactly UVs are laid out
I vaguely suggest the following solution:
- separate generator structs from iterators. Thus users will call
cube.iter()
orcube.iter_uv
to get different iterators. - don't implement UV for the
SharedVertex
logic, since it's too much headache, and the users can always useLruIndexer
to compute those, if needed. Perhaps, we could have a helper to do this semi-automatically? - stick to Three.js UV layout convention. This also sparks the question of vertex positions should follow the same order.
Any opinions? @csherratt @ozkriff @brendanzab
I ran into this problem while using Amethyst. I wouldn't have had a problem if the texture coordinates for a sphere were simply the latitude and longitude scaled to 0..1.
It would be perfectly fine to me to have to write the shape and UV generation myself but it would be useful to have helper functions available for computing tangents etc.