Isometric 2.5d transformations

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

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

You posted this in the Java2D board, but you really need 3D transformation matrices (4x4), so you cannot use the AffineTransforms of Java2D.

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.

How are you drawing your graphics?

Using this method for each tile. Quite similar to what you had in the 2.5d post i linked earlier


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);
		}

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.

Ok thanks

Though, you can still make some pretty cool 3d stuff with just Graphics2D :slight_smile:

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 ;D

The models are made in code :slight_smile:
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! :slight_smile:

I get about 50-100 fps while running the game (I get about 30-200 fps in minecraft) :stuck_out_tongue:

Wow! Mind sharing the code?

Notice the view-distance; about the length of an arm. =S

Agree, but notice the implementation: cpu…

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 :slight_smile:

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 :stuck_out_tongue:

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