Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (843)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  3D (With OpenGL)Meshes and Animations: How do I make it warks?  (Read 3791 times)
0 Members and 1 Guest are viewing this topic.
Offline UprightPath
« Posted 2012-08-02 10:16:55 »

Not talking about videos (Since I know how bad that is)! No, I'm talking about just doing frame-based drawing and animation.

I already know the basics about doing things, like getting it to draw on the screen, getting textures to draw on 'em, etc. No, I'm talking about two separate issues which I'd like some opinions on.

1) Groups: If you have several objects that you will be drawing in the same area (A 'squad' of troops for instance, where you have one mesh per person in the squad) is it better to combine all of the smaller meshes into a single larger mesh and draw it just once, or to draw the small single person mesh several times (Translating as need be to position them correctly).

I figure that the second one would have the benefits of differing the current frame/state of each person, as well as allowing you to place things at different heights. However, I'm more talking performance wise (And yes, I'm working on this in the hopes that I can put it on something like my crappy little phone, so 3D speed is important.)

2) Animations: Would processing some sort of mesh animation file (Such as MD5 Animations) be better than doing something like creating several different .obj (Or other still frame format) and loading those up, then handling the animation by just specifying which loaded mesh I want to draw.

Offline theagentd
« Reply #1 - Posted 2012-08-02 13:00:09 »

1) Keep individual meshes for each unit in the squad. Having all troops of a squad in the same mesh would mean that you can't move and animate the units individually. They will literally be glued together. I wouldn't worry about performance in this case. If your graphics card can handle drawing the troops, it doesn't matter if they are in one mesh or many meshes. However, if your individual units are very low-poly (<500 vertices or so maybe)  and you have over like 2000 of them, you could get a CPU bottleneck due to your CPU not being able to send instructions fast enough to your GPU. In this case the solution isn't to combine meshes but to use more advanced rendering techniques like instancing, which allows you to draw multiple instances of the same mesh without doing OpenGL calls for each instance, but seriously, you don't need it unless you're making an insanely large-scale strategy game.

2) There are two animation techniques: bone/skeleton animation and key frame animation. Bone animation is pretty tricky to get working since it uses lots of matrix math, and you most likely want to do it in a shader to get decent performance. If you have no idea what a shader is (or a matrix xd), don't try it.
Key frame animation is a LOT simpler. Just keep multiple complete meshes for different "frames" in the animation.

Offline gouessej
« Reply #2 - Posted 2012-08-02 17:48:40 »

You should look at the source code of some modern scenegraphs, it would be a nice source of inspiration.

Julien Gouesse | Personal blog | Website | Jogamp
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline UprightPath
« Reply #3 - Posted 2012-08-02 18:13:17 »

Well, as I said, I'm planning on trying to get this to work on my crappy ass Samsung Traverse (So I'll have a game I want to play on my phone when I'm waiting). So performance is something of an issue here. However, the other comments do make sense.

I'm going to try to keep it low Vertex for the multiple instance troops (I can't say how many, 'cause I haven't done it yet, but fairly simple) and a low number of troops on screen (I'm thinking eight per tile, with a maximum of like 100 tiles on screen at a time... With a limit of the number of units. Hah.)

As for the Matrix? Is that where Neo lives?... But no, really. I understand the basics of it (It's the thinger that holds the position, rotation, etc for the OpenGL instance you're sending stuff to. Works as the origin for drawing things, etc.)

I was somewhat worried about the size that a bunch of key frames would get up to. But, I would guess, that they would take up less in the Memory than the flat file would.

Pages: [1]
  ignore  |  Print  

EgonOlsen (42 views)
2018-06-10 19:43:48

EgonOlsen (22 views)
2018-06-10 19:43:44

EgonOlsen (43 views)
2018-06-10 19:43:20

DesertCoockie (197 views)
2018-05-13 18:23:11

nelsongames (124 views)
2018-04-24 18:15:36

nelsongames (123 views)
2018-04-24 18:14:32

ivj94 (863 views)
2018-03-24 14:47:39

ivj94 (124 views)
2018-03-24 14:46:31

ivj94 (768 views)
2018-03-24 14:43:53

Solater (140 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!