Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

165 Neutral


About pristondev

  • Rank

Personal Information

  • Role
    Game Designer
  • Interests

Recent Profile Visitors

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

  1. Hey, Im using directx allocate hierarchy from dx9 to use a skinned mesh system. one mesh will be only the skeleton with all animations others meshes will be armor, head etc, already skinned with skeleton above. No animation, idle position with skin, thats all I want to use the animation from skeleton to other meshes, so this way I can customize character with different head, armor etc. What I was thinking its copy bone matrices from skeleton mesh to others meshes, but Im a bit confused yet what way I can do this. Thanks.
  2. Hey guys, Im getting bounding box of a mesh in my engine using D3DXComputeBoundingBox, but when I use this function, looks like the mesh is every on position (0,0,0), but it isn't. The bounding box should be in position of sphere, and dont (0,0,0) D3DXComputeBoundingBox getting wrong sMin and sMax (how we can see on the pic, it isnt a problem of render...) How it should be: The code im using to get bounding box: BYTE * pData; pMeshContainer->MeshData.pMesh->LockVertexBuffer( D3DLOCK_READONLY, (void**)&pData ); //Compute Bounding Box D3DXComputeBoundingBox( (const D3DXVECTOR3*)(pData), pMeshContainer->MeshData.pMesh->GetNumVertices(), pMeshContainer->MeshData.pMesh->GetNumBytesPerVertex(), &pMeshContainer->cBoundingBox.sMin, &pMeshContainer->cBoundingBox.sMax ); pMeshContainer->cBoundingBox.sMid = (pMeshContainer->cBoundingBox.sMax - pMeshContainer->cBoundingBox.sMin) * 0.5f; pMeshContainer->cBoundingBox.sCenter = (pMeshContainer->cBoundingBox.sMax + pMeshContainer->cBoundingBox.sMin) * 0.5f; //Compute Bounding Sphere D3DXComputeBoundingSphere( (const D3DXVECTOR3*)(pData), pMeshContainer->MeshData.pMesh->GetNumVertices(), pMeshContainer->MeshData.pMesh->GetNumBytesPerVertex(), &pMeshContainer->cBoundingSphere.sCenter, &pMeshContainer->cBoundingSphere.fRadius ); pMeshContainer->MeshData.pMesh->UnlockVertexBuffer(); //We have min and max values, use these to get the 8 corners of the bounding box pMeshContainer->cBoundingBox.sBoxPoints[0] = D3DXVECTOR3( pMeshContainer->cBoundingBox.sMin.x, pMeshContainer->cBoundingBox.sMin.y, pMeshContainer->cBoundingBox.sMin.z ); //xyz pMeshContainer->cBoundingBox.sBoxPoints[1] = D3DXVECTOR3( pMeshContainer->cBoundingBox.sMax.x, pMeshContainer->cBoundingBox.sMin.y, pMeshContainer->cBoundingBox.sMin.z ); //Xyz pMeshContainer->cBoundingBox.sBoxPoints[2] = D3DXVECTOR3( pMeshContainer->cBoundingBox.sMin.x, pMeshContainer->cBoundingBox.sMax.y, pMeshContainer->cBoundingBox.sMin.z ); //xYz pMeshContainer->cBoundingBox.sBoxPoints[3] = D3DXVECTOR3( pMeshContainer->cBoundingBox.sMax.x, pMeshContainer->cBoundingBox.sMax.y, pMeshContainer->cBoundingBox.sMin.z ); //XYz pMeshContainer->cBoundingBox.sBoxPoints[4] = D3DXVECTOR3( pMeshContainer->cBoundingBox.sMin.x, pMeshContainer->cBoundingBox.sMin.y, pMeshContainer->cBoundingBox.sMax.z ); //xyZ pMeshContainer->cBoundingBox.sBoxPoints[5] = D3DXVECTOR3( pMeshContainer->cBoundingBox.sMax.x, pMeshContainer->cBoundingBox.sMin.y, pMeshContainer->cBoundingBox.sMax.z ); //XyZ pMeshContainer->cBoundingBox.sBoxPoints[6] = D3DXVECTOR3( pMeshContainer->cBoundingBox.sMin.x, pMeshContainer->cBoundingBox.sMax.y, pMeshContainer->cBoundingBox.sMax.z ); //xYZ pMeshContainer->cBoundingBox.sBoxPoints[7] = D3DXVECTOR3( pMeshContainer->cBoundingBox.sMax.x, pMeshContainer->cBoundingBox.sMax.y, pMeshContainer->cBoundingBox.sMax.z ); //XYZ SAFE_RELEASE( pMeshContainer->lpBoundingBoxMesh ); SAFE_RELEASE( pMeshContainer->lpBoundingSphereMesh ); //Create Bounding Sphere Mesh D3DXCreateSphere( lpDevice, pMeshContainer->cBoundingSphere.fRadius, 15, 10, &pMeshContainer->lpBoundingSphereMesh, NULL ); //Create Bounding Box Mesh float fWidth = pMeshContainer->cBoundingBox.sMax.x - pMeshContainer->cBoundingBox.sMin.x; float fHeight = pMeshContainer->cBoundingBox.sMax.y - pMeshContainer->cBoundingBox.sMin.y; float fDepth = pMeshContainer->cBoundingBox.sMax.z - pMeshContainer->cBoundingBox.sMin.z; D3DXCreateBox( lpDevice, fWidth, fHeight, fDepth, &pMeshContainer->lpBoundingBoxMesh, NULL ); Im not using any World transform on the mesh or bounding box...
  3. Probably the problem is here: // Copy over all the faces and groups from the mesh unsigned int *indices = NULL; unsigned long *attributes = NULL; newMesh->LockIndexBuffer( D3DLOCK_READONLY, (void**)&indices ); newMesh->LockAttributeBuffer(D3DLOCK_READONLY, &attributes ); for(DWORD i = 0; i < totalFaces; i++) { mFaces[i].v1 = *indices++; mFaces[i].v2 = *indices++; mFaces[i].v3 = *indices++; mFaces[i].group = attributes[i]; // Store the group (attribute) index - this is where the grouping happens mGroups[attributes[i]].numFaces++; // Keep count of the number of faces } newMesh->UnlockIndexBuffer(); newMesh->UnlockAttributeBuffer(); Im getting problem with mGroups on my meshes, so CreateIndexBuffer failed and crash the program. What I was doing before to run program, I was simply ignoring when mGroups.indexBuffer is null, but I think that its the problem. Someone?
  4. I deleted most of the map objects, to turn it into a small mesh, but I got the same problem lol. With this mesh (example), all works good. @Loading the mesh out of this octree system, like DX mesh viewer, I can see normally
  5. Ye.. D3DFMT_INDEX32 mGroups.numFaces * 3 * sizeof(UINT); UINT *indices;
  6. I changed to UINT and I got the same problems, but only with big meshes..
  7. Hey, Im trying to use this Octree sample from Davig Ang What happens its that works perfectly with small meshes or medium meshes, buuut, with a really big mesh, dont. The mesh I want to use: What happens on Octree App: As I said, this happens ONLY with BIG MESHES, small meshes like on the sample all works good. I already tried to change the #defines, because its a big mesh, but nothing works. Thanks for help.
  8. I was making some tests on sample (c++/dx9) of dx sdk, and all works good. When I passed the code to my app, the meshes are getting stretched, i dont know why, both use the same code, same camera, same mesh class etc.. Image of problem: (left its my app, and right its the same code on dx sample) I creating my camera this way: pcCamera->CreateProjectionMatrix( D3DX_PI / 4.4f, (float)RESOLUTION_WIDTH / (float)RESOLUTION_HEIGHT, 20.0f, 4000.0f ); fCameraFov = fFov; fCameraAspect = fAspect; fCameraNearPlane = fNearPlane; fCameraFarPlane = fFarPlane; D3DXMatrixPerspectiveFovLH( &sProjection, fCameraFov, fCameraAspect, fCameraNearPlane, fCameraFarPlane ); lpD3DDevice->SetTransform( D3DTS_PROJECTION, &sProjection ); Thanks.
  9. pristondev

    Stencil Test

    Hey guys, Im trying to make a texture mask using stencil test on directx9, but for some reason i didnt understand totally stencil yet, or im doing something wrong.   My code it's: renderDevice.GetDevice()->SetRenderState( D3DRS_COLORWRITEENABLE, 0 ); renderDevice.GetDevice()->SetRenderState( D3DRS_STENCILENABLE, true ); renderDevice.GetDevice()->SetRenderState( D3DRS_STENCILFUNC, D3DCMP_ALWAYS ); renderDevice.GetDevice()->SetRenderState( D3DRS_STENCILREF, 0 ); /*renderDevice.GetDevice()->SetRenderState( D3DRS_STENCILMASK, 0xFFFFFFFF ); renderDevice.GetDevice()->SetRenderState( D3DRS_STENCILWRITEMASK, 0xFFFFFFFF );*/ renderDevice.GetDevice()->SetRenderState( D3DRS_STENCILZFAIL, D3DSTENCILOP_REPLACE ); renderDevice.GetDevice()->SetRenderState( D3DRS_STENCILFAIL, D3DSTENCILOP_REPLACE ); renderDevice.GetDevice()->SetRenderState( D3DRS_STENCILPASS, D3DSTENCILOP_KEEP ); ---(drawing mask image) renderDevice.GetDevice()->SetRenderState( D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED ); renderDevice.GetDevice()->SetRenderState( D3DRS_STENCILFUNC, D3DCMP_EQUAL ); renderDevice.GetDevice()->SetRenderState( D3DRS_STENCILPASS, D3DSTENCILOP_ZERO ); renderDevice.GetDevice()->Clear( 0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0,0,0,0), 1.0f, 0 ); --(drawing object that i want to clipping) renderDevice.GetDevice()->SetRenderState( D3DRS_STENCILENABLE, false ); I have a png image, where the black part it's i want to clip, but when i run the code, never happens, keep rendering entire object. (ah, i was trying to follow this tutorial:   Thanks.
  10. With Hardware Vertex Processing, when I reset the device all happens okay, but if game of people is running game with Software Vertex Processing, fail here:   lpD3DDevice->Reset( &lpD3DPresentParameters )   Someone know what is happening? The problem is only with Software Vertex Processing...   Thanks.   Video of problem:
  11. pristondev

    Problem With Hlsl Of Blur

    Thanks for all, I got it, i remade shader and now the blur works... Now I need clip mesh from render and leave just the silhouette. Some idea?
  12. Im trying run some shader of blur in my game, but nothing happen and the render be normal, without blur..   HLSL Code: sampler ColorSampler1 : register(s0); #define SAMPLE_SIZE 15 float2 texelSize = {1/1024,1/768}; float offsets[SAMPLE_SIZE] = {-0.006836,-0.005859,-0.004883,-0.003906,-0.002930,-0.001953,-0.000977,0.000000,0.000977,0.001953,0.002930,0.003906,0.004883,0.005859,0.006836}; float weights[SAMPLE_SIZE] = {0.008847,0.018216,0.033562,0.055335,0.081638,0.107778,0.127325,0.134598,0.127325,0.107778,0.081638,0.055335,0.033562,0.018216,0.008847}; float4 PS_BlurH(float2 texCoord : TEXCOORD0) : COLOR0 { float4 sum = float4(0.0, 0.0, 0.0, 1.0); for (int i = 0; i < SAMPLE_SIZE; i++) sum += tex2D(ColorSampler1, float2(texCoord.x + (offsets[i] * texelSize.x), texCoord.y)) * weights[i]; clip(sum.a < 0.01f ? -1 : 1); return sum; } float4 PS_BlurV(float2 texCoord : TEXCOORD0) : COLOR0 { float4 sum = float4(0.0, 0.0, 0.0, 1.0); for (int i = 0; i < SAMPLE_SIZE; i++) sum += tex2D(ColorSampler1, float2(texCoord.x, texCoord.y + (offsets[i] * texelSize.y))) * weights[i]; clip(sum.a < 0.01f ? -1 : 1); return sum; } technique Glow { pass BlurHorizontal { PixelShader = compile ps_2_0 PS_BlurH(); } pass BlurVertical { PixelShader = compile ps_2_0 PS_BlurV(); } } Screenshot:   As can see in pic, nothing happens with meshe, dno why.. If i change values of offsets and weights same thing... Blur dont work. Someone know what can be? Thanks
  13. pristondev

    Clipping Shader Post-Proccess

    Thank you man! I got it.
  14. pristondev

    Clipping Shader Post-Proccess

    Ye is just circles... Can give some example how do this with math, no textures in hlsl? Sorry but im not pro in dx for now. Anyway thanks for ur help :D
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!