I am using scene Optimizer for performance improvement, but it reduces the glow layer intensity from the scene

const optimizerOptions = new BABYLON.SceneOptimizerOptions(30, 2000);
// Add specific optimizations without affecting glow
optimizerOptions.optimizations.push(
new BABYLON.HardwareScalingOptimization(0, 1),
new BABYLON.LensFlaresOptimization(),
new BABYLON.ParticlesOptimization(),
new BABYLON.TextureOptimization(1024),
new BABYLON.RenderTargetsOptimization(0)
);
let optimizer = new BABYLON.SceneOptimizer(scene, optimizerOptions, engine);
optimizer.start();

  optimizer.onSuccessObservable.add(() => {
    console.log('success optimized');
  });
  optimizer.onFailureObservable.add((optimizer) => {
    console.log('Scene optimization failed.', optimizer.currentFrameRate);
  });
  optimizer.onNewOptimizationAppliedObservable.add((e) => {
    console.log(e, 'new optimization');
  });

I am using above mentioned code to increase the scene performance but after optimization the glow layer intensity is reduce, that is not expected as per my requirement.
Before Optimization :
image
After Optimization:
image

Expected: Optimize performance without affecting the glow layer intensity, any other suggestion are always welcome.

Hello and welcome to the BJS community!

IIRC, Glow Layers utilize RenderTarget and require a separate Draw call. Consequently, have you tried just disabling the RenderTargetOptimization to see if that makes a difference?

HTH

1 Like

From the docs:

  • BABYLON.RenderTargetsOptimization(priority): This optimization disables render targets (It will turn them on if the optimizer is in improvement mode (see below)).

Glow uses RTTs.

EDIT: @jelster sorry, didn’t see your post :slight_smile:

2 Likes

const optimizerOptions = new BABYLON.SceneOptimizerOptions(30, 2000);
// Add specific optimizations without affecting glow
optimizerOptions.optimizations.push(
new BABYLON.HardwareScalingOptimization(0, 1),
new BABYLON.LensFlaresOptimization(),
new BABYLON.ParticlesOptimization(),
new BABYLON.TextureOptimization(1024),
//new BABYLON.RenderTargetsOptimization() // Remove this line from code
);
As you mentioned in the above comment that, I have disabled the RenderTargetsOptimization() method, but it doesn’t implement the optimization and failed the process of optimization.

Below added the image for your reference:
image

Hi @Siddhant -

It would seem that optimization failed here because the target frame rate wasn’t achieved during the given sample period. Given that after optimizations the frame rate was still in single digits, you may want to look at other factors in your scene that are taking up so much render time. The Inspector is useful for high level timings ofc, and the profiler can give you more details on how your scene performs.

Given that the scene optimizer is performing as expected, what is it that you’re hoping to accomplish aside from a general “make go fast”? If the glow layer is the problem, then I would consider double checking how it’s being used in your scene, perhaps it’s not configured correctly or perhaps you’ve accidentally instantiated more than one?

HTH!