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();
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 :
After Optimization:
Expected: Optimize performance without affecting the glow layer intensity, any other suggestion are always welcome.
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?
BABYLON.RenderTargetsOptimization(priority): This optimization disables render targets (It will turn them on if the optimizer is in improvement mode (see below)).
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.
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?