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

caibbor

Members
  • Content count

    26
  • Joined

  • Last visited

Community Reputation

116 Neutral

About caibbor

  • Rank
    Member
  1. I've been working on a 3d engine from scratch for a while now. I've got my own model format with an export plugin for blender, and models are importing just fine in game. I'm working with a test model - a Hellknight imported from Doom3 and exported to my own format. The mesh draws as expected in my engine. But now I'm designing animation.   Basically, I'm not sure the right way to go about this, either:   A.) I'll export the skeleton with each bone pose (in world space, not relative to any other bones) as an array for each frame - even non-key-frames. this way, I can just set bone pos and be done with it. However, this will take lots of memory and more disk space than option B or C.   B.) I do the same as above, except export only keyframes, but this time interpolate between bone vertex positions. With this, we'd need more informatiion and processing to do the interpolating so that bones/mesh doesn't deform improperly, since point A to point B would need to be on a curve, not linear. This also would have to be relative to it's parent bone.   C.) Same as option B, except bone head/tail positions will be relative to the parent bone's tail position.   What's the standard way of doing this in decent game engines?
  2. glEnableVertexAttribArray takes am attribute location value which you get with glGetAttribLocation. however, glGetAttribLocation returns a SIGNED integer, and glEnableVertexAttribArray takes an UNsigned integer, as shown by ths following links (and this is how it is implemented in glew): [code]GLint glGetAttribLocation(GLuint  program,  const GLchar * name); void glEnableVertexAttribArray(GLuint  index);[/code]   http://www.opengl.org/sdk/docs/man/xhtml/glEnableVertexAttribArray.xml http://www.opengl.org/sdk/docs/man/xhtml/glGetAttribLocation.xml so I ask... "wtf?"   am I overlooking something important?
  3. even this exaple uses -0.5/0.5 on x and y, and 1/10 as default values on the frustum: [url="http://www.songho.ca/opengl/gl_transform.html"]http://www.songho.ca..._transform.html[/url] ( scroll all the way to the bottom, look at the image and it's glFrustum() call ). running this program, it doesn't let you go below 1 for z-near.
  4. I'm running Linux Mint. This is OpenGL, I assure you. I am, however, using my own 4x4 matrix implementation. i've used libraries like glu as references when implementing these, so they should have identical functionality. I'm not using fixed-functionality pipeline, which is why I wrote this library.
  5. update: fixed up and confirmed my perspective invert function is working properly. although with -1/1 bounds on all axes like you mentioned, I'm still getting this hour-glass shaped thing.
  6. OpenGL

    "I always do that. I always mess up some mundane detail." - Michael Bolton, Office Space thanks.
  7. OpenGL

    alright, then riddle me this. (all in column-major order) The projection matrix I created is: 0.074978 0.000000 0.000000 0.000000 0.000000 0.099970 0.000000 0.000000 0.000000 0.000000 -1.000100 -1.000000 0.000000 0.000000 -0.200010 0.000000 It's inverse I calculated is: 13.337285 0.000000 0.000000 0.000000 0.000000 10.002963 0.000000 0.000000 0.000000 0.000000 0.000000 -4.999750 0.000000 0.000000 -1.000000 20001000.000000 an multiplying those matrices together should be identy, but instead I get: 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 -20000994.000000 1.000000 All code related to this is shown below. I've been up and down and all the methods, as far as I can tell, look correct. [source lang="cpp"]// Mat4f class is a 4x4 matrix of floats. // Mat4f::data is a float[16], and is column-major // returns float& intentionally, method is private inline float& Mat4f::M( const int col, const int row ) { assert( col < dim && row < dim && col >= 0 && row >= 0); return data[row+col*4]; } void Mat4f::Multiply( const Mat4f& mat, Mat4f& out ) const { assert ( &mat != &out ); int r,c; for ( c=0; c<4; c++ ) { for ( r=0; r<4; r++ ) { out.M(c,r) = M(r,0) * mat.M(0,c) + M(r,1) * mat.M(1,c) + M(r,2) * mat.M(2,c) + M(r,3) * mat.M(3,c); } } } // calculation from: http://www.glprogramming.com/red/images/Image23.gif void my_glFrustum( float l, float r, float b, float t, float n, float f, Mat4f& out ) { float n2 = n * 2.0f; out.data[0]=n2/(r-l); out.data[1]=0.0f; out.data[2]=0.0f; out.data[3]=0.0f; out.data[4]=0.0f; out.data[5]=n2/(t-b); out.data[6]=0.0f; out.data[7]=0.0f; out.data[8]=(r+l)/(r-l); out.data[9]=(t+b)/(t-b); out.data[10]=-(f+n)/(f-n); out.data[11]=-1.0f; out.data[12]=0.0f; out.data[13]=0.0f; out.data[14]=-(n2*f)/(f-n); out.data[15]=0.0f; } // calculation from: http://www.glprogramming.com/red/images/Image23.gif void my_glFrustum_inv( float l, float r, float b, float t, float n, float f, Mat4f& out ) { float n2 = n * 2.0f; out.data[0]=(r-l)/n2; out.data[1]=0.0f; out.data[2]=0.0f; out.data[3]=0.0f; out.data[4]=0.0f; out.data[5]=(t-b)/n2; out.data[6]=0.0f; out.data[7]=0.0f; out.data[8]=0.0f; out.data[9]=0.0f; out.data[10]=0.0f; out.data[11]=-(f-n)/(n2*f); out.data[12]=(r+l)/n2; out.data[13]=(t+b)/n2; out.data[14]=-1.0f; out.data[15]=(f+n)/n2*f; } void my_gluPerspective( float fov, float x,float y,float near,float far, Mat4f& out, bool invert = false ); void my_gluPerspective( float fov, float x,float y,float near,float far, Mat4f& out, bool invert ) { // inspired by [url="http://www.cse.unsw.edu.au/~cs3421/labs/nate/frustsrc.html"]http://www.cse.unsw....e/frustsrc.html[/url] float aspect = x / y; float t = 1.0f/tanf(fov * 3.141f / 360.0f); if ( invert ) { my_glFrustum_inv(-t * aspect, t * aspect, -t, t, near, far, out); } else { my_glFrustum(-t * aspect, t * aspect, -t, t, near, far, out); } } inline void my_gluPerspective_inv( float fov, float x,float y,float near,float far, Mat4f& out ) { my_gluPerspective( fov, x, y, near, far, out, true ); } int main ( void ) { Mat4f should_be_identity; Mat4f projection; Mat4f projection_inverse; my_gluPerspective(90,800,600,0.1f,2000,projection); my_gluPerspective_inv(90,800,600,0.1f,2000,projection_inverse); projection.Multiply(projection_inverse, should_be_identity); for ( int i=0; i<16; i++ ) printf("%f ", should_be_identity.data[i] ); /* expected output: 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 actual output: 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 -20000994.000000 1.000000 */ return 0; } [/source]
  8. I figured that +1/-1 wouldn't be a unit cube.. it would be a unit*2 cube [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img] and 0.1 to 1.1 because, like I said, if I use +1/-1 on the z, the nature of the perspective matrix continues to project the cube if it goes behind the camera, makign it look like an hour-glass (my Z axis is up/down) using +1/-1 on the z: [img]http://bcaptain.net/share/hourglass.png[/img] using -0.1/-1.1 on the z: [img]http://bcaptain.net/share/frust.png[/img] all Vec3's when multiplied by a 4x4 matrix assume a w of 1. But, it seems I am inverting my projection matrix incorrectly, as discussed later in the conversation here: http://www.gamedev.net/topic/635876-bottom-row-of-4x4-matrix/
  9. OpenGL

    [quote name='Brother Bob' timestamp='1355781685' post='5011829'] But take a look at how OpenGL's matrices are commonly designed [url="http://www.glprogramming.com/red/"]here[/url] in appendix F. It lists their inverse also. [/quote] I tried implementing my own fucntions to generate a matrix based on those equations, as well as an inverse: [img]http://www.glprogramming.com/red/images/Image23.gif[/img] Multiplying a matrix together with it's own inverse should result in an identity matrix. I'm getting mostly identity, except col 3 row 4 is always -5.9, and col 4 row 3 is always -1.2. I've tripple-checked that my matrices match the ones in the image. I think the problem is in my matrix multiplication. I know how to multiply the 3x3 rotation section of the matrix and then add the translation, but what do I do with the perspective section? Edit: I've been googling and even looked into a few CG programming books. nobody seems to say how to handle the bottom row of a GL 4x4 when multiplying two matrices together...
  10. it might fit in the Math section better, I just figured I'm using opengl-style matrices as opposed to any other, and perspective/projection is more of a computer graphics thing than mathematics, so... I'm not sure. I am trying to apply a perspective projection to a unit cube so that it becomes a view frustum, for view frustum culling in my octree. I'm sorry I forgot to mention it's a "view frustum" in the title - editing it now. edit: not sure I can change the title of the thread.
  11. I've found countless threads, articles, etc about this topic, but I'm not doing something right. I can create a view frustum but it isn't on the shape of the 'view' (it's much much wider) I'll explain my process here as best I can without getting too deep into the math. if everything here checks out, I'll look closer at those operations. steps I take: 1.) create a unit cube (8 vertices) with these bounds: min/max x: -0.5f to 0.5f min/max y: -0.5f to 0.5f min/max z: -0.1f to -1.1f (if z ranges from positive to negative, the frustum becomes more like an hour glass) 2.) invert my projection matrix 3.) multiply each of my cube's vertices by this inverted projection matrix 4.) ... 5.) profit I don't know how to apply the view resolution like 800x600 because the thing is already pretty big at this point, with the smallest face of the frustum (the screen) being slightly larger than the actual screen space.
  12. OpenGL

    thank you, larspensjo. I was delighted to find octave available for my linux distro. but how about projection/perspective matrices? I presume the way to invert the perspective section of a matrix is to just negate the values, just the same as negating the translation parts. is this correct?
  13. OpenGL

    I'm curious... what program are you using there in the last post? has some interesting notation
  14. OpenGL

    oh wow, that's easy. thank you very much! sometimes it takes baby-speak and sock puppets to explain things to me