11
$\begingroup$

I am trying to export a glass material in gltf. Here is the material principled shader, notice I have transmission set to 1.0:

principled shader

this gives me this result in cycles (the glasses have the glass material):

van with glass

However when I export this to gltf, and view it in the gltf viewer or load it in my webgl application, this is the result:

webgl van

How do I export glass?

I already have this in my render options:

render transparency

I am using blender 2.8 beta, all the other questions I could find all refer to an older version of blender.

EDIT: I don't even have the Blend Mode dropdown in my shader settings:

shader settings

$\endgroup$
1
  • $\begingroup$ A big comprehensive write up in blender docs would be good for this challenging transition where V8 and Blender are tops $\endgroup$
    – Cymatical
    Commented Sep 3, 2020 at 17:04

1 Answer 1

9
$\begingroup$

Transmission (of light, such as glass and water)

UPDATE: Blender 2.91 and above support exporting transmission directly as shown in the original post above, using glTF's KHR_materials_transmission extension. Not all renderers support this. ThreeJS, PlayCanvas, Adobe Dimension, Microsoft's BabylonJS, and Google Filament are among the rendering engines known to support transmission in glTF.

Alpha Blending

glTF 2.0 has always had an alpha blending mode available, but it's intent is just to be "coverage" (like medical gauze tape), not a physically correct optical translucency (as the latter was considered too high a target for the initial release of 2.0). Basically this means that low alpha values will dissolve the entire material, including specular reflections. Even so, the mode is often used to emulate clear materials like glass, particularly for situations where real transmission support is not available.

To control the blend mode, look for a settings panel near the bottom of the material properties set of panels. Blender offers many choices here. glTF supports three of them: Opaque, Alpha Blend, and Alpha Clip (along with the "Clip Threshold" value in that case).

NOTE: Eevee must be the selected rendering engine, to reveal this blend mode setting. The user's selection will be remembered and used by the glTF exporter even when other engines such as Cycles are selected.

The alpha values come from the "Alpha" input on the Principled BSDF node, and when exporting to glTF, they are stored in the alpha channel of the base color texture.

Blend Mode

$\endgroup$
4
  • $\begingroup$ Thanks for the insight! However I am not finding the Blend Mode setting, I even downloaded the latest beta right now, do I need to do something specific? i.imgur.com/dzoTVVa.png $\endgroup$
    – Pontiacks
    Commented Jan 25, 2019 at 22:32
  • $\begingroup$ Hmm, it's there when Eevee is selected as the rendering engine (in the Scene tab), but when I switch to Cycles, these options disappear. This might need to be filed as an exporter issue, not accounting for blend modes in Cycles. I guess the workaround would be to temporarily switch to Eevee to edit the material settings. $\endgroup$
    – emackey
    Commented Jan 28, 2019 at 15:28
  • 2
    $\begingroup$ Ok, I've been able to make the material transparent also, in eevee, following this guide, however the gltf export still exports an opaque material. Should I report this bug to the blender issue tracker? blender.stackexchange.com/questions/81851/… $\endgroup$
    – Pontiacks
    Commented Feb 10, 2019 at 18:36
  • $\begingroup$ When you switched to Eevee, did you find the "blend mode" -> "alpha blend" setting on the material, similar to the screenshot above? This, plus an alpha channel in the base color texture, should cause the current exporter to ask for blending in glTF. If you still need to file an issue, the tracker is here: github.com/KhronosGroup/glTF-Blender-IO/issues $\endgroup$
    – emackey
    Commented Feb 11, 2019 at 13:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .