Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
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  
  Matrices and Java3D  (Read 2388 times)
0 Members and 1 Guest are viewing this topic.
Offline Captain-Goatse

Junior Devvie




I suck at teh 2D. XBOX IS BIG LOL!111


« Posted 2002-12-01 14:11:41 »

I have been using Java3D for awhile now and I just realized how I have managed to survive without matrices. I have read all articles concerning matrices at Gamedev.net awhile ago when I was doing 3D with c++.

In c++ I thought matrices were quite easy concept to grasp. I mean its not its like rocket science, since everything is like pregenerated for you. While I understood what a matrix is, using a pregenerated matrix api, pretty much cut me off from raw matrix manipulation. I handled creating object space and such. So no raw math for me.

Now I needs to understand what is Java3Ds relationship with matrices. I understand that Transform3D = my buddy, but I can't see any demos using any raw math.

As I plan to use Matrix4f as my base matrix, what kind of arithmetic progression should I use as the base numbers. I mean the quides gave me understanding of what the these things are and what to do with them, they failed to inform what to store in a matrix. I assume I'm supposed to store cordinates in there. How do I do this? Do I just create a matrix4f(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15} like this? Natural light of reason tells me that this is wrong.

Now I need to create object space to interact with my camera so that I can easily rotate things in there and set up my hud.

I might as well stop sounding intelligent, hence WTF.

How the hell am I supposed to create object space and manipulate it with Transform3D? I have a faint clue that Scenegraph and transform group might be something similar to the object space? Could someone who has done some direct3D programming please explaing what equals what?

Its kind of hard to try to guess what something is supposed to do from the docs, I mean as far as java tutorials go is creating universe and adding behaviors. Someone should explain what to use for rotation and what to use for creating the object/camera space interaction.

Thanks for your time.

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #1 - Posted 2002-12-01 21:19:10 »

Damnit, I wrote a much longer reply but it must have been eaten by the power goblins ( http://www.penny-arcade.com/view.php3?date=2002-11-25&res=l ).

Basically, matricies can be thought of as 4 vectors, typically aranged vertically, which are the x, y and z axies and a translation. Thus you perform a rotation/scale/shear by messing with the vectors, and can represent any arbitary transformation in a single matrix. By multiplying two matricies together you form a new matrix with is the result of both transforms. By multiplying a point by a matrix, it is transformed by the operations represented in the matrix. You transform a vector in the same way, except that you don't perform any translation.

Spaces then.. World space is your entire virtual universe, with some arbitrary reference point. This origin may be a corner of your level, middle of your heightmap, center of the earth etc. It contains everything that is 'physical' in your game (and a few things that aren't  Shocked ) Object space is a things personal coordinate system - say when you create your 3d model, this is where the origin is, the center of a ball, the feet of a person, etc. Camera space is that with the origin centered on the camera, usually with the x axis going left/right, the y up and the z into the screen.

Moving from one space to another is (easily?) represented by a matrix transformation. So, object->world will be how your model should be positioned in the world in regard to everything else. World->camera defines how a world is viewed, the world is moved into the camera space at the correct position, and hence the camera appears to move around the world. Then usually you multiply by a projection matrix to collapse the whole scene (still fully 3d and orientated around the camera) into a single flat plane - possibly appying perspective whilst doing so. Now wash, rinse and repeat for every single vertex, and you're halfway to having a complete frame drawn..

Moving backwards along this chain is done by multiplying by the inverse matrix at each point (note that you can't usually undo the projection matrix though, you'll get a line in space, not a point). Finding the inverse of a matrix is something i've managed to avoid so far, the maths gets a tad sticky. There may be a function in j3d for this, I can't remember though.

That may or may not have made no sense at all  Embarrassed Hopefully it gives you some ideas though..

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Captain-Goatse

Junior Devvie




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #2 - Posted 2002-12-02 10:23:18 »

I understand your text and it is quite logical. I just ordered some basic matrice math books that should cover the raw math part for me. I have always liked doing the raw mathematics myself.

Now however, as I'm using Java3D, where do matrices come in? What do I use to create the object space or is it created for me? I have seen many objects and not a single matrix in the demos. Its extremely confusing.

Some people make it sound like rocket science although I find it hard to believe since I have seen a lot harder things in my life.


Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Captain-Goatse

Junior Devvie




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #3 - Posted 2002-12-02 12:29:23 »

WHEEE-E!

I'm starting to actually understand this stuff.

I understand how these things work in Java3D, in fact I don't have to do too much math myself, which is quite disappointting(not really), since java being my buddy handles this.

However, many things are still left unclear. Do I have to create a new matrix every time I want to do rotation, or do I just have basic rotation matrix, which is good for all classes?

BWAHHAHAHAHA

I just figured it all out. I can get the matrix from the transform3D and thats my object space, right? Now I just perform whatever I want, perhaps two matirix multiplications? Or perhaps vertex operation? Invert?

Basically just by understanding java docs I could get by without even the most primitive grasp on the matrix math. This is of course Java3D. I have great hopes for this java addon and btw I love Sun. I still get to do some maths though since I'm building a physics engine ^^.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #4 - Posted 2002-12-02 14:10:03 »

It would be easier to repy if you explained your problem in full - what exactly is it that you need to perform in object space that requires you delving into matricies?

But yeah, most of j3d you can get by without knowing anything about them, like i did with my j3d stuff (although the geomorphing did need quite a bit of vector math Grin )

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Captain-Goatse

Junior Devvie




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #5 - Posted 2002-12-02 15:16:47 »

There is no problem. I i just got out of the matrix or something and know kung fu(maybe?).

One thing I got. What are the limitations of the matrix acquired from, lets say Transform3D? I mean what kind of form does it come out. I did some testing, but couldn't really figure out.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #6 - Posted 2002-12-02 16:13:03 »

Limitations? None really, you can represent any arbitrary combination of transforms in a single 4x4. The upper left will be the rotate/scale/shear, the far right collumn the translation and the very bottom right value the homogeneous coord.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline xsist10

Innocent Bystander





« Reply #7 - Posted 2002-12-16 11:57:50 »

grab this for a good maths read

Complete Maths Engine
http://rucus.ru.ac.za/~xsist10/downloads/
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.

rwatson462 (28 views)
2014-12-15 09:26:44

Mr.CodeIt (19 views)
2014-12-14 19:50:38

BurntPizza (35 views)
2014-12-09 22:41:13

BurntPizza (70 views)
2014-12-08 04:46:31

JscottyBieshaar (32 views)
2014-12-05 12:39:02

SHC (44 views)
2014-12-03 16:27:13

CopyableCougar4 (40 views)
2014-11-29 21:32:03

toopeicgaming1999 (108 views)
2014-11-26 15:22:04

toopeicgaming1999 (94 views)
2014-11-26 15:20:36

toopeicgaming1999 (29 views)
2014-11-26 15:20:08
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!