question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SceneOptimizer: "Positions are required"

See original GitHub issue

Bugs

App works fine if not using SceneOptimizer.

When activating SceneOptimizer, I get an error “Positions are required”, which is coming from this file: https://github.com/BabylonJS/Babylon.js/blob/a0afb803db41aa578c8adb04971cca4848765a54/src/Mesh/babylon.mesh.vertexData.ts#L466

Whether I do:

public async createScene(): Promise<void> {
  this.scene = new Scene(this.engine);

  this.optimizeScene();
}

private optimizeScene() {
  const optimizationSettings = SceneOptimizerOptions.ModerateDegradationAllowed();
  optimizationSettings.targetFrameRate = 30;

  SceneOptimizer.OptimizeAsync(
    this.scene,
    optimizationSettings,
    () => { ... },
    () => { ... },
  );
}

Or:

public async createScene(): Promise<void> {
  this.scene = new Scene(this.engine);

  this.scene.whenReadyAsync().then(
    () => this.optimizeScene()
  )
}

private optimizeScene() {
  const optimizationSettings = SceneOptimizerOptions.ModerateDegradationAllowed();
  optimizationSettings.targetFrameRate = 30;

  SceneOptimizer.OptimizeAsync(
    this.scene,
    optimizationSettings,
    () => { ... },
    () => { ... },
  );
}

I get the error.

Not 100% sure that’s a bug, I might be missing something but as it’s perfectly working when I do not use the SceneOptimizer I’m suspicious.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:21 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
zakhenrycommented, Jul 5, 2018

@deltakosh I managed to get a repro at last. Unfortunately I can’t save it in the playground as I’m getting a 500 error?

Here’s the code anyway:

var createScene = function () {

    // This creates a basic Babylon Scene object (non-mesh)
    var scene = new BABYLON.Scene(engine);

    // This creates and positions a free camera (non-mesh)
    var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);

    // This targets the camera to scene origin
    camera.setTarget(BABYLON.Vector3.Zero());

    // This attaches the camera to the canvas
    camera.attachControl(canvas, true);

    // This creates a light, aiming 0,1,0 - to the sky (non-mesh)
    var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene);

    // Default intensity is 1. Let's dim the light a small amount
    light.intensity = 0.7;

    // Our built-in 'sphere' shape. Params: name, subdivs, size, scene
    var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 2, scene);
    var sphere2 = BABYLON.Mesh.CreateSphere("sphere2", 12, 1.5, scene);
    var sphere3 = BABYLON.Mesh.CreateSphere("sphere2", 8, 1, scene);

    sphere.position.y = 1;
    sphere2.position.y = 2;
    sphere3.position.y = 3;

    // Our built-in 'ground' shape. Params: name, width, depth, subdivs, scene
    var ground = BABYLON.Mesh.CreateGround("ground1", 6, 6, 2, scene);

    const optimizationSettings = BABYLON.SceneOptimizerOptions.ModerateDegradationAllowed();
    optimizationSettings.targetFrameRate = 70;

    sphere2.parent = sphere;
    sphere3.parent = sphere2;

    BABYLON.SceneOptimizer.OptimizeAsync(
        this.scene,
        optimizationSettings,
        () => { 
            console.log("done")
        },
        () => { 
            console.log("failed")
        },
    );

    return scene;

};
1reaction
deltakoshcommented, Jun 25, 2018

Ok no worry…I’ll check back early july then 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How does the Scene Optimizer improve photos? - Samsung
When the camera recognizes a subject or scene, an icon will appear on the screen and the optimized color will be applied automatically....
Read more >
Samsung Galaxy S10 Scene Optimizer - Verizon
Watch this video to learn how to use Scene Optimizer on your Samsung Galaxy S10 to automatically adjust settings to take the best...
Read more >
How to use the Scene Optimizer photo settings on ... - YouTube
Scene Optimizer recognizes 30 different scenes, like sunsets, people, or clothing, and automatically adjusts the settings to get a better ...
Read more >
Operations — Omniverse Create documentation
The following is a list of optimization modules currently supported by the scene optimizer, with a brief description of the functionality ...
Read more >
Scene Optimizer - Canopy - Procedural Worlds
Does the scene optimizer have any special requirements for the scene models, ... Box colliders are not in the correct position when runinng...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found