• Advertisement

GameDevEnthusiast

Member
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

131 Neutral

About GameDevEnthusiast

  • Rank
    Newbie

Personal Information

  • Interests
    Programming
  1. 0) In the original marching cubes algorithm, there are 15 equivalence classes (which comprise all 256 cases). But why is there no cases when 5 vertices lie inside the solid volume, and 3 - outside (e.g. case 61d = 3Dh = 0011 1101b) ?   1) What is the 'standard' method for automatically constructing a 'good' marching cubes table (fewer triangles, no holes between neighbours) ? Considering each case and writing out the table is laborious and error-prone.  
  2. how to download directx old version ?

    DirectX 1,2,3 SDKs: http://craig.theeislers.com/2006/03/directx_then_and_now_part_2.php   DirectX 8 SDK: http://www.darwinbots.com/numsgil/dx81sdk_full.exe   DirectX 9.0c SDK (June 2010) http://directx-sdk.soft32.com/   (Ahhaha, yeah...)   btw, where can I get DirectX 4-6 SDKs (just curious) ?
  3.     Hello!       I'm trying to implement a stateless multithreaded renderer as described in the "Firaxis LORE" presentation about Civilization 5 renderer from GDC 2011 and their system seems to be very elegant, clean and simple to use.     Their rendering commands are self-contained and can be submitted in any order which, among other nice things, lends itself to easy parallelization. For example, a 'COMMAND_RENDER_BATCHES' command contains a list of surfaces to render, each with shader constant payload.     The recommended way to update uniform shader constants is to put them into uniform blocks (constant buffers in Direct3D parlance) according to their update frequency (to minimize memory transfers). Besides, uniform blocks can be shared between different programs (conserves memory).     Let's say, I have several global uniform buffers (e.g. PerFrame, PerView, PerInstance and PerLight), which can be updated independent of any shader programs (no need to bind a program). But shader dependencies on global stuff ruin the whole 'statelessness' idea - I can no longer sort the draw calls, because I need to preserve the original update-set-draw order for correct rendering!       Should I abandon the idea of using global uniform buffers and resort to the old OpenGL 2.* way of setting all shader uniforms on each batch submission (which is said to be most inefficient) ?  
  4. [Assimp] Build the skeleton from the scene

    yes, after a week of painful debugging and studying tens of skeletal anim samples i'm able to build a basic skeleton, interpolate and display it correctly (one of the problems was with my quaternion math - needed to multiply the .w component by -1).   I'm going to abandon mSkinOffset and instead calculate inverse bind pose matrices myself (after building the 'whole mesh' skeleton with absolute joint positions and orientations in object space).   I will post my code in the hope that it will be useful. Here's how I build the skeleton: I gather all bone names - I use them to prune the skeleton - the resulting joint tree will be same as originally defined in md5 mesh file. // set of all animated bones/nodes typedef std::set< std::string > BoneNameSetT; static void GatherBoneNames( const aiScene* scene, const NodeMapT& nodes, BoneNameSetT &bones ) { bones.clear(); // Loop through each bone of each mesh. for( int meshIndex = 0; meshIndex < scene->mNumMeshes; meshIndex++ ) { const aiMesh* mesh = scene->mMeshes[ meshIndex ]; for( int boneIndex = 0; boneIndex < mesh->mNumBones; boneIndex++ ) { const aiBone* bone = mesh->mBones[ boneIndex ]; const aiNode* node = FindNodeByName( nodes, bone->mName.C_Str() ); while( node ) { bones.insert( node->mName.C_Str() ); node = node->mParent; if( node && node->mNumChildren == 1 ) { break; // don't chase up until the scene root, if possible } } } } } struct BoneDesc { const aiNode * node; std::string name; int parentIndex; aiMatrix4x4 globalTransform;// absolute (world => node) transform }; static void BuildSkeleton(const aiNode* node, const BoneNameSetT& boneNames, const aiMatrix4x4& parentTransform, const int parentBoneIndex, TArray< BoneDesc* > &skeleton) { // accumulated parents => node transform const aiMatrix4x4 globalTransform = node->mTransformation * parentTransform; // P * B int newBoneIndex = parentBoneIndex; BoneNameSetT::const_iterator boneIt = boneNames.find( node->mName.C_Str() ); if( boneIt != boneNames.end() ) { newBoneIndex = skeleton.Num(); BoneDesc* newBone = new BoneDesc(); skeleton.Add(newBone); newBone->node = node; newBone->name = node->mName.C_Str(); newBone->globalTransform = globalTransform; newBone->parentIndex = parentBoneIndex; } for( int childIndex = 0; childIndex < node->mNumChildren; childIndex++ ) { const aiNode* childNode = node->mChildren[ childIndex ]; BuildSkeleton(childNode, boneNames, globalTransform, newBoneIndex, skeleton); } } Here's how I calculate local joint transforms: // The bone's transformation in the skeleton space, // aka the bind matrix - the bone's parent's local matrices concatenated with the bone's local matrix. const aiMatrix4x4 nodeGlobalTransform = boneDesc->globalTransform; //Assert(nodeGlobalTransform == CalculateGlobalTransform(node)); // The transformation relative to the bone's parent (parent => bone space). aiMatrix4x4 nodeLocalTransform; if( boneDesc->parentIndex != -1 ) { const BoneDesc* parentBone = skeleton[ boneDesc->parentIndex ]; aiMatrix4x4 parentGlobalTransform = parentBone->globalTransform; aiMatrix4x4 inverseParentGlobalTransform(parentGlobalTransform); inverseParentGlobalTransform.Inverse(); nodeLocalTransform = nodeGlobalTransform * inverseParentGlobalTransform; // N = P^-1 * B } else { nodeLocalTransform = node->mTransformation; } aiVector3D scaling; aiQuaternion rotation; aiVector3D translation; nodeLocalTransform.Decompose(scaling, rotation, translation); Vector3D jointTranslation = ToMyVec3D(translation); Quaternion jointOrientation = ToMyQuat(rotation); I studied the samples very closely: scenes are animated by interpolating node movement, but I don't want to have the full node hierarchy at run-time with redundant bones (referring to the same node, but having different mOffsetMatrix matrices, as mentioned. http://www.gamedev.net/topic/630903-assimp-and-collada-bind-shape-matrix/?view=findpost&p=4977756
  5. How to construct the 'global' skeleton from a scene imported by the Open Asset Import Library (Assimp) ?   In Assimp, a scene is essentially a hierarchy of nodes, each node can possibly have meshes, each mesh can have a set of bones so it's easy to build a joint hierarchy for a single mesh, but I need to build the joint tree for the whole mesh (as in Doom 3).  
  • Advertisement