royibernthal

3D Models Animations

Recommended Posts

1) Is it possible to have 3D models with animations? Perhaps using the OBJ extension?

2) Can 3D models be lightweight or are they always around a few megabytes per model?

 

I need to be able to have multiple animated 3d models in the game at a reasonable size - hopefully the sum of all assets will not exceed a few megabytes, more than that would mean unbearable loading times to the end user.

Share this post


Link to post
Share on other sites

Hiya @royibernthal

  My suggestion... just make sane-resolution models in Blender, or assemble them with math, or via parenting multiple BJS easy-make mesh... together.  Do the animating... after import... with BJS animations or sin/cos orbit trajectories.

To make lightweight models, just make sure they have low amounts of vertices... in your modeling software.  There is also a Simplification system available in BJS, that reduces vertex-counts on complicated mesh.  It has a bit of "work time", so it is better to CREATE your models lightweight in the modeler... or with your math-based mesh-grower.  The less subdivisions, on all three axes, the less model "weight".

Just like our BJS basic elements.  The less vertical and horizontal subdivisions (tessellation) in a mesh/model, the better the performance of the scene. (in my humble opinion).  You can get models that are WAY WAY WAY smaller than 1 megabyte... and they will still look great... sometimes thanks-to the auto-smoothing of our rendering engine.  If you need to use flat-shading, that's when you will take a hit... and need to use more tessellation to smooth the surface.  Avoid flat-shading, for higher performance (imho).  Just make good models, and I think BJS speeds will surprise you and not get in your way, performance-wise or load-time-wise.

Morphing (animating the position/scale of each vertex of a model, to change its shape) is a different story.  It is a type of animation that can get slow.  Yet, let me show you what geniuses like @jerome can accomplish.

http://www.babylonjs-playground.com/#1X7SUN#7

Amazing, huh?  Lots of mesh, all animated position-wise, rotation-wise, AND animated morphing-wise.  I'm getting 60 FPS on that, WHILE having 5 other playgrounds open, and WHILE Grand Theft Auto 5 is running in another window.  Pretty impressive, huh?  Most people don't need morphing.  Your animations will probably be basic position, rotation, and scale animations, and BJS does these animations with great speed and ease.  Just keep the details on your models... vertex-count-sane.  You should see models no bigger than 100kb... and see plenty of high-speed performance from BJS.  It's the fastest webGL framework on the planet, currently.  Really.  :)  Be well, party on.

Share this post


Link to post
Share on other sites

Hey @Wingnut

I'll keep in mind your hints for optimizing models weight.

There's only one problem - I won't be able to do the animations after import using BJS animations or anything of the sort.

The animations I need are too complex and will be animated by professional 3d animators, therefore it must be before import.

 

1) Is there even a way of importing animated models?

2) How do I keep the file size low in this case? I imagine every keyframe in the animation will be like adding to the file another model in terms of size, correct me if I'm wrong.

Share this post


Link to post
Share on other sites

@royibernthal

On 2016-07-30 at 7:06 PM, royibernthal said:

1) Is it possible to have 3D models with animations? Perhaps using the OBJ extension?

Hi roy :)  1a) Yes.  1b) I believe not

 

On 2016-07-30 at 7:06 PM, royibernthal said:

2) Can 3D models be lightweight or are they always around a few megabytes per model?

Yes an animated model can be lightweight if you design it that way. Three factors will end up defining the size of the file.

1. # of mesh vertices - more complex meshes - bigger file.

2. # of bones - more bones - bigger file size. Think of a hand - does it have a bone for every finger and thumb joint?

3. # of frames of animation - more frames -bigger file size.

See my "Blue Lady". Original file size ~7Mb -approximately 4,000 vertices mesh, 32 bones, and 900+frames of animation. The most recent export with the Blender exporter 4.6.1 ~2mb with same mesh/bones/frames. A huge improvement over two years in BJS and the exporter.

36 minutes ago, royibernthal said:

I imagine every keyframe in the animation will be like adding to the file another model in terms of size, correct me if I'm wrong.

No - just adds frames.

 

You might want to have a look at this thread which discusses adding animations to a rigged model (with no animations) from a separate .babylon file.

cheers, gryff :)

 

Share this post


Link to post
Share on other sites

Hi @gryff :)

 

What if we're not talking about rigged models?

For example, what if I had an animation of animals, and each keyframe contained a completely different animal - i.e. frame 1 dog, frame 2 cat, etc... Of course this specific animals example doesn't make much sense, but you got the idea of what I'd like to be able to deal with.

Share this post


Link to post
Share on other sites

Hi R.  Are you talking about a 2D animation on a 3D model?  I suspect Gryff and I were talking about animating the 3D model itself.  We were mistaken.

This is related to your other topic... putting 2D animation on the side of a box, right?

Ok, now I understand, and the answer is no.  :)

Ok, maybe.  You have a 2D animation.  It needs to play on certain faces of certain mesh, right?  Well forget it.  It is against the laws of webGL.  You can do it in a modeler, and render it to video, but it won't make the trip to webGL.  Sorry.

But, speaking of video-Texture.  Yes.  You can make the 2D animation into a video, and "play" it on a plane, via the BJS videoTexture feature.  But that sort-of sucks, too.  The videoTexture feature is based on the HTML5 video element, and it is flaky.  (the great CODEC wars are still happening) 

For example, sometimes it takes "press RUN twice" in playgrounds with videoTextures... to make them play.  Sometimes it takes more than that.  mp4 and webm formats seem to be the norm.  I don't know how well video textures exported from Blender (already mapped to the mesh)... will work in BJS.  It's a scary world.  :)  I dunno if your modeling people will be using Blender.

It doesn't do any good to ask "How about obj files?" or "What about fbx files?", etc. etc.  The log jam is with webGL.  (as far as I know... not all that far)  :)

I hope we got on the same frequency now.  You are NOT talking about 3d mesh animation, right?  You're talking 2D sprites, cartoons, movies, video, etc, correct?

Sorry.  I think Gryff and I were thinking "Transformers"... like a cell phone that unfolds into being a 50-foot fire-breathing, car-crushing robot.  :)  (mesh animation)

Share this post


Link to post
Share on other sites

@royibernthal Have been following this thread and am confused as to what you actually want. (but then I am easily confused).

Firstly am I correct in that you and a team of animators are using a software package to produce a complex 3D animation that needs to be imported meshes and animation and all into BJS?

Secondly your following post seems to imply that the file you want to export contains keyframes.

On 08/01/2016 at 3:32 AM, royibernthal said:

Hi @gryff :)

 

What if we're not talking about rigged models?

For example, what if I had an animation of animals, and each keyframe contained a completely different animal - i.e. frame 1 dog, frame 2 cat, etc... Of course this specific animals example doesn't make much sense, but you got the idea of what I'd like to be able to deal with.

For example keyframe 1 contains a cube and keyframe 2 contains a sphere and having imported this into BJS you want BJS to produce the inbetween frames. Is this the idea?

Some questions for you.

Is the package you and your team one you have bought in, and if so what is it?

Is the package one you have built yourselves?

Why import into BJS, is it to have the animation on the web?

Can you be more specific as what data you want to export from your package and what exactly you want BJS to do with it?

 

 

Share this post


Link to post
Share on other sites

Okay I understand my explanation was very confusing.

 

Regarding your questions:

I don't have a team of animators at the moment

There're no animations done yet

I don't have any experience with 3D animation

I don't want BJS to produce the inbetween frames

I need to import 3D animations for a game I'm making in BJS

I don't know what would be the best way to make those animations, for now I'd like to test it with any animated 3D model I can get my hands on.

 

An attempt at explaining things differently:

I need to import into BJS an animated 3D model, its animation can't be done via coding (tweening, etc..) - or otherwise would be unnecessarily hard to do via coding, as far as I can imagine.

Example for such animations out of the top of my head - complex face expressions - a vampire exposing its fangs, a pirate winking...

Hopefully things are clearer now.

 

Share this post


Link to post
Share on other sites

@royibernthal

Hi roy :)

5 hours ago, royibernthal said:

I don't know what would be the best way to make those animations, for now I'd like to test it with any animated 3D model I can get my hands on.

I can give you a rigged model - with or without an animation. But it requires you have a knowledge of Blender - and you don't seem to want rigged models

5 hours ago, royibernthal said:

Example for such animations out of the top of my head - complex face expressions - a vampire exposing its fangs, a pirate winking..

This can be done from Blender - but the best I can say is it is experimental. @JCPalmer : is working on animations that are not rigs but rather "shapekeys" and maybe "Queued Interpolation"

Fingers

Only example I kmow - and no documentation. He also has a facial speech/expression demo - but I don't have a link.

cheers, gryff :)

Share this post


Link to post
Share on other sites

@gryff

Hey gryff :)

Not really what I'm looking for either.

Is there no such thing as importing 3D animations in BJS so that the actual animation could be left to the animators to be done in Blender?

Same as when you import a 2D animation you don't start to modify or tween between the frames, you display each frame as it was imported. Perhaps this is just not the way things are done in 3D?

Share this post


Link to post
Share on other sites

@gryff, looks like guy wants the exact opposite of what I am doing.  I judge doing externally animations then replaying them in BJS to be both un-scalable & too limiting.  Playback is fine for small works & for allowing multiple sources to export in a common format, but doing "the actual performance" externally is especially heavy for morphing.  Maybe OK if you are distributing on DVD-rom for a game console.  Shipping an entire set of positions & normals for every frame on-line definitely limits mesh size drastically.

Also FYI, QI.ShapeKeyGroup objects are way more powerful than Blender shape keys, in that they can be isolated to only parts of a mesh.  You have to be careful with groups like WINK though.  FACE also can also change eye lids/lashes for some expressions.  As blinking is primarily an involuntary action, I just check that a facial morph is not in progress in my auto blink code.

Share this post


Link to post
Share on other sites

:) You sound sort of discouraged, R.  Let's talk a bit more, if you have time.  For ease of talk, let's use "step" as the term for each frame of the animation.  No "playback" speed is implied.  And let's assume some other things:

1.  One mesh per animation... probably just a sphere or patch grid (like our ground mesh)... all points already connected by indices.  Like this.
2.  Use only a single texture, or use color-per-vertex with no texture.
3.  Each step does not add or subtract vertices or indices.  No welding, un-welding, merging other mesh, none of that stuff.  Animators MUST ONLY move-around pre-established vertices/points.

Could your idea... follow those rules?  If so, the possibility of "page-flipping" 3D models... has a much better chance for success.

Instead of loading model after model after model, and when complete, using BJS to "change them" as fast as JS-possible..

...you find/invent... a "script" that records the change of each vertex... each step.  Let's say you have 5000 vertices that you let animators position each step.  But maybe only 35 vertices actually changed position since the last step.  SO, in your "recorder" (which would happen in the modeling software)... an "encoder" would record the action of those 35 vertices, and no more.

After much toil, you would load that final 3D "animation script" into your BJS project, build a JS func that converts that "script" into real changes in the sphere's POSITION data on its vertexData object (its shape)... and see how fast it will go.  Weeeeeee.

The encoder?  Probably a Blender plugin.  It will be much like stop-action or clay-mation.  Move some vertices, record-to-script, move, record.  Each "record" not taking a snapshot of the current state, but analyzing the changes since the last step, and recording those changes/deltas.

The decoder, in your scene... easy.  You will only be playing with the positions, not the indices, or normals.  You WILL be dealing with mesh UV's if you use a texture.  Or, you WILL be dealing with mesh colors data... if you use colorPerVertex coloring.  But still... the point is... no model after model, no changing any LENGTHS of vertexData arrays... essentially morphing-only.

Don't let the term morphing make you think that you need to change from shape to shape... slowly.  You don't.  You can SNAP to a completely different shape... in one step... if you wish.  But think about that.  5000 vertex position changes... POOM... in one step.  HOW FAST can your JS-based in-scene decoder...  read 5000 pieces of data from the script, and adjust 5000 vertex positions on the sphere's vertexData object?  Probably not fast enough.  But maybe.  :)

Still, the alternative is storing a truckload of 5000-vertex mesh.  Some of the steps only moved 35 vertices, yet you made the user wait-through yet another 5000 vert mesh load.  60 frames, 60 mesh. erf.

See what I'm talkin', here?  Good, cuz I don't.  :)  Can ya help me out, here?  heh.   I might be describing Blender ShapeKeys... I wouldn't know.

In general, if each step of the animation can keep the same amount of vertices... there's hope... either with the mesh-flipping method, or with the "deltaEncoder" (vertex change recorder).  :)   Am I anywhere near on-subject?  I hope so.  Ever written Python for Blender?  I have.  Kind of fun.  I used Python to drill-into my Blender v2.75 and barf-out all it's known hotkeys.  phew!  :)   Zip of the code, here.

Share this post


Link to post
Share on other sites

Hi, seems i'm a bit late in, but i'd like to share a few thoughts on the size of downloads,

 a few MB of loading isn't that big a deal in todays age of the internet, most people have atleast 5MB/s download speeds..

i recently made a few tests where i downloaded around 80 MB from a server located 500 Km from me + ran a lot of code, from start to finish it took an avg of 25 seconds, about 3 seconds were timeout's & 2 seconds was a interval. 
and after the initial download, unless the clients browser cache is cleared or you make changes to your meshes, it doesn't need to be re-downloaded,
and at last, to be fair, waiting a few seconds for any game to load isn't that abnormal :) 

 

Share this post


Link to post
Share on other sites

@Wingnut

I was discouraged because it seemed for a moment like animating won't be scalable and would take a lot of dirty work for every new animation and result in restricted animations.

Now that I read your idea it seems it doesn't have to be the case, sounds interesting. It feels like you're leading me down the road to writing a new bjs extension :)

 

Does such a model follow rules 1+2? (some random image from google)

http://preview.turbosquid.com/Preview/2014/05/21__21_11_41/piratespiratelord01preview03.jpge96f2e79-ee78-4fff-b604-7f6aaae48c3aOriginal.jpg

I believe each step of the animation can keep the same amount of vertices, it shouldn't be a problem.

 

So if I get it right, the encoder would be a blender plugin written in Python, allowing animators to intuitively animate the model using blender and then export the animation in the format you described using the plugin, and the decoder would be in JS. Correct?

I'm not familiar with blender (or any other 3d animating software), would such a thing be quick and easy to write or would it be a big project?

 

@aWeirdo

Where did you get that statistic? It'd be great if you could link to your source.

From what I know it'd be a poor dev choice to count on such download speeds, I plan to keep the whole project combined under a few MB. (hopefully it'd be possible)

Share this post


Link to post
Share on other sites
19 minutes ago, royibernthal said:

Where did you get that statistic? It'd be great if you could link to your source.

From what I know it'd be a poor dev choice to count on such download speeds, I plan to keep the whole project combined under a few MB. (hopefully it'd be possible)

Akamai 2015 global connection speed rankings,

Q3 2015 Global avg  was at  5.1 Mb/s (September)

Q4 2015 Global avg was at 5.6 Mb/s (December)

 

Wikipedia have it all summed up, sources at bottom of page^^

https://en.wikipedia.org/wiki/List_of_countries_by_Internet_connection_speeds

 

Don't be too scared of your project size, cache is your friend^^ :) 

Share this post


Link to post
Share on other sites

@royibernthal What I described... is likely implausible for models like the pirate.  We are still sort-of feeling-around for what you have in mind... and I'm still not coming up with any good ideas.  Things like that pirate... likely work best with rigging.  hmm.  *scratch scratch*  Sorry.

Share this post


Link to post
Share on other sites

Absolutely yes.  We have a playground buddy named "Dude" that is quite active 'round these parts.

http://www.babylonjs-playground.com/#1BZJVJ#10

Sometimes travels in groups.  http://www.babylonjs.com/Demos/InstancedBones/

Ms. Rabbit visits the PG, too.

http://www.babylonjs-playground.com/#1BZJVJ#4

She sometimes gets furry:    http://www.babylonjs.com/Demos/fur/

SIMD girls know how to dance.  Set the targetFPS to 20 and the dance party begins:  http://www.babylonjs.com/Demos/SIMD/

The Blue Lady is a bit more exotic:  http://www.3dworlds.ca/1webgl/blady/index.html

The Geek Guys dance, too.  Press x30, and after the fall, tap the F button to your fave song beat.  http://www.visualiser.fr/Babylon/character/default.htm

(animation via sub-terrain jet engines)  :D   There's a few more boney creatures around... but that's a good starting sampler.

Share this post


Link to post
Share on other sites

@royibernthal I may be wrong but it seems that you have an idea for a game and are at the very start of exploring how it could be achieved and have a particular view of how it might be achieved. This appears to be

A background character in the game could be for example a parrot which opens and closes its mouth as it dips its head to eat seed for a bowl. (I am using a background character to mean one that is unaffected by any player interaction and am doing this to keep things as simple as possible for the moment.)

Create 3D parrot animation in software A, export finished animation in file format .readableBySoftwareB, import file into software B and with software B create the game that uses the  parrot animation  imported from software A.

After importation into software B other than perhaps positioning the parrot the animation of the parrot should just happen.

Again I may be wrong but it seems to me that you have come across BabylonJS as a 3D games engine and are hoping that it will serve as software B and there was a  file format .readableByBabylonJS  that would do with the parrot animation as described for software B above. If this was the case then you could find a software A that a team of animators could do the animations and then just pop them into BabylonJS.

Please forgive me if I appear a little blunt but the following

On 04/08/2016 at 0:07 PM, royibernthal said:

Perhaps this is just not the way things are done in 3D?

implies you know little about animating in 3D and so entering into a discussion on the methods of 3D animation such as the question

On 01/08/2016 at 3:32 AM, royibernthal said:

What if we're not talking about rigged models?

is not helpful and is confusing. In whatever way the 3D animation is achieved you just want software to create the animation and software to put the animation into a game.

You probably know this already but just in case

In 2D animation a frame is an image drawn by an animator, sequences of frames are viewed at speed.

In 3D animation a world model is created mathematically from a set of 3D points. A frame is rendered (drawn) as a screen image from the model depending on the view of a camera. Two things can change - the camera view as it moves and/or the positions of objects in the model. In BabylonJS new frames are drawn up to a rate of 60 frames per second and the user can alter the camera position at any time.

So back to the parrot. Presuming that the player can also move around the scene at will then the view of the parrot at any time, t, is determined by two things, the camera position and angle in software B and the positions of the various points that make up the parrot and its animation at time t as determined by software A.

So someway or other Software A has to export the parrot model plus a method of determining the points that make up the parrot at time t, which could be any array of points, an array of changes or even a function. Software B has to be able to read the model and the method of animation and render a frame correctly at time t.

So perhaps your question is

Is there any software that can create and export an animation of (for example) a model of  a parrot which opens and closes its mouth as it dips its head to eat seed for a bowl. If so is there one that can export this in a file format such that BabylonJS can import this file and show the animation of the parrot model without any other code than the importation code?

Or perhaps you need to be looking for coding animators that could do the game directly in BabylonJS because BabylonJS could create the game directly but I can see why you would want animation software and game software that imports the animation.

Sorry to be so long winded (am I channeling Wingnut???) and I hope I have come close to what you are thinking. If not than I have just confused everybody and made things worse and perhaps you need to think through your question again in a new thread. 

 

 

 

Share this post


Link to post
Share on other sites

@JohnK True, if I haven't said it already or wasn't clear about it - I have no experience with 3D. It is as you say, I have an idea of a game in my head and I'm trying to bring it to life, I come from the 2D world.

I'm not entirely sure I understood - why do you need both software A and software B? Is it like in Wingnut's example where software A is blender to make the animations and software B is a blender plugin to translate the animations into something readable by BJS?

Could you perhaps demonstrate your idea with concrete examples? Perhaps you already have but it was a bit hard for me personally to completely understand them.

e.g. The animators will be animating in Blender, then you export the code and import it to ... where you export it to something readable by BJS.

1 hour ago, JohnK said:

So perhaps your question is

Is there any software that can create and export an animation of (for example) a model of  a parrot which opens and closes its mouth as it dips its head to eat seed for a bowl. If so is there one that can export this in a file format such that BabylonJS can import this file and show the animation of the parrot model without any other code than the importation code?

I believe this question would be correct. Another example of an animation which I'd like to be able to create - a bird flapping very long wings.

What method would you use to animate this in 3D? rigging?

Would what you're talking about give the animator complete freedom over the animation? (shaping, facial expressions, positioning, etc...)

How much would it affect the size? Are you suggesting only saving the changes between frames in the animation the way Wingnut suggested?

My idea would require having to create many animations that'll keep adding up, so I'm trying to have the most comfortable animating environment, without limiting the animating work to coders. There are a couple more good reasons but even that alone would be enough in my opinion.

 

@Wingnut Looks good, can you maybe tag the people in this topic so that they'll be able to give their thoughts on the subject?

 

@aWeirdo Interesting, after a bit more research it seems you truly have a point, thanks for opening my eyes :)

Share this post


Link to post
Share on other sites
18 hours ago, royibernthal said:

I'm not entirely sure I understood - why do you need both software A and software B? Is it like in Wingnut's example where software A is blender to make the animations and software B is a blender plugin to translate the animations into something readable by BJS?

Yes such as blender and BJS. There are many 3D animation packages some may do everything you need. BJS cannot do graphical animation modelling you need another package for that if you are to use BJS.

I do not have sufficient expertise to advise you further on which packages to use. I was just trying to get a clearer idea of what you needed so other could help.

 

18 hours ago, royibernthal said:

What method would you use to animate this in 3D? rigging?

Why at this stage is the method of animation important to you, provided you can find package(s) to do as you wish what is happening under the hood is not so important.

 

18 hours ago, royibernthal said:

Would what you're talking about give the animator complete freedom over the animation? (shaping, facial expressions, positioning, etc...)

Only if you choose the right package.

 

Some more questions for you.

How far on are you with your 3D game idea? Have your drawn the characters you will use in 2D? Have you described the game in writing and with drawings?

What 3D animation packages have you researched?

Sound like you want to produce a professional game, have you looked at paid packages?

Have you explored animation forums (if they exist)?

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.