Documentation
    Preparing search index...

    Interface RenderTargetTexture

    A RenderTarget's colour attachment, seen as a texture (§77, §61).

    Extends MaterialTexture — the contract @fourjs/materials declares and @fourjs/render's Texture implements — so this is assignable to any material slot that takes a texture, which is the whole point of the type. Two things distinguish it, and both are load-bearing for a backend:

    • data is always null. There are no CPU-side texels: the pixels live in the framebuffer the backend allocated, and reading them back is readPixels (staged — see the module header). Narrowed to the literal null rather than left as Uint8Array | null so the compiler knows too.
    • RenderTargetTexture.renderTarget points back at the target. A backend that meets one of these in a render list looks the target up in its framebuffer cache — allocating it if this is the first the backend has heard of it — instead of trying to upload texels that do not exist.
    interface RenderTargetTexture {
        anisotropy?: number;
        colorSpace?: ColorSpace;
        data: null;
        disposed: boolean;
        filter?: MaterialTextureFilter;
        height: number;
        id: string;
        isRenderTargetTexture: true;
        minFilter?: MaterialTextureMinFilter;
        mipmaps?: boolean;
        renderTarget: RenderTarget;
        version: number;
        width: number;
        wrap?: MaterialTextureWrap;
        getDirtyRegion?(sinceVersion: number): Rectangle2 | null;
    }

    Hierarchy (View Summary)

    Index
    anisotropy?: number

    How many anisotropic samples the backend may take (§77's "anisotropy"; R-30b, 2026-08-21). An integer ≥ 1.

    Optional, and absent means 1 — isotropic filtering, GL's own default and this contract's previous fixed behaviour.

    Anisotropic filtering is an extension in WebGL 2 (EXT_texture_filter_anisotropic), so this is a request, not a guarantee: a backend clamps it to what the device reports and ignores it entirely where the extension is absent. That is §62's capability tiering rather than §85's refusal — a value the driver merely cannot honour is not an authoring mistake, and refusing it would make the same scene unrunnable on a conformant device. A non-integer or a value below 1 is an authoring mistake, and the concrete class refuses it.

    colorSpace?: ColorSpace

    The colour space the texels are in — §60a's texture metadata, read by the backend on the upload path (R-15, 2026-08-08).

    Optional, and absent means "linear". §60a says colour textures default to sRGB-encoded; this tier defaults them to linear instead, and the deviation is deliberate and dated: flipping the default would change what every already-authored texture in the engine looks like — every pixel golden with it — for scenes that never asked for colour management. An author who has sRGB-encoded texels (a decoded PNG, an authored albedo map) says so with colorSpace: "srgb" and the backend decodes on sample; the §60a-conformant default is an owner decision, recorded with R-15.

    Optional rather than required so that a test double, a procedurally generated atlas, and every texture written before this field existed keep satisfying the contract without a line of change. Read it as texture.colorSpace ?? "linear".

    data: null

    Never any CPU-side texels; see the interface documentation.

    disposed: boolean

    Whether the texture has been disposed (§83).

    How the backend samples between texel centres (§77; R-30, 2026-08-13).

    Optional, and absent means "linear" — the value this tier hard-coded before the field existed, so every texture written against an earlier build and every test double keeps issuing the identical texParameteri pair. Read it as texture.filter ?? "linear", exactly as MaterialTexture.colorSpace is read.

    "nearest" is what a bitmap glyph atlas and pixel art want: a texel drawn at or above 1:1 stays a square instead of being blurred across its neighbours.

    height: number

    Height in texels.

    id: string

    Stable identity (§83's resource model). Backends key their upload caches on it and validate the entry with MaterialTexture.version, exactly as they do for BufferGeometry.

    isRenderTargetTexture: true

    Marker the isRenderTargetTexture guard reads — the duck-typed contract pattern isParticleDrawable and isDirectionalLightSource already use, so a backend narrows without naming the class and without an instanceof that would break across realms.

    How the backend samples when the texture is minified (§77; R-30b, 2026-08-21).

    Optional, and absent means "derived": without MaterialTexture.mipmaps it is MaterialTexture.filter, which is what this contract always meant; with them it is that filter's mip-chain-aware form ("linear" → "linear-mipmap-linear", i.e. trilinear). Read it as the concrete class resolves it, or as texture.minFilter ?? texture.filter ?? "linear" if the texture is known to carry no chain.

    mipmaps?: boolean

    Whether the texture carries a full mip chain (§77's "mipmaps"; R-30b, 2026-08-21).

    Optional, and absent means false — no chain, exactly the one level this contract described before the field existed, so every texture and test double written earlier uploads the identical call sequence.

    true asks the backend to build the chain at upload time (WebGL 2's generateMipmap, which needs no power-of-two size). What the chain is for is minification: a 512² texture drawn across twenty pixels samples twenty of its half-million texels without one, which is the shimmer that appears when the camera moves.

    renderTarget: RenderTarget

    The target whose colour attachment this is.

    version: number

    Counter advanced by every mutation; the cache-invalidation key (§53, §77).

    width: number

    Width in texels.

    How the backend addresses texture coordinates outside [0, 1] (§77; R-30, 2026-08-13).

    Optional, and absent means "clamp-to-edge" — this tier's previous fixed choice, for MaterialTexture.filter's reason. Read it as texture.wrap ?? "clamp-to-edge".

    • Union of changed texels since a backend version; null requires a full upload.

      Parameters

      • sinceVersion: number

      Returns Rectangle2 | null