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

lesshardtofind

Members
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

104 Neutral

About lesshardtofind

  • Rank
    Member

Personal Information

  • Location
    Texas
  1. Thank you for the responses.  I adjusted my Vector3 structure to defined operator overloads which made the entire equation alot easier.  It now works to a degree but not how I expected.  It has me floating to the right point rather than just staying on top of the terrain.  It made me realize I'm going to need working structs and formulas in a library before I really delve into this so I'm going to jump into some calculus websites for a few days and program a math library for me to use.   I will look into the Linear Interpolation, Barycentric Coordinates, and quadratic/cubic bezier curves.  (thanks for that sometimes I just need to find the right phrase to google)
  2. Hey!      I've been trying, for a couple days, to get my Camera to smoothly "walk" across any loaded heightmap with any size triangles.  It was suggested to me to use a ray to plane collision to get this done, but I'm having some issues figuring out where I slipped up.  Maybe someone here can shed some light on my ignorance.   This function should return a Vector3, which is a struct of 3 float, that represents the point at which collision would occur.   Here is the code:   Vector3 IntersectionPoint(Triangle ColTri, Vector3 CameraPos){   float a = DotProduct(Normal(ColTri), Vector3(0, -1, 0));  // Vector {0, -1, 0} is the up vector, Normal(ColTri) returns the normal of the triangle passed   if(a == 0)     return CameraPos;   Vector3 Temp;   //this is used to calculate the distance from the plane   Temp.X = CameraPos.X - ColTri.VertexA.X;          Temp.Y = CameraPos.Y - ColTri.VertexA.Y;   Temp.Z = CameraPos.Z - ColTri.VertexA.Z;   float X = DotProduct(Normal(ColTri), Temp);   float Mag = Magnitude(Normal(ColTri));   float DistanceToPlane = X/Mag;               // end of the distance to plane formula   Vector3 ToReturn;                                   // the vector to return   float Multiplier = DistanceToPlane/a;   ToReturn.X = CameraPos.X;   ToReturn.Y = CameraPos.Y-((-1)*Multiplier);   ToReturn.Z = CameraPos.Z;   return ToReturn; }     I know there may be a couple extra data types as I was trying to dumb down the logic for myself to understand it.  I'm very sketchy on calculus still.  Been reading on plane math and planes equations, but still haven't found anything yet.   Thanks for your time!  - John
  3. OpenGL

    Not sure since I can't look at your project parameters, but this link shows what should be on your system to use wglmakecurrent. here
  4. My method does use GL translate to draw onto the screen at the "correct" position. The translate translates to the center of the object. The example I gave was simple, but I use this method so the physics engine can manipulate the objects location. Shouldn't every object be movable unless it is a wall or some sort of stationary object? I'm sorry I seem to be confused. Are you just wanting to move the camera rather than the object? I also made a little play around particle engine using this method with a couple std::vector that did a pushback to increase the number of particles. The computer I'm using with 2gig ram was able to handle around 500k particles (which each contained 4 triangles so around 2 million triangles on the screen moving their own centers) before it even started to slow down. I have recently read since then that the physics engine should operate calculations at half the speed of your renderer to increase speed so I'm guessing using that tactic I could probably nearly double the number of triangles on the screen.
  5. Hey I'm definitely still a ameteur in OpenGL, but I can share my method. I usually start by making a Class of any object I'm going to draw. Then I give every object a center point. And all rendering is done based off the size of the object and its center. Like in the example of a cube you know each Face is going to be size/2 away from the Center. So you draw everything in a formula based off the center. Translate to center then draw off the formula. When I want to move an object I can just change the center cartesian coordinates(3 set x, y, z) and the object will automaticly move where I tell its center to go. for(int a = 0; a < 20; a++) { Cube.SetCenter(Cube.CenterX(), Cube.CenterY(), Cube.CenterZ()+1); } This would move it 20 forward from its original position. If you know your classes and geomotry this should be a snap. I apologize if this isn't an applicable solution due to my lack of understanding of all OpenGL formats, but I figured I'd take a stab at it since no one had responded yet.
  6. Thankyou
  7. Quite aware that a rotation of the object must pass through its center. Hence I have two rotation points that each object holds. Local (its own center) and Global rotation (any point I define if I want to "attach" it to an object. Looked up Rotation Matrixes in 2d. If I applied 3 different 2d matrix rotations would this NOT be subject to gimbal lock using the following formula? x = x*cos(Omega)-y*sin(Omega) y = x*sin(Omega)-y*cos(Omega) this follows from the Rotation(Omega) = [ cos(Omega) - sin(Omega) ] [ sin(Omega) cos(Omega) ] formula listed on wiki. I got all my other information from wiki and you shot it down lol so Was wondering if this was valid.
  8. Lol from every source I read about gimbol lock it reported that quaternions was the "fix". I've spent weeks working with rotation alone I want to leave this part of the programming, have a gimbol lock free system and move on to forces of physics. As far as I read gimbol lock has the least amount of calculations required as a gimbol lock solution especially when you start to go around multiple axis. Guess I'll post some code since it doesn't seem I'm portraying my problem verbally very well. calculus.h #ifndef CALCULUS_H #define CALCULUS_H typedef struct Vector{ float x, y, z; }Vector; typedef struct Quaternion{ float a, b, c, d; }Quaternion; Quaternion QProduct(Quaternion A, Quaternion B); Vector QVProduc(Quaternion A, Quaternion B); Vector QuatRot(Vector Point, Vector RotVector, float Angle); calculus.cpp Quaternion QProduct(Quaternion A, Quaternion B) { Quaternion Result; Result.a = (A.a*B.a)-(A.b*B.b)-(A.c&B.c)-(A.d*B.d); Result.b = (A.a*B.b)+(A.b*B.a)+(A.c*B.d)-(A.d*B.c); Result.c = (A.a*B.c)-(A.b*B.d)+(A.c*B.a)+(A.d*B.b); Result.d = (A.a*B.d)+(A.b*B.c)-(A.c*B.b)+(A.d*B.a); return Result; } Vector QVProduct(Quaternion A, Quaternion B) { Vector Result; Result.x = (A.a*B.b)+(A.b*B.a)+(A.c*B.d)-(A.d*B.c); Result.y = (A.a*B.c)-(A.b*B.d)+(A.c*B.a)+(A.d*B.b); Result.z = (A.a*B.d)+(A.b*B.c)-(A.c*B.b)+(A.d*B.a); return Result; } Vector QuatRot(Vector Point, Vector Axis, float angle) { float SinVal = sin(angle*.5); Quaternion RotationQuat; Quaternion PointQuat; Quaternion ConjugateQuat; Quaternion Temp; RotationQuat.a = cos(angle*.5); RotationQuat.b = SinVal*Axis.x; RotationQuat.c = SinVal*Axis.y; RotationQuat.d = Sinval*Axis.z; PointQuat.a = 0.0f; PointQuat.b = Point.x; PointQuat.c = Point.y; PointQuat.d = Point.z; ConjugateQuat.a = RotationQuat.a; ConjugateQuat.b = -RotationQuat.b; ConjugateQuat.c = -RotationQuat.c; ConjugateQuat.d = -RotationQuat.d; Temp = QProduct(RotationQuat, PointQuat); Vector P = QVProduct(Temp, ConjugateQuate); return P; } Again it works with an square object that has a center on (0, 0, -5) when I give it a axis vector (0, 0, 1). This does not work on an Object that has a center located at (2, 0, -5), even when I give it a vector (2, 0, -4). It might be important to note that the object this is working on is a square with NO Z dimension AKA coplanar to the XY plane. The objects this doesn't work on are A equalaterial pyramid(4 triangles), and a diamond (8 triangles). Though I think the shape should not matter as long as the center of the object is precise.
  9. Quote:Quaternions have nothing to do with gimbal lock one way or the other, so don't get hung up on that idea. Sorry I think I spoke in an ambiguous mannar that was misleading. The gimbal lock problems were Pre-Quaternion rotation. Using Co-planar unit circles to derive rotations by cos(omega) and sign(omega) to its respective coordinate depending on the axis around which the rotation shall occur. As the number approaches zero it has a tendency to get stuck, giving the illusion of gimbol lock. Through this limitation I decided to learn Quaternion methods in order to NOT be subject to gimbol lock. The function takes the point (cartesian) and axis and angles and converts them into quaternion counterparts and radians for the angle. A conjugate quaternion is also created. Then applies a multiplication based on the rules stated in Wiki Quaternion Rotation. Cos(Angle*.5), Sin(Angle*.5), Sin(Angle*.5), Sin(Angle*.5) being the values of the rotation quaternion by which Point is multiplied after it is set as a quaternion with W = 0(I think they called this the identity rotation). Well on my 12th read through wiki (lol I said I'm slow) I noticed that I THINK my function when it is handed the Point vector that this should be a unit vector? I haven't been passing as such. I've merely been passing the cartesian coordinates of the given vertice of the triangle I wish to rotate. Am I supposed to convert the Vector Point into a unit vector? If so how would I accomplish this. I tried deriving a current angle based off a standard vector (1, 0, 0) Then the angle formed using the formula cos(Omega) = VectorDotProduct(A, B)/(VectorLength(A, Aorigin)+VectorLength(B, Borigin)); Then I figured I could find the new "Unit Vector Coordinates" by using the formula Delta Z = AngleFoundAbove; (in radians) x = cos(DeltaZ); y = sin(DeltaZ); then passing those coordinates to the QuatRot Function. And finally multiplying the output coordinates by its original radius to get the respective coordinates based on actual vector and not unit vector. Still no avial. I'm very off somewhere in my thought process and I don't know why. Do both Vector Point and Vector Axis NEED to be in unit vector format in order for the Rotation Quaternions to be Unit Quaternions?
  10. Alright I beat my brain up for a while now trying to really understand 3d rotation. I ended up writing my own calculus lib and trying to rotate with known formulas so I could get a full bearing on it, and of course the Gimbol lock reared his head a few times, and I finally started to see how and where quaternions fit in. I read wikipedia (quaternion rotations) like 10 times (I'm a slow learner) and ended up writing my own version then compared it to their "psuedo" code and I ended up pretty close. Though I'm observing that I missed some fundamental law and I'm not sure what that is. I think it has to do with definition of the Axis around which the object is rotated. Say in the code Vertices = QuatRot(Vector Point, Vector Axis, float Angle); How am I supposed to define this Axis in vector format? I assumed it would be in unit vector format and so I defined a Z rotation function as a QuatRot around the Vector (0, 0, 1). This worked only if the object was in the middle of the screen and my other objects don't even rotate. So then I tried defining this vector in reference to each Objects center so (center.x center.y center.z+1) this ends up doing something silly like spinning the center object REALLY fast and the object on the right and left just move straight up and down respectively. Then the center object completely dissapears after 10 seconds. Sorry about the apparent ingnorance but this concept has been a bumpy road for me. If you would like I can post the code, but I'm trying to get this conceptually so that the coding is a natural response to understanding.
  11. Quote:You wrote a whole lot of text based on not understanding the situation I wrote a whole lot of text based ON calculus and trignometry. What you are correct is I didn't understand the quaternions as a whole and the neccesity. What I described above is how OpenGL already rotates. The unit vector unit circle thing isn't hard to understand. Unit Vector - a vector whose length is equivalent to 1. Unit Circle - a circle whose radius has a length of 1. Then if Unit = Unit then 1 = 1 aka vector length = radius length. You can demonstrate this easily. As far as programming this level of rotation of course I've already been doing it for some time. It was a response to you telling me to go look up 2d rotations because you assumed I didn't understand how they work. The point represented by 3 perpindicular planes is exacly how graphing 3 dimensional graphing works. The point 0, 0, 0 in its exhistence creates 3 perpindicular planes by which all coordinates can be measured. The point 1, 1, 1. Doesn't relate in any way to 0, 0, 0 if there was no planes created by which to measure every other point. This is a calculus explanation that I have read in at least 3 books. None of what I posted about rotations applied to quaternation rotation, because I'm not convinced I have to use it yet. Hence the questions about how to proof it. So the next quaternation question I would like to pose is. In reference to × 1 i j k 1 1 i j k i i −1 k −j j j −k −1 i k k j −i −1 Which side is considered the number you are multiplying and which is considered the number that is being multiplied by. I need to understand this because i * j != j * i since one apparently creates a positive version of k which one creates a negative version of k.
  12. "Do some more reading. And keep Einstein out of this." I was hoping to get actual mathematic responses, not insults of implied ignorance that mean nothing when they are unquantified. A measurement by which you imply my inacuracy would be most appreciated i.e. a formula by which the thinking is incorrect. Which scientist do you propose we keep in this? Just Hamilton? Its mathematics naturally derived from "proven" laws of other scientists applied by a given uncertainty. If you want to keep Einstein out of your games that cool, but I'd rather have the possibility of a nuclear explosion. "Quaternions are an abstract mathematical system. It just turns out that they're useful to represent rotations. They were not developed to represent rotations nor do they really represent anything that actually exists. It's just math, try to keep reality out of it and you'll go less insane." Thanks for the link I don't know how I missed that wiki page. I've spent many hours since I heard about quaternions(yesterday) reading and learning the math. Had I found that link myself I wouldn't have needed to pose the question about unit vectors. The philosophy of the generation of a hypersphere in the beginning part is exactly what I was talking about above is three special unit circles can derive any given rotation point needing 3 different hyperspheres if you are rotating on 3 axis around one point. It has a lot better explanation of the math though. I very much appreciate that. Oh and why would I want reality out of my games? Even the best surrealistic games follow a system coherant to reality. How could you derive that 1 = 1 without a reality by which to stand in and say yep that rock is definitely itself.
  13. "Yes, the `i', `j' and `k' are historically the same thing as the usual base of R^3, but I don't know how much that's going to help you understand quaternions." Thank you for the confirmation here is what was in my head as a result of these being unit vectors if this was indeed true. Well it can be assumed that a unit vector is also a radius of a Unit Circle. I assumed that taking three unit vectors could derive a unit sphere(but I couldn't do this until I could validate they each were unit vectors). From there it is safe to assume that you can find any given angle in radians and degrees from any given two points within that sphere using the calculus omega function. Angle between any two vectors or points can be derived from. Both A and B are vectors (I believe this equation is coplanar though so that you can translate it to a change in X, Y, or Z ) cos Omega = (A*B)/A.length * B.length or Omega(radians) = acos((A*B)/(A.length * B.Length)) Then knowing that i, j, k represent a "unit" vector of a "unit" sphere then you could establish that unit as a One radian or Pi. (this opens a huge door of already known equations on the unit circle) Knowing that any point in space is created by 3 Planes XY, XZ, YZ you could assume the same would be true with any point on this sphere being represented by 3 diffent unit circles Unit Circle XY, XZ, YZ. Then expanding XY, XZ, YZ to their corresponding "special unit circle" which would have a radius of the "Special unit vector" of the given vector and following the logic of a calculus sphere equation you could find a new position based on a old position and a given angle in either radians or degrees and vice versa, and as long as it satisfied the sphere equation then it would be safe to assume this is a correct point on a given sphere (and rotation is nothing other than movement along the surface of a given sphere/circle). Using the unit vector though this last step isn't needed because we already put it on a unit 1 we would just have to multiply by its real number to get the value of the new position that creates the given angle and lies on the sphere. Obviously the order of rotations around each given special unit circle would create a different product so it wouldn't be communitave. What I'm not able to figure out at this moment, why the need for W. And based on Einsteins theory of relativity why even W and not T? And if it was T then it could be assumed that all objects in a current rendering process have the same T so why even use it at all? Thank you for the confirmation on this being a unit vector. I can try to learn how to proof Hamilton's theory of multiplication of Quaternions.
  14. Hey trying to wrap my head around quaternions, because I like to understand a concept and code it myself rather than just copy paste someone elses highly efficient shared code. I'm looked at the multiplication table and didn't understand why i * i = -i. I found the answer under imaginary number multiplication. Once I understood that I understood why but relating that to i * i = j * j = k * k = ijk = -1 still didn't quite add up in my head. The only way I figured this could work would be if i = 1; j = 1; k = 1; Started looking up why, and finally found an answer in my Mom's old Calculus book that I think explains this. Unit Vector - A vector whose length is equal to 1. or Given A is a vector and A.x, A.y, A.z are cartesian coordinates of this vector; ........------------------------------- 1 = \/(A.x*A.x)+(A.y * A.y)+(A.z * A.z) A unit vector can be defined as components (A.x, 0, 0), (0, A.y, 0), (0, 0, A.z) as such any vector can be defined as a Special Unit Vector. Or A = (A.xi, A.yj, A.zk). Suddenly I hit a eureka as I saw a repeat of these values i, j, and k. So I trodded around all morning looking for a confirmation that i, j, and k are assumed to be imaginary unit vectors for the given Quaternion. I didn't find that validation so I decided I'd ask here. Sorry if the post is a little lengthy, but I wanted show what understanding my current research has lead me to. So that I could be corrected if I was misunderstanding something.