Search the Community

Showing results for tags 'instances'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 20 results

  1. error with dispose, latest build

    erm, ok...I haven't been following the latest announcements so pls bear with me if someone has spotted this alr. Working on a long ass project which was working fine until today, got an error in my console ' setting getter-only property "skeleton" '. Traced my codes down to the error popping up in disposing of instanced meshes and managed to get the repro in PG: Is this a bug or just me ?
  2. Instancing bug

    There seems to be an issue with instances in the preview version (stable is fine). Moving an instance too far way from the camera causes the original mesh to vanish (and also sometimes causes black artifacts to appear in the scene when moving the camera).
  3. Destroying instances

    Hi all, I'm working on my first Phaser based game, online documentaion is very useful, but I can't find informations about destroying instances. function Enemy(game, layer, x, y, enemyStyle){ var newX = 0; var newY = 0; switch(enemyStyle){ case 'big_guy': newX = x; newY = y-68; break; case 'fast_guy': newX = x; newY = y-24; break; } var mySprite = game.add.sprite(newX, newY, decoType); mySprite.anchor.setTo(0.5, 0.5); layer.add(mySprite); } Enemy.prototype.delete = function(){ mySprite.destroy(); } Here I can destroy the enemy sprite, but not the enemy instance..
  4. Hi, I created material, based on Simple material (diffuse map, bump, specular map). Worked fine till point I tried to reuse one material for instance and non instance meshes. Can it be done from technical side? I have mesh that I use to create instances and I have other mesh that just use same material, as soon I add material to non instance mesh my instance meshes disappear on camera movement. Similar as in this tread but my material is not frozen.
  5. It seems that wireframe rendering goes haywire if used on instanced meshes. - open the link and zoom out (down arrow). Changing the instances to clones, or turning off wireframe, fixes the issue. Is this a bug, or one of those things where certain features can't be used together?
  6. I've been working on creating low poly tree assets for a game that I am very slowly trying to develop. I know there are various scripts for tree creation but I wanted something a little more Canadian, so I wondered what I could do with Blender and instances. So I took a look at the BJS demo of trees that uses instances. Opening the debug layer on this scene seemed to produce odd results.(see Image below). 1. As I move around the scene the number of draw calls keeps changing - the highest I get is 102, yet the total number of meshes is 107. Why does the number keep changing and why so high? 2. The debug layer indicates that there 7 textures used but looking at what the textures are indicates that four of them are the same ? These type of results I get if I use the Sandbox with my own scenes gryff sits back in his chair wondering what the forum Sherlocks are thinking cheers, gryff PS And if you "want to go down in the woods today",here is my scene with trees (2 different trees, 100 of each so 2x the BJS demo in terms of meshes). I have included some stats including drawcalls which never gets above 5 (two for each tree and 1 for the terrain).
  7. instances position

    hy gangs, i used a random position for my array of trees then i merged it, but it returns just one tree\
  8. Hi everyone! I'm building an infinite runner and exporting predefined blocks from Blender. In BJS I create instances of those block meshes exported from Blender and place them dynamically to create pathway for a character. So my aim is to use exported meshes as `blueprint` for instances creation. What's the best way to hide a mesh exported from Blender and use it only as a reference to create instances of the mesh to place them dynamically? Currently I'm just placing base meshes outside the skybox mesh to hide them and then create instances of those base meshes and place the instances inside skybox mesh where I need them to be. Although that works I'm just wondering is there any better/proper way to hide base meshes?
  9. Freezing materials on instances

    I read in another topic/question here that you should not freeze materials of instances, and from personal experience I see (or should I say, "do not see") the problem...the instances are transparent. Is it better to give the instances their own material to share and freeze it, or to not freeze the material for that mesh and its instances? Also, what is causing the problem of the instances not being visible when the material is frozen? I have no background in 3d, so it could be something obvious, but I am still curious.
  10. In the image below there are 2 scenes : 1. the 3D window of Blender, 2. The same scene exported as a.babylon file and viewed in the Sandbox. The scene is a low poly "rock" and a number of instances (10) using Blender's particle system on the ground plane. The particle system is then converted to instances (using the modifier "Convert" button) But compare the rotation of the instanced rocks between 1 and 2 - they are different. I have highlighted 4 of the worst - but others are incorrect on closer examination. (D is really really noticeable!! ) Anyone any thoughts about what might be going wrong? I can provide .blend files if needed. cheers, gryff
  11. I think I have answered my own question, but it seems you can't dispose of a root mesh that is used to build instances without deleting all the instances from the scene as well. Is that right? I created a "galaxy" (OK, a small one!) of various star types. I created one root star for each star type then made several thousand instances of each star type with different xyx positions and scaling. It works great. But when I dispose of the root meshes everything disappears. I guess this is how it is supposed to work. Reminds me of a game I worked on where we had to keep all the magic items in a hidden treasure chest somewhere in the game world and whenever a player got a magic sword we just copied one from the hidden chest. -- George
  12. instanced

    hy guys, i want to be able to dispose instanced meshes one by one
  13. As per title. Clones work fine, but trying to add an instance makes BJS throw an error.
  14. ok here is demo for instances. How Is design one three(base tree component). Is three one mesh(object) or is it made with more meshes(objects) ? If base tree component is made with more objects. For example(two objects) with trunk and treetop. If we design tree(base tree component) in blender. Then if I add multi trees with "Duplicate linked" to another layer. Everythink is ok. CAN WE ADD THIRD OBJECT (for example snow) on base tree component so that, all "Duplicate linked" objects will reflect change. So that all "duplicate linked" object will reflect snow? (Blender or 3D Max). How can we achive that. (WITH NO CODING IN BLENDER) (JUST DESIGN IN BLENDER OR 3D MAX). (I know that if we add object snow on base tree component, and than code in babylon instances that snow will reflect on all instances. BUT HOW WE DO THIS IN BLENDER OR 3D MAX? CAN WE ADD OBJECTS TO THE BASE INSTANCE OBJECT SO THAT ALL DUPLICATE LINKED OBJECTS WILL REFLECT NEW ADDED OBJECT? @Deltakosh greetings, ian
  15. GPU Instances vs merging

    Hey 3D Gurus! Just a technical question. I'm making a tile editor, but the tiles are cubes. What would be the best practice regarding the performance? Every tile is a mesh (setEnabled(false)) that acts as a reference, and I can place instances from them to the level. Something like that (my english is horrible, sorry): [ ][ ][ ][ ] Let's say this is somethink like a bridge or a floor or a castle wall made of the same referencing mesh. So that are instances, the cubes share the same geometry and the same material, that's clear for me. If I would merge (with a custom function or the babylonjs function) them, then it would be more vertices. That's clear too. Now the question: Since BabylonJS doesn't have occlusion culling, the concealed sides from the cubes will be rendered too. Now what is better: Lots of single instances with probably a higher fill rate (hidden sides in between) vs. merging the instances to a single mesh (and apply uvs again) with much more vertices? I upload a picture to make it more clear. That walls or whatever is made of single cube instances. When I would make one mesh out of it, would that be better? Thanks in advance. Cheers.
  16. renderOverlay with Instances

    Hello. I have a scene with some instances, and I would like to renderOverlay only for some of them. However it seems that setting renderOverlay on an InstancedMesh has no effect at all (seems that this value is always obtained from parent mesh). In this sample I set renderOverlay = true on an instancedMesh, and nothing happens. In this sample I set renderOverlay = true on the parent mesh, and renderOverlay = false on an InstancedMesh, but overlay is rendered for all instances. Am I'm doing something wrong? Thanks in advance. Best Regards.
  17. Hey guys, long time no see, eh? How are you all doing? I started digging up some old game ideas and playing around. I ended up with one where I create a field of hexagons as the game world. Unfortunately I am having performance problems when creating bigger maps and zooming out to show the whole map. Here is an example of what I am trying to do: Any idea how I could improve performance for this kind of game world?
  18. hi everyone, I need to load a mesh, and duplicate it, but with different materials, so createInstance(), seems a little bit limited in that case also if I load a mesh with Append, it is added to the scene, but if I load a mesh with a Load, how do I append it to the scene ? thanks
  19. Hi, can instanced meshes use different parents? When I export a scene from 3ds Max all instances get the same parent, but transformations are applied, so you won't see any difference in the exported scene. But I can apply working parents in JavaScript. I could remove the parents in 3ds Max, export the scene and apply the parents in JavaScript, but that would result in some work and maybe exporting different parents per instanced mesh is a wanted feature anyway, that's why I ask first. brgds
  20. Hi, ive got a question, because i need to have 400 imported meshes in my scene, im using createInstance at the moment, but first problem came with changing color of clicked element, with instances when i click 1 mesh and change its color, it changes on all meshes i know that i cant change material for each created instance, so ive tried with clone, but its to slow for more elements, so i was trying to make a workaround. First ive created 400 instances, than when someone click on 1 mesh i was trying to dispose this mesh, make a clone of a template make some things that i needed and after someone click on another mesh i disposed the clone and created new instance from template, in theory it should work but in practice it froze the web browser ;] Here is some of mine code var rackTemplate;BABYLON.SceneLoader.ImportMesh("rack_hp", "./", "rack_hp.babylon", scene, function (newMeshes) { newMeshes[0].scaling = new BABYLON.Vector3(0.1, 0.1, 0.1); rackTemplate = newMeshes[0].clone("rackTemplate"); newMeshes[0].dispose(); = "rackTemplate"; rackTemplate.isVisible = false; rackTemplate.material = new BABYLON.StandardMaterial("rackMaterial", scene); rackTemplate.material.diffuseColor = new BABYLON.Color3(0.30, 0.30, 0.30); for (var index = 0; index < 600; index++) { var newInstance = rackTemplate.createInstance("rack" + (index)); = "rack" + (index + 1); newInstance.position = new BABYLON.Vector3(index * 7, 9, 0); } });//EVENTSvar startingPoint;var currentMesh;var prevObjectMaterialDiffuseColor;var onPointerDown = function (evt) { if (evt.button !== 0) { return; } // check if we are under a mesh var pickInfo = scene.pick(scene.pointerX, scene.pointerY, function (mesh) { return mesh !== ground; }); if (pickInfo.hit) { if (currentMesh != null && currentMesh != undefined) { var newInstance = rackTemplate.createInstance(; =; newInstance.position = currentMesh.position; newInstance.isVisible = true; currentMesh.dispose(); } var objectId =; var objectPosition = pickInfo.pickedMesh.position; pickInfo.pickedMesh.dispose(); var rackClone = rackTemplate.clone(objectId); = objectId; rackClone.position = objectPosition; rackClone.isVisible = true; rackClone.material = new BABYLON.StandardMaterial("objectMovingMaterial", scene); rackClone.material.diffuseColor = new BABYLON.Color3(0.10, 0.80, 0.10); currentMesh = rackClone; startingPoint = getGroundPosition(evt); if (startingPoint) { camera.detachControl(canvas); } } }P.S. ArcRotateCamera is not working for me with babylon 2.1 beta but its fine on 2.0