Search the Community
Showing results for tags 'instance'.
-
I think I spot an issue when importing a gltf file containing instanced meshes. It simply seems to not instanciate meshes, but make copies instead. Here the gltf json showing meshes are correctly exported: and the result (playground link, check the console) same scene exported as .babylon is OK (playground link)
- 7 replies
-
- sceneloader
- instance
-
(and 1 more)
Tagged with:
-
Hi all! I use Blender for modelling. I've found out that mesh's instances can greatly improve performance, however I've got 2 issues after importing scene in Babylon.js: 1. There are no collisions with any instances except "parent" mesh. In Blender collision checkbox is set and affects all instances (no chance to set it separately, but that's OK in this case). How to enable collisions? 2. There are no tags for individual instance. I can set them for "parent" mesh, in Blender tags are visible for all instances, however they are not accessible from Babylon.js. How to set different tags for individual instance? Thank you!
-
Hi, found weird bug with shadows. Device: Galaxy S4 OS: Android 5.0.1 GPU: {vendor: "Qualcomm", renderer: "Adreno (TM) 320", version: "WebGL 1.0 (OpenGL ES 2.0 Chromium)"} Browser: Chrome (62.0.3202.84) / Native (6.2.01.12) PG Have mesh with PBRMetalnes material and ground with PBRMaterial. Added spot light as shadow light and included sphere as caster and box as receiver. Than created instance of the sphere. And after that both spheres disappear in S4 device. Sphere dont disappear if instead of instance, clone is used. Working PG
-
Hey everyone! Here is another demo to show that I failed to create the instance from mesh. Is something I missing? Please give me a hand, thanks!
-
The PG https://playground.babylonjs.com/index.html#0LM7CJ#10 is based on the PhysicsEngine HowTo example https://playground.babylonjs.com/index.html#0LM7CJ#6 but modified to use instances. It seems to work with the gravitationalField but not applyRadialExplosionImpulse. Is there something I've missed or is this not possible right now?
-
Hello! I discovered, what i call a bug, with instances and frustum culling. When the original mesh got submeshes the submesh culling of the instances relate to the position of the original mesh. This results in disappearing instances (submeshes) when the original mesh leaves the frustum. My quick hack was BABYLON.SubMesh.prototype.isInFrustum = function (frustumPlanes) { if( this._mesh._isAllwaysInFrustum )return true; var boundingInfo = this.getBoundingInfo(); if (!boundingInfo) { return false; } return boundingInfo.isInFrustum(frustumPlanes); }; //then setting orginalMesh._isAllwaysInFrustum = true; I think the current behaviour is not intended.
-
I was unable to transform mesh instance if the original mesh had a shader material. Is this a bug? I have created a playground example using box mesh. If you open the debug -> mesh panel, you realize there are 6 meshes, but only 5 are displayed. This is because one of the instances in the second row was not transformed properly. On the other hand, clones of meshes with shader material can be transformed properly. https://playground.babylonjs.com/#B2NZ1M#1
-
Howdy, Is it possible to create a group that contains a few meshes and then create instances of that group which includes the child meshes? How might one go about doing so? Thus far my attempts to create an instance of the group on creates the transform node but no children. Thanks! JPS
-
I have a lot of instances in my scene, and some of those instances have other instances as parents (not sure if this matters). So, whenever I dispose of one of those instanced meshes, my scene crashes.
-
Hi all, I found something weird while optimizing my code: I was using InstancedMesh as much as possible, and switched all my materials to ShaderMaterial. And then boom, everything disappeared. After a bit of research, it seems instanced meshes will simply not be drawn when their source has a ShaderMaterial assigned. Playground repro: http://www.babylonjs-playground.com/#TWDEA#6 Uncomment lines 40 to 44 to see for yourself. It's actually a bit more complex than that: when you assign a shader material to it, even the source mesh disappears if it has been instantiated (?), but only if its instances are in the field of view. I'm currently looking at BJS code and ANGLE_instanced_arrays doc (the extension used for drawing instanced meshes), but I thought I'd come here to fish for ideas... FYI these are two errors I noticed in the log when this problem showed (errors not always there): drawElementsInstancedANGLE: at least one enabled attribute must have a divisor of 0glDrawElementsInstancedANGLE: attempt to draw with all attributes having non-zero divisorsThanks
-
Is there a way to clone an imported mesh to use it in a different scene? I try to change the _scene parameter of the mesh like that : this.mesh._scene = newscene; but I got an error. It seems like I must import all my meshes twice in both of my scenes. Unfortunetly it will increase the loading time. Looking for suggestions! Thanks
-
If you look at this PG https://www.babylonjs-playground.com/#165IV6#8 and by commenting out line 32 you see that the mesh is updated. Try this with dashed lines and the updated mesh does not appear if line 32 left uncommented? https://www.babylonjs-playground.com/#165IV6#75 The option instance works with all the other meshes it should. Have had a look at code on github but CreateLines uses the linessystem but CreateDashedLines does not. Any advice welcome. Perhaps one for @jerome
-
Hi all, I've implemented a basic-functionality of a cloner system and I'd like to hear your opinions and design/concept-suggestions for further develepment and finishing my work (if you're interested at all). I decided to use a working title "SCS" for "Simple Cloning System" and here are the core features and concepts : Cloners: given one or several meshes, either clones or instances will distributed in a specific manner. If more than one mesh is provided, the meshes are distributed alternatively. Additionally, cloners can be nested, so it is possible to clone cloners. Each cloner can have several Effectors (in particular order) to influence the Scale/Position/Rotation parameter of a clone (or cloner). A sensitivity parameter controls this influence for a cloner. Following Objects are designated: RadialCloner: radial distribution where following parameters are recognized: count, radius, offset, startangle, endangle, Effector-sensitivity for Position, Scale and Rotation, alignment-flag, orientation. LinearCloner: linear distribution where following parameters are recognized:count, offset, growth, Effector-sensitivity for Position, Scale and Rotation. An interpolation-mode-flag determines, if the clone -parameters (Scale/Position/Rotation) are interpreted as "step" or "end"-values. MatrixCloner: coming soon (clones will be distributed in 3D space) PlanarCloner: coming soon (clones will be distributed in 2D space) ObjectCloner: coming soon (clones will be distributed in relation to the internals of a given mesh (vertices, edges, triangles ...) RandomEffector: influences Scale/Position/Rotation of a clone with repeatable random values, controlled with an overall "strength" parameter. Not quite finished, but basically working. FormulaEffector: coming soon, influences Scale/Position/Rotation via text thought to control from outside (html-page). StepEffector, TimeEcffector, DelayEffector and much more ??? So, enough for the moment, you can see and play with some scenes: LinearCloner,RadialCloner,RandomEffector radial-linear-radial-cloner linear-radial-linear-cloner PS: I need some advise if I should upload the sources to github if you're interested. Should I upload it to my own github space or to BABYLONX ? If the latter, do I have to send a pull request? Sources are written in typescript
-
hi, I tried to create instances of meshes, basically cloned my loaded meshes and then create instances of that clones, but run into issue. some instances created fine but others throws in console "[.CommandBufferContext.Offscreen-MainThread-0x12d4118a0a00]GL ERROR :GL_INVALID_OPERATION : glDrawElementsInstancedANGLE: attempt to access out of range vertices in attribute 2" during render. I also created small demo http://www.babylonjs-playground.com/#1NAQZD#8 . looks like this errors occurs only when some of the instances out of screen, maybe I forget something or this approach can't be used, but didn't found in docs any restrictions about using clones and instances. so what is the right approach to solve this? using Chrome Version 51.0.2704.103 (64-bit)
-
Hi! So I want to have a mini-me view of a mesh that will always be present in a little bubble in the lower left of my screen. I figured the best way to do that is to have two active cameras. One is my regular camera as per usual, and the other is in a small viewport in the lower left with a layer mask that filters out everything except an extra instance of my mesh. However, I'm noticing some strange behavior where only the first active camera will actually show the mesh and the instance. That is to say, I create the instance, and all is well, but then I push the new camera on the active cameras array and the new camera does not see either the mesh or the instance. If I switch the order of the active cameras (that is to say us unshift instead of push on the activeCameras), then the mesh and it's instance are both visible in the new camera, but not the old. Do any of you have insight to how mesh instances work with cameras? I assumed it would be the same, but there seems to be some magic going on. Thanks.
-
Hello, is it the correct behaviour that instances that are being disposed doesn't get removed from ShadowGenerator.getShadowMap().renderList ? I have the refreshrate set to 0 and only render with shadow on demand. if (_renderShadow && this._manuallyShadowRender) { this._shadowGenerator.getShadowMap().refreshRate = 1; this._scene.render(); this._shadowGenerator.getShadowMap().refreshRate = 0; } else { this._scene.render(); } Is this a problem i this case? I just want to know (maybe it's a bug). Shouldn't ShadowGenerator check the Mesh.isDisposed attribute? Have a nice day Kevin
-
Hi, Is there a simple way to create instances of a mesh with its children (and grandchildren) meshes ? I have a tree made of a hierarchy of custom meshes : treeGround (juste a square ground for texture like tree roots, dirt and grass), a trunk wich has treeGround as parent, a branch wich has trunk as parent, and other branches wich are instances of the first branch and also have trunk as parent (and are moved and rotated around the trunk). When i try to create instance of treeGround i get only the ground, not the tree, same if i try to instanciate the trunk i dont get the branches. So is there a way to create an instance of the whole hierarchy ? Would cloning instead of instancing be better ?
-
Hi! I'm trying to create various units for different players, each player can have multiple units, all from the same model. Because materials can't be per instance, only per mesh (WebGL limitation if I know correctly), I create a clone of a model for each player, change the material and afterwards I'm doing instancing from those clones. My problem is, that when I do this everything disappears (first it flickers and completely blank scene afterwards). Everything is visible again if bounding boxes are turned back on, but instances from clones aren't shown, only bounding boxes are at correct locations (attached first image). What am I doing wrong that this happens or is a bug? A minimal example on plunkr: http://plnkr.co/edit/yOaBtmu9NaOQpoULo6pv?p=preview EDIT: Example uses BJS version 2.2, but 2.3 suffers for the same problem. EDIT2: Added second image that renders exactly the same scene, the only difference is checked option for bounding boxed in debug layer.
-
http://www.babylonjs.com/Demos/INSTANCES/ 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
- 7 replies
-
- babylon.js
- instances
-
(and 2 more)
Tagged with:
-
Hello people, I had a good conversation with @JCPalmer. I asked him if he could add parent variable for instance in .babylon file and he did it. you can read it here : At the moment, the fileloader do not apply the right parent but always the same parent of original mesh. I will try to find solution for the babylon fileloader read parent for instance and apply this My idea > Add this in mesh file : // Instances if (parsedMesh.instances) { ... if (parsedInstance.parentId) { instance._waitingParentId = parsedInstance.parentId; } ... } Because in fileLoader, this code allready exist and all instances are in "meshes" array : // Connect parents for (index = 0, cache = scene.meshes.length; index < cache; index++) { var mesh = scene.meshes[index]; if (mesh._waitingParentId) { mesh.parent = scene.getLastEntryByID(mesh._waitingParentId); mesh._waitingParentId = undefined; } ... } What do you think @Deltakosh? Have a nice day, Letsbro studio team.
-
Hey guys, When you add actions to a mesh's instances, it affects the parent mesh and every instances. I'm not sure that's the behaviour you want, am I right ? You can see it in this playground : http://www.babylonjs-playground.com/#HZTM8 Thank you
-
Hello, I've got a peculiar thing. I want to capture the instances in such a way that once I've left my create scene handlers, I can return to my model calculators (i.e. scene hosts). User will engage with some form fields, during which time, I want to look up the related model calculators and make changes, potentially rebuild the scene based on the input. I've tried something like this, but it falls over on account of the scene object, deep within which is circular I think; somewhere is, at any rate. Point is, jumping to/from JSON is not going to work very well for purposes of what I am doing. <script type="application/json" id="data"> {"calc1": null, "calc2": null, "calc3": null} </script> Perhaps I will need to completely decouple the calculator configuration from the scene modeling bits, that's probably the right longer range answer. But I want to see if I can make it work without jumping to/from JSON first. Partly, too, is my ignorance concerning JavaScript object life cycle of variables throughout the scripts, i.e. if they survive the load and can be referenced at a later point. Regards, Michael Powell
-
Hello, If I export a scene containing nested instances of the same mesh/object (a tree of objects linked by a parent/child relashionship), and that I load the scene in BabylonJS, mesh positions are altered. Cases that works: - If I make every objects "single user", then it works fine. - If objects are duplicated but not nested, it works too. In the attachment, a Blender test scene with several layers : - the first is a tree made of duplicated copies (data is not shared between instances). - the second is a tree made of duplicated linked instances (same data shared by several object). - the third one is just a linked duplicate of the same object. The tested version of BabylonJS is 2.2. testBabylonExportParenting.zip
- 3 replies
-
- blender exporter
- duplicate linked
-
(and 5 more)
Tagged with:
-
When I create an instance of a mesh that has child meshes, do I need to also create an instance for all the children or will Babylon.js already do this for me?
-
Want to ask the authors - if you create multiple scenes at once, it does not violate the ideology pixi.js? I'm doing an application in which the page several canvases, each of which is a stage. Do not break this "something inside"? Although I assume this is normal, but still want to ask...