Texture is not being applied to out of view meshes

Link to the playground: PG

Steps to reproduce:

  1. Create standard material and some texture, but don’t apply the texture to the material yet.
  2. Create a number of meshes that would share that material, and optionally a number of their instances. Make sure some of them are positioned out of the view of the camera.
  3. When texture is loaded, apply it to the material as a diffuse texture.
  4. Observe that the texture seems to only be applied to meshes/instances that are in the viewport (not 100% sure about that criteria though), but other meshes/instances remain grey, although they all share the same material.

NOTE: this also happens just for the meshes, when there’s no instances created.

Marking the material as dirty explicitly after applying the texture doesn’t seem to make any difference (it would only work if one zoomed the camera out viewing all the meshes/instances).

Can be reproduced with BJS 5.x, but not with BJS 4.x

Thanks!

Yup definitely looks like bug, we ll look into it ASAP.

cc @Deltakosh

1 Like

This is getting crazier :slight_smile: I can not seem to repro running everything locally

I think I have it I ll validate with @Deltakosh but that sounds pretty good at the moment :slight_smile:

2 Likes

Will push the fix in a couple hours, validating the result :slight_smile:

Will be fixed in the next release: Fix dirty on inactive meshes by sebavan · Pull Request #12645 · BabylonJS/Babylon.js · GitHub

Thank you very much!