Why line thickness becomes thinner when using the SSAO2 (Prepass renderer ?)

I am applying SSAO2 to my project to render CAD (B-rep) models.

Here, line rendering is required to represent each face, and I am drawing lines using MATERIAL_LineListDrawMode.

The problem is that when SSAO2 is applied, the line thickness noticeably thins out.

What could be causing this?

If this is a limitation of WebGL’s line renderer, I should probably use Greased Line or Line Geometry.

However, I’m concerned about performance and would prefer to use the native line rendering feature provided by the graphics API if possible

To be more contextual, the initialization code for my project’s rendering pipeline is as follows, and removing only the SSAO2 rendering pipeline results in thick lines appearing.

const defaultPipeline = this._defaultRenderingPipeline = new DefaultRenderingPipeline("default", false, scene, [this._orbitCamera], false);
defaultPipeline.samples = 4;
defaultPipeline.fxaaEnabled = true;
defaultPipeline.bloomEnabled = false;
defaultPipeline.grainEnabled = false;
defaultPipeline.sharpenEnabled = false;
defaultPipeline.chromaticAberrationEnabled = false;
defaultPipeline.imageProcessingEnabled = true;
defaultPipeline.prepare();
defaultPipeline.imageProcessing.toneMappingEnabled = true;
defaultPipeline.imageProcessing.toneMappingType = ImageProcessingConfiguration.TONEMAPPING_KHR_PBR_NEUTRAL;

this._ssaoRenderingPipeline = new SSAO2RenderingPipeline(
    "ssao",
    scene,
    { ssaoRatio: 1.0, blurRatio: 1.0 }, // ratio
    [this._orbitCamera], // cameras
    false, // forceGeometryBuffer
    Constants.TEXTURETYPE_FLOAT // textureType
);
this._ssaoRenderingPipeline.samples = 16;
this._ssaoRenderingPipeline.bilateralSoften = 1.0;
this._ssaoRenderingPipeline.bilateralTolerance = 1.0;

We don’t do anything special in SSAO with regard to lines, so I’m not sure we can do anything…

However, I can’t reproduce your problem:

With SSAO2: https://playground.babylonjs.com/#XT1HAS#15
Without SSAO2: https://playground.babylonjs.com/#XT1HAS#16

If you open these two PG files in two different tabs and switch between them, you will see that the lines are exactly the same.

If you can reproduce the problem in a PG file, we will be able to investigate further.

2 Likes

I’ve fully reproduced the issue here. You can see the difference by changing the enableSsao variable.

I tried using the Babylon serializer first time, and it works surprisingly well. It’s easy to recreate the problem in PG.

That’s because MSAA is not enabled for the SSAO2 post-process (see line 45):

1 Like

Thank you, it was a simpler problem than I thought.