Jump to content
  • Advertisement

Endemoniada

Member
  • Content Count

    658
  • Joined

  • Last visited

Community Reputation

431 Neutral

1 Follower

About Endemoniada

  • Rank
    Advanced Member

Personal Information

  • Role
    Programmer
  • Interests
    Art
    Audio
    Design
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Endemoniada

    XYZ Rotations Without Quaternions?

    Duh, it's just this: matrixRotationX(&mX, rot_x); matrixRotationY(&mY, rot_y); matrixRotationZ(&mZ, rot_z); matrixMultiply(&mTemp, &mX, &mY); matrixMultiply(&mR, &mTemp, &mZ);
  2. Hi guys, I'm trying to replace my quaternion rotations with matrix rotations (please don't ask why). I can't seem to get it right. Here is the code: // axes float3 xAxis(1.0f, 0.0f, 0.0f); float3 yAxis(0.0f, 1.0f, 0.0f); float3 zAxis(0.0f, 0.0f, 1.0f); // create the quaternions float4 qX, qY, qZ, qComp, qTemp; quaternionRotationNormal(&qX, &xAxis, rot_x); quaternionRotationNormal(&qY, &yAxis, rot_y); quaternionRotationNormal(&qZ, &zAxis, rot_z); // combine (multiply) and normalize quaternionMultiply(&qTemp, &qX, &qY); quaternionMultiply(&qComp, &qTemp, &qZ); quaternionNormalize(&qComp); // create rotation matrix from quaternions float4x4 mR; matrixRotationQuaternion(&mR, &qComp); Here is what I've come up with so far: // axes float3 xAxis(1.0f, 0.0f, 0.0f); float3 yAxis(0.0f, 1.0f, 0.0f); float3 zAxis(0.0f, 0.0f, 1.0f); // create x rotation matrix float4x4 mX; matrixRotationX(&mX, rot_x); // transform y and z-axes by x matrix transformVector(&yAxis, &mX); transformVector(&zAxis, &mX); // create y rotation matrix xmfloat4x4 mY; matrixRotationAxis(&mY, &yAxis, rot_y); // transform z-axis by y matrix transformVector(&zAxis, &mY); // create z rotation matrix xmfloat4x4 mZ; matrixRotationAxis(&mZ, &zAxis, rot_z); // combine xmfloat4x4 mTemp, mR; matrixMultiply(&mTemp, &mX, &mY); matrixMultiply(&mR, &mTemp, &mZ); The behavior should be (almost) identical but it isn't. I hope someone can help. Thanks.
  3. Hi guys, I've been using the Fbx SDK to extract animation info and it's been working fine. Now that I'm up to IK solvers I've found that I have to bake my animation when exporting (from 3ds Max) or I can't get the proper keyframe data. I don't mind baking but I'm having some issues. If I have a simple rig for a leg (thigh, knee, foot bones) and setup an HI IK solver from the foot_end to the foot, and another from the foot to the thigh, I can move the thigh down (like a squat) and the foot stays planted as it should. It works perfectly when I scrub the timeline in 3ds Max. In my game the foot goes in to the floor a little, the deeper the squat the deeper the foot goes. I'm wondering if I avoid the bake, and do the evaluations myself with the Fbx SDK, whether or not it will be better. I would just try it but I know it's going to be complicated (like all things Fbx) and it would be pointless if it gave me the same results as the bake. I don't know what to do. I'm not doing anything weird so I don't see why it doesn't work like it should. Any help would be great.
  4. Endemoniada

    Modern game engine written in C

    Wow, that's impressive. For FBX support, are you using the Autodesk FBX SDK?
  5. Endemoniada

    FBX Axis to DirectX Axis Conversion Problem

    Hi guys, thanks for helping. I think I got it to work right, I need to double-check though. I went though a bunch of threads at the official FBX SDK site, many of them old, and just kept trying things. I ended up getting the rotation angle correct by negating some of the rotation angles. At that point all I had to do was swap Y and Z of my transformed skin vertices. Changing the skin vertices after the transform isn't very satisfying but it's good enough for now. Thanks again.
  6. Hi guys, I am exporting my skeletal animation via FBX (from 3ds Max) and it's coming out wrong (see image). The image shows a mesh with a single bone. On the left is how it's supposed to look, I got that by simply setting the bone's transform to the identity, so the mesh part is good. The right side shows what's rendered when I transform by the bone. As you can see, it's rotated 90 degrees CCW around the X-axis. Also, when I do a simple animation of the bone rotating around the X-axis (it's local Z-axis) it goes the wrong way, it should go CCW but it goes CW. I thought it would be simple to fix, by maybe swapping Y and Z but I've tried so many things. FBX says it uses a Y-up right-handed system, mine is standard DirextX Y-up, positive Z into the screen. Please help, this is making me crazy. Thank you.
  7. Hi guys, I'm making texture maps and running into problems because of linear filtering (D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT). It's dramatically slowing down my workflow and I still can't figure out the best way to handle it. Rectangular pieces aren't too hard to work with, I can shrink the UVs a little, but other objects are much harder to deal with. Just in case you don't know what I mean, the area outside the textured part is bleeding in because of the way the texture is sampled. How do you guys do it ? Thanks.
  8. Hi guys, Should I use MSAA surfaces (and corresponding depth buffers) when drawing data like positions, normals, and depth to use in stuff like SSAO ? And what about when drawing the SSAO itself ? I'm doing forward rendering for the scene and using MSAA for that.
  9. Endemoniada

    D3D11 Picking Problem

    Hi vinterberg, unfortunately the results are the same, it seems to have made no difference at all.
  10. Endemoniada

    D3D11 Picking Problem

    Hi guys, I'm just getting back to this and still can't figure out what's wrong. I'll post the complete code and results: // view matrix float3 camera_target = { 0.0f, 0.0f, 0.0f }; DirectX::XMVECTOR look = DirectX::XMVectorSet(camera_target.x, camera_target.y, camera_target.z, 0.0f); DirectX::XMVECTOR eye = DirectX::XMVectorSet(camera_target.x, camera_target.y + 64.0f, camera_target.z - 64.0f, 0.0f); DirectX::XMVECTOR up = DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f); DirectX::XMMATRIX view_matrix = DirectX::XMMatrixLookAtLH(eye, look, up); // projection matrix (orthographic with same aspect as screen 16:9) DirectX::XMMATRIX projection_matrix = DirectX::XMMatrixOrthographicLH(160.0f, 90.0f, 8.0f, 128.0f); // mouse/screen coordinates float screen_width = 1920; float screen_height = 1080; float mouse_x = params[0]; float mouse_y = params[1]; // picking part DirectX::XMFLOAT4X4 mat; DirectX::XMStoreFloat4x4(&mat, projection_matrix); float point_x = ((2.0f * mouse_x) / screen_width) - 1.0f; float point_y = -(((2.0f * mouse_y) / screen_height) - 1.0f); point_x = point_x / mat._11; point_y = point_y / mat._22; DirectX::XMMATRIX inv_view = DirectX::XMMatrixInverse(nullptr, view_matrix); DirectX::XMStoreFloat4x4(&mat, inv_view); float3 ray_origin = { mat._41, mat._42, mat._43 }; float3 ray_dir; ray_dir.x = (point_x * mat._11) + (point_y * mat._21) + mat._31; ray_dir.y = (point_x * mat._12) + (point_y * mat._22) + mat._32; ray_dir.z = (point_x * mat._13) + (point_y * mat._23) + mat._33; // normalize ray_dir (not sure if necessary) normalize3(&ray_dir); The camera is simply above and behind the world origin, looking down and forward at it, like a basic top-down view. The screen resolution (same as render target) is 1920 x 1080. Here are the results: (mouse coords in screen space) : (ray direction) (960, 540) : (0.0, -0.707, 0.707) (970, 540) : (0.640, -0.543, 0.543) (1000, 540) : (0.958, -0.203, 0.203) The first set is the centre of the screen and seems fine. The second set is just 10 pixels over to the right, but look at the ray_dir.x. Look at the third set, the mouse is just 40 pixels over to the right and the ray is pretty much pointing down the x-axis. I feel like I'm missing a step somewhere. Please help. Thank you.
  11. Endemoniada

    D3D11 Picking Problem

    Hi iedoc, yes, that was a typo, I fixed it. My camera is pointing down (isometric), like in Diablo. The ray from the camera position (eye) to the camera look at point is always positive z, so it's hard for me to see how the picking ray direction can have a negative z. In any case, I still can't figure out what I'm doing wrong. When I click parts of the flat ground that are in positive x and positive z they come up as negative and are totally inaccurate. For example, when I click the ground at world coordinates (0, 0, 0) it shows ~ (-70, 0, -70) and when I click at (4, 0, 0) it shows ~ (-58, 0, -80), the values are way off, the z shouldn't change at all, and the x should only change by 4. I'll keep trying.
  12. Hi guys, when I do picking followed by ray-plane intersection the results are all wrong. I am pretty sure my ray-plane intersection is correct so I'll just show the picking part. Please take a look: // get projection_matrix DirectX::XMFLOAT4X4 mat; DirectX::XMStoreFloat4x4(&mat, projection_matrix); float2 v; v.x = (((2.0f * (float)mouse_x) / (float)screen_width) - 1.0f) / mat._11; v.y = -(((2.0f * (float)mouse_y) / (float)screen_height) - 1.0f) / mat._22; // get inverse of view_matrix DirectX::XMMATRIX inv_view = DirectX::XMMatrixInverse(nullptr, view_matrix); DirectX::XMStoreFloat4x4(&mat, inv_view); // create ray origin (camera position) float3 ray_origin; ray_origin.x = mat._41; ray_origin.y = mat._42; ray_origin.z = mat._43; // create ray direction float3 ray_dir; ray_dir.x = v.x * mat._11 + v.y * mat._21 + mat._31; ray_dir.y = v.x * mat._12 + v.y * mat._22 + mat._32; ray_dir.z = v.x * mat._13 + v.y * mat._23 + mat._33; That should give me a ray origin and direction in world space but when I do the ray-plane intersection the results are all wrong. If I click on the bottom half of the screen ray_dir.z becomes negative (more so as I click lower). I don't understand how that can be, shouldn't it always be pointing down the z-axis ? I had this working in the past but I can't find my old code Please help. Thank you.
  13. Endemoniada

    How to Work with FBX SDK

    I really do hope this has an alternative since the latest SDK 2015.1 does not support it:   FbxAnimStack* currAnimStack = mFBXScene->GetSrcObject<FbxAnimStack>(0);   Also, these have no data types and are left to the imagination:   in FBXExporter::ProcessJointsAndAnimations()   mAnimationName mAnimationLength   And this line:   Keyframe** currAnim = &mSkeleton.mJoints[currJointIndex].mAnimation;   Why did you not show us what Keyframe is ? You don't provide your Joint struct either. It's difficult to follow without that information.
  • 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!