• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

374 Neutral

About he3117

  • Rank
  1. physx vehicle problem

    Solved. I forgot to put the vehicle in rest state before adding it to scene.
  2. physx vehicle problem

    When my vehicle is in air there is no problem but when wheel touch the ground my game crash. and I'm getting this error:   First-chance exception at 0x00672cb7 in Game.exe: 0xC0000005: Access violation reading location 0x374a2c5c. Unhandled exception at 0x00672cb7 in Game.exe: 0xC0000005: Access violation reading location 0x374a2c5c.   this is my call stack:      Game.exe!physx::PxVehicleUpdate::updateDrive4W()  Line 2408 + 0x6 bytes    C++      Game.exe!physx::PxVehicleUpdate::update()  Line 3599 + 0x24 bytes    C++      Game.exe!physx::PxVehicleUpdates()  Line 3638 + 0x20 bytes    C++   I think there is some thing wrong in ray casts but I don't know what is it.   any idea how can I solve this problem?
  3. Hi I want to add physx to my engine but I'm getting a very strange errors: I found a single line in my code that cause these errors but the code is true here my code for starting physx: CPhysxPhysic::CPhysxPhysic(void) { m_Physics=NULL; m_Foundation=NULL; //static PxDefaultErrorCallback gDefaultErrorCallback; //static PxDefaultAllocator gDefaultAllocatorCallback; printf("initializing PhysX\n"); printf("creating Foundation\n"); // create foundation object with default error and allocator callbacks. m_Foundation = PxCreateFoundation(PX_PHYSICS_VERSION,gDefaultAllocatorCallback,gDefaultErrorCallback); printf("creating Physics\n"); // create Physics object with the created foundation and with a 'default' scale tolerance. m_Physics = PxCreatePhysics(PX_PHYSICS_VERSION,*m_Foundation,PxTolerancesScale()); m_Cooking = PxCreateCooking(PX_PHYSICS_VERSION, *m_Foundation, PxCookingParams()); if (!m_Cooking) printf("PxCreateCooking failed!\n"); if (!PxInitExtensions(*m_Physics))//This line is the problem!!! printf("PxInitExtensions failed!\n"); m_ProfileZoneManager = &PxProfileZoneManager::createProfileZoneManager(m_Foundation); if(!m_ProfileZoneManager) printf("PxProfileZoneManager::createProfileZoneManager failed!\n"); #ifdef PX_WINDOWS pxtask::CudaContextManagerDesc cudaContextManagerDesc; m_CudaContextManager = pxtask::createCudaContextManager(*m_Foundation, cudaContextManagerDesc, m_ProfileZoneManager); if( m_CudaContextManager ) { if( !m_CudaContextManager->contextIsValid() ) { m_CudaContextManager->release(); m_CudaContextManager = NULL; } } #endif PxInitVehicleSDK(*m_Physics); PxVehicleSetBasisVectors(PxVec3(0,1,0),PxVec3(0,0,1)); // static PxDefaultSimulationFilterShader gDefaultFilterShader; PxSceneDesc sceneDesc(m_Physics->getTolerancesScale()); sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); // customizeSceneDesc(sceneDesc); if(!sceneDesc.cpuDispatcher) { m_CpuDispatcher = PxDefaultCpuDispatcherCreate(2); if(!m_CpuDispatcher) printf("PxDefaultCpuDispatcherCreate failed!\n"); sceneDesc.cpuDispatcher = m_CpuDispatcher; } if(!sceneDesc.filterShader) sceneDesc.filterShader = PxDefaultSimulationFilterShader; #ifdef PX_WINDOWS if(!sceneDesc.gpuDispatcher && m_CudaContextManager) { sceneDesc.gpuDispatcher = m_CudaContextManager->getGpuDispatcher(); } #endif m_Scene = m_Physics->createScene(sceneDesc); if (!m_Scene) printf("createScene failed!\n"); printf("PhysX initialized\n"); } If I remove this line I an compile the code: if (!PxInitExtensions(*m_Physics))//This line is the problem!!! printf("PxInitExtensions failed!\n");   Why I got multiply defined symbols?and how should I solve it?   EDIT:I solve it my self(after 3 days of testing I finally found the answer 5 minutes after asking here :D).I included <PxPhysicsAPI.h> before any other header file and it solved my problem.  
  4. Can you guess what is leaking?

    May be you forgot to delete the bone name.
  5. Hi I want to start writing forward rendering pipeline for my deferred engine and I'm looking for efficient way to pass light information to shader. I have an idea about it.I don't want to pass light info as constant or array so I'm thinking about sending them as textures. for point lights I need:   struct PointLight {    COLOR LightColor;    Vector3 LightPosition;    float LightRadius; }   It seems I can store this structure in 2 pixel of a texture: RGB=LightColor; alpha=LightRadius;   RGB=xyz of light position   struct SpotLight {    COLOR LightColor;    Vector3 LightPosition;    float LightRadius;    float CosAngel; } RGB=LightColor; alpha=LightRadius;   RGB=xyz of light position alpha=CosAngel;   so with a texture 128*2 I can pass 128 point light to the shader. But what is the best way to fill this texture?Should I make a vertex buffer with light info and pass it to a shader to writing in texture or use LockRect and fill the texture on CPU?   also I can pack all light info in one texture and use another texture to pass ligh Ids to shader
  6. Crash on exit

    maybe m_pRenderTargetView and swap chain are the same before the shutdown.
  7. I'm working with DX9 and my answer may not help you so much but check the return value of ClearDepthStencilView. In dx9 this function can fail if you don't have stencil information in depth buffer.
  8. Hi I had exactly the same problem.I tracked the normal transform and I found the problem. for me changing :   output.Normal =mul(input.Normal,World); to output.Normal =mul(World,input.Normal);   solved it or you can transpose the world matrix before multiply it.
  9. Bug in my shadow map

    [quote name='eppo' timestamp='1354743288' post='5007530'] Sounds like you're not clearing (setting all values to a clip-far value) your shadow map before rendering. [/quote] Finally I found it. The problem was Zbuffer.It couldn't clear the Zbuffer. From MSDN: IDirect3DDevice9::Clear will fail if you: 1-Try to clear either the depth buffer or the stencil buffer of a render target that does not have an attached depth buffer. 2-Try to clear the stencil buffer when the depth buffer does not contain stencil data. Mine was case 2.
  10. Bug in my shadow map

    I clear it correctly.There should be some thing wrong with matrix but I can't find it.Because PIX doesnt show any error.[img]http://public.gamedev.net//public/style_emoticons/default/ohmy.png[/img]
  11. Hi I'm working on shadow mapping for my Game engine and I have a big problem.It makes me crazy and I can't find it for last week of debugging. [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] The problem is my shadow maps work when objects are fix.But after moving the light or other objects it doesn't work any more.When I want to debug it by PIX it shows the correct image in PIX.[img]http://public.gamedev.net//public/style_emoticons/default/huh.png[/img] Also after resetting the device(for device lost)It shows the correct image before moving the light or other objects.After a while this shadow complettly disappears. It seems vertex shader for deph pass uses incorrect matrix but I can't find the problem.[img]http://public.gamedev.net//public/style_emoticons/default/dry.png[/img] P.S:I'm using deferred shading. [source lang="cpp"]float4x4 WorldViewProjection; struct VertexShaderInput { float4 Position : POSITION0; }; struct VertexShaderOutput { float4 Position : POSITION0; float2 Depth : TEXCOORD0; }; VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; //float4 worldPosition = mul(World,input.Position); //float4x4 worldview = mul(World, View); //worldview = mul(worldview, Projection); //output.Position = mul(input.Position,worldview); output.Position = mul( WorldViewProjection,input.Position); //output.Depth = worldPosition-SpotlightPosition; output.Depth.x = output.Position.z; output.Depth.y = output.Position.w; return output; } struct PixelShaderOutput { float4 Depth : COLOR0; }; PixelShaderOutput PixelShaderFunction(VertexShaderOutput input): COLOR0 { PixelShaderOutput output; //float4 l=input.Depth-SpotlightPosition; //input.Depth/=input.Depth.w; //output.Depth =float4(0,0,0,0); //output Depth output.Depth =input.Depth.x/input.Depth.y; //output Depth return output; } technique buildPass { pass Pass1 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } [/source] First image is the image befor rotating the car. [attachment=12619:first.JPG] second image is what I see after rotating the car. [attachment=12620:second.JPG] Third pic is what I see in PIX [attachment=12621:pic_from_pix.jpg]
  • Advertisement