All 2D sampler refer to the first texture in models (SOLVED)

As shown below, my shader use a diffuse map, a metallic/gloss/AO map.


My shader work correctly last week end, but stop working this Monday.
I simplify it until it become a one liner, and find out that sampling metallic_gloss map give diffuse result:

gl_FragColor = vec4(texture2D(metallic_gloss, uv).rgb, 1);

Weird enough, model preview window give correct result of sampling diffuse / metallic_gloss map:
The first image above is sample of gloss metallic map, the image below is diffuse map:

My bad…
I use a model instance instead of modal file in the collection, The engine works fine.

Suggest give unbound texture a default black or white texture instead of repeating previous texture unit to avoid this kind of confuse

4 Likes