I’m seeing some dark rendering artifacts for certain models when using WebGPU. They’re not present in WebGL2 and I also can’t repro this in the Playground so it could have something to do with my setup but any advice or tips would be helpful.
I’m running Babylon.js v8.51.2 within Electron, and when I query the browser’s navigator.useragent this is the output:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) pistachio3dviewer/1.0.0 Chrome/144.0.7559.173 Electron/40.4.1 Safari/537.36
Also I’ve found that if I switch the albedo texture’s Sampling from “Linear & linear mip” to “Nearest” the artifacts disappear, but other models have textures set to “Linear & linear mip” and don’t have this issue.
The model in this example can be found here: Dropbox
If it doesn’t work properly with “linear mip”, it may be that the mipmaps are not generated correctly for some reasons.
The only thing I can see is that the albedo texture is quite big (2048x2048). You should try to rescale the texture to 512x512, for example, and see if it fixes it.
Also, does it work in the Sandbox (on the same computer, same browser)?
The texture shows that mipmaps are created but I don’t know how else to diagnose a potential mip map issue. Any ideas on things I could try?
The asset looks fine in Babylon.js sandbox running in Chrome but it’s not a 1 to 1 comparison since for my use case I’m running a chromium engine from within an Electron app.
I’m wondering if there are some settings I could try applying on the webgpu engine that could potentially fix this, as I don’t have visibility into exactly what engine properties the Babylon.js sandbox is setting.
In terms of rescaling the texture, I’m also seeing this issue with 512x512 textures, like for this asset:
In any case, what i’m building needs to work across different texture sizes so this wouldn’t be a fix for me.
Some more relevant info: I’m seeing this warning in my console whenever I load a file into my scene and I don’t see this same error in the Sandbox:
[21:09:59]: WebGPU uncaptured error (1): [object GPUValidationError] - Destroyed texture [Texture "IOSurface(RasterRead|DisplayRead|Scanout|WebgpuRead|WebgpuSwapChainTexture|WebgpuWrite)"] used in a submit.
- While calling [Queue].Submit([[CommandBuffer from CommandEncoder "upload"], [CommandBuffer from CommandEncoder "render"]])
The strange thing is that the artifacts look like the mesh is rendered faceted (same normal for all vertices of a triangle), but I can’t see the relationship with the type of the texture sampler…
I have no idea for this one…
Are you able to generate/test the Electron app on Windows?
With a Windows app, I could try to use RenderDoc or PIX and see what’s different between the sandbox and the app (hoping the bug exists on Windows!).
Even if you don’t have a Windows computer, can you target Windows when you generate the Electron package? Sorry, I’ve never used Electron before, so I’m just winging it.
@pnut, if you can share your source files without “node_modules”, then “npm install” on windows should be enough (afaik?). On windows, you then just run “npm start” or “node electron .”