Disabling specific KHR extensions

Hi all,
samples like dragon by Khronos (https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/DragonAttenuation/screenshot/screenshot_large.png) use KHR_materials_transmission, KHR_materials_volume, KHR_materials_variants extensions.

Everything is working really nice on desktop, although on mobile (e.g. smartphone) refraction indeed has huge impact on fps.

Is there a way to disable specific KHR_* extensions in THREE?
In that case, one could disable certain extensions on low-profile devices

I think there are basically three ways to ‘downgrade’ materials for better performance:

  1. after loading in three.js, swap materials for something cheaper (MeshBasicMaterial < MeshLambertMaterial < MeshPhongMaterial < MeshStandardMaterial < MeshPhysicalMaterial)
  2. disable extensions in GLTFLoader so that more advanced extensions are ignored
  3. offline, create a version of the model that uses fewer extensions

The most flexible of these is (1), since you can target things like MeshLambertMaterial or MeshPhongMaterial that no glTF file will create by default. I would probably do this first, to figure out which materials you actually want to use on mobile.

Once you’ve done that, you may also want to do (3), in case the original .glb contains textures for thickness or volume that you don’t need to download at all on mobile.

I think we could set something up to support (2), but you may need to open a github feature request for it, and I’m not sure if it would help as much as the other two options in this case.

4 Likes

Thanks Don. I’ll surely try those

Hi all, I’m still a beginner in this field, so can you tell me how it works? How does the code look like in detail? Is there a concrete method in the GLTFLoader class? I didn’t find anything online :frowning:

No, sorry. I suggested above that GLTFLoader could be modified to support this. But no such modifications have been made in three.js, that I know of. Please feel free to open a pull request or a feature request.