What are the ssao ratios used when adding ssao via the inspector?

so if I add ssao2 via the inspector and tweak the numbers , all looks good.

Then when trying to add that same ssao via code now , using all the same numbers … it doesnt look the same , far to weak … almost not there.

The only number not visible now to me are the ratios eg :

var ssaoRatio = {
        ssaoRatio: 1, // Ratio of the SSAO post-process, in a lower resolution
        blurRatio: 0.5, // Ratio of the combine post-process (combines the SSAO and the scene)
        combineRatio: 1,
      };

I tried omiting this argument but then it bombs

my full ssao2 function if you interested :

function setSSAO2(state) {
  if (state === true) {
    if (SSAO2RenderingPipeline.IsSupported) {
      // Create SSAO and configure all properties (for the example)
      var ssaoRatio = {
        ssaoRatio: 1, // Ratio of the SSAO post-process, in a lower resolution
        blurRatio: 0.5, // Ratio of the combine post-process (combines the SSAO and the scene)
        combineRatio: 1,
      };
      SSAOPipeline = new SSAO2RenderingPipeline("ssao", scene, ssaoRatio);
      SSAOPipeline.radius = 0.2;
      SSAOPipeline.totalStrength = 1;
      SSAOPipeline.base = 0;
       SSAOPipeline.expensiveBlur = true;
      SSAOPipeline.samples = 16;
      SSAOPipeline.maxZ = 100;
      SSAOPipeline.minZAspect = 0.2;
      // Attach camera to the SSAO render pipeline
      scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline("ssao", camera);
      scene.postProcessRenderPipelineManager.enableEffectInPipeline(
        "ssao",
        SSAOPipeline.SSAOCombineRenderEffect,
        camera
      );

      //fix for ssao affecting transparent objects
      scene.enableGeometryBufferRenderer().renderTransparentMeshes = false;
    }
  } else {
    if (SSAOPipeline !== null && SSAOPipeline !== undefined) {
      SSAOPipeline.dispose();
    }
  }
}

ok i moused over the constructor in VSC and saw the value suggested there are ,

 ssaoRatio: 0.5, 
        blurRatio: 1,

this works BUT i also found another issue , I was calling my SSAO2 function before calling my function to add the default rendering pipeline … this was causing it to not work properly?

So it is fixed but i am curious what is the cause of this?

my function for default pipeline is this :

function setdefaultRP(state) {
  if (state === true) {
    if (!defaultPLR) {
      defaultPLR = new DefaultRenderingPipeline("defaultPipeline", true, scene, [camera]);

      defaultPLR.imageProcessingEnabled = true;
      defaultPLR.samples = 16;
      defaultPLR.fxaaEnabled = true;
      defaultPLR.sharpenEnabled = false;
      defaultPLR.sharpen.edgeAmount = 0.32;
      defaultPLR.imageProcessing.vignetteEnabled = false;
      defaultPLR.imageProcessing.colorGradingEnabled = false;     
      defaultPLR.imageProcessing.contrast = 1.9;
      defaultPLR.imageProcessing.exposure = 1;
      defaultPLR.imageProcessing.toneMappingEnabled = true;
      defaultPLR.imageProcessing.toneMappingType = ImageProcessingConfiguration.TONEMAPPING_ACES;
      
      defaultPLR.imageProcessing.colorCurvesEnabled = true;
      var curve = new ColorCurves();
      curve.globalDensity = 0; // 0 by default
      curve.globalExposure = 0; // 0 by default
      curve.globalHue = 30; // 30 by default
      curve.globalSaturation = 20; // 0 by default
      curve.highlightsDensity = 0; // 0 by default
      curve.highlightsExposure = 0; // 0 by default
      curve.highlightsHue = 30; // 30 by default
      curve.highlightsSaturation = 0; // 0 by default
      curve.midtonesDensity = 0; // 0 by default
      curve.midtonesExposure = 0; // 0 by default
      curve.midtonesHue = 30; // 30 by default
      curve.midtonesSaturation = 0; // 0 by default
      curve.shadowsDensity = 0; // 0 by default
      curve.shadowsExposure = 0; // 0 by default
      curve.shadowsHue = 30; // 30 by default
      // curve.shadowsDensity = 80;
      curve.shadowsSaturation = 0; // 0 by default;
      defaultPLR.imageProcessing.colorCurves = curve;
    }
  } else {
    if (defaultPLR !== null && defaultPLR !== undefined) {
      defaultPLR.dispose();
      defaultPLR = null;
    }
  }
}
1 Like