Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with quantization and KHR_materials_volume #328

Closed
donmccurdy opened this issue Aug 17, 2021 · 6 comments · Fixed by #330
Closed

Issue with quantization and KHR_materials_volume #328

donmccurdy opened this issue Aug 17, 2021 · 6 comments · Fixed by #330

Comments

@donmccurdy
Copy link
Contributor

Originally reported at mrdoob/three.js#22343, but it appears that the renderers are correct and both gltfpack and gltf-transform have a similar issue in quantizing models using the KHR_materials_volume extension. When compressing or quantizing this example:

129646713-e7bcbbd7-6205-49e3-919c-0baac4d6e044
Screen Shot 2021-08-16 at 9 39 20 PM

Left: Original. Right: gltf-transform. Below: gltfpack.

https://github.com/mrdoob/three.js/files/6996178/Archive.zip

...the boxes should all be the same color, before and after compression. Instead they get lighter (for non-normalized vertex attributes) or darker (for normalized vertex attributes) because the node's scale affects the material.thicknessFactor property. I believe it's necessary to apply the inverse of the node's scale to the thickness, to compensate.

@zeux
Copy link
Owner

zeux commented Aug 17, 2021

Thanks. This is unfortunate, since this also means the presence of the volume material should block mesh merging.

@zeux
Copy link
Owner

zeux commented Aug 19, 2021

I think there's probably still some sort of bug in three.js here - after fixing this on gltfpack side all rows now look identical in quantized and non-quantized versions except for the row with thickness texture:

image

Maybe the thickness texture doesn't have the UV transform applied to it? This works correctly in Babylon.JS afaict.

@zeux
Copy link
Owner

zeux commented Aug 19, 2021

Here's a file after the fix for testing:

attenuation-q.zip

@zeux
Copy link
Owner

zeux commented Aug 19, 2021

Yeah seeing the same problem with texture in three.js on DragonAttenuation [which is a much nicer looking test model albeit not as pedantic as the one above :D]. Since this renders correctly in Babylon I'm going to assume it's an issue with UV xform and merge the fix here.

@zeux zeux closed this as completed in #330 Aug 19, 2021
@zeux
Copy link
Owner

zeux commented Aug 19, 2021

three.js issue has been fixed in mrdoob/three.js#22364

@donmccurdy
Copy link
Contributor Author

Thank you for the quick fix and the three.js patch here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants