Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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 2120 times)
0 Members and 1 Guest are viewing this topic.
Offline UprightPath
« Posted 2012-08-02 12: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 15: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.

Myomyomyo.
Offline gouessej
« Reply #2 - Posted 2012-08-02 19:48:40 »

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

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline UprightPath
« Reply #3 - Posted 2012-08-02 20: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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (37 views)
2014-07-24 01:59:36

Riven (38 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00

Cero (60 views)
2014-07-16 00:42:17

Riven (57 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org 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‑gaming.org
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!