Jump to content

disappearing meshes (culling issue?)


AndyBeaulieu
 Share

Recommended Posts

First off, thanks for all of the great work on Babylon.js - I have had a lot of fun playing with it over the past week.

 

I am having an issue with disappearing meshes, as shown in this video:

 

http://www.youtube.com/watch?v=JTKbvFSBs_0&feature=share&list=UUjW3rmSx2bXeUnFcN4o-yOw

 

It looks like some kind of culling issue, but with the position of the camera I don't think it should be hiding the meshes?

 

The issue occurs with both a FreeCamera and an ArcRotateCamera, but it seems worse with the FreeCamera. In the scene I am creating a bunch of Meshes with different y value (elevation) data and giving them a texture for the surface.

 

Are there any ideas given this, or can I provide more information? 

Link to comment
Share on other sites

(by the way I hope to get all of this cleaned up and write a nice tutorial on Babylon !)

 

This problem took awhile to narrow down, but I found that:

  • I was using an async ajax call to get elevation data from a server for a whole bunch of separate meshes (64 or more "tiles")
  • in the ajax success, I was creating a new mesh and setting vertices, computing normals, etc. to get a mesh with elevation formed
  • if I change the method to ajax call to synchronous (async: false below), then the issue goes away.
  • if I leave the method as async (the default) then the issue with disappearing meshes comes back.

So this is kind of bizarre, as JS is single-threaded so there can't be thread safety issues in Babylon or anything. I'll keep playing with how I do this but let me know if you have any ideas.  

// this is really just pseudocode !! $.ajax({        url: "/api/proxy/GetElevations",        data: JSON.stringify(query),        type: "POST",        meshName: meshName,        async: false,        dataType: "json",        contentType: "application/json; charset=utf-8",        success: function (result) {            var data = JSON.parse(result);            // create a ground with elevation            // create new BABYLON.Mesh(name, scene);            // set vertices data and compute normals                   }    });
Link to comment
Share on other sites

Hey! Cool to see that Andy Beaulieu is playing with Babylon.JS! :)

 

It's indeed very weird that switching to synchronous is solving the problem. BabylonJS is handling the asynchronous building of texture for you and injecting new meshes on the fly shouldn't be a problem.

 

If you could share the code indeed with David and I, it will help a lot for the debugging job.

 

Thanks.

 

David

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