I have an interesting issue with my game.
If I using AssetManager to load textures and using WebGL2 in my phone (Realme GT Master), the rendered textures are fully transparent.
The issue only appear with chrome browser and only with my mobile, on desktop it works correctly.
If I disable WebGL2, it works fine with WebGL1. But I would like to use WebGL2, because with WebGL1 causing another heightmap issue.
Previously when I created a POC for this game I not used AssetManager, and it worked fine.
Maybe I missed some crucial config parameter or something.
The issue is very specific because with another phone (Realme 9 pro plus) it works well.
Can somebody give me a starting point for what to look at?
Here is a part of the current code:
if (assetUrl.endsWith(".png") || assetUrl.endsWith(".jpg")) {
const taskName = `task-${AssetLoader.taskCounter++}-${assetName}`;
const task = this.assetsManager.addTextureTask(taskName, url(assetUrl), true, true, Texture.NEAREST_NEAREST);
task.onSuccess = (task) => {
const { texture } = task;
const material = new StandardMaterial(assetName, store.scene);
material.diffuseTexture = texture;
if (assetUrl.endsWith(".png") && options?.hasAlpha) {
material.diffuseTexture.hasAlpha = true;
}
if (options?.disableSpecular) {
material.specularColor = new Color3(0, 0, 0);
}
store.materials[assetName] = material;
onSuccess?.(task, { material });
};
And here is a previous code which not used the AssetManager, and worked on my phone:
this.groundTexture = new B.Texture(groundTextureUrl, this.scene, false, false, undefined, () => {
this.groundTexture.updateSamplingMode(B.Texture.NEAREST_NEAREST);
});
this.groundTexture.uScale = -1;
this.groundMaterial = new B.StandardMaterial(`groundMaterial-${this.name}`, this.scene);
this.mesh.material = this.groundMaterial;
And of course all of the textures loaded correctly I checked with the debug layer on mobile.