temportalflux / TemportalEngine

GNU General Public License v3.0
4 stars 1 forks source link

Texture Stitching #13

Closed temportalflux closed 3 years ago

temportalflux commented 4 years ago
temportalflux commented 4 years ago

Needs to be broken up into subtasks

temportalflux commented 4 years ago

Misc Notes

Could provide a mat4 which contains 12 floats (6 vec2) for UV offsets per face, but how would the shader know which offsets to apply? If a normalized orthogonal vec3 was also sent per vertex, we could use it to lookup the offsets algo: Normal.x != 0 => row 1 Normal.y != 0 => row 2 Normal.z != 0 => row 3 sign(axis value) => column structure: -X U, -X V, +X U, +X V -Y U, -Y V, +Y U, +Y V -Z U, -Z V, +Z U, +Z V 0 , 0 , 0 , 0 Better yet, since mat4 takes up for slots anyway, just send 3 vec4s where each vec4 is a axis face set. If tex coords per vertex could be locked to [0, 1], we could instead pass a scalar multiplier as a uniform per draw call which would indicate how to scale down the tex coords to represent their true size in the stitched atlas. Paired with the offsets should be able to take [0, 1] -> scale([0, 1]) + offset -> [u, v]

temportalflux commented 4 years ago

See https://github.com/temportalflux/TemportalEngine/issues/18 for more ideas

temportalflux commented 4 years ago

Texture Stitching and the editor UI both will require:

Assets used in texture stitching should never exceed or match the size of the atlas. In truth, they should never be more than a fraction the side of the atlas. It would be best to define these parameters on a per-stitcher basis.