PBR Material From GLTF2 (Specular)

Hey @bghgary … I have used my specular export i n quite a while, but now when i dow my textures that is was working before when i wrote now show grey… But if i use the inspector and i click the wrench next to the texture (Render as main texture) is then show fine.

First… when did we change that the specular texture was NOT the main texture ?

Second… What can i do to make it the main texture, i did see a setMainTexture type function ?

I set the KHR Specular extension DiffuseTexure with the main texture when i export from unity to gltf. So why would it not be the main texture anymore ?

@bghgary will be back next week. cc @sebavan

cc @PatrickRyan too

What do you mean by main texture ? I am not sure to understand the issue, would you happen to have a repro ?

When i export from Unity using the specular workflow… Which in turns uses the KHR Specular GLTF Extension… I set the DiffuseTexture of the extension… But now, when its gets rendered, the texture is not rendered… But if i use the inspector and click the WRENCH to left of the ALBEDO texture (which says Render as main texture). then it renders the actual texture it was supposed to:

do you have an example glb working in previous versions and not in latest ?

I afraid I do not… They just test exports for the Specular workflow (Which I hardly ever use, didnt even notice it was broken til yesterday when i had to export a scene that was made with Specular materials)

But.. what is the concept of Main Texture that there is a BUTTON that says render as main texture. Which implies that there could be secondary texture for the Albedo/Diffuse. Like i am setting the WRONG texture that babylon is expecting for the specular workflow.

Its shows as ALBEDO (Not Diffuse), I can see the texture there. But i have to click thata wrench button to make the MAIN TEXTURE… what ever that state is ?

I looked a the source:

<span className="actionIcon" onClick={() => this.debugTexture()} title="Render as main texture">
     <FontAwesomeIcon icon={faWrench} />
</span>

Which calls some sort of debugging texture function… Not sure what is going with what should already be the MAIN TEXTURE

Yo @sebavan … I made a demo playground.

You must load the inspector then hit the wrench next to albedo (like the snapshots above)

Nothing changed since at least V5 of Babylon regarding this behavior you can try with https://playground.babylonjs.com/#BTAY4X#1 and changing version.

What is happening is that you do not have an environment texture and your model is fully reflective so it appears all dark. Swapping the reflectivity color to black and adding an environment should make it ok.

So then is an environment texture is required for specular pbr gltf materials ?

I’m back. This thread doesn’t seem resolved, but all PBR materials (specular/glossiness or metallic/roughness workflows) require an environment texture to display properly.

OK… I didnt know that. I usually am using one from the default SKYBOX (I generate a dds from the skybox in unity when you export, if you have not specifiaclly set one)

Thanks @sebavan and @bghgary

Yo @bghgary … Just to double check… What should be the default reflectivity color for Metallic Roughness and what should it be for Specular Glossiness

I don’t know what you mean by “default”.

For metallic/roughness workflow, reflectivityColor is ignored.

For specular/glossiness workflow, reflectivityColor is the color of the specular component. It will be multiplied against the reflectivityTexture (i.e. the specular texture).

Thank you @sebavan and @bghgary