meshoptimizer icon indicating copy to clipboard operation
meshoptimizer copied to clipboard

gltfpack: Improve handling of meshes with very large UV bounds

Open Momohanfeng opened this issue 5 years ago • 5 comments
trafficstars

gltfpack version: 0.14 and 0.15

I convert my gltf model to gltfpack format by -tc, it will generate a new model correct. And then use KTX2Loader and GltfLoader to load the target model in Threejs(v0.122.0).

But some textures are displayed as stretch(LEFT: before convert, RIGHT: after convert), I don't know what's the reason for this result? what should I do to resolve it? IMG20201109_094430 IMG20201109_095614

Momohanfeng avatar Nov 09 '20 01:11 Momohanfeng

Please attach a model that would allow me to reproduce this.

zeux avatar Nov 09 '20 02:11 zeux

test07.zip I put the model into the zip file in attachment, thank you

Momohanfeng avatar Nov 09 '20 02:11 Momohanfeng

I looked into why this happens; this is due to some of the textures being mapped on geometry with very large UV range, e.g. one of the walls has a texture stretched because the ground mesh has some geometry that is mapped to the same texture with UV range min -376010.687500 0.709212 max 376014.500000 0.921277.

For now I'd recommend using -noq for this mesh. There are some changes planned to gltfpack that can improve the behavior for cases like these, so I'm relabeling this as "enhancement".

zeux avatar Nov 09 '20 04:11 zeux

OK, thank you

Momohanfeng avatar Nov 09 '20 09:11 Momohanfeng

I have had similar issue that models from different sources had very different UV scale/vertex scale, affecting the quantization. I had to change source models to be in a similar range to fix this. I think if meshoptimizer could handle this in itself (e.g. by normalizing outlying values to the 90-percentile scale), this could be a non-issue.

Inviz avatar Jan 05 '21 12:01 Inviz