Jump to content
• Advertisement  # Sansros

Member

12

112 Neutral

## About Sansros

• Rank
Member
1. Going through some literature, I became confused about matrices in relation to extracting world space frustum planes.    The way being devised to extract frustum planes was to use the Projection matrix alone and to play around with column values and normalization. That I understood fine. I guess, the problem with this way was that all of the plane normals extracted were in camera space and in effect, all distances would be 0 since, even if the planes are far away in world space, they are always are the origin of the camera.    In any case, the solution to extract world space frustum planes was to still use the same method but to use the View * Projection matrix rather than just the Projection matrix alone. I fail to see though how the resulting matrix helps us get the frustum planes in world coordinates. If I multiply the View and Projection matrices, I get that my view frustum is now in the shape of a box and that vertices, multiplied by this, would be against the box planes. Thus, I am going from world space to NDC space.It would have made sense if I were told to take an NDC space plane normal and to multiply it by the inverse of the View matrix to get a world space coordinate but that's not the current issue.    Btw, for sake of context, here is the way the world space frustum plane was being extracted from the VP matrix:     Left Plane->Normal.X = - (m14 + m11) = 1.62566 Left Plane->Normal.Y = - (m24 + m21) = 0 Left Plane->Normal.Z = - (m34 + m31) = -0.211452
2. Got it, that clarified it up when you mentioned curve vs planar surface.
3. Ok but isn't this relative to what your starting x value is? I mean, if I use 0.2 that is 0.2 units away from 0, not a small change relative to any arbitrary x value on the graph. In other words, if I use 0.2 as my delta but now have it relative to let's say, 1.5 instead of 0 on the x-axis, the output would now be: 2(1.7) + .3 = 3.7 "You can think of that as saying that a small change in x (0.2 away from 1.5 on the x-axis) results in a change in f(x) that is about 3.7 times the change in x." The most general form I can think of it is like this: "Any change in x will result in [background=rgb(250, 251, 252)]2x +y for the Z output"[/background]
4. "[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][background=rgb(250, 251, 252)]"if I were to vary x a little bit, what multiple of the change would the function change?". You can consider y to be fixed and x to be variable"[/background] [/font] I think the above is mainly what I'm confused about. For example: Z = x² + xy + y² @z ---- = 2x +y @x Let's say now x = .2 and y = .3. 2(.2) + .3 = .7 I could have done this for any point of x and gotten different results for my output. So is this saying that for every change of "something" in x, Z will increase by .7? If I change X to 1.5 to get 2(1.6) + .3 = 1.1 so I'm confused in this sense.
5. So I get the general idea of partial derivatives, meaning you make everything else constant and solve for one for the partial derivatives of a function. Let's say I have some surface whose Z is defined by function f which takes (x,y). If I find the partial derivative of f with respect to just x, I get a formula in which I can plug in some x and my constant y. The result is the slope of Z for that point on x. However, my x can be anything from 2 to 100 and my output will be slopes drastically different from one another. So I am failing to connect how a partial derivative means "it tells you how much Z changes for every change in X" to what I wrote above for any arbitrary X and its output. Oh and I came back to brushing up on partial derivatives due to the GPU gems article on water (in the normals and tangents part) http://http.developer.nvidia.com/GPUGems/gpugems_ch01.html so I am just trying to connect what I know above to what the article talks about.
6. So the enemies of my game are mindlessly animation along pre-generated cutmull-rom splines, interpolating back and forth along the curve. I've set up a volume where these objects can roam and simply calculated a random position for the start of the curve and the end, setting the position of the enemies to the interpolated point along the curve. The problem is, is that obviously these will intersect and I want a way to avoid this. I could I guess have the bounding volume further split into regions where I would know where enemies are located. I could then somehow know at which point two enemies will intersect and temporarily fly away into an empty region and then resume my way onto the curve. Any suggestions?
7. For Matrix.CreateFromYawPitchRoll, I meant during the operation. If you pitch first let's say 90 degrees, than the local y-axis will now line up with the world z-axis. If you want to now yaw, will you yaw around the world's y-axis at (0,1,0) or the local's (0,0,1)?
8. So I just want to talk about broad API calls and euler rotations and matrices for a second. Are euler rotations always going to be in relation to an object's axis? For example, in XNA there is: Matrix.CreateFromYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z) [font="Lucida Sans Unicode"]1. So here I assume that you rotate on the object's Y-axis which coincides with the world's y-axis. After, you then would rotate on the x-axis (wherever that may be after the y rotation) of the object and not the world. Is this generally the case for euler rotations and these types of functions? I only ask to bring the distinction between functions like[/font] Matrix.CreateFromAxisAngle(angle, vector) [font="Lucida Sans Unicode"] [font="Lucida Sans Unicode"]2. I only worry about orthogonality if I am creating a matrix from scratch right? In other words, the function above and quaternion functions in frameworks always drag axis along for the ride together. It's never like you can rotate one axis without effecting the others. Thus, maintaining orthogonality. [/font][/font] 3. For gimbal lock, I see online videos of the problem through a parent structure where if I am rotating (x,y,z), an x rotation will move the y and z axis. A y rotation will only affect the z axis and so on. However, I thought that each axis is moved along for the ride as mentioned above so they would always be orthogonal to one another. Can anyone clarify?
9. Your explanation and diagram helped me extremely. I was just visualizing the vector from the origin to a point on the plane wrong which lead me to my confusion.
10. Ok so I about understand all there is to planes except for the 'd' in the equation of ax+by+cz +d = 0 and finding the distance from world origin. While reading through here (GameDevJournal) at the third part is 'Get Plane Distance Using Plane Equation'. He says that d = -dotProduct(n,p) where n is a normal vector to the surface of the plane and p is already a point on the plane. This is a big 'well duh', you are figuring out 'd' here but won't the result always be 0? If you have a plan 100 units in whatever axis, the distance from the world-origin to this plane obviously isn't 0. Aside from that, if 'd' is the distance from the world origin to the plane, what point on the plane is this the distance from? I only ask because a plane can be oriented in different ways. Some points may be closer to the world-origin than others and so on.
11. Because the order in which you multiply you FIRST translate and then rotate. Read matrix multiplications from right to left. Also multiplying with identity is pointless by definition and just like multiplying a number with 1. [/quote] So what I wrote is fine if I read right to left and do: world = tr * rr; correct?
12. If I rotate a sprite 90 degrees along the Z-axis and then multiply that matrix by a translation matrix, I expect my sprite to move upwards. This is because the x-axis of the sprite is now aligned with the world's z-axis. However, the sprite instead still moves right or left along the world's z-axis. Can anyone explain what's wrong? //expect this to change the axis on which the sprite works on Matrix rr = Matrix.CreateRotationZ(MathHelper.ToRadians(90.0f)); //moves to the right instead of upwards like I expect Matrix tr = Matrix.CreateTranslation(new Vector3(2, 0, 0)); world = identity * rr * tr;
• Advertisement
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!