I was wondering if anyone could help with an issue we are facing. We want to be able to do the following:
On ARPlane objects which are generated by ARFoundation we want to be able to generate the UV’s so that they are between 0-1 with no repeating/tiling. We are looking into a ProBuilderMesh to help with this
For all meshes generated by ARMeshManager we want to convert them to a ProBuilderMesh so that we can apply UV’s to them (as ARKit does not support texture coords).
The reliance on ARFoundation is not the issue here, it is that the procedural meshes are not suitable for what we need, and we need help to get them to regenerate to conform to the 0-1 range with no repeating / tiling. So far through all tests we have not been able to achieve the results we need, with planes and meshes having very odd UV data.
UVs must coexist with every vertex in an object. How you map them is simply an agreement you make up with yourself to map them between the local spatial position of that vertex to where on the texture you want.
If you never want to go outside 0 to 1 and never repeat or wrap, you need to choose a direction of mapping (with some heuristic such as triplanar mapping) and calculate the correct 0-1 UVs.
I have a simple world-to-UV mapper you could easily hack up: it would have to make one pre-pass to determine the largest span in any given axis view, then map all UVs to 0 to 1 instead of minimum to maximum world coordinate.