|
Post by trejkaz on Jul 14, 2021 1:29:40 GMT
The bonus texture mapping chapter led me to build a design where TextureMap extends Pattern and contains a UVPattern and a UVMap. UVMap.get receives a point in object space and returns the UV. UVPattern.get handles the UV to Color lookup. UVImage extends UVPattern to implement this for textures. So now I'm looking at what I'd have to do to support this for models, but here, the UV coordinates are stored in the actual triangle. I could come up with a mapping function which can determine this for a single triangle. But I can see problems: - I'm going to have a different UVMap for every single triangle, which is going to cost memory.
- It's a lot of computation considering that the triangle already comes with the UVs for each vertex.
- If I ever implement skinning it may break this entire design... but I haven't thought about how to implement that.
An alternative thought I had was that maybe instead of a Material having a Pattern, a Shape itself should be a UVMap and all patterns should be UV patterns? Yet another thought was that maybe I should abstract it right back to a Shape just knowing how to produce a Color for a point in object space. Some mapping schemes (e.g. triplanar mapping) don't rely on UVs at all, and this might help model that. Has anyone else implemented this? How did you put it together?
|
|