viktov

Members
  • Content Count

    16
  • Joined

  • Last visited

  1. Ah, ok. Im using IE11 with Win7 so that is why it is not working. Thanks.
  2. Hi, Im using textures with normal map for bump mapping effect. And everything works fine on firefox and chrome but there is no visible result of bumpmapping in IE. Is it a known issue or am I missing something? The code I use: var scale = 10;var ceilingMaterial = new BABYLON.StandardMaterial("ceilingMaterial", scene);ceilingMaterial.diffuseTexture = new BABYLON.Texture("texture/ceiling.jpg", scene);ceilingMaterial.diffuseTexture.uScale = scale;ceilingMaterial.diffuseTexture.vScale = scale;ceilingMaterial.specularColor = new BABYLON.Color3(0.5, 0.5, 0.5);ceilingMaterial.bumpTexture = new BABYLON.Texture("texture/ceiling_normal.jpg", scene);ceilingMaterial.bumpTexture.uScale = scale;ceilingMaterial.bumpTexture.vScale = scale;
  3. Hi, I wonder what is the best way to get only these meshes which are visible by camera at the moment. I know there is octree implementation in babylon, but Im not sure how to use it. I've seen this https://github.com/BabylonJS/Babylon.js/wiki/Optimizing-performances-with-octrees but still have problems to make it work. If someone could explain (write a piece of code or pseudo code) how to make it. Lets say I have 5 cubes on my scene and a free camera. I would like to have a function that would return meshes which are visible in a viewport of my camera. Thank you, Regards V.
  4. Hi again! What would be the best way to remove unused textures from memory? I put all textures in the array and when I dont need them anymore I call dispose() on each. But this doesnt seem to work as expected and soon I get: Not enough storage is available to complete this operationon IE console while creating next textures I need. Thanks for any help with that. V.
  5. Ok, guys, I found a workaround. If I clone meshes and materials instead of creating new instaces each time, it works fine. Although it still doesnt explain the memory leak when creating - disposing meshes. So for now, it solves the problem for me, but if somebody would take a deeper look into it to make sure there is no bug in the framework, that could be helpful. Here's working code: var segments = [];var loaded = [];var cube = new BABYLON.Mesh.CreateBox("cube", 1, scene);var baseMaterial = new BABYLON.StandardMaterial("baseMaterial", scene);function createGround() { var groundMaterial = new BABYLON.StandardMaterial("groundMaterial", scene); var ground = BABYLON.Mesh.CreateGround("ground", 1000, 1000, 1, scene, false); groundMaterial.diffuseColor = new BABYLON.Color3(0.0, 0, 0.5); ground.material = groundMaterial; ground.checkCollisions = true;}function createCamera() { var freeCamera = new BABYLON.FreeCamera("freeCamera", new BABYLON.Vector3(0, 150, -500), scene); freeCamera.maxZ = 2000; freeCamera.applyGravity = true; freeCamera.ellipsoid = new BABYLON.Vector3(40, 75, 20); freeCamera.position = new BABYLON.Vector3(0,150,-800); freeCamera.speed = 8; return freeCamera;}function createSegments(){ var segment; var material; for(i = 0; i < 50; i++) { segment = cube.clone("segment" + i); segment.scaling = new BABYLON.Vector3(50,50,50); segment.position = new BABYLON.Vector3(Math.random() * 1000 - 500, 25, Math.random() * 1000 - 500); material = baseMaterial.clone("segmentMaterial" + i); material.diffuseColor = new BABYLON.Color3(Math.random(), Math.random(), Math.random()); segment.material = material; segments.push(segment); loaded.push(false); }}function ShowDetails() { var face; var material; for (i = 0; i < segments.length; i++) { if (!loaded[i] && i == Math.round(Math.random() * segments.length)) { for (j = 0; j < 100; j++) { face = cube.clone("f_" + i + "_" + j); face.id = "f_" + i + "_" + j; face.scaling.x = Math.random() * 20 + 5; face.scaling.y = Math.random() * 20 + 5; face.position.x = segments[i].position.x + Math.random() * 50 - 25; face.position.y = 100 + Math.random() * 50; face.position.z = segments[i].position.z + Math.random() * 50 - 25; material = baseMaterial.clone("m_" + i + "_" + j); material.diffuseColor = new BABYLON.Color3(Math.random(), Math.random(), Math.random()); face.material = material; } loaded[i] = true; } }}function HideDetails(){ var face; var material; for (i = 0; i < segments.length; i++) { if (loaded[i]) { for (j = 0; j < 100; j++) { material = scene.getMaterialByName("m_" + i + "_" + j); if (material) { material.dispose(); } face = scene.getMeshByID("f_" + i + "_" + j); if (face) { face.dispose(); } } loaded[i] = false; } }}createGround();createSegments();var camera = createCamera();camera.attachControl(canvas, false);var light = new BABYLON.HemisphericLight("hemi", new BABYLON.Vector3(0, 1, 0), scene);setInterval(function () { ShowDetails(); }, 500);setInterval(function () { HideDetails(); }, 2000);
  6. It still doesnt work for me. Windows 7, IE 11, +500MB in about 15 minutes Im running out of ideas what might be wrong with this code S.O.S.
  7. Thanks Kilombo for your thoughts. I see your point. And I could do something like: http://www.babylonjs.com/playground/#QEBJS but it means that I would create 10 000 meshes at once (memory peak just from the begining) and I would rather avoid this. Thats why I thought that creating meshes on demand would be a solution here but I still cant get it work as it should. Look at this: http://www.babylonjs.com/playground/#1KSU3X I left only meshes without any materials for the clarity of code. I removed creation of any unneccesery objects but still there is a memory leak in this code.
  8. Good point, Kilombo. I have updated demo: http://www.babylonjs.com/playground/#1QA535 and no doubt there is an improvement but it doesnt solve the problem. Memory grows a bit slower, but still there is +500MB in about 20 minutes using IE.
  9. Thanks Temechon. Which browser have you checked, which system you have? Im on Windows 7, IE11, FF 29.01, Chrome 35.0.1916.114. And what if you leave demo running for 20 minutes or longer?
  10. I think I posted wrong version of demo, thats why you did not see anything wrong going on. I edited links above, so now you should see what the problem is. Dear all, lets find out where the problem lays because it seems quite a serious issue. I did check in dev tools that dispose() for the mesh is called as many times as CreateBox(). It is the same with dispose() for the material. So, one thing Im sure is that it is not the issue of dispose() not being called.
  11. http://www.babylonjs.com/playground/#1WWTSA You should see appearing and disappearing artifacts over the boxes... browser memmory raising, framerate falling down to 0... Disposed objects seem to stay somewhere there... or is it something wrong with my code? Any help would be much appreciated.
  12. Thanks for your information. Have you looked at task manager and browser memmory usage?
  13. dad72 - how about memmory growth? Leave it for 10 - 15 minutes and see if the framerate falls. I have onboard graphic card which obviously is not fast, but in the begining the demo runs smoothly and after a while the performance drops dramatically.
  14. Thank you guys for your response and some useful piece of knowledge Wingnut. Deltakosh, I created a simple demo for you to check and see what I mean. http://www.babylonjs.com/playground/#1WWTSA And it seems it is not only IE problem. Just run this demo, open task manager and watch for a couple of minutes how memmory grows and framerate falls.