Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Mon Aug 19, 2019 4:22 am

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Sat Oct 01, 2005 3:00 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
The idea is to perform a bone-based system that permits the biped automatically get the best pose for his weight and inertial forces. This idea is copied from david at wolfire. This gifs (from wolfire too) illustrate the idea perfeclty.
Image

Image
gifs from wolfire too

The idea (as i imagine rigth now) is something like this:
  • the biped must have a relax pose, this is with the legs almos rect and the foots in 90 degrees. Like when you are stand up.
  • the biped must have maximun rotation angles in his legs and foots
  • the "input" of the movement is a certain force(vectorial force) applied to the gravity center or the pelvis (could change in certain models).
  • the foots define an area, we could name it as AREA. If the gravity center (its projection) "falls" over this AREA, the body is stable. If don't, the body is not stable.
  • when the biped is not stable, the leg closer to the force vector will try move to a final position that compensate the inestability.
  • each leg has a tension value. So if a leg is manteining the whole weight, the other leg has a low tension value. Of course a leg with a hight tension value can't move with easy.
  • The final point of the movement of the leg has to be pre-calculated. In this way the leg and the foot will have a correct and smooth movement. Also this method give us the possibility of include "errors" that could happend if the character is nervous (the final point of the movement could have a pseudo-random Delta pan, directly proportional to the nervousness)
  • Of course the body must have an skeleton, this method won't works on pure meshes without skeleton.

I mean the main idea is clear, isn't it? And yes, it has a lot of work to do.

Also i have seen that the current format file (.tri) of Raydium only support fixed meshes(with no animation) and the near future only a version of quake models could be done.
I propose to use an expanded version of the milkshape(ms3d) format file. I have used in the past and it has all the standard for a character. Also blender importer/exporter should be done.
How do you see? :wink:


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 01, 2005 8:01 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
Fine !
You MUST do it :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 02, 2005 9:21 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
i'm using some ancient code from an old 3d engine i tried in windows(:P).
I have to sustitute the D3DXMATRIX structure for something else. Basically it's a float 4x4 matrix. There is something like that already done in raydium? Else i'll do a simple structure but if already exist i prefer to use it.
more details about the class:
http://msdn.microsoft.com/archive/defau ... matrix.asp
Btw, i'm translating the c++ code to c.
And maybe you have a sustitute for D3DXMatrixRotationYawPitchRoll ???


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 02, 2005 10:11 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
Raydium is doing all this on hardware side thru OpenGL.
For example, see :
internal.c : raydium_internal_dump_matrix() (reading matrix from hardware)
camera.c : raydium_camera_place() (creating a matrix from yaw and pitch and roll)

You'll (probably) have to change the way "raydium_camera_place" do its job, but it's a big clue ;)

See also :
http://www.cs.sfu.ca/~haoz/teaching/htm ... atrix.html
http://www.cs.sfu.ca/~haoz/teaching/htm ... atrix.html

Main idea (Raydium will always try to stay on MODELVIEW matrix, so you don't have to care about that) :

glPushMatrix()
glLoadIdentity()
your transformations
glGetFloatv(GL_MODELVIEW_MATRIX,matrix);
glPopMatrix()

Dunno if it's clear :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 02, 2005 11:49 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
hmmm
i need to yawpitchroll the matrix with certains angles to make the bones rotate, i say this is not a graphical result, it's only data that will be used for get more data(vertex transformed according the rotated bones). However i suppose that using hardware matrix from openGL could be usefull.
i'll try

Other thing. Maybe could be helpfull to make a second "trunk" so we can work dirty on it nad let clean the main trunk. Also with a dirty trunk we can collaborate faster, i think.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 02, 2005 12:12 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
OpenGL doest not mean graphical. glLoadIdentity(), glMultMatrix() and so on don't have any visual impact. It's just a useful way to do quick (hardware accelerated) matrix computations. Just remember to restore original matrix on the stack (glPopMatrix), so you don't break rendering. Also note that transformed matrix on the stack may directly help you to render vertices, since vertices will be transformed by the MODELVIEW matrix ! (it's its mail goal).

About another SVN branch, why not (I'm reading SVN book to learn more about this), but since we're only two "commiters", I think we can do this simple thing : "commit only when it's done". For example, I'm working since a few hours on MD2 animations, and I will only commit when I'll reach a "stable and compilable" state (and "svn update" is still available for me if YOU do a commit). What do you think about this ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 02, 2005 3:27 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
ok, but i see a little problem, if we both want to work in a same file that is not "published" we have to send the file by other ways (ftp, email or so). Anyway it's a minimal problem. :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 02, 2005 3:33 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
That's right. I'm planning to buy Oreilly's french version of "Project management with Subversion" book, it will probably gives me some good clues :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 9:53 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
this could be rigth usign opengl? (i know the identity is 111111... but just as an example)
Code:
void MatrixIdentity(matrix4x4 *matrix)

{

   glPushMatrix();

   glLoadIdentity();

   glGetDoublev(GL_MODELVIEW_MATRIX, matrix);

   glPopMatrix();

}


hmmm, and now i'm having a problem to get the inverse of a matrix (inverse, not the transpose). It impossible (or inviable) to calculate with opengl , and i don't know enough linear algebra to make my own function. The last time i used the D3D functions.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 7:00 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
Your sample function is ok. About inverse matrix, even if I'm absolutely not a math guy, I think you can find suitable code all around the net.
I've tried "inverse matrix" using http://koders.com (limit search to C language) and there interesting results. You may also use any "math lib" (until the code is GPL compatible) you want :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 8:18 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
should i put the matrix funcions in a matrix.c and .h or into the biped.c and .h?
/// nice web, that koders

update: i'm working in a matrix.c file, the external functions finished are:
double raydium_matrix_determinant(matrix4x4 matrix);
matrix4x4 raydium_matrix_adjoint(matrix4x4 matrix);
matrix4x4 raydium_matrix_multiply(matrix4x4 matrix1, matrix4x4 matrix2);
matrix4x4 raydium_matrix_inverse(matrix4x4 matrix);

and as you can now there is a new typedef: matrix4x4

I think that no more functions are needed. Also i'd like to make the documentation about this, but the one i have dowloaded is a pdf(not editable).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 10:54 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
Another choice is to add your functions to raydium/trigo.c
This file (since a long time ago, now) don't have the right name, it should be "math.c", since it provides some non-trigonometric functions (there's already some matrix related functions in this file). With this method, you don't have to add a new file to the project, and as it's a "long" step, I think it's better. (Adding a new file includes: modifying Makefile, index.c and index.h, and create a header file).

Documentation is provided in source code, in headers exactly, see raydium/headers/ directory. There's also a PHP script (raydoc.php) in this directory, used to generate wiki documentation (and then a PDF version).

Any added function must be declared in headers (and documented, sure :) )


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 12:43 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
ok, i'm adding them to trigo.c and .h
But should i change the name of the functions from raydium_matrix to raydium_trigo ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 3:40 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
I think the real solution is to switch *trigo* functions to *math* (*math_matrix* for you). But eh, it's time to do it directly, keep your original names (raydium_matrix_*) :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group