Jump to content
  • Advertisement

Vaine0

Member
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

121 Neutral

About Vaine0

  • Rank
    Newbie
  1. Vaine0

    Java vs. C# / XNA

    There are quite a few games out there where if you hit up the site, you end up downloading a small executable. This was more of the situation I was envisioning. Would packaging all the dependencies make this solution less desirable from a marketing standpoint?
  2. Vaine0

    Java vs. C# / XNA

    So I've noticed a trend that most online distributed games seem to be developed in Java. (I'm not talking about Steam distributed, but more like games such as RuneScape.) What I'm wondering is if anyone has any insight as to why this is, and whether C# / XNA could perhaps be a viable alternative to a Java distribution.
  3. Vaine0

    Expanding Polytope Alg

    Ok, so I must have issues reading papers, because after Molly Rocket explained GJK I understood it completely, but I was at a complete loss reading papers. I'm having the same issue with EPA now. Can anyone here explain the concept of how it's supposed to work? If I just understood that, I could probably implement it... Thanks! David EDIT: I think part of my problem is that I don't have an entirely sold grasp of minkowski space. But, I have an idea of how to detect a single point of collision... I would appreciate if someone would let me know if this idea would work well. If, in GJK, I end up with a tetrahedron that encloses the origin, I would take my _last_ search direction, and grab those two points from convex hulls, A and B. On B, I would get all the triangles which have the farthest vertex in -d (the search direction), and cast a ray on them from the farthest vertex from A in +d, to find a single point of penetration. Would this work for a tetrahedral case? If so, is there a better way, and how would I detect and edge/edge, edge/face, face/face scenario? [Edited by - Vaine0 on January 31, 2009 12:59:11 PM]
  4. Hey, I'm trying to render my scene to a texture. Here's the function I wrote to try to figure this out: int DXRenderer::DrawToTexture(Window* window, ITexture& texture) { m_done = false; HRESULT hRes = 0; Camera* camera = window->GetCamera(); LPDIRECT3DTEXTURE9 dxTexture; LPDIRECT3DSURFACE9 dxSurface; m_d3dDevice->CreateTexture(texture.GetWidth(), texture.GetHeight(), 0, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &dxTexture, NULL); dxTexture->GetSurfaceLevel(0, &dxSurface); m_d3dDevice->SetRenderTarget(0, dxSurface); if(window == GetActiveWindow()) m_d3dDevice->Clear(0,NULL,D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,0x99999999,1.0,0); else m_d3dDevice->Clear(0,NULL,D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,0x88888888,1.0,0); Matrix4 m = ~camera->GetCoordinateSystem(); m_d3dDevice->SetTransform(D3DTS_VIEW, (D3DXMATRIX*)&m); D3DXMATRIX matProjection; D3DXMatrixPerspectiveFovLH( &matProjection, 45.0f * (PI/180.0f), (float)window->GetWidth() / (float)window->GetHeight(), camera->GetNearPlaneDistance(), camera->GetFarPlaneDistance()); m_d3dDevice->SetTransform(D3DTS_PROJECTION, &matProjection); D3DLIGHT9 d3dLight; ZeroMemory(&d3dLight, sizeof(d3dLight)); d3dLight.Type = D3DLIGHT_POINT; d3dLight.Diffuse.r = 1.0f; d3dLight.Diffuse.g = 1.0f; d3dLight.Diffuse.b = 1.0f; d3dLight.Ambient.r = 1.0f; d3dLight.Ambient.g = 1.0f; d3dLight.Ambient.b = 1.0f; d3dLight.Specular.r = 1.0f; d3dLight.Specular.g = 1.0f; d3dLight.Specular.b = 1.0f; d3dLight.Position.x = camera->GetPosition().x; d3dLight.Position.y = camera->GetPosition().y; d3dLight.Position.z = camera->GetPosition().z; d3dLight.Attenuation0 = 0.5f; d3dLight.Range = 1000.0f; hRes = m_d3dDevice->SetLight(0, &d3dLight); DX_ERROR(hRes); if(m_threadSafe) { m_d3dDevice->BeginScene(); { // Draw all objects. RenderStack* renderStack = GetRenderStack(); IRenderableObj* obj = renderStack->Peek(true); while(obj) { if(m_texMan.Contains(obj->GetTextureName())) { hRes = m_d3dDevice->SetTexture(0, m_texMan.Get(obj->GetTextureName())); DX_ERROR(hRes); } else m_d3dDevice->SetTexture(0, NULL); Matrix4 transform = obj->GetTransform(); m_d3dDevice->SetTransform(D3DTS_WORLD, (D3DMATRIX*)&transform ); if(strcmp(obj->GetType(), "Triangle") == 0) DrawTriangle((TriangleRenderObj*)obj); else if(strcmp(obj->GetType(), "MeshSet") == 0) DrawMesh((MeshRenderObj*)obj); else if(strcmp(obj->GetType(), "Line") == 0) DrawLine((LineRenderObj*)obj); obj = renderStack->Peek(); } } m_d3dDevice->EndScene(); } LPDIRECT3DTEXTURE9 dxDestTexture; LPDIRECT3DSURFACE9 dxDestSurface; m_d3dDevice->CreateTexture(texture.GetWidth(), texture.GetHeight(), 0, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &dxDestTexture, NULL); dxDestTexture->GetSurfaceLevel(0, &dxDestSurface); m_d3dDevice->GetRenderTargetData(dxSurface, dxDestSurface); D3DLOCKED_RECT rect; dxDestTexture->LockRect(0, &rect, NULL, 0); for(unsigned i = 0; i < texture.GetHeight(); i++) memcpy(texture.GetData() + (i*texture.GetWidth()), (char*)rect.pBits + (i * rect.Pitch), texture.GetWidth() * texture.GetByteType()); dxDestTexture->UnlockRect(0); D3DXSaveSurfaceToFile(L"D:\\wtf.bmp",D3DXIFF_BMP,dxDestSurface,NULL,NULL); dxTexture->Release(); dxSurface->Release(); dxDestTexture->Release(); dxDestSurface->Release(); m_done = true; return 1; } The problem is that calling D3DXSaveSurfaceToFile(L"D:\\wtf.bmp",D3DXIFF_BMP,dxDestSurface,NULL,NULL); produces correct results. for(unsigned i = 0; i < texture.GetHeight(); i++) memcpy(texture.GetData() + (i*texture.GetWidth()), (char*)rect.pBits + (i * rect.Pitch), texture.GetWidth() * texture.GetByteType()); Does not seem to copy the same image into memory though. Here's what was output to D:\\wtf.bmp: and I'm rendering the texture data on the quad, in the image. And the only last bit of information is how I'm creating my texture to be displayed. I know this is bad, but I'm creating it once per frame. So, DrawToTexture() is called, the source I'm posting below is called, and then my main render loop is called, with the updated texture applied to the quad. case ITexture::Ax8Rx8Gx8Bx8: szType = sizeof(char); hRes = m_d3dDevice->CreateTexture(texture->GetWidth(), texture->GetHeight(), 0, D3DUSAGE_DYNAMIC, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &d3dTexture, NULL); break; } If anyone knows why this image isn't coming out correctly on the quad, please let me know... Thanks, David
  5. Hey guys I can't seem to get this right. I'm trying to draw my scene to a texture, and then plaster that texture as a billboard. (Trying to debug some culling stuff.) Anyway, here's the snippets: Here, I'm specifying that I want to set my render target to a surface. if(!pRenderTexture) hRes = m_d3dDevice->CreateTexture(window->GetWidth(), window->GetHeight(), 0, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &pRenderTexture, NULL); hRes = pRenderTexture->GetSurfaceLevel(0,&pRenderSurface); const WCHAR* err = DXGetErrorString9(hRes); hRes = m_d3dDevice->SetRenderTarget(0,pRenderSurface); err = DXGetErrorString9(hRes); ... Draw my scene here. ... And here, I'm trying to fill out a texture stored in window. D3DSURFACE_DESC desc; hRes = pRenderSurface->GetDesc(&desc); IDirect3DTexture9* pTempTexture = NULL; hRes = m_d3dDevice->CreateTexture(desc.Width,desc.Height,0,D3DUSAGE_DYNAMIC,desc.Format,D3DPOOL_SYSTEMMEM,&pTempTexture,NULL); IDirect3DSurface9* pTempSurface = NULL; hRes = pTempTexture->GetSurfaceLevel(0,&pTempSurface); hRes = m_d3dDevice->GetRenderTargetData(pRenderSurface, pTempSurface); D3DLOCKED_RECT rect; hRes = pTempTexture->LockRect(0, &rect, NULL, 0); memcpy(window->GetRenderTarget(), rect.pBits, window->GetWidth() * window->GetHeight() * sizeof(char) * 4); hRes = pTempSurface->UnlockRect(); D3DXSaveTextureToFile(L"D:\\asdf.bmp",D3DXIFF_BMP,pTempTexture,NULL); pTempTexture->Release(); pTempSurface->Release(); window->GetRenderTarget was allocated properly: new char[width * height * sizeof(char) * 4]; There is no dx debugging error output. Technically everything here seems to be "correct" with incorrect results. Now, the frustrating part is that D3DXSaveTextureToFile saves out my image correctly. However, when I try to render my texture in DX, I get a 2/3 green square, with the last 1/3 as black. So I'm slightly confused. The texture I'm displaying gets created as follows: case ITexture::Ax8Rx8Gx8Bx8: szType = sizeof(char); hRes = m_d3dDevice->CreateTexture(texture->GetWidth(), texture->GetHeight(), 0, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &d3dTexture, NULL); break; So if anyone knows what I'm doing wrong... Thanks, David
  6. Hey guys I can't seem to get this right. I'm trying to draw my scene to a texture, and then plaster that texture as a billboard. (Trying to debug some culling stuff.) Anyway, here's the snippets: Here, I'm specifying that I want to set my render target to a surface. if(!pRenderTexture) hRes = m_d3dDevice->CreateTexture(window->GetWidth(), window->GetHeight(), 0, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &pRenderTexture, NULL); hRes = pRenderTexture->GetSurfaceLevel(0,&pRenderSurface); const WCHAR* err = DXGetErrorString9(hRes); hRes = m_d3dDevice->SetRenderTarget(0,pRenderSurface); err = DXGetErrorString9(hRes); ... Draw my scene here. ... And here, I'm trying to fill out a texture stored in window. D3DSURFACE_DESC desc; hRes = pRenderSurface->GetDesc(&desc); IDirect3DTexture9* pTempTexture = NULL; hRes = m_d3dDevice->CreateTexture(desc.Width,desc.Height,0,D3DUSAGE_DYNAMIC,desc.Format,D3DPOOL_SYSTEMMEM,&pTempTexture,NULL); IDirect3DSurface9* pTempSurface = NULL; hRes = pTempTexture->GetSurfaceLevel(0,&pTempSurface); hRes = m_d3dDevice->GetRenderTargetData(pRenderSurface, pTempSurface); D3DLOCKED_RECT rect; hRes = pTempTexture->LockRect(0, &rect, NULL, 0); memcpy(window->GetRenderTarget(), rect.pBits, window->GetWidth() * window->GetHeight() * sizeof(char) * 4); hRes = pTempSurface->UnlockRect(); D3DXSaveTextureToFile(L"D:\\asdf.bmp",D3DXIFF_BMP,pTempTexture,NULL); pTempTexture->Release(); pTempSurface->Release(); window->GetRenderTarget was allocated properly: new char[width * height * sizeof(char) * 4]; There is no dx debugging error output. Technically everything here seems to be "correct" with incorrect results. Now, the frustrating part is that D3DXSaveTextureToFile saves out my image correctly. However, when I try to render my texture in DX, I get a 2/3 green square, with the last 1/3 as black. So I'm slightly confused. The texture I'm displaying gets created as follows: case ITexture::Ax8Rx8Gx8Bx8: szType = sizeof(char); hRes = m_d3dDevice->CreateTexture(texture->GetWidth(), texture->GetHeight(), 0, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &d3dTexture, NULL); break; So if anyone knows what I'm doing wrong... Thanks, David
  7. Hey guys, I'm new to using the fbx sdk. I need some help understanding how to associate vertex weights with their respective bones. (I believe I understood the implementation of ComputeClusterDeformation(...), found in the ViewScene project which came with the sdk docs.), which I will describe to the best of my knowledge in case I'm not understanding something. From what I understand, an animated model has the following hierarchy when stored in the fbx file format: Mesh->Skin->Cluster->Weights. To compute a vertex position of the skin, you obtain the vertex transformations indirectly, and by indirectly I mean that it's obtained through a single call to: GetTransfromAssociateModelMatrix(). (Please correct me on this if I'm wrong... I'm going by function names, because it's all the docs really seem to offer, short of parameter descriptions) Now that's fine and all... it's nice to be able to get the concatenated transforms for the entire cluster, but I already have an animation system in place, that I would like to keep using. What I need, is a way to extract the following data: Skeleton hierarchy: {parent joint, relative position, relative orientation} Check. Vertex information: { texcoords{u, v}, [weight0idx, weight1idx, .. weightNidx] } Not yet, but will fall out of getting weight information. Weight information: { ASSOCIATED JOINT INDEX, bias, relative position(x, y, z, w) } Possible? As I described above, I don't know how to get "ASSOCIATED JOINT INDEX" from the fbx cluster, nor the position of the weight, relative to the joint that it is attached to. (I realize that I would have to figure out the index on my own, but even a way to obtain the name of the joint, which the weight is associated with would be all I need.) How do I link a weight to a bone? Thanks for any insight you guys my have.
  8. Hey guys, I'm new to using the fbx sdk. I need some help understanding how to associate vertex weights with their respective bones. (I believe I understood the implementation of ComputeClusterDeformation(...), found in the ViewScene project which came with the sdk docs.), which I will describe to the best of my knowledge in case I'm not understanding something. From what I understand, an animated model has the following hierarchy when stored in the fbx file format: Mesh->Skin->Cluster->Weights. To compute a vertex position of the skin, you obtain the vertex transformations indirectly, and by indirectly I mean that it's obtained through a single call to: GetTransfromAssociateModelMatrix(). (Please correct me on this if I'm wrong... I'm going by function names, because it's all the docs really seem to offer, short of parameter descriptions) Now that's fine and all... it's nice to be able to get the concatenated transforms for the entire cluster, but I already have an animation system in place, that I would like to keep using. What I need, is a way to extract the following data: Skeleton hierarchy: {parent joint, relative position, relative orientation} Check. Vertex information: { texcoords{u, v}, [weight0idx, weight1idx, .. weightNidx] } Not yet, but will fall out of getting weight information. Weight information: { ASSOCIATED JOINT INDEX, bias, relative position(x, y, z, w) } Possible? As I described above, I don't know how to get "ASSOCIATED JOINT INDEX" from the fbx cluster, nor the position of the weight, relative to the joint that it is attached to. (I realize that I would have to figure out the index on my own, but even a way to obtain the name of the joint, which the weight is associated with would be all I need.) How do I link a weight to a bone? Thanks for any insight you guys my have.
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!