Troubleshooting
Blank Canvas
- Confirm WebGL2 is available in your browser.
- Ensure you created
WebGLRenderDevicewith a valid canvas. - Ensure
renderer.render([... , camera], device)includes a camera.
const device = new WebGLRenderDevice(canvas, { depth: true });
Object Is Black or Unlit
- Add
LightPluginfor lit materials. - Add at least one light (
AmbientLight,DirectionalLight, etc.). - Keep
MeshMaterialPluginandCameraPluginenabled.
Distorted Aspect Ratio
Update canvas size and camera projection on resize.
if (camera.projection instanceof PerspectiveProjection) {
camera.projection.aspect = innerWidth / innerHeight;
}
Missing Textures or Models
- Use correct asset URLs under
/assets/.... - Check browser network tab for 404s.
- For cube maps, provide all six faces in the expected order.
Shadows Not Visible
- Add
ShadowPlugin. - Assign
light.shadowand tunebias/normalBias. - Verify shadow camera bounds include your objects.
Useful full examples: