ThreeJS & 3D Development Reference

Color Management & HDR

WebGPU HDR Support

WebGPU enables HDR rendering through configuration options:

const context = canvas.getContext("webgpu");

context.configure({
  device,
  format: "rgba16float",
  toneMapping: { mode: "extended" },
});

Reference: New in WebGPU 129

WebGL P3 Color Space

WebGL2 supports P3 color space for wider color gamut rendering:

const glP3 = document.getElementById('setExampleP3').getContext('webgl2');
if (`drawingBufferColorSpace` in glP3) {
  glP3.drawingBufferColorSpace = 'display-p3';
  console.log(glP3.drawingBufferColorSpace);
  glP3.clearColor(1, 0, 0, 1);
  glP3.clear(glP3.COLOR_BUFFER_BIT);
}

Reference: WebGL P3 Color Space Example

Detecting P3 Support

[!CAUTION] To detect support for WebGL, check if the drawingBufferColorSpace attribute is present. The following example will draw green if the feature is present and red if it is not.

var gl = document.getElementById('detectExample').getContext('webgl2');
if (`drawingBufferColorSpace` in gl) {
  console.log('Color space support is present');
  gl.clearColor(0, 1, 0, 1);
} else {
  console.log('Color space support is NOT present');
  gl.clearColor(1, 0, 0, 1);
}
gl.clear(gl.COLOR_BUFFER_BIT);

Color Space Utilities

Explore P3 color space conversion utilities:

File Formats & Platforms

3D Asset Formats

  • GLTF - Standard for 3D scene transmission
  • USDZ - Universal Scene Description format (Apple ecosystem)

Target Platforms

  • Vision OS - Apple’s spatial computing platform

Rendering Techniques

Visual Effects

  • Particles - Particle system implementations
  • Post Processing - Screen-space effects and filters

Performance

  • Optimizations - Performance tuning strategies

Narrative

  • Storytelling - Interactive storytelling techniques

Shading & Materials

ThreeJS Shading Language (TSL)

TSL provides a modern approach to shader development in ThreeJS:

Reference: ThreeJS Shading Language Documentation