Search the Community

Showing results for tags 'mesh'.

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
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 206 results

  1. So.... to my great disappointment - yes, another one of those - it looks like parented meshes don't work with physics engine. Is there any workaround? I think it's impossible for me to unroll all parenting in the project, it would break animations and god knows what else... BTW it looks like @Wingnut is currently working on similar issues (poor physics support). thumbs up to you for all the great work
  2. 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
  3. 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: 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
  4. Creation of ground

    Hi team, I would like to create a ground in my scene. However I don't want that it was square, is it possible? Thanks!
  5. Hello, guys. I'm newbie on 3d programming. I want to display sprite like GUI that has a function linkWithMesh. but it hasn't. In this example, sprite's position from a mesh is changing, not fixed. the mesh must have BILLBOARDMODE_ALL. how to make sprite to track mesh's position like GUI's linkWithMesh.
  6. I'm stuck with loading my meshes. I'm new to all the 3D and modelling so any thoughts are highly appreciated. Basically I want to extends Babylons default Mesh class called BaseMesh and add a 'load' function to it to get rid of clutter in my scene code. I'm extending this BaseMesh class for each model I have. My BaseMesh class: (Note that all code examples are written in TypeScript) // BaseMesh.ts class BaseMesh /* extends BABLYON.Mesh */ { public readonly BASE_URL: string; // I want these to be static public readonly MODEL_URL: string; // I want these to be static public readonly NAME: string; // I want these to be static public body; /* constructor( scene ) { // I don't know what to do here super( this.NAME //name scene // scene null // parent ? // source ); } */ public load( assetsManager: BABYLON.AssetsManager ) { return assetsManager.addMeshTask( this.NAME + ' task', // name "", this.BASE_URL, this.MODEL_URL ); } public onLoaded( results ) { // I don't know what to do here this.body = results.loadedMeshes[0]; } public update(): void {} }; A model class would looks like this: // Robot.ts class Robot extends BaseMesh { public readonly BASE_URL: string = '/models/'; public readonly MODEL_URL: string = 'robot.babylon'; public readonly NAME: string = 'robotMesh'; public update(): void { this.body.rotation.y += 0.03; } } In my code above I store the loadedMesh from the AssetsManager into this.body. But here is question 1: why is my model already showing on the scene when the meshtask has run? I'm only loading a mesh, I've not put anything about putting it on the scene. Question 2: How do I extend my BaseMesh class from BABLYON.Mesh so that the result (loadedMeshes) of my load function is "the mesh itself" (instead of an attribute this.body). For example this would mean I could change my update function to 'this.rotation.y += 0.03;' and just generally makes more sense. Question 3: I'm really confused about the relationship between my "code" and my "model/.babylon files". Is there any good documentation/tutorials about this? These questions range from: - when is it healthy to split different parts of a model in different files - do I apply textures in my code or do I do that in my .babylon file - do I apply animations in my blender file or do I code them - ... This was a pain to type, if you have any questions please do ask Thank you in advance!
  7. 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.
  8. Quick question: Does freezeWorldMatrix need to be called on children meshes to gain full performance benefit, or is freezing a parent mesh enough (I see that the children have different values for isWorldMatrixFrozen, so guessing I need to freeze each child individually, but figured I'd make sure before making a bunch of changes that didn't need to be made) Also: Is there a way to measure how many meshes world matrices are being evaluated in the scene, i.e. something like engine.drawCalls for matrices calculations count?
  9. Hi, i have a question about shadows, is it possible to let a mesh cast shadow on it self? Currently I can make a tree looking like the first picture, but in this case the 3d deep looks not that good. I looking for a solution I can get a tree like the second picture. Thanks for your help Mirco
  10. Hi all. I'm trying to return an array of objects loaded by the Mesh Importer for later use. I would like to be able to call a function to load my objects and outside of the function, affect & change each one of them OUTSIDE of the function. Here is the small demo I made :: Thank you! <3 Mythros
  11. Hi, I have question about creating meshes based on one prototype. I have multiple meshes, that have same geometry but should have different material (color), idea was to create prototype mesh in 3d max, add bump map and export it. Than I found that Mesh class have source mesh, so I passed my prototype mesh into mesh constructor: PG So far everything was working I could create new meshes and change material for them. But problems started when I tried to create instances from new meshes as all instances where moved to same position: PG But if I make clones from meshes they work: PG Was it designed to be used like that, or I am overusing system Maybe there is better way to achieve same result? prototype -> different meshes -> instances. @Deltakosh some ideas there?
  12. I am new to Babylon and I have some knowledge about unity shaders but I am not sure how can I create shaders for Babylon, can any one suggest me any tool or any link which can help me to design or create some beautiful Shaders for Babylon. as BabylonJs Object's material, as we have shader forge available for unity, can any one suggest me a tool for WebGL shader create tool? that will be your good help for me, I am getting frustrated and need extream help from Babylonjs Community.
  13. Is there a way to smooth dynamic created mesh? searched the forum and found something related to VertexData.ComputeNormals, I tried it and not working. here is a demo the attached picture shows the problem, the outer head is a babylon file (smoothed ), the inner face is dynamically generated. clearly the lighting on the inner face looks flat. I guess it is something like this in unity forum ? thanks for the help
  14. Bug in GUI causes crash

    Hi, I run into trouble when trying to clear a scene. The scene contains objects which have Babylon.GUI labels linked on them. Something is not getting updated properly? I can make it work using a timer delay between consecutive mesh.dispose() commands, but running them in a loop crashes the program. Here is the same problem in a PG. You can dispose one or the other mesh, but not both -- without a delay.
  15. Hi everybody: I need to know about what is the preferred approach to handle the mouse/touch events (for example onclick): (1) via the canvas by means of myCanvas.addEventListener("pointerdown", function (evt) { ... var pickInfo=myScene.pick(myScene.pointerX,myScene.pointerY,function(mesh){ return (mesh===myMesh); }); if(pickInfo.hit){ alert("Mesh picked"); } }); (2) via the mesh using the powerful ActionManager functionality myMesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickDownTrigger,function(evt){ alert("Mesh picked"); })); Thank you for your time.
  16. How to create Empty Mesh/Node for Parenting? The Empty Node must have Position, & other Transform data!
  17. Hi, I thought I would ask before coding functions for which I'm not certain babylon.js already supports. Is there a ready method that can take a single obj/mesh that consists of several contiguous meshes and parse the contiguous meshes into, say, an array ? I have attached an example of a hex tile terrain (see attached) exported from blender which consists of 50 hex tiles. If possible, I'd like to simply pass the hex terrain data and obtain all the 50 hex tiles in an array. Which I can then use mouse triggers on and so forth. I have read the doc and done some testing but cannot seem to get the behaviour I wanted with subMeshes. Does another method/function exists that can do the job? Or do I have to code my own by parsing the babylon file ?
  18. Code: So if you try to load a scene asynchronously, do something else, start the engine using that scene, The scene will just show an empty space. However, if you take a look at the code above, go to async function createScene(config) { const { textureModifier } = config; const { height, width, color } = config; const scene = new Scene(config.engine); await importScene(config.mesh, scene); And comment 'importScene' line, the go to async function run() { // await importScene(config.mesh, scene.internal); engine.runRenderLoop(() => scene.render()); // engine.runRenderLoop(() => console.log('test')); } And uncomment 'importScene' here, it works fine. I've included a .babylon file below. foot.babylon
  19. Hi, Looking around for a lazy-loading mesh example. There is assetManager and sceneLoader, with ImportMesh, .append() and .load() variations. All good there. : ) Question: Which way is best to delay-load (lazy-load) 3D meshes? The original hope was for AssetManager to be able to delay-load. Does it? - Looking for something like runTask, after init, but then found ._runTask, so maybe delay not possible. Did I miss it? Idk. : ) 2) Next, sceneLoader.append, can it lazy-load? Couldn't find example.... 3) ImportMesh, my previous favorite way, but recently standardized around AssetManager, and hesitant to switch. etc. Which is best to lazy-load? Thanks,
  20. I have a .babylon file that I've read.And I need to load the mesh into the scene. What would be the best way to do it? I can't use HTTP requests, it has to import from that object. I've tried: const loader = BABYLON.SceneLoader.GetPluginForExtension('babylon'); loader.load(scene, data); But it gave an error: foot.babylon
  21. Funky Rendered meshes

    Hi guys , I'm fairly new to babylon and this forum. But I already like it a lot. Thanks for the knowledge that is shared over here! I'm trying to build my first little babylon experiment with a friend and we ran into a problem which we don't know how to solve. It's a small scene with a couple of skeletal animations. You can find over here: When its done it should be looking like this, ...Reference Frame The meshes getting rendered in a funky manner/order We think it has something to do with the alphaIndexes and all our non-opaque meshes. We already searched for it an read this article: about how things are rendered, but we still don't know the best way to fix this: Some advice, best practices would be very welcome. THANKS IN ADVANCE flo PS.: Had some trouble with building a working playground. (It always said that I need to have a camera.) -- A LOT OF CODE WAS POSTED HERE --
  22. I am importing a generated foot mesh. After importing it I strip the jpg that's overlaid. Is it possible to modify color in parts of the foot. Let's say I'd want to make toes red, or half of the foot blue, can i do it after model is imported? Or do I have to overlay another mesh on top and color it ?
  23. Hi, I have an issue with scene that is loaded incrementaly. After meshes are loaded I apply freezeWorldMatrix to some of them (checked isReady and it is is true). As soon as camera is near to meshes and beta angle of camera is near 90 meshes start to disappear and appear during camera movement. Doesn't happen if incremental loading is not used. Found similar issue here, but it was solved.
  24. Custom mesh triangulation

    I'm having trouble creating a custom mesh. The documentation doesn't help much to be honest and I've looked at the source code of Plain and Rope but after that I'm still unable to get it working. The way we did it for the past months was to extend the Rope and override the way rope works. With this solution we're having a lot of UV issues and we have too little control so we wanna make a custom mesh. Basically all we have to do is make a dynamic line so in the tick loop we add/remove points from the line. This is pretty much what I made now and I've tried different draw modes and different triangulation. So a couple questions, Does the mesh update when I set the vertices, uvs and indices or is there something else that needs to be done? Is there some documentation on how to do triangulation for the different draw modes? Any other idea why my mesh doesn't render anything?
  25. Hi, I'm new to Babylon and try to load my mesh from a remote address. I put it in my aws s3 bucket and public it on aws cloudfront. So it is accessible via http request. Can I stringify .babylon file as json file and feed it to SceneLoader? And load it to my scene via ImportMesh("","", "data:mydatahere", scene, onsuccess, progressCallBack, onerror)? or is there a better way? Thanks, Derek