Large Scene Memory Management
20 July 2017 01:22
Hi all B4w staff and users
I am having a large scene, about 4000 Blender units. The camera is Hover with a tiny clipping distance of 20 Blender units. The user(first person) will slowly advance through the scene and some meshes will be repeated dynamically as the user proceeds.
I am having a mousedown event listner on the canvas element, to get the camera postion.
I am using scenes.get_active_camera() and camera.get_translation().
Once the camera reaches a certain point, I am using objects.copy() scenes.append() and then transform.set_translation() to put the new mesh in the scene.
For simple mesh objects this is working fine. But when the mesh is complex this is crashing both Firefox and Edge on my machine which has 2GB ram.
Any better way?
I am having a large scene, about 4000 Blender units. The camera is Hover with a tiny clipping distance of 20 Blender units. The user(first person) will slowly advance through the scene and some meshes will be repeated dynamically as the user proceeds.
I am having a mousedown event listner on the canvas element, to get the camera postion.
I am using scenes.get_active_camera() and camera.get_translation().
Once the camera reaches a certain point, I am using objects.copy() scenes.append() and then transform.set_translation() to put the new mesh in the scene.
For simple mesh objects this is working fine. But when the mesh is complex this is crashing both Firefox and Edge on my machine which has 2GB ram.
Any better way?
20 July 2017 03:25
Are any errors showing in your browser console?
20 July 2017 23:27
21 July 2017 02:42
Your Task Manager can show you how much memory is being used.
Also, your Scene Viewer can give you information that might help you confirm you are running out of memory.
2 MB is not much these days, your project might run well on many PCs.
Another option is to look at the Cartoon Interior project in your SDK. That project loads and unloads objects.
Also, your Scene Viewer can give you information that might help you confirm you are running out of memory.
2 MB is not much these days, your project might run well on many PCs.
Another option is to look at the Cartoon Interior project in your SDK. That project loads and unloads objects.
document.getElementById("delete").addEventListener("click", function(e) {
console.log("What is e = " + e);
if (_selected_obj) {
var id = m_scenes.get_object_data_id(_selected_obj);
m_data.unload(id);
_selected_obj = null;
}
28 July 2017 02:15
After a lot of experimentation I think copy_object() copies the whole object data into the RAM rather than use a built in clipboard.
Using remove_object() to get rid of unnecessary objects help a bit, but remove_object only works on dynamic objects.
Anyways thanks for the help. B4w is a great engine but some areas need improvement. Cheers.
Using remove_object() to get rid of unnecessary objects help a bit, but remove_object only works on dynamic objects.
Anyways thanks for the help. B4w is a great engine but some areas need improvement. Cheers.