Loading glb file with KHR_materials_transmission extension

To correctly render it, the extension needs to be implemented. There is no workaround for it.

Alright that’s what i thought. Thanks :slight_smile:

With workaround i meant something like:
Get the material in question and replace it with some predefined one.

well you can change materials … but that will not render it correctly?
Or are you happy to just render it with any material?

Hi @LucaHeft ,

Depending on what you need, take a look at the material’s opacityFadesSpecular option. Disabling that will give you shiny transparent materials.


@mvaligursky @slimbuck I can reproduce the same rendering result with a playcanvas material.

The option in question is the Opacity Blend Type, which needs to be set to Multiply.

Here is our material setup in Blender:

If we set Transmission to 0.0 and only use Alpha, the resulting glb won’t use the extension. But this does not produce the desired render result.

When you load glb at runtime and create an instance of it, for example this way:

    const house = asset.resource.instantiateRenderEntity();

You can then find and change all materials this way:

    const renders = house.findComponents("render");
    renders.forEach((render) => {
        render.meshInstances.forEach((meshInstance) => {
            meshInstance.material.blendType = pc.BLEND_MULTIPLICATIVE;

is this what you need?

1 Like

That would works yes!

It looks like we have additional changes though. So i’m just replacing the material with a predefined one.

    const renders = house.findComponents("render");
    renders.forEach((render) => {
        render.meshInstances.forEach((meshInstance) => {
            if(meshInstance.material.name.toLowerCase() === "glass_red"){
                meshInstance.material = self.glas.resource;

Out of interest: What is the roadmap for glTF Extensions. Will they be supported in the future?

1 Like

yes, we plan to add support for all these extensions.

1 Like

Hi, is there any update on extension implementation ? I’m trying to achieve glass look ( transmission, volume, ior ) but with no success using editor.

Is there any shader code which could do the job ?

Thank you very much

Currently it’s only available via code but when Engine 1.58 is made ‘current’ in Editor, the material inspector will have properties for it:

We do have engine examples showing the materials extensions too here: PlayCanvas Examples

And the plan is to promote the Editor to use the Engine 1.58 early next week … so then you should be able to use those materials directly in the Editor without any coding.

Thank you very much for the feedback, is there any code sample for using transmission? btw i dont see it in material’s properties screenshot

They are in the API for Standard Material. See Sheen for example: https://developer.playcanvas.com/api/pc.StandardMaterial.html#sheen

Not sure about transmission, maybe @mvaligursky or @Gustav_Sterbrant may know? Looks like it’s calculated from IOR and refraction values looking at the code

Not sure what you mean? All the panels are collapsed in the screenshot I made

Thanks for the link, so if I understood right actually PC can render KHR extensions by loading GLB ( not coding the shader ), in fact in the viewer im able to load my glass material correctly, but those extensions are not yet available in the editor, and it will be with next release, so it will be possible to create same materials shown in asset viewer, correct ?

p.s.: About your sccreenshot I was referring to the fact that TRANSMISSION parameter is missing, and usually is a standalone extension, never saw it as parameter of another extension.

PC can render the KHR extensions by loading GLB, yes that is correct. They are available in the current engine (1.57) that the Editor is running.

However, the Editor cannot import GLBs directly (something we are looking at) but they can be used at runtime like this: Loading glTF GLBs | Learn PlayCanvas

In the Editor release where we update the engine used to 1.58, then yes you should be able to create the materials in the Editor.

@Gustav_Sterbrant would be able to explain more but from what I can see in the code, transmission is calculated from refraction: engine/transmission.js at c6f41880da1e89b747760f300da7603113ff9720 · playcanvas/engine · GitHub

Hi, I saw the new release, i did selected in editor 1.58, still I cant see new parameters for KHR extensions in material inspector, is there something I should update or so ?

thank you very much

Yes, we haven’t yet removed the flags but will be doing so for the next Editor release

Good, is there an idea about when it will be out ?

Early next week is the expectant date. If you want, I can quickly give you early access if you send me your PlayCanvas username