Jump to content

Scene Optimizer Question


Recommended Posts

So I love what happens to the performance when you run the scene optimizer,  But I have some questions... what is it actually doing?  Can I manually control some of these features?  Why would some of my meshes disappear?  Mainly Im wondering whats happening to my ground meshes they seem to be getting dropped out.

Any hints?  When at street level, walking around in the buildings after the scene optimizer I can get it to hold a constant 20 fps which on my system is pretty bossy (my dog peed on the motherboard to my development rig so I have been stuck on a old beat up i7 that I put together from spare parts years ago, which sucks but at the same time is cool because if this can run it any modern system would be able to)

If I can figure out whats causing the meshes to drop then I will definitely be using the optimize function.





Link to comment
Share on other sites

So I am looking at the doc you posted and Im kinda confused by what its telling me to do...

BABYLON.SceneOptimizer.OptimizeAsync(scene, BABYLON.SceneOptimizerOptions.ModerateDegradationAllowed(),
function() {
   // On success
}, function() {
   // FPS target not reached

why does that have a comma at the end what else is it expecting from me?



var result = new BABYLON.SceneOptimizerOptions(60, 2000);

var priority = 0;
result.optimizations.push(new BABYLON.ShadowsOptimization(priority));
result.optimizations.push(new BABYLON.LensFlaresOptimization(priority));

// Next priority
result.optimizations.push(new BABYLON.PostProcessesOptimization(priority));
result.optimizations.push(new BABYLON.ParticlesOptimization(priority));

// Next priority
result.optimizations.push(new BABYLON.TextureOptimization(priority, 256));

// Next priority
result.optimizations.push(new BABYLON.RenderTargetsOptimization(priority));

// Next priority
result.optimizations.push(new BABYLON.HardwareScalingOptimization(priority, 4));

return result;

I see this, but how does this work with calling it because this looks like the contents of a function.

then at the end it talks about this:

function mySceneOptimization(priority) {
  if (typeof priority === "undefined") {
     priority = 0;

  this.priority = priority;
  this.apply = function (scene) {
     // Work on scene...

I mean the documentation is there, but it makes little to no since, do you know of a working example I can look at?
Link to comment
Share on other sites

Fixed the comma typo :)

Regarding the rest of your question, not sure to understand.

Just call BABYLON.SceneOptimizer.OptimizeAsync(scene, BABYLON.SceneOptimizerOptions.ModerateDegradationAllowed()) to get the moderate degradation option.

Moderate means:

  • Level 0: ShadowsOptimization and LensFlaresOptimization
  • Level 1: PostProcessesOptimization and ParticlesOptimization
  • Level 2: TextureOptimization(2, 512)
  • Level 3: RenderTargetsOptimization
  • Level 4: HardwareScalingOptimization(4, 2)

The advanced usage chapter allows you to create your own degradation option.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...