Hello.
I don’t know if it has been covered yet, but I didn’t find a straight way so I just coded an addon for Khronos Group official glTF exporter for Blender, to write KHR_materials_volume → thicknessFactor, attenuationColor and attenuationDistance, plus KHR_materials_ior.
thicknessFactor is necessary in order to compute the correct refraction of materials transmission ( that is written correctly in the glTF by Khronos exporter straight from Blender Principled BSDF material’s transmission property).
Now you can export refractive (glass) materials with the correct thickness from Blender, load the model in three.js and view correct refraction instead of very subtle one.
it relies on Principled BSDF material, and a Volume Absorption node that must be created in the node graph in order to export attenuation color and distance (this node can be left unlinked)
- it takes KHR_materials_volume[‘thicknessFactor’] from Refraction Depth (Settings tab in Material panel)
- it takes KHR_materials_ior[‘ior’] from Principled BSDF IOR property
- it takes KHR_materials_volume[‘attenuationColor’] and KHR_materials_volume[‘attenuationDistance’] from a Volume Absorption node you must create in the node graph that can be unlinked. If more thank one Volume Absorption nodes are present, it takes the first created one.
- In the export panel you can select what extension and property want to export.
The main feature missing is exporting thicknessTexture, but as I can understand we are far from “standardising” how to export this straight from Blender.
Here it is, you just have to install into Blender and activate, then you’ll find it under Extensions in the glTF exporter panel.
( In the addons panel you can find it by searching “KHR” )