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

GLTFLoader: Add KHR_materials_volume and KHR_materials_ior extensions support #22117

Merged
merged 2 commits into from
Jul 13, 2021

Conversation

takahirox
Copy link
Collaborator

Description

This PR adds KHR_materials_volume and KHR_materials_ior extensions support and updates the webgl_loader_gltf_transmission example.

The video of this PR with #22116.

transmission.mp4

I replaced the TransmissionTest model in webgl_loader_gltf_transmission example with IridescentDishWithOlives.

@mrdoob mrdoob added this to the r131 milestone Jul 12, 2021
@mrdoob mrdoob merged commit 361a46c into mrdoob:dev Jul 13, 2021
@mrdoob
Copy link
Owner

mrdoob commented Jul 13, 2021

Thanks!

@mrdoob
Copy link
Owner

mrdoob commented Jul 13, 2021

Hmm, seems like the shader has some overblown colors?

Screen.Recording.2021-07-13.at.11.44.57.mov

I think it's the same issue as number 3 in @WestLangley list? #22009 (comment)

@WestLangley
Copy link
Collaborator

WestLangley commented Jul 13, 2021

I think it's the same issue as number 3 in @WestLangley list? #22009 (comment)

It is issue number 7 in @WestLangley list. #22009 (comment)

@mrdoob
Copy link
Owner

mrdoob commented Jul 13, 2021

@WestLangley Sure is! #22125

@takahirox takahirox deleted the GLTFVolumeAndIor branch July 13, 2021 15:01
@takahirox
Copy link
Collaborator Author

takahirox commented Jul 13, 2021

@donmccurdy

Regarding the glb file you shared. Did you cut off specular color texture? According to the repository it seems to have specular color texture. I need it for testing KHR_materials_specular.

@donmccurdy
Copy link
Collaborator

donmccurdy commented Jul 13, 2021

That turned out to be the issue in donmccurdy/glTF-Transform#286 yes, had implemented a pre-release version of the spec. I'll regenerate the file later today, or this should work on the most recent gltf-transform release:

gltf-transform cp input.gltf output.glb

@donmccurdy
Copy link
Collaborator

@takahirox
Copy link
Collaborator Author

Thanks! Do you mind if compressing the textures? The file size is a bit too huge 7.5MB and I'm wondering if we can reduce the size more.

@donmccurdy
Copy link
Collaborator

Sure, got this down to about 4MB with squoosh.app/ -

IridescentDishWithOlivesCompressed.glb.zip

@takahirox
Copy link
Collaborator Author

Thanks so much!

@takahirox
Copy link
Collaborator Author

The textures in the glb file don't seem to be compressed because no KHR_texture_basisu extension in extensionsUsed.

@donmccurdy
Copy link
Collaborator

Ah, I just used OxiPNG and MozJPEG compression in this case, not Basis. Would take a bit more time to get KTX2/Basis fine-tuned for these textures I think, and may or may not reduce the file size as much. Can give that a try if we want it but it will be a couple days.

@takahirox
Copy link
Collaborator Author

takahirox commented Jul 14, 2021

I just used OxiPNG and MozJPEG compression in this case, not Basis.

OK OK, that's fine if it's intentional. Thanks!

@ManishJu
Copy link
Contributor

which software currently supports the export of volumetric GLTF models like this : https://github.com/wallabyway/gltf-presskit-transparency/blob/main/docs/MosquitoInAmber_withRefraction.glb ? Afaik Blender is not ready yet ....

@donmccurdy
Copy link
Collaborator

These extensions were just announced as ratified/complete this week, it'll take a bit longer for implementations to arrive in DCC products. Gestaltor (https://ux3d.io/gestaltor) is the only one I'm sure of at the moment. Perhaps Adobe Dimension, but I don't have access to a copy to check. PRs to https://github.com/KhronosGroup/glTF-Blender-IO are always welcome too, IOR and Specular are in progress (KhronosGroup/glTF-Blender-IO#1158) but I don't think anyone has started a PR for volume yet.

A more roundabout option would be to export the extra volumetric textures from Blender separately, then use a script to attach them to the glTF file.

@gonnavis
Copy link
Contributor

gonnavis commented Jul 18, 2021

Hello @takahirox, Thanks for the PR! I found that current example has gaps if look from side view or back view:
image
But front view is OK.
I tried with a simple box, seems all refracted pixel are pushed to +Z axis a little?

@takahirox
Copy link
Collaborator Author

takahirox commented Jul 20, 2021

@gonnavis Thanks for the report. Would you mind reporting it in #22009, too, because this PR has been already closed and that thread may be the best place to discuss the transmission issues.

@gonnavis
Copy link
Contributor

OK, I re-commented there.

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

Successfully merging this pull request may close these issues.

6 participants