klaude

SceneOptimizer instance has empty

Recommended Posts

Hello,

I'm trying to use SceneOptimizer wity babylonjs v3.1.1. 

var options = new BABYLON.SceneOptimizerOptions(30, 1000);
options.optimizations.push(new BABYLON.RenderTargetsOptimization(0));
options.optimizations.push(new BABYLON.ParticlesOptimization(1));
options.optimizations.push(new BABYLON.TextureOptimization(1, 1024));
// options.optimizations.push(new BABYLON.HardwareScalingOptimization(2, 4));
 
// Optimizer
var optimizer = new BABYLON.SceneOptimizer(scene, options);
optimizer.start();

but optimizer object has nothing.

this is console log.
   e {} __proto__: Object
 

what am i missing?

 

Share this post


Link to post
Share on other sites

Hi @klaude

Try:

function optimizerOptions() {
    let options = new BABYLON.SceneOptimizerOptions(30, 1000);
    options.optimizations.push(new BABYLON.RenderTargetsOptimization(0));
    options.optimizations.push(new BABYLON.ParticlesOptimization(1));
    options.optimizations.push(new BABYLON.TextureOptimization(1, 1024));
    return options;
}
BABYLON.SceneOptimizer.OptimizeAsync(scene, optimizerOptions());

Share this post


Link to post
Share on other sites

It has no error.

Maybe it works for now. It shows 'success'.

BABYLON.SceneOptimizer.OptimizeAsync(scene, optimizerOptions(), function() {
console.log('success');
}, function() {
console.log('failed');
});

Thanks! @Arte

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.