I started getting an error while trying to upload a UGC head that I was working on.
The issue was very opaque… what unexpected UVs was it talking about?
Well, I dove into the UGCValidation
code to figure out what was wrong, and discovered the code for validating the cage mesh UVs. There’s a predefined dictionary of UVs called WrapTargetCageUVReferenceValues
. I wrote some code to snap my cage mesh UVs to the nearest values in this dictionary, and found that the errors were… quite small. Most of the time a magnitude difference of less than 0.0001
.
correcting UV
old: 3.69422102, 0.319555014
new: 3.69431996, 0.319570988
diff: 0.00010022489004768431
correcting UV
old: 3.72608304, 0.246077999
new: 3.72621012, 0.246140003
diff: 0.00014139678387437016
correcting UV
old: 3.7301929, 0.312626004
new: 3.73042011, 0.31270501
diff: 0.00024055695394054055
correcting UV
old: 3.79952788, 0.27986601
new: 3.79974008, 0.279897988
diff: 0.00021458858100231737
correcting UV
old: 3.72608304, 0.246077999
new: 3.72621012, 0.246140003
diff: 0.00014139678387437016
correcting UV
old: 3.79952788, 0.27986601
new: 3.79974008, 0.279897988
diff: 0.00021458858100231737
correcting UV
old: 3.7301929, 0.312626004
new: 3.73042011, 0.31270501
diff: 0.00024055695394054055
correcting UV
old: 3.76120996, 0.354229987
new: 3.7615099, 0.354404986
diff: 0.00034725075238384306
correcting UV
old: 3.72608304, 0.246077999
new: 3.72621012, 0.246140003
diff: 0.00014139678387437016 (x2)
correcting UV
old: 3.76120996, 0.354229987
new: 3.7615099, 0.354404986
diff: 0.00034725075238384306
correcting UV
old: 3.77772999, 0.430159986
new: 3.77835989, 0.430440992
diff: 0.0006897396524436772
correcting UV
old: 3.79952788, 0.27986601
new: 3.79974008, 0.279897988
diff: 0.00021458858100231737 (x2)
correcting UV
old: 3.78078198, 0.502425015
new: 3.78129005, 0.502544999
diff: 0.0005220453022047877
...
If they need to be absolute, I feel like some kind of auto-correction could kick-in here. This behavior was cutting off a previous UGC body I uploaded, as well as the new one I was working on. I’m not sure how or when I touched the UVs, but I thought I had them close enough to be a non-issue.