• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.


  • Content count

  • Joined

  • Last visited

Community Reputation

113 Neutral

About ayush3017

  • Rank
  1. Hey Camus, thanks for the reply. I'll try it and post the results.
  2. I think I should change my question: How to get transformation from rigid bodies (ragdoll actors) and apply it correctly to skinned mesh??
  3. Its a DirectX matrix question so I thought this section is appropriate. Ok, here is the problem I was about to complete my game but then my mind demanded more so I thought of applying ragdolls in my game: 1. My game uses nVIDIA PhysX engine. 2. Im currently using hardware skinning. 3. I create my ragdoll using box shapes. 4. The ragdoll creation is ok as I have tested it in Visual debugger. 5. After applying ragdoll I get the transforms of each actor and apply it directly to the skinned mesh. So here is the problem. After applying this my mesh is not drawn correctly. I know that you cannot just apply directly the transforms to the bones but here Im totally clueless. Here are the screens: Ragdoll switched off Ragdoll on And here is the code of ragdoll creation: void peds::CreateRagdoll() { NxQuat qRotLeft, qRotRight, qRotAround; qRotLeft.fromAngleAxis(90, NxVec3(0,0,1)); qRotRight.fromAngleAxis(-90, NxVec3(0,0,1)); qRotAround.fromAngleAxis(180, NxVec3(0,0,1)); transformation.resize(player.pedsMesh.NumBones()); ragdollActors.resize(player.pedsMesh.NumBones()); //boxMeshes.resize(player.pedsMesh.NumBones()); //Get current bone transforms from skinned mesh and make ragdoll actors //depending upon the transforms vector<D3DXMATRIX> a = player.pedsMesh.getTransforms(); //Disable character controller collision player.pedsMesh.playerController->getActor()->raiseActorFlag(NX_AF_DISABLE_COLLISION); //----- ///Create Ragdoll Actors//// //----- /Code removed for(int x=0 ; x< player.pedsMesh.NumBones() ; x++) { NxMat34 b; b.setColumnMajor44(a[x]); ragdollActors[x]->setGlobalPosition(b.t); ragdollActors[x]->setSolverIterationCount(50); } //Create Actors //COde removed //Transform the ragdoll created to current player position for(int x=0 ; x<player.pedsMesh.NumBones() ; x++) { D3DXMatrixMultiply(&a[x], &a[x], &player.pedsMesh.wowMatrix); NxMat34 b; b.setColumnMajor44(a[x]); ragdollActors[x]->setGlobalPosition(b.t); ragdollActors[x]->putToSleep(); } } Code fo getting actor transforms and applying it to skinned mesh: if(!ragdollAvailable) { //Get current player matrix and apply it to world matrix effect->SetMatrix("world", &player.pedsMesh.wowMatrix); //Get bone transforms effect->SetMatrixArray("gFinalXForms", player.pedsMesh.getFinalXFormArray(), player.pedsMesh.NumBones()); } else { effect->SetMatrix("world", &worldMatrix); //Get actor transforms and apply it to skined mesh //<-- This is the wrong stuff ---> for(int x=0 ; x<player.pedsMesh.NumBones() ; x++) { // Get actors global pose in world space ragdollActors[x]->getGlobalPose().getColumnMajor44(transformation[x]); D3DXMatrixScaling(&scale, 2.5f, 2.5f, 2.5f); D3DXMatrixMultiply(&transformation[x], &scale, &transformation[x]); } //effect->SetMatrix("world", &scale); effect->SetMatrixArray("gFinalXForms", &transformation[0], player.pedsMesh.NumBones()); } And here is the most common skinning shader code ! float4x4 world; float4x4 view; float4x4 projection; float3 eyePos; float4x4 InverseTransposeView; uniform extern float4x4 gFinalXForms[35]; texture colorMap; sampler colorMapSampler = sampler_state { Texture = <colorMap>; MinFilter = Anisotropic; MagFilter = Linear; MipFilter = Linear; MaxAnisotropy = 16; }; struct OutputVS { float4 vPos : POSITION0; float2 vTex0 : TEXCOORD0; float3 vWorldPos : TEXCOORD1; float3 vWorldNrm : TEXCOORD2; float3 eyeVec : TEXCOORD3; float4 vPos1 : TEXCOORD4; }; struct OutputPS { float4 vMaterial : COLOR0; float4 vWorldNrm : COLOR1; float4 vWorldPosXY : COLOR2; }; OutputVS VS_Lambert(float3 posL : POSITION0, float3 tangentL : TANGENT0, float3 binormalL : BINORMAL0, float3 normalL : NORMAL0, float2 tex0 : TEXCOORD0, float4 weight0 : BLENDWEIGHT0, float4 boneIndex : BLENDINDICES) { OutputVS outVS = (OutputVS)0; float4 vertex = float4(posL, 1); float LastWeight = 0.0f; float4 p = 0.0f; float4 n = 0.0f; float BlendWeightsArray[4] = (float[4])weight0; int4 IndexVector = D3DCOLORtoUBYTE4(boneIndex); int IndexArray[4] = (int[4])IndexVector; for(int x=0 ; x<3 ; x++) { LastWeight = LastWeight + BlendWeightsArray[x]; p += BlendWeightsArray[x] * mul(float4(posL, 1.0f), gFinalXForms[IndexArray[x]]); n += BlendWeightsArray[x] * mul(float4(normalL, 0.0f), gFinalXForms[IndexArray[x]]); } LastWeight = 1.0f - LastWeight; p += LastWeight * mul(float4(posL, 1.0f), gFinalXForms[IndexArray[3]]); n += LastWeight * mul(float4(normalL, 0.0f), gFinalXForms[IndexArray[3]]); // p.w = 1.0f; //n.w = 0.0f; n = normalize(n); float4x4 ViewSpace = mul(world, view); outVS.vWorldPos = mul(p, ViewSpace); float3 vWorldPos = mul(p, ViewSpace); outVS.eyeVec = p.xyz - eyePos; float4x4 viewProjection = mul(view, projection); outVS.vPos = mul(float4(outVS.vWorldPos, 1), projection); outVS.vPos1 = outVS.vPos; outVS.vTex0 = tex0; outVS.vWorldNrm = normalize(mul(n, (float3x3) InverseTransposeView)); return outVS; } //----------------------------------------------------------------------------- // Pixel shader. //----------------------------------------------------------------------------- OutputPS PS_Lambert(OutputVS i) : COLOR { OutputPS o; float distance1 = distance(i.eyeVec, float3(0, 0, 0)); float4 texColor = tex2D(colorMapSampler, i.vTex0); distance1 /= 460; //LOD alpha transition //clip(texColor - distance1/2); //clip(texColor.a - 0.2f); //clip(texColor.a - 0.5f); o.vMaterial.rgb = texColor * 1.5f; //o.vMaterial.rgb = float3(0.6f, 0.6f, 0.6f); o.vMaterial.a = texColor.a; o.vWorldNrm.xyz = 0.5f * (i.vWorldNrm + 1.0f); o.vWorldNrm.w = 0.0; o.vWorldPosXY = float4(i.vWorldPos.xyz, 0); return o; } What should I do to correctly transform my skinned mesh?? Thanks.
  4. Thanks chetan.. It worked like a charm.
  5. Hello, Well my problem is that I cannot get my game to work on other PCs (Visual Studio and DXSDK not installed). I have created setup of my game, checked all the dependencies, installed VC++ 2008 Redistributable SP1 on other PC but still no luck. The error message I get(the usual) : "The application failed to initialize because its side-by-side configuration is not correct. Please contact....." Please help, Thanks.
  6. Thanks for the reply. I am getting it somewhat clear :) But I do have a question. When I was doing my deferred pass I was rendering my light volume geometry like spheres for point lights, cone for spotlights, etc. But in sampling RSM and calculating the contribution, rather then drawing spheres, have to draw a full screen quad right?? Or can it be done by drawing spheres?? If so how?? Thanks. And also thanks for the SH link, I'll also look into it when I get this RSM stuff working.
  7. Thanks for the reply. I know but I was just trying to learn indirect illumination the simple way. And about LPV they go off my head because of SH stuff. I just want to know how can I sample the rsm. LPV is a long way to go. Also my game is built on DX9 so no geometry shader. Any ideas?? [Edited by - ayush3017 on October 8, 2010 2:08:02 PM]
  8. I googled and found that by using vertex texture fetch I can get the position of the texel at which I should place the sphere (point light source). This is OK but now how would I iterate through all the point lights by drawing all the spheres at their position read from the texture. Please help..
  9. Hey thanks for the clarification, atleast I learned something new.. :)
  10. Recently I got a good frame rate when placing thousands of lights because of your help. Now I want to extend my game to support a simple indirect illumination using reflective shadow maps. I read the paper and I found something that I don't understand. Here are the steps: 1. Render the scene from lights POV and store luminance, position and normals. 2. Render the scene from camera view. 3. Deferred pass: Sample RSM and place VPLs (point lights spheres) with radius depending upon luminance, position. I don't think I require normals as I am only using point lights. So here is the problem: how should I sample RSM and place VPLs and then iterate through each VPL for lighting? (volume texture??) Or am I doing something wrong? Thanks. [Edited by - ayush3017 on October 8, 2010 2:27:55 AM]
  11. Thanks for replying. What I did I replaced my code of scissor testing and just draw low poly spheres to a rt and guess what?? It worked like a charm. No more frame rate drops even with 2000 lights. Just a slight drop (60) when I placed all the lights very close, radius too big and camera is very close. @programci_84: I am confused about your code: for (each light) { turn off z-writes and color writes, turn on z-buffering; <--ok fill your stencil buffer with light volume meshes (sphere for point lights, cone for spot ones); //for example, clear your S/B to "1" and put a "0" when rendering a light volume.<--ok ///-- This is to be done or what?? --> Clear to 1; StencilFunc = Always; StencilRef = 0; pass->Begin(); DrawSphere(); pass->End(); This is to be drawn to a rt?? //Now what??? turn on color writes; do deferred lighting for pixels that contain "0"s in S/B <-- In which pass?? StencilFunc = Equal; StencilRef = 0; } Thanks.
  12. Thanks for the replies. I'll try it by drawing boxes and spheres.
  13. Thanks for the replies. No, I am currently drawing all the lights whether visible to the camera or not. But what if 14-20 lights are all visible? They are still causing a lot of frame rate drop. What should I do iluminate an apartment hallway where many lights are present and all are visible. I was thinking to extend this approach for indirect illumination by reflective shadow maps. But what if my frame rate drops like this??
  14. Thanks for the reply. I have used PIX before but now whenever I profile my game using PIX the frame rate drops to 6-9 and when press the frame capture key it goes out of memory and as a reusult it fails to capture all the frames. Regarding the lighting code there is nothing much. Here it is: float4 deferredLightingPointLights(float2 tex0:TEXCOORD0):COLOR { float3 position; position = tex2D(positionXYSampler, tex0).xyz; float lightRadius = 5.0f; float3 lightPositionInViewSpace = lightProperty.xyz; float invRadius = 1.0f / lightProperty.w; float3 lVec = (lightPositionInViewSpace - position); float4 output; if(length(lightPositionInViewSpace - position) > lightRadius*2) discard; float3 diffuseMaterial = tex2D(textureSampler, tex0); float3 worldNormal = 2*tex2D(normalSampler, tex0) - 1; //float3 reflectionVector = normalize(reflect(-lVec, worldNormal)); float3 lightVec = normalize(lVec); float atten = saturate(1.0f - length(lVec)/lightRadius); float diffuse = max(0, dot(lightVec, worldNormal)); /*if(diffuse < 0.01f) discard;*/ output = float4(atten * diffuse * diffuseMaterial, 1.0f); return output; //return float4(atten * diffuse, atten * diffuse, atten * diffuse, 1.0f); } technique LightPass { pass P0 { VertexShader = NULL; PixelShader = compile ps_3_0 deferredLightingPointLights(); CullMode = CCW; Zenable = false; ZWriteEnable = false; AlphaBlendEnable = true; Srcblend = One; Destblend = One; } } What could be wrong??
  15. Hello everyone, In my game I use deferred rendering. I create bounding box for each point light and then use that box by projecting in 2D and then use scissor test to draw the required area affected by the point lights. Here is the test bench: -------------------------------------------------------------------------- No.Of.PointLights | FPS.When.Camera.Far | FPS.When.Camera.Close.To.Light -------------------------------------------------------------------------- 0 85 85 14 84 28 1200 81 26 --------------------------------------------------------------------------- As you can see when the camera is near to the point light position the frame rate is too low even if their are less number of lights. What could be the problem? Thanks.