Compatibility

See which parts of a Three.js scene render as they are, which are approximated, and which need a fallback. bakery3.check() answers it for your own scene.

Check your scene

check() runs in the browser. It is free, uploads nothing and needs no account.

const report = bakery3.check();
// {
//   score: 0.97,
//   counts: { info: 1, warning: 2, error: 0 },
//   issues: [{ code: 'material_approximated', severity: 'warning', path: '<Lamp>/<Shade>', … }],
// }

Every issue names the material, its type, where it is in your scene, and the docs page with the fix. This is what a ShaderMaterial gets:

{
  code: 'material_custom_shader',
  severity: 'error',
  message:
    'ShaderMaterial "CarPaintFlakes" renders flat gray, because the render cannot run GLSL. Declare a fallback, or port it to TSL.',
  path: '<Car>/<Body>/<Paint>',
  materialName: 'CarPaintFlakes',
  materialType: 'ShaderMaterial',
  docs: 'https://bakery3.com/docs/material-fallbacks',
}

Materials explains the report in full.

What is supported

FeatureSupportNotes
MeshStandardMaterialFullBase color, roughness, metalness, normal, emissive, opacity
MeshPhysicalMaterialFullPlus clearcoat, transmission, thickness, IOR, sheen, specular, anisotropy. Not iridescence or dispersion
MeshStandardNodeMaterial, MeshPhysicalNodeMaterialFullYour TSL graph renders. See Custom shaders
MeshBasicMaterialApproximatedIts color, unlit. It does not light the scene, cast a shadow or show in reflections
MeshLambertMaterialApproximatedRendered as a fully rough, non-metal surface in its color
MeshPhongMaterialApproximatedRendered like Lambert. Shininess is not used, so there are no sharp highlights
MeshToonMaterialApproximatedRendered like Lambert, without the cel shading
MeshMatcapMaterialApproximatedRendered like Lambert, in its color and map. The matcap is not used
MeshNormalMaterial, MeshDepthMaterial, MeshDistanceMaterialApproximatedRendered flat gray
ShaderMaterialNot supportedRendered flat gray. Declare a fallback material or port it to TSL
RawShaderMaterialNot supportedAs above
alphaMap, bumpMap, displacementMap, specularMapNot renderedcheck() warns. See Slots the render ignores
PerspectiveCameraFullIncluding zoom. Everything is in focus
OrthographicCameraFull
InstancedMeshFullEvery instance renders
SkinnedMeshFullRendered in its current pose
Morph targetsFullRendered with their current influences
DirectionalLightFull
PointLight / SpotLightFullIntensity is converted to physical units
RectAreaLightFullIntensity is converted to physical units
HemisphereLightFullSky color from above, ground color from below, added to the HDRI
HDRI environmentFullIntensity and rotation are kept
Post-processingNot renderedBloom, depth-of-field passes and color grading are screen-space effects

The pages that follow go deeper: Materials covers every material and texture slot, Custom shaders the TSL operations, and Cameras and Environment & lighting the projections and light units.

Render a custom shader as a physical material

Declare the material the renderer should use instead. Your shader stays in the viewport.

import { Bakery3Material } from '@oeave/bakery3/r3f';

<Bakery3Material
  web={<CarPaintShader />}
  render={
    <meshPhysicalMaterial
      color="#830000"
      metalness={0.9}
      roughness={0.14}
      clearcoat={1}
    />
  }
/>

See Material fallbacks for the plain Three.js form and every field it accepts.