Jump to content

scene optimization


ua4192
 Share

Recommended Posts

Hi all.

 

I am trying to apply different optimizations on my big complex scene with 4000 meshes and 40000 instances.

The scene is very complex (12.5M vertices )

My idea is to combine diferent optimization methods probided by babylon.

AUTOLOD+MESHSUBDIVIDE+OCTREES+SCENEOPTIMIZATION.

My main problem is that when I try  to apply the scene optimization method SceneOptimizerOptions.HighDegradationAllowed I always get the message that the optimization has been successfully but many times the scene is cleaned and the number of scene total vertices decrease until 0. I think there is something wrong.

 

Here the code:

 

BABYLON.SceneOptimizer.OptimizeAsync(scene, BABYLON.SceneOptimizerOptions.HighDegradationAllowed(15, 5000),    function(){    
    if ( mydebug ) {
            console.log("Optimization successful");
        }
    }, function(){
        console.log("Optimization failed");
});

 

I have also realize that the function provides the mesage only one time. I thought that the function was executed each 5 seconds (5000ms) if the target of FPS of 15 was not possible.

I am thing in serializing big scenes, but I have never tried and don't know if this will help.

 

Many many thanks in advanced.

 

Link to comment
Share on other sites

I think it is because you use a strong optimization by default:

SceneOptimizerOptions.HighDegradationAllowed

Try custom optimization :

var EngineOptimizer = function()
	{   
		let result = new BABYLON.SceneOptimizerOptions(60, 5000);
		
		result.optimizations.push(new BABYLON.ShadowsOptimization(0)); // Priority 0		
		result.optimizations.push(new BABYLON.LensFlaresOptimization(1)); // Priority 1		
		result.optimizations.push(new BABYLON.PostProcessesOptimization(2)); // Priority 2	
		result.optimizations.push(new BABYLON.TextureOptimization(3, 512));	 // Priority 3, texture size 512 sur les textures superieur à 512, 1024 ...
		result.optimizations.push(new BABYLON.TextureOptimization(4, 256));	 // Priority 4, texture size 256 sur les textures superieur 256 ...	
		result.optimizations.push(new BABYLON.ParticlesOptimization(5)); // Priority 5		
		result.optimizations.push(new BABYLON.RenderTargetsOptimization(6)); // Priority 6 	
		result.optimizations.push(new BABYLON.HardwareScalingOptimization(7, 2)); // Priority 7, HardwareScaling 2
		result.optimizations.push(new BABYLON.HardwareScalingOptimization(8, 4)); // Priority 8, HardwareScaling 4
		
		return result;	
	}

And 

BABYLON.SceneOptimizer.OptimizeAsync(scene, EngineOptimizer(), function(){    
    if ( mydebug ) {
            console.log("Optimization successful");
        }
    }, function(){
        console.log("Optimization failed");
});

 

Link to comment
Share on other sites

It seems very interesting, despites it seems not to be compatible with all browsers.

I have tried to load an example:

https://www.babylonjs.com/demos/simd/

 

But it doesn't work.

 

It gets hang while loading, no progress.

 

Do you have any other example?

 

I have not found too much documentation.

 

Many thanks in advanced.

 

You are the master

 

:)

Link to comment
Share on other sites

Do you mean to use LOD?

 

I am already using 4 levels of detail.

 

My problem with this approach is that LOD cannot be used with closes and with instances now I have the same problem than before about inherited transformations.

Anothe problem is that I am using an arcrotatecamera and the LOD distance seems not to be working properly.

 

Sometimes I have to be very near from the object to make it visible.

 

Best regards

Link to comment
Share on other sites

I cannot comment on the screen optimizer per say, but having 8000 meshes is a LOT of render loop CPU overhead.  This CPU takes away time that could be spent at the GPU.  Even though instances only have the single draw call of the regular mesh,  they each must be accounted for in Javascript.

If an mesh / instance never moves, then you could:

mesh.freezeWorldMatrix();

If multiple instances, or meshes sharing the same material, do not move independently, you could merge them into one mesh.  This reduces the Javascript overhead and draw calls.

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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