Tag Info

Hot answers tagged

31

This is a dimetric projection (a special case of the axonometric projection) with the horizontal axes at tan-1(0.5) ≈ 26.565° (an isomeric projection would have them at 30°, by the way) from the horizontal line. It's commonly called "isometric projection", but it isn't exactly one. EDIT: A simple transformation matrix for this one, assuming the x and y ...


15

If you can vary your speed (thus your angle of steer) you will always find a solution, starting from the degenerate one where the entity is almost stopped rotating in a little circle until pointing the target. If you can't vary your speed, you can think about unreachable areas or shadows that you can not reach even using your better steer, if the target is ...


14

It's isometric projection or perspective. Isometric perspective can work very well with a 2D game, and there is the example of the Flexible Isometric Free Engine which is a 2D engine, with an isometric view (though as it is flexible, that is not forced).


14

Short Answer Yes, it can. You should simply calculate a View Matrix and Projection Matrix separately (which are both 4x4 matrices), multiply them together in that order and pass the result (which is still a 4x4 matrix) to your 3D engine. Long Answer Do you know the difference between a View Matrix, a Projection Matrix, and Perspective? You seem to be ...


10

If we're talking about any projection, this is quite obviously not the case. After all, Cahill's Butterfly is a valid projection of a sphere onto a 2D surface: Non-uniform parallel projections will also tend to distort the shape. Perspective projections on the other hand won't distort the shape as long as the projection surface has zero curvature (that ...


8

Well, if you want to use it for 2D games (assuming from the tags), you only need a Transform matrix to apply to the SpriteBatch, you don't need World and Projection matrices. So, when you're drawing an object that should be drawn inside your game world (e.g. the main player), you use the following Begin method from SpriteBatch (XNA 4.0, replace the other ...


7

That is simple. You are using orthographic projection (viewing rays are parallel), so it doesn't make any difference if you are at distance 1 or 100. Use gluPerspective and it will work how you expect. (left img ortho projection, right img perspective proj) your code may look like this: glMatrixMode(GL_PROJECTION); gluPerspective( PI / 3.0f, ...


7

You guessed properly. The orthographic projection you came up with is the one used for most of the objects. You can tell because parallel lines in the X, Y or Z directions all become parallel lines, indicating that there is no perspective projection. Also, horizontal lines remain horizontal, meaning that X' does not depend on Y. Similarly, Y' does not depend ...


6

Pre- or post-multiplication just defines the order of operations how the member of that matrix and vector are multiplied, its purely a notational convention. The common operations in 3D graphics are post-multiplying a row-vector with column-major matrices (OpenGL) and pre-multiplying a column-vector with row-major matrices (DirectX). Both are basically ...


5

You can assign any arbitrary matrix to the pipeline's projection matrix in XNA, even one that doesn't perform a useful projection (you probably won't see useful results doing that, but you can). So you can construct an orthographic projection matrix yourself or use one of XNA's helper methods and use that. You'll also have to adjust the view matrix to ...


5

It's not saying the matrices are pre-multiplied but rather that they are (read use) pre-multiplication. This basically specifies the correct order of multiplication when using them, such that when multiplying a matrix by a vector, the matrix needs comes first. In other words, this: result = matrix * vector Instead of: result = vector * matrix


5

How is the rotated sprite generated? Are these screenshots of a rotating 3D model? The facing angle could be off due to the camera perspective of the 3D modeling tool. Isometric perspective is not an accurate representation of the 3D space. Stuff far away from the 'camera' does not get smaller. If you just want a quick fix. Solution 2 might be difficult ...


5

I solved my own problem--and rather than just blow it off as a simple explanation, I want to describe the steps I took to debug the issue. I left out that I was using a single FBO for special-effects. First, it turns out everything above is in fact correct and a step I left out was the problem. I verified my orthogonal matrices through-and-through. ...


4

Look at the reference of Matrix.CreateOrthographic, and notice that it says this: The viewable area of this orthographic projection is centered on 0,0,0. The x-axis of the area ranges from -width/2 to width/2. The y-axis of the area ranges from -height/2 to height/2. So, in your case, the upper border of the screen has an Y coordinate of -scale/2 instead ...


4

The multidimensional generalization of a triangle is an N-Simplex, here is a video of a projection of such an object. Here is another interesting video of a 4D hypercube. This wiki page is a good starting point if you want to learn more about the fourth dimension and how to visualize such objects. It also links a wiki page with a list of 4D games. ...


4

An example of what you might be looking for: http://blog.wolfire.com/2009/06/how-to-project-decals/ These forum topics should help you get started: http://forums.create.msdn.com/forums/t/16810.aspx (Graphics Runner's & Shawn Hargreaves's response) http://forums.create.msdn.com/forums/p/6574/131973.aspx (Nick Gravelyn's response) ...


4

First of all, X points right, not left, in screen coordinates. But yes, the normalized device coordinates are a left-handed system. It doesn't matter for backface culling, though. From the OpenGL FAQ: OpenGL face culling calculates the signed area of the filled primitive in window coordinate space. The signed area is positive when the window ...


4

What you'll need to do is create a sheared projection matrix that leaves the X and Y axes alone but bends the Z axis up and to the left. The matrix to do the shearing would generally look like this: 1 0 A 0 0 1 B 0 0 0 1 0 0 0 0 1 Or possibly the transpose of that, depending on whether your math library is using a column vector convention (as above) or a ...


4

I think your idea is pretty much spot on! First calculate a ray for your cursor using both the near plane and the far plane as Z values for your 2D coordinates (i.e. use 0 and 1 for your Z coordinate). Here's an helper method to handle that: public Ray GetScreenRay(Vector2 screenPosition, Viewport viewport, Matrix projectionMatrix, Matrix viewMatrix, Matrix ...


4

It all starts here: thick enough to stun an ox and to steal a meme: "If you don't like a wall of text, you're gonna have a bad time." Then since you're concerned with OpenGL, a side trip down Route 666 one of the classic OpenGL books But if you want to short circuit understanding of a complete graphics pipeline and just want to focus on some math for the ...


4

Almost all 3D games are fake 3D. At the end of the day, you're projecting a 2D image into the screen. The standard way to project a 3D scene onto a 2D scene is using a Projection Matrix. In every 3D game, the programmer has to think in 3D "world-space" and 2D "screen space" (and sometimes, 3D "camera space") but sir, I know the difference between SNES Zelda ...


4

After some more research I found out it's a Pinhole Camera Model. It is supposed to model a real camera. There is a nice description here: http://www.epixea.com/research/multi-view-coding-thesisse8.html What I was having trouble understanding was that I need some sort of projection plane. If there is no projection plane, all pixels would basically meet in ...


4

I need vector in iso coordinates that leads outside the monitor (is normal to a monitor screen). It's two rotations. Your tiles are half as high as they are wide. Projection/dot product is proportional to cosine, and arccosine(1/2) == 60 degrees, which means that's your first rotation. It is followed by a 45-degree rotation. You start with unit-z, ...


3

Given that your walls are not cells, you will need a way to identify occluders as you raymarch. The easiest way to do this would be, as you step from one cell to the next, check whether there is a wall on the boundary you are crossing from tile A to tile B, and store the result for use. Let's look at three different approaches to clarify this for you. ...


3

(None of this advice is specific to the XNA function you named; it applies equally well to e.g. glFrustum. I don't know XNA.) You need to think about the view frustum. The rectangle in 3D space which is "at the location of" the viewport is precisely the "near plane" face of the frustum, and the left, right, bottom, and top values are the positions of the ...


3

When you have chosen isometric perspective you need to correct the scale between the X and the Y-axis. If a given distance projects to 1 on the screens Y-axis then the same distance will project to sqrt(3) on the screens X-axis. So if you draw stuff flat on the screen you'd do something like: draw(object.image, object.x*sqrt(3), object.y) Non-answer ...


3

Yes, they are 2D sprites. These sprites, as those in Diablo I, II, Starcraft I, Warcraft II as just a few (Blizzard) examples, were pre-rendered from a 3D content creation package like 3DSMax, Maya or Lightwave. That means you have a camera swivelling around them taking every possible frame of animation from a set number of camera angles. So if you character ...


3

The fourth dimension in 3D vector is used to compute the affine transformations that will be impossible to compute using matrixes alone. The space remains tree-dimensional so this mean that the fourth is mappend in the 3d space in some way. Map a dimensions means that different 4D vectors indicates the same 3D point. The map is that if A = [x',y',z'.w'] ...


3

If you're making a Vector class, then I presume the class will store the description of a 3D vector. 3D vectors have x, y, and z magnitudes. So unless your vector needs an arbitrary w magnitude, no, you won't store it in the class. There is a big difference between a vector and a transformation matrix. Given that both DirectX and OpenGL deal with matrices ...


3

First of all pixel on the screen is a ray in your 3d world - all scene behind this pixel. Second, what you must know, that any point in 3d converted into 2d motinor space via multiplying 3 matrices: pointIn2DSpace = pointIn3DSpace * WorldMatrix * ViewMatrix * ProjectionMatrix So you can do a back conversion, multiplying "monitor" point with inverted WVP ...



Only top voted, non community-wiki answers of a minimum length are eligible