i have a model with UV coordinates less than 0 and greater than 1. im trying to normalize these coordinates into the range 0 and 1 but with bad results. at moment im using this function to convert any UV coordinate into my target 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 result is this
but the expected result is this
where im wrong?
@pailhead, my goal is to port the first texture onto the atlas with normalized UV points. My question is if could work in this way. I normalize the first UV coordinates to 0 and 1 and to avoid the "stretch" effect i also repeat the texture onto the second atlas for a number of times equal to what was done with the "repeat" function