SSAARenderPass constructor

SSAARenderPass(
  1. dynamic scene,
  2. dynamic camera,
  3. dynamic clearColor,
  4. dynamic clearAlpha,
)

Implementation

SSAARenderPass(scene, camera, clearColor, clearAlpha) : super() {
  this.scene = scene;
  this.camera = camera;

  sampleLevel = 4; // specified as n, where the number of samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16.
  unbiased = true;

  // as we need to clear the buffer in this pass, clearColor must be set to something, defaults to black.
  this.clearColor = clearColor ?? Color.fromHex(0x000000);
  this.clearAlpha = clearAlpha ?? 0;
  _oldClearColor = Color(0, 0, 0);

  copyUniforms = UniformsUtils.clone(copyShader["uniforms"]);

  copyMaterial = ShaderMaterial({
    "uniforms": copyUniforms,
    "vertexShader": copyShader["vertexShader"],
    "fragmentShader": copyShader["fragmentShader"],
    "premultipliedAlpha": true,
    "transparent": true,
    "blending": AdditiveBlending,
    "depthTest": false,
    "depthWrite": false
  });

  fsQuad = FullScreenQuad(copyMaterial);
}