Skip to content

SelectiveBloom allocates huge GPU memory even with empty selection #344

@erikdotdesign

Description

@erikdotdesign

Using SelectiveBloom causes very large GPU memory usage, even for a small scene. Memory usage can quickly reach multiple gigabytes. State updates appear to multiply the gl texture count.

To Reproduce:

import { useState } from "react";
import { useThree, Canvas } from "@react-three/fiber";
import { EffectComposer, SelectiveBloom } from "@react-three/postprocessing";

const Effects = () => {
  const { gl } = useThree();

  console.log(gl.info.memory.textures);

  return (
    <EffectComposer>
      <SelectiveBloom
        lights={[]}
        selection={[]}
        intensity={1}
        luminanceThreshold={0.8}
        luminanceSmoothing={0.025} />
    </EffectComposer>
  );
};

const SelectiveBloomTest = () => {
  const [count, setCount] = useState(0);

  return (
    <Canvas>
      <ambientLight intensity={2} />
      <mesh onClick={() => setCount(count + 1)}>
        <planeGeometry args={[3, 3, 32, 32]} /> 
        <meshStandardMaterial color="red" />
      </mesh>
      <Effects />
    </Canvas>
  )
};

export default SelectiveBloomTest;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions