Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (654)
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 2743 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 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: 57
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 ( ).

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..

[ - 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 »


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?


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: 57
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 )

[ - 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: 57
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.

[ - 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
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

SHC (28 views)
2015-08-01 03:58:20

Jesse (20 views)
2015-07-29 04:35:27

Riven (40 views)
2015-07-27 16:38:00

Riven (22 views)
2015-07-27 15:35:20

Riven (25 views)
2015-07-27 12:26:13

Riven (15 views)
2015-07-27 12:23:39

BurntPizza (36 views)
2015-07-25 00:14:37

BurntPizza (46 views)
2015-07-24 22:06:39

BurntPizza (31 views)
2015-07-24 06:06:53

NoxInc (37 views)
2015-07-22 22:16:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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!