Jump to content

Loading 3D Models


royibernthal
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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:D  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!

Link to comment
Share on other sites

@Wingnut Yeah, you seem reliable and responsive :D

 

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?

Link to comment
Share on other sites

I modify my playground


http://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

Link to comment
Share on other sites

@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?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

@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 :)

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...