threejs-worldgen
    Preparing search index...

    Function bakeImpostor

    • Renders object from many directions into a texture atlas and returns a material + quad that draw it as a camera-facing impostor, the far level of detail of a scatter layer.

      Each view is unlit: one pass captures each material's base colour (after its alpha test), a second its normals, so the impostor is lit live by the scene's lights. Materials keep their vertex displacement (positionNode), so wind is frozen at bake time; set wind to 0 while baking if that matters.

      The object is baked in its own local space (its position, rotation and scale are ignored).

      Parameters

      • renderer: Renderer

        An initialised WebGPURenderer (three/webgpu).

      • object: Object3D
      • options: Partial<ImpostorOptions> = {}
      • Optionalmask: (source: Material) => number | Node<"float">

        Optional 0..1 float (node) per source material, baked with the normals and read back as surface.mask, e.g. which pixels are foliage, so a re-shaded impostor can treat them differently.

      Returns Promise<Impostor>