royibernthal Posted August 5, 2016 Share Posted August 5, 2016 I'd like to load into BJS a 3D model (e.g. a chicken) created in a 3D software (e.g. Blender), and then display it in my scene. The OBJ extension's demo seems to be loading a bundle of meshes that are grouped together to make one big model (if I understood it correctly), e.g. face mesh, body mesh, etc. http://doc.babylonjs.com/extensions/OBJ I'd like to be able to load one unified small file size mesh. What's the best way to do it? Would I have to use an extension for that? Would you recommend loading an .obj file or a .babylon file? Does it depend on the case? Are there any free downloadable model ready for experimentation in BJS? Quote Link to comment Share on other sites More sharing options...
royibernthal Posted August 6, 2016 Author Share Posted August 6, 2016 @Wingnut Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 6, 2016 Share Posted August 6, 2016 Ohhh, he's starting to target me. Yeah, I'm not keeping up with the zero-reply forum topics so well, am I? It seems that the forum users are asking hard questions, and I'm not qualified to answer many of them. But this question... is easy. .babylon file all the way. Blender is a free and powerful modeling package, but it takes a little work to learn to drive. I'm sure there are .blend files around with "a pile of demo mesh" in them. Maybe you or another can run some .blend files through the Babylon exporter-for-Blender, and make a few .babylon test files for us. You can create a free GitHub account for yourself, and store them there for free. You can even drag'n'drop them at the GitHub web interface to upload them (be sure to hit the commit button at the bottom of the page, after the drag'n'drop upload). I have a folder at github called 'misc' that I put stuff like that... into. Then I can use it in the playground. Like this: http://www.babylonjs-playground.com/#1CMD3G#15 Nine different mesh, all arriving in a single .babylon file... made with Blender 2.75. My first-ever Blender export to .babylon. Works great! I had to convert it to "ridiculous mode", of course. (drag while holding control key... to slew-around arcRotate cameras, as needed, of course) I just LOVE sparkly particles (sparticles). Particles themselves... used-to be able to produce godrays, but I'm STILL awaiting @Luaacro's word on whether that feature will be included in future BJS versions. (nudge nudge ahem) But that's a different topic. A playground search for 'SceneLoader' should find a crapload of .babylon file loads/appends/imports to experiment-with. Party on! royibernthal 1 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 6, 2016 Share Posted August 6, 2016 http://www.babylonjs-playground.com/#1RDUXN#0 http://www.babylonjs-playground.com/#1RDUXN#1 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted August 7, 2016 Author Share Posted August 7, 2016 @Wingnut Yeah, you seem reliable and responsive By playground search do you mean searching the forum like this? http://www.html5gamedevs.com/search/?&q=SceneLoader Or is there some other functionality I'm not aware of? I downloaded Blender, I'll start experimenting with it as soon as I have some time. I'll look into using GitHub, sounds like a good idea. Since I'm using AssetManager to load all assets before rendering the scene, I chose to go with assetManager.addMeshTask, similar to @Nabroski's PG. (which possibly under the hood uses SceneLoader) I'm adding the loaded mesh to an array for later use upon load complete. Is there a way to have it not appear automatically on stage on load? In other words, I'd like to load the mesh, and start using and rendering it only a minute (for instance) after it finished loading. Setting isVisible to false does the job, but is there a better way to do it that'd make more sense? From what I understand it's possible to even load multiple meshes from the same file. Do you choose arbitrarily what meshes you'd like to bundle in a .babylon file or are there rules and logic behind it? Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 7, 2016 Share Posted August 7, 2016 you can declare an other loader ? maybe var loader = new BABYLON.AssetsManager(scene); http://www.babylonjs-playground.com/#1RDUXN#2 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted August 7, 2016 Author Share Posted August 7, 2016 How will it help? Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 7, 2016 Share Posted August 7, 2016 Oh, i'm sorry, i kind of get lost, i reread your question, yes just set an event at loader.load(); this makes your mesh not appear automatically on stage on load Pryme8 1 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted August 7, 2016 Author Share Posted August 7, 2016 It'd delay the actual loading wouldn't it? Correct me if I'm wrong. I'd like to complete the loading and delay the rendering of meshes once they are loaded, not delay the loading (which would miss the point). Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 7, 2016 Share Posted August 7, 2016 I modify my playgroundhttp://www.babylonjs-playground.com/#1RDUXN#3 You have to experiment with in on a local server, and report it, if you got questions, you can hidetoloadingUI(), it works not well in the playground.http://www.babylonjs-playground.com/#1RDUXN#4 EDIT sorry again, i'm wrong you have to experiment with run http://www.babylonjs-playground.com/#1RDUXN#6@royibernthal Quote Link to comment Share on other sites More sharing options...
royibernthal Posted August 9, 2016 Author Share Posted August 9, 2016 @Nabroski Removing members from scene.meshes in your code gave me the idea to look for a scene.addMesh and scene.removeMesh, which seem to exist, thanks Any idea about this question? On 8/7/2016 at 7:53 PM, royibernthal said: From what I understand it's possible to even load multiple meshes from the same file. Do you choose arbitrarily what meshes you'd like to bundle in a .babylon file or are there rules and logic behind it? Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 9, 2016 Share Posted August 9, 2016 You are the artist make a discussion and go for it. Most of the time you want to draw kind of startingpoint (room, hall) so the player has already a visual response, what he is paying for. scene.addMesh Great Thank you, didnt know that. Quote Link to comment Share on other sites More sharing options...
royibernthal Posted August 9, 2016 Author Share Posted August 9, 2016 7 minutes ago, Nabroski said: You are the artist make a discussion and go for it. Most of the time you want to draw kind of startingpoint (room, hall) so the player has already a visual response, what he is paying for. Hmm not really what I meant. Let me try to rephrase - assuming you have all game assets ready - can you freely choose which to bundle into a .babylon file inside Blender? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 9, 2016 Share Posted August 9, 2016 Yes. If you have meshes, lights, cameras in your .BLEND that you do not wish to export, place them on a separate layer. Use 'Export only selected layers' checkbox on scene properties tab. While that layer of unwanted stuff is not currently selected of course. gryff 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted August 9, 2016 Share Posted August 9, 2016 @royibernthal : You can load all your assets into one Blender file putting them into different layers. You can then export only the layers you wish - could be all ,could be some, could just be one layer (Use the Layer Management addon that comes with Blender) If you decide to change one asset - delete that layer and import/append the new one. Also with the newest version of the BE you have the ability to add lights to different layers so that only the meshes in that layer are lit. TY to @JCPalmer for this new feature. cheers, gryff Quote Link to comment Share on other sites More sharing options...
royibernthal Posted August 9, 2016 Author Share Posted August 9, 2016 @JCPalmer @gryff Sounds good. Will each exported layer be a member of loadedMeshes array in bjs? Would it be wise to include all the meshes of a game in 1 .babylon file? e.g. objects, characters, etc... Or would you suggest to perhaps split by categories? Is there some convention? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 9, 2016 Share Posted August 9, 2016 You tell us. Quote Link to comment Share on other sites More sharing options...
gryff Posted August 9, 2016 Share Posted August 9, 2016 2 minutes ago, royibernthal said: Would it be wise to include all the meshes of a game in 1 .babylon file? e.g. objects, characters, etc... Or would you suggest to perhaps split by categories? Is there some convention? You can do it either way. Develop a work flow that you are comfortable with. For example: 1. Meshes that will never change - export as a single .babylon file( perhaps terrain, trees, rocks) 2. Then use BABYLON.SceneLoader.Append(...); to add objects from a second .babylon file that might change a lot (buildings, characters etc). Just get the work flow that suits you best. cheers, gryff royibernthal 1 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted August 9, 2016 Author Share Posted August 9, 2016 @gryff Okay I understand, thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.