Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

336 Neutral

About programci_84

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

4630 profile views
  1. programci_84

    Rotating camera around player origin

    Do you need a 3rd person camera rotating around the player? If so, I recommend you to use quaternions. It's much easier. If not, can you describe what you want more clearly? Btw, I don't recommend you to deal with LookAt and Eye vectors. You can define a world transform for your camera because it's quite easy to perform some transformations (translate, rotate etc.) over a world matrix. And when you need a view matrix, just take the inverse of this world matrix.
  2. programci_84

    Problem with shaders

    I[s] think your problem comes from depth output: // Pixel shader output structure struct PS_OUTPUT { float4 Color[4] : COLOR0; float Depth : DEPTH; }; PS_OUTPUT ps_main (void) { //... Out.color = blah; Out.Depth = 1.f; //WHY THIS? return Out; } Why are you writing 1.f to DEPTH semantic output? I think this will cause that all pixels' depth value would be 1.f; so everything would be invisible (according to your Z-Buffer config.).[/s] Sorry, I didn't read your last sentence about you fixed it. Never mind hth. -R
  3. programci_84

    Mesh collisions

    Physics engines are not designed for a specific graphics library such as DX or GL. Their main goal is to make physical calculations and return final transformations of registered objects/primitives. And your job is to get that transformation data and use for your needs. PhysX is the most popular physics engine. Now it became free for commercial and non-commercial applications. You can use it. The first important thing you must know about it is that the matrix structure of the engine is column-major but in it's row-major in DX. On the other hand, Bullet is another popular engine. It's open source and developed by a Sony R&D employee. I know it's used in some animation movies like Toy Story. hth. -R
  4. programci_84

    Question about occlusion culling

    I think there's a good explanation about occlusion culling in GPU Gems 3. You can find it on nVidia's website; it's free to read. Btw, I don't use occlusion culling. I don't know whether this will be helpful or not, but here's a list of what I'm doing: 1) Checking visibility: By using view frustum and bounding volumes. It's quite easy. 2) Filling Z-Buffer: First, setting ZWriteEnable to TRUE, ZEnable to TRUE and ZFunc to LESSEQUAL. Then I'm rendering the visible objects (returned from the prev. step) to only Z-Buffer (i.e. don't touch the front-buffer or any pixel) with a front-to-back order (Ordering is calculated in view space). 3) Rendering with Z-Culling: First, setting ZWriteEnable to FALSE, ZEnable to TRUE and ZFunct to EQUAL then rendering the objects. This technique is called "Early Z Culling" and works well for forward renderers (like CryEngine 2 and Doom 3 Engines). With this technique, pixel shader won't be executed for invisible pixels (maybe invisible objects). I cannot say anything about performance comparison between occ. culling and this one; try and see. hth. -R
  5. programci_84

    Mesh collisions

    As dAND3h said, the cheapest way is to check bounding volume collisions. You can use either bounding box or bounding sphere according to the shape of your mesh. For example, a box would be best for a television and a sphere for a beach volleyball Btw, Why? I think you're wrong. Because we can transform bounding boxes (AABBs) and check them for collisions. F. Luna's book (Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach; this is available in Google Books) has a good explanation about bounding volumes: creation, transformation and checking. I think the most accurate way is to create a low-poly version of your mesh manually (i.e. with a 3D modeling software) and send it to your physics engine. There're a lot of physics/collision engines around the net. hth. -R
  6. Take a look at here. hth. -R
  7. programci_84

    D3DXVec3TransformCoord Problem

    Try using D3DXVec3TransformNormal() instead of TransformCoord(). Because direction vector is a normalized vector, not a coordinate.
  8. There's an exact vertex declaration equivalent for every FVF. And every mesh has a FVF property. So, you don't need to manually call IDirect3DDevice9::SetVertexDeclaration(), because ID3DXMesh::DrawSubset() function calls IDirect3DDevice9::SetVertexDeclaration() before calling SetStreamSource() and SetIndices().
  9. programci_84

    World space to tangent space

    What can you say about a float3? Is it a 3x1 or 1x3 matrix? I think that "mul" function deals with that difference.
  10. programci_84

    [C++] Custom containers vs STL

    Thank you all! You helped me a lot!
  11. Hi all, I want to write my own container classes and I've some questions. I've learnt that when we want to add one or more elements to an STL container (e.g. std::vector), it increases the size of the buffer more than we want. For example, if we have a 4-element-vector and if it's capacity is 4, when we want to insert 3 elements somewhere in it, it sets the capacity (or size, whatever you say) more than 7 (e.g. 10). I think this is done to avoid calling ::operator new frequently. But the size increases unnecessarily, right? So, for an STL-like custom container, which one is more expensive?: a) Using new/delete every time we want to add/delete elements (To keep the size of the buffer exact: for an n-element-buffer, the size is n*sizeof(element_type) ). b) Increasing the capacity unnecessarily (To avoid calling ::operator new and ::operator delete every time). btw, I've heard about "heap compaction" but I don't have any idea about that. Hope I could describe. Thx in advance. -R
  12. programci_84


    You've 2 memory pool parameters for D3DX Mesh functions: D3DXMESH_MANAGED and D3DXMESH_SYSTEMMEM. If you don't specify one of'em, the function will choose D3DPOOL_DEFAULT for both vertex and index buffer of the mesh. So, if you specify only D3DXMESH_WRITEONLY, buffers will reside default memory pool. As far as I understand, the sentence says: "Unless you specify D3DUSAGE_WRITEONLY, D3DPOOL_DEFAULT is a bad choice for memory pool. i.e. D3DPOOL_DEFAULT works well with only D3DUSAGE_WRITEONLY". hth. -R
  13. programci_84

    Skinned mesh with Assimp

    If you have the full source of assimp library, then you can take a look into the project named "assimp_view". It shows how to load the model, animations, skin info etc. and manage them. Also it shows how to build D3DX buffers and render. Here's the path: assimp_sdk_dir\workspaces\vc9\ btw, it's written in C++ and for DX9. So I hope you can understand. hth. -R
  14. programci_84


    D3DXMESH_MANAGED means D3DPOOL_MANAGED for vertex and index buffer of the mesh. Like this one, D3DXMESH_WRITEONLY means D3DUSAGE_WRITEONLY for both vertex and index bufferof the mesh. So, you can check DX docs for D3DUSAGE and D3DPOOL. Docs say about D3DUSAGE_WRITEONLY: "Buffers created with D3DPOOL_DEFAULT that do not specify D3DUSAGE_WRITEONLY might suffer a severe performance penalty."
  15. Basically, if you change some properties defined in D3DPRESENT_PARAMETERS object (like auto depth buffer usage, window dimensions etc.), it's recommended to reset your device. You don't have to do that for resizing, but, for example, if you resize the window in windowed mode and if you don't reset the device, rendered image may be distorted each time you resized the window. If you want to change device properties (e.g. Vertex Processing: like switching from H/W to Pure HW, Device Type: like switching HAL to REF), you must release your device then recreate. Before you reset or release the device, you must release all the memory but in D3DPOOL_MANAGED (e.g. D3DXLoadMeshFromX function creates meshes in D3DPOOL_MANAGED). After resetting or recreating, you must recreate corresponding memory. hth. -R
  • 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!