• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

iLikeCarrots

Members
  • Content count

    8
  • Joined

  • Last visited

Community Reputation

100 Neutral

About iLikeCarrots

  • Rank
    Newbie
  1. Thank you - I'll look over this and see where my code differs. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] EDIT: I found that my code is correct, but I didn't notice that all of the joints were using global positions, which is why the rotations appear to be offset. In Modo 401 'weightmap deformers' were used to rig geometry, and I didn't realize that the center of all the deformers was zero while the pivot position was always relative to the model center.
  2. Thank you, it appears to be working. I'm assuming that 1/scale will remove scaling on the inverse, but that alone won't remove the scaling multiplied with the original matrix, which is why I have to square it. I just hope that this is correct and won't end up with bugs later! [img]http://public.gamedev.net//public/style_emoticons/default/rolleyes.gif[/img] Here is the fixed code: [url="http://pastebin.com/EMu7zjcF"]http://pastebin.com/EMu7zjcF[/url] And the compile command: [b]gcc -o Matrix Matrix.c -lm[/b]
  3. [quote]how did you end up with a 4 in position 14?[/quote] Sorry - those are remains from an earlier test that I didn't change correctly. [quote]Also, can you print out those matrices at the bottom of the first post with more precision?[/quote] I'll post directly from the console to prevent typos.. [CODE] Object 1.000000 0.000000 0.000000 0.000000 0.000000 0.540302 -2.524413 0.000000 0.000000 0.841471 1.620907 0.000000 0.000000 0.000000 0.000000 1.000000 Inverse 1.000000 0.000000 0.000000 -0.000000 0.000000 0.540302 0.841471 -0.000000 0.000000 -0.841471 0.540302 0.000000 0.000000 0.000000 0.000000 1.000000 Inverse * Object 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 0.000000 0.000000 0.000000 3.000000 0.000000 0.000000 0.000000 0.000000 1.000000 [/CODE] Note: I wonder if the inverse of scale (1/scale) should be squared? Perhaps I should get another piece of paper and work through the math. Also, here is code that compiles to demonstrate the problem. [url="http://pastebin.com/ks07zNm2"]http://pastebin.com/ks07zNm2[/url] Name the file as Matrix.c then compile with the command 'gcc -o Matrix Matrix.c -lm'
  4. I use the invertMatrix function from the first post. Argument A is the resulting inverted matrix, and B would be the object's matrix.
  5. [quote]you need to compute the product of the inverses [b]in reverse order[/b][/quote] I'm assuming that I did this part correctly - I performed Scaling * Rotation * Translation. I flipped the 3x3 rotation section along the diagonal, so the transformed indices (OpenGL) would be.. [CODE] [0 1 2] [4 5 6] [8 9 10] [/CODE] [quote]I don't know what "rot(1,0,0)" means.[/quote] I modified the description of my test. They are the values that I use in my object matrix, which is combined in the order Translation, Rotation, Scale. Also for completeness, this is how I create the matrix. Position, rotation, and scale are arrays with three floats. [CODE] mat[12] = node->position[0]; mat[13] = node->position[1]; mat[14] = node->position[2]; float A = cos(node->rotation[1]), B = sin(node->rotation[1]); float C = cos(node->rotation[0]), D = sin(node->rotation[0]); float E = cos(node->rotation[2]), F = sin(node->rotation[2]); mat[0] = ( A*E + B*D*F) * node->scale[0]; mat[1] = ( C*F ) * node->scale[0]; mat[2] = (-B*E + A*D*F) * node->scale[0]; mat[4] = ( B*D*E - A*F) * node->scale[1]; mat[5] = ( C*E ) * node->scale[1]; mat[6] = ( B*F + A*D*E) * node->scale[1]; mat[8] = ( B*C ) * node->scale[2]; mat[9] = (-D ) * node->scale[2]; mat[10]= ( A*C ) * node->scale[2]; [/CODE]
  6. Well, you need to have a compiler or Integrated Development Environment (IDE) to start programming in C. You also need some good learning material, [url="http://www.cprogramming.com/tutorial/c/lesson1.html"]this[/url] is a tutorial that I used to start in C. It's a fairly simple language because there isn't much to it. That said, you'll be exposed to some tricky topics like pointers, linked lists, etc. which gets to be a bit complicated, but manageable. Also, if you're looking to program a game in C, you may want to transition to a language like C++ or Objective C if you want to use an object-oriented style of design. You can accomplish the same end result using C, but it may or may not require more design effort than the other languages.
  7. I'm having trouble inverting my object matrix with non-uniform scaling. I have scanned the web and written the multiplication out by hand, but I haven't been able to find my error. I am creating a matrix for OpenGL, and I combine my 4x4 matrix in the order Translation, Rotation, Scale. Where could I be going wrong? I find the position X,Y,Z in the last column I find the scaling X,Y,Z as the lengths the first three columns I use the upper left 3x3 matrix as the rotation [CODE] ~ Inv Scale ~ ~ Inv Rot ~ ~ Inv Pos ~ [1/X 0 0 0] [\.......] [1 0 0 -X] [ 0 1/Y 0 0] [..flip..] [0 1 0 -Y] [ 0 0 1/Z 0] [diagonal] [0 0 1 -Z] [ 0 0 0 1] [.......\] [0 0 0 1] [/CODE] After combining the above matrices in that order, I come up with the following code with matrix A as the result: [CODE] (GL Matrix Indices) [0 4 8 12] [1 5 9 13] [2 6 10 14] [3 7 11 15] void invertMatrix (float A[], float B[]) { float sclX = lengthVector(&B[0]); float sclY = lengthVector(&B[4]); float sclZ = lengthVector(&B[8]); A[0] = B[0]/sclX; A[4] = B[1]/sclX; A[8] = B[2] /sclX; A[1] = B[4]/sclY; A[5] = B[5]/sclY; A[9] = B[6] /sclY; A[2] = B[8]/sclZ; A[6] = B[9]/sclZ; A[10] = B[10]/sclZ; A[3] = 0.0; A[7] = 0.0; A[11] = 0.0; float posX = -B[12], posY = -B[13], posZ = -B[14]; A[12] = A[0]*posX + A[4]*posY + A[8] *posZ; A[13] = A[1]*posX + A[5]*posY + A[9] *posZ; A[14] = A[2]*posX + A[6]*posY + A[10]*posZ; A[15] = 1.0; } [/CODE] To test my inverse, I created a matrix with the following transform: [i]Position[/i] x=0, y=0, z=0 [i]Rotation[/i] x=1, y=0, z=0 [i]Scaling[/i] x=1, y=1, z=3 I multiply the inverse times the matrix, which always returns the scaling on the diagonal. [CODE] -- Object Matrix -- -- Inverse Matrix -- -- Inverse * Object -- [1.0 0.0 0.0 0.0] [1.0 0.0 0.0 -0.0] [1.0 0.0 0.0 0.0] [0.0 0.5 -2.5 0.0] [0.0 0.5 0.8 -0.0] [0.0 1.0 -0.0 0.0] [0.0 0.8 1.6 0.0] [0.0 -0.8 0.5 0.0] [0.0 0.0 3.0 0.0] [0.0 0.0 0.0 1.0] [0.0 0.0 0.0 1.0] [0.0 0.0 0.0 1.0] [/CODE]
  8. I'm attempting to animate a skinned mesh with joints. I have looked at many different materials, and something isn't right with my understanding. All of my nodes hold a local and global matrix. When I load in the joints, I calculate the inverse pose matrix like so: [b]Pose Matrix[/b] = Mesh's Inverse Global * Joint Global [b]Inverse Pose Matrix[/b] = Inverse of Pose Matrix Then when my joints are updated, I calculate the joint in mesh space and multiply it with the inverse pose matrix. [b]Joint wrt Mesh[/b] = Mesh's Inverse Global * Joint Global [b]Deform Matrix[/b] = Joint wrt Mesh * Inverse Pose Matrix I uploaded the following video files to demonstrate what is happening to my mesh. Is my algorithm correct in handling the matrices in mesh space and calculating the inverse pose matrix? If I knew that, it would be easier to further study the problem. [url="http://tinypic.com/r/ncmnpj/5"]Source animation..[/url] [url="http://tinypic.com/r/egviqf/5"]My Results..[/url] These are my references - [url="http://books.google.com/books?id=79ud9_8mbgYC&pg=PA507&lpg=PA507&dq=inverse+world+space+transform&source=bl&ots=HppyGTOg-X&sig=Ml4rrZSWndjs9h6AA9ITAp6Nksw&hl=en&sa=X&ei=3-uRT4unHpDZiAKywZ3UDQ&ved=0CDQQ6AEwAw#v=onepage&q=inverse%20world%20space%20transform&f=false"]Introduction to Game Development[/url] [url="http://www.google.com/url?sa=t&rct=j&q=cse169_05&source=web&cd=1&ved=0CCQQFjAA&url=http%3A%2F%2Fgraphics.ucsd.edu%2Fcourses%2Fcse169_w05%2FCSE169_05.ppt&ei=9keST46TPImMiAKc1egK&usg=AFQjCNFDvvY9-EYOrd_sG0tt8pk4GfLhYQ"]UCSD - Skinning powerpoint[/url] [url="http://www.google.com/url?sa=t&rct=j&q=jason%20gregory%20animation&source=web&cd=1&ved=0CCgQFjAA&url=http%3A%2F%2Fwww-scf.usc.edu%2F~gamedev%2Fanimation.ppt&ei=V0iST9zTGIqZiQKEuIQi&usg=AFQjCNHeOuIxEasJgntrrrGEBb97jApV9w"]Animation in Video Games[/url]