I am facing an issue where my model has UV coordinates that are outside the range of 0 and 1. I have attempted to normalize these coordinates with a function, but the results are not as expected. This is the function I am using to convert the UV coordinates into the desired range:
private convertNumberToUV(numb:number) {
let converted = 0;
if(numb < 0 || numb > 1) {
if(numb < 0){ numb = -numb; }
converted = numb - Math.floor(numb);
}
else if(numb > 1){
converted = numb - Math.floor(numb)
}
else {
converted = numb;
}
return converted;
}
The current result looks like this:
https://i.sstatic.net/5HUOf.jpg
However, I am expecting the result to look like this:
https://i.sstatic.net/XaaVT.jpg
I am unsure where I am going wrong in my approach. My objective, as pointed out by @pailhead, is to normalize the UV coordinates of the first texture to fit onto an atlas. I am also trying to repeat the texture on the second atlas to prevent any "stretch" effect. Does my method seem feasible for achieving this goal?