Removing textures with useParallax = true causes material to be black

Remove texture | Babylon.js Playground (babylonjs.com)

with line 44
material.useParallax = true;.
When I click on the remove texture button I created, it causes the sphere to turn black.
However, if I comment line 44, I can remove the texture without any problem.

I also found that with useParallax set to true, when I just use inspector to remove the bumpTexture first and then remove the other textures, the bump texture seems to be cached and cannot be removed correctly. But if I remove all other textures first, and remove the bump texture last, then the texture removal seems to be alright.

I’m not sure is it my problem or this is a bug

Looks like a bug: in the console there’s a shader error when trying to use the undeclared identifier “'vDetailUV”. But it will prob have to wait until Monday to be fixed when the devs are back on it after the weekend. :slight_smile:

Meanwhile it seems a simple workaround is to call resetDrawCache() on the mesh:

2 Likes

Sounds weird indeed, I will fix it ASAP.

Fix parallaxOcclusion not being reset by sebavan · Pull Request #12688 · BabylonJS/Babylon.js · GitHub will fix it in the next nightly

2 Likes