A rendered square = 24 vertices? (5,5,0),no z dimension box

A stupid question, but: why does drawing a (2,2,0) sized square (or flat cube) draw 24 vertices? If a square, would be 4 vertices, right? If a cube, 8 (which I can understand, since in the 3D engine it likely overlaps the 4 vertices and still remains a square), but 24? The other could be a material if that even counts? +4 vertices? +8, if the 3D theory applied?



Thanks!

A simple quad uses 4 vertices. (Two triangles which share 2 vertices).



A cube consists of 6 quads, hence 6*4 = 24 vertices.

2 Likes

And the reason a z of 0 still gives 24 is that the vertices for front and back just overlap

1 Like

Ah I see, thanks! So basically using cubes as squares ends up being the same, performance-wise?

No its not the same, as a quad (square) needs only 4 vertices

1 Like

And, if triangles are the building block for everything, why aren’t at anytime the vertices = 3 x triangles? Oh, quads, right, stupid.

Actually: if I’m only drawing cubes and therefore quads, why are triangles drawn?

Sorry didn’t explain myself properly: if jME treats making a square as making a flat cube and uses the same number of vertices for both, it’s the same?

This kind of stupid question is spam to the forum xD

Any suggestions on what I could read to get a good grasp of this sort of thing?

Another question: culled objects make NO IMPACT whatsoever on graphical performance right? A few tests point that it’s true but I’m just spamming cubes to test it, there could be other factors besides being seen… thanks

The tutorial on custom meshes might help explain how all this works if you are interested.



The main thing to remember is that the basis of your shape is your vertices. Then you make triangles up from those vertices but any number of triangles can share one vertice.



Some shapes (for example the cube) have multiple vertices at one location because they have different normal (or other) attributes. Others (for example a sphere) only need one vertice at each location due to smooth shading.

1 Like

Ah that clears some things up… I will, I’m going through the tutorials at the moment but so many questions pop up that I get caught in one experimenting for hours hehe

That’s the best way to learn…

Theoreticaly you can make a cube with 8 vertices, however then all data of those will be shared, like the normals.



This would lead to intresting lighting artifacts, hence they are not shared.

Theoreticaly you can make a cube with 8 vertices, however then all data of those will be shared, like the normals.



This would lead to intresting lighting artifacts, hence they are not shared.

1 Like

Right, since the entire engine is built upon things taking a 3D context, trying to true-2D it would skew everything up because it ain’t build for it, makes sense.

Does anyone know where

http://www.jmonkeyengine.com/doc/overview-tree.html

is updated? The version here says it dates back to 2009!

thats the old version of jME, com.jme3.XXX is what you want.



Go to the Documentation (top of this page) > JavaDoc > Tree

2 Likes

Thanks mate

1 Like