straykiwi
Junior Newbie
|
 |
«
Posted
2012-09-26 22:43:36 » |
|
 Hi there, I am new to this forum. I am making a isometric game, and @riven's transformation matrix has been really helpful so far. http://www.java-gaming.org/index.php?topic=19927.0I currently have a list of vectors and colors for the top face of a 'wall-tile' but I want to fill out this wall tile so that it looks 3d. What I need is 2 transformation matrices that can do this transformation, but i have no idea on how to construct them.
|
|
|
|
Riven
|
 |
«
Reply #1 - Posted
2012-09-26 23:13:39 » |
|
You posted this in the Java2D board, but you really need 3D transformation matrices (4x4), so you cannot use the AffineTransforms of Java2D.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
straykiwi
Junior Newbie
|
 |
«
Reply #2 - Posted
2012-09-26 23:17:22 » |
|
That is true. Sorry, I keep thinking that this is 2.5d and it is messing up my thinking. Could you perhaps move this to that section and answer it there?
My apologies for posting in the wrong section, I am new here.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Riven
|
 |
«
Reply #3 - Posted
2012-09-26 23:18:47 » |
|
How are you drawing your graphics?
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
straykiwi
Junior Newbie
|
 |
«
Reply #4 - Posted
2012-09-26 23:23:08 » |
|
Using this method for each tile. Quite similar to what you had in the 2.5d post i linked earlier 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| List<float[]> quads = t.getQuads(); List<Color> colorList = t.getColors(); float[] view = new float[3]; for (int i = 0; i < quads.size(); i++) { g.setColor(colorList.get(i)); Polygon p = new Polygon(); for (int k = 0; k < 4; k++) { float[] model = quads.get(i).clone();
model[0] += xRel[k]; model[2] += yRel[k]; Matrix44 isom = Matrix44.isoMatrix(scale, locX, locY); view = isom.multiply(model);
p.addPoint((int) view[0], (int) view[1]); }
g.fillPolygon(p); } |
|
|
|
|
Riven
|
 |
«
Reply #5 - Posted
2012-09-26 23:38:22 » |
|
You can't do much more than wireframe and/or opaque, solid colored surfaces, with isometric projection in Java2D.
So you might wonder whether you're doing the sensible thing, or that you should look into OpenGL.
Regardless of the rendering engine, you really need to look up matrix transformations, if you want to get anywhere with rendering.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
straykiwi
Junior Newbie
|
 |
«
Reply #6 - Posted
2012-09-26 23:40:08 » |
|
Ok thanks
|
|
|
|
orange451
|
 |
«
Reply #7 - Posted
2012-10-06 22:19:18 » |
|
You can't do much more than wireframe and/or opaque, solid colored surfaces, with isometric projection in Java2D.
Though, you can still make some pretty cool 3d stuff with just Graphics2D  this is a project I started, that was made with just Java (using Graphics2D for rendering): 
|
|
|
|
matheus23
|
 |
«
Reply #8 - Posted
2012-10-07 09:07:29 » |
|
You can't do much more than wireframe and/or opaque, solid colored surfaces, with isometric projection in Java2D.
Though, you can still make some pretty cool 3d stuff with just Graphics2D  this is a project I started, that was made with just Java (using Graphics2D for rendering):  ... ... Seriously, did you REALLY create that? (Where did you get those models, btw) And how fast was it running? I'm skeptical. But cool stuff, bro 
|
|
|
|
orange451
|
 |
«
Reply #9 - Posted
2012-10-07 13:57:38 » |
|
... ... Seriously, did you REALLY create that? (Where did you get those models, btw) And how fast was it running? I'm skeptical. But cool stuff, bro  The models are made in code  I used a little bit of Notches code (from his old player running animation applet used for testing minecraft skins) in order to learn how polygonal rendering worked. Then I made a running character in java, then a block, then a chunk, then multiple chunks, then I created my own frustum culling, then I made random terrain, then I started some simple player physics, and viola!  I get about 50-100 fps while running the game (I get about 30-200 fps in minecraft) 
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Quarry
|
 |
«
Reply #10 - Posted
2012-10-08 16:50:25 » |
|
Wow! Mind sharing the code?
|
|
|
|
theagentd
|
 |
«
Reply #11 - Posted
2012-10-09 20:22:05 » |
|
... ... Seriously, did you REALLY create that? (Where did you get those models, btw) And how fast was it running? I'm skeptical. But cool stuff, bro  The models are made in code  I used a little bit of Notches code (from his old player running animation applet used for testing minecraft skins) in order to learn how polygonal rendering worked. Then I made a running character in java, then a block, then a chunk, then multiple chunks, then I created my own frustum culling, then I made random terrain, then I started some simple player physics, and viola!  I get about 50-100 fps while running the game (I get about 30-200 fps in minecraft)  Notice the view-distance; about the length of an arm. =S
|
Myomyomyo.
|
|
|
matheus23
|
 |
«
Reply #12 - Posted
2012-10-09 20:33:04 » |
|
Notice the view-distance; about the length of an arm. =S
Agree, but notice the implementation: cpu...
|
|
|
|
orange451
|
 |
«
Reply #13 - Posted
2012-10-09 22:00:41 » |
|
Notice the view-distance; about the length of an arm. =S
In that picture, the view distance is about the same as Minecrafts "short" render distance, perhaps slightly farther. The lag isn't from drawing, but inefficiencies in the code. I can get almost double that rendering distance (which is about a little farther than minecrafts "normal" rendering distance), and get 30-50 fps  The problem is that each block is stored as a Model object, and each Model has polygon objects, and each polygon has Vertex objects. If I can completely get rid of the vertices, and have them as variables inside the polygon, then I could potentially get a much higher frame rate. However, this is a really impractical thing to do 
|
|
|
|
matheus23
|
 |
«
Reply #14 - Posted
2012-10-10 16:56:32 » |
|
You might consider doing this.
I think minecraft stores blocks as either int, or short or char at runtime. (I think it saves as byte, but I'm not sure...)
|
|
|
|
orange451
|
 |
«
Reply #15 - Posted
2012-10-10 18:15:14 » |
|
You might consider doing this.
I think minecraft stores blocks as either int, or short or char at runtime. (I think it saves as byte, but I'm not sure...)
They are. The block id's are stored as bytes in a byte array in the chunk. I also store the entire model of the chunk so I can loop through that array every frame update to draw the chunk, rather than recreate all the polygons every step (which would be MUCH slower).
|
|
|
|
|