chucara

Members
  • Content count

    10
  • Joined

  • Last visited

Community Reputation

122 Neutral

About chucara

  • Rank
    Member
  1. Finding a projection matrix from a 2D image

    I have taken a look at it, and it does indeed seem like a correct way of doing this. However, I'm having a little trouble isolating t in the final equation without substituting the values for the ones that are known. This means that I can at least verify that this is a correct solution by hand, but I can't implement it in code just yet. Once again thanks. I will verify the solution tomorrow as it is getting late.
  2. Finding a projection matrix from a 2D image

    Josh, I can't yet claim to understand what you wrote, but I will have a look when I'm near some paper (I think I will need it). If this works, you are truely a mathemagician Thanks a lot, I'll be sure to let you know if I can get it running.
  3. Hi, I have been stuck on this problem for quite some time.. I think it is best described with a picture: [img]http://www.chucara.dk/example.png[/img] Imagine that this picture is taken of a table. I am able to find the four red dots and their coordinates on the pictures. Same goes for the green dot. Now, I want to be able to find the location of the green dot in 2D space on the table. Assuming the following mappings: (171,22) -> (0,0) (488,155) -> (1,0) (24,126) -> (0,1) (361, 346) -> (1,1) How do I determine what coordinate (167,128) maps to on the plane created by the table? I seem to have read that I need to find a projection matrix (which I have a basic understanding of what is), but how? Any hints or suggestions you can give me is very welcome, example calculations even more so. Also, please point out if I am reinventing the wheel here. I am not aware of any libraries that do this already. (for .NET)
  4. World, View and Projection

    Indeed.. In XNA, GraphicsDevice.Viewport.Project(...) does the trick. Thanks for your help!
  5. World, View and Projection

    I am messing around with some augmented reality library, which I have working. Now, I don't actually plan to use it for augmented reality, but rather to help me track markers. Now, the output of the library algorithm is a transformation matrix. What I really need, is screen coordinates. Now, my question is this: Given my transformation (World) matrix, my View matrix, my Projection matrix and the Vector3 that is the position of my model, can I get the screen coordinates? I tried: Vector3.Transform(Positon, World*Projection*View), but that leaves me with another Vector3. I'm a but lost here, so any advice you can give is appreciated. On a second note, should I be using a different library for this? (as in: not an augmented reality library) I want to create a board game where a projector projects the board and a webcam tracks the pieces. So basically, I just want a plane in 3D space. (I cannot be certain that the webcam and the projector are perfectly aligned*) *some would even argue that it is a physical impossibility.
  6. Resources on Matrix/Vector math

    Thanks. Everything works like a charm now, save for the fact that I have to point my camera at (0,0,-1) instead of (0,0,1). I assume this is because the code I am using assumes a left-handed coordinate system. I am using the following method to convert from the 3x4 matrix to a XNA 4x4: private Matrix ConvertToMatrix(NyARTransMatResult result) { var matrix = new Matrix(); matrix.M11 = (float)result.m00; matrix.M12 = -(float)result.m10; matrix.M13 = -(float)result.m20; matrix.M14 = 0; matrix.M21 = (float)result.m01; matrix.M22 = -(float)result.m11; matrix.M23 = -(float)result.m21; matrix.M24 = 0; matrix.M31 = (float)result.m02; matrix.M32 = -(float)result.m12; matrix.M33 = -(float)result.m22; matrix.M34 = 0; matrix.M41 = (float)result.m03; matrix.M42 = -(float)result.m13; matrix.M43 = -(float)result.m23; matrix.M44 = 1; return matrix; } I tried a few things, and I've read online that I need to multiply by a 3x3 matrix of [1,0,0, 0,1,0, 0,0,-1] to get to a right-handed coordinate system. So I created an Identify matrix and changed M33 to -1, and while that does makes my model within camera (0,0,1) range, it seems to shift it a distance to the left.. What am I doing wrong? It is even possible in a (relatively) simply way to transform a LH transformation matrix to a RH?
  7. Resources on Matrix/Vector math

    Nicely done - I didn't expect that thorough an answer, but I am very grateful. I'm off to bed, but I will read and try to understand tomorrow. I had originally added the last row as 0,0,0,0, but I got some.. well. unexpected results. Once again, thanks a lot!
  8. So today I found out that my math is a little rusty when it comes to vectors and transformations in 3D space. (Which admittedly is a pretty big part of what I am trying to do) Now, I will ask some questions, and while you are naturally welcome to answer them for me, I am really just looking for a few hints as to what to read to really understand this. My scenario is this: I am using the NyARToolkit to detect the position of markers (2D barcodes) using my webcam. When I place a marker in front of my camera, I am returned a Matrix of dimensions 3x4. Now in order to use the Matrix class from XNA, I need to convert it to a 4x4 matrix. This leads me to my first question. 1. How do I convert a 3x4 transformation matrix to a 4x4? Now, assuming I have a proper 4x4 transformation matrix, I need to transform my cube so that it will display as if it was on top of my marker if I had the video running on my screen. 2. What do I need to transform to get a Cube rendered at (0,0,0) to align with the camera view? Once this is working, I want to setup a projector to project my game onto a table while the camera monitors the tokens on said table. 3. What do I need to change (View/Projection/World) to get this to align correctly? I hope my above question gives you some hints as to what I am trying to achieve. Can anyone recommend me some books / tutorials on this? Or even just provide me with some keywords as to where to start looking?
  9. Best practice introduction

    Yeah, didn't really expected a single best practice book. Naturally, there is no single way of doing games, but what I really need right now is a decent overview of current technologies for building a decent outdoor environment. And other related topics for that matter. Most resources are very focused and give an implementation specific solution to most problems, but I'd rather have the "why" than the "how-to". Basically, what I want is something I can read to keep me from just hammering things down where I think they belong. Most books seem somewhat old, but I suppose the general architecture only changes slowly.
  10. Best practice introduction

    I've been looking through the book lists on this site, yet I'm not quite able to find exactly what I'm looking for. I'd like a resource(book, article, comic, brain implant etc.) that is as void of technology specific discussions as possible. But focuses on the best practices of game programming, regardless of whether it's DirectX, Managed DirectX, OpenGL etc. By best practices, I mean: What is the best(or at least normal) way to build and store a 3D world. Terrain maps, buildings, actors etc. That, and similar questions. I have no problem learning the specific technology, but it would be nice if someone with years of experience could guide me to use the tools I'm learning properly. Does anyone have any suggestions?