# \[UPDATED\] thicknessFactor, attenuationColor, attenuationDistance, ior exporter for Blender glTF exporter

**URL:** <https://discourse.threejs.org/t/updated-thicknessfactor-attenuationcolor-attenuationdistance-ior-exporter-for-blender-gltf-exporter/31737>\
**Category:** Resources\
**Tags:** exporter, gltf-exporter, gltf-loader, loaders, materials, transmission\
**Created:** [November 12, 2021, 10:06pm UTC](https://discourse.threejs.org/t/updated-thicknessfactor-attenuationcolor-attenuationdistance-ior-exporter-for-blender-gltf-exporter/31737 "2021-11-12T22:06:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stmaccarelli](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/stmaccarelli/32/3181_2.png) [@stmaccarelli](https://discourse.threejs.org/u/stmaccarelli)\
**Post date:** [November 12, 2021, 10:06pm UTC](https://discourse.threejs.org/t/updated-thicknessfactor-attenuationcolor-attenuationdistance-ior-exporter-for-blender-gltf-exporter/31737/1 "2021-11-12T22:06:09Z")

</div>

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” )

> <https://gist.github.com/stmaccarelli/acc97d9f9b00cd1f7169455d5404f388.js>

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [November 12, 2021, 10:55pm UTC](https://discourse.threejs.org/t/updated-thicknessfactor-attenuationcolor-attenuationdistance-ior-exporter-for-blender-gltf-exporter/31737/2 "2021-11-12T22:55:00Z")

</div>

That’s awesome! I don’t know Python all that well, but the code looks clean to me — you should consider submitting that to the Blender addon directly, see [Manage KHR\_materials\_volume · Issue #1454 · KhronosGroup/glTF-Blender-IO · GitHub](https://github.com/KhronosGroup/glTF-Blender-IO/issues/1454). 🙂

I wrote up a similar script recently, except to process a glTF file _after_ exporting, in [Writing volumetric refraction in glTF 2.0](https://www.donmccurdy.com/2021/11/11/writing-volumetric-refraction-gltf/).

---

<div class="post-metadata">

**Author:** ![stmaccarelli](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/stmaccarelli/32/3181_2.png) [@stmaccarelli](https://discourse.threejs.org/u/stmaccarelli)\
**Post date:** [November 13, 2021, 8:47am UTC](https://discourse.threejs.org/t/updated-thicknessfactor-attenuationcolor-attenuationdistance-ior-exporter-for-blender-gltf-exporter/31737/3 "2021-11-13T08:47:02Z")

</div>

Thanks Don.  
I’ll submit this, good suggestion.

It looks the Khronos group is working on a proper implementation of the KHR\_materials\_volume glTF extension into their Blender exporter addon, supporting also thicknessMap, attenuationDistance and attenuationColor.  
Or at least I hope so 😁

And it wouldn’t be difficult at all for a decent Blender python coder (I’m not) to build that.  
If you know someone please get me in touch.

---

<div class="post-metadata">

**Author:** ![orion\_prime](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/orion_prime/32/15785_2.png) [@orion\_prime](https://discourse.threejs.org/u/orion_prime)\
**Post date:** [November 18, 2021, 3:11pm UTC](https://discourse.threejs.org/t/updated-thicknessfactor-attenuationcolor-attenuationdistance-ior-exporter-for-blender-gltf-exporter/31737/6 "2021-11-18T15:11:22Z")

</div>

Is this value equivalent to thickness ?

screen space reflections & refraction has to be on to visualize effect of this slider

 ![ref](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/5/2/52d01fc4f3ff6e0d8154d19315350692516a2f71.png)

---

<div class="post-metadata">

**Author:** ![stmaccarelli](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/stmaccarelli/32/3181_2.png) [@stmaccarelli](https://discourse.threejs.org/u/stmaccarelli)\
**Post date:** [November 18, 2021, 6:27pm UTC](https://discourse.threejs.org/t/updated-thicknessfactor-attenuationcolor-attenuationdistance-ior-exporter-for-blender-gltf-exporter/31737/7 "2021-11-18T18:27:50Z")

</div>

@orion_prime yes, if you set that param, will export to thicknessFactor.  
and yes, to actually see the effect in Blender you have to enable SS reflections and refraction, but for the exporter this doesn’t matter, it just takes the value in “refraction depth”

---

<div class="post-metadata">

**Author:** ![stmaccarelli](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/stmaccarelli/32/3181_2.png) [@stmaccarelli](https://discourse.threejs.org/u/stmaccarelli)\
**Post date:** [December 10, 2021, 10:48am UTC](https://discourse.threejs.org/t/updated-thicknessfactor-attenuationcolor-attenuationdistance-ior-exporter-for-blender-gltf-exporter/31737/8 "2021-12-10T10:48:33Z")

</div>

Addon Updated.
