I'm wondering, what calculations are made under the hood, to transform texture pixel coordinates from uvw space to xyz space, when using sampler2d in fragment shader. Any links to read about it would be appreciated.
This bruteforce algorithm that comes to my mind:
- find what triangle in uvw space the pixel belongs to (there are several methods to do this)
- make 2 matrices from that triangle in uvw and in xyx
- multiply by inverted uvw matrix to find coords in triangle-space
- multiply by xyz matrix
But I think there should be some more effective way.