Jump to content
  • Advertisement

judeclarke

Member
  • Content Count

    54
  • Joined

  • Last visited

Community Reputation

129 Neutral

About judeclarke

  • Rank
    Member

Personal Information

  • Interests
    Programming
  1. I increased my far clip plane and it went away. Thanks for the help
  2. When I render my point light sphere my depth stencil has depth enabled. It is defined as D3D11_DEPTH_STENCIL_DESC depthStencilDesc; ZeroMemory(&depthStencilDesc, sizeof(depthStencilDesc)); depthStencilDesc.DepthEnable = true; depthStencilDesc.DepthFunc = D3D11_COMPARISON_GREATER_EQUAL; depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; depthStencilDesc.StencilEnable = true; depthStencilDesc.StencilReadMask = 0xFF; depthStencilDesc.StencilWriteMask = 0xFF; depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_EQUAL; depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP; depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_EQUAL; My projection matrix values are - projectionMatrix {_11=1.81066012 _12=0.000000000 _13=0.000000000 ...} const Matrix4x4 _11 1.81066012 float _12 0.000000000 float _13 0.000000000 float _14 0.000000000 float _21 0.000000000 float _22 2.41421342 float _23 0.000000000 float _24 0.000000000 float _31 0.000000000 float _32 0.000000000 float _33 1.01010096 float _34 1.00000000 float _41 0.000000000 float _42 0.000000000 float _43 -1.01010096 float _44 0.000000000 float I renderd the sphere outside of my lighting pass and I do not have the same issue
  3. Based upon where my how far back from the camera is there will be a artifact of my point light. Here is what I mean before going into details I have a flat rectangle and a standing rectangle of 20x20 dimensions with a point light of 22 radius. My camera currently sits at -76 but if I were to move the camera to -75 then even in the most extreme example of point light z = 3.0 from above will no longer have the artifact. I am not sure what could be causing it but I have tried several idea to avail. The one with the biggest benefit seemed to be scaling my world matrix for rendering the point lights sphere by a small modifier like 1.1 in addition to the radius.That seemed to only mask the issue for a little bit. When looking at the render targets in RenderDoc going into the lighting pass the render targets seem correct so my guess is that it is my shading code. I am not sure what other details would be beneficial to detailing the problem but if there is something mentioned I will post it. Shader Code Texture2D NormalMap : register( t0 ); Texture2D DiffuseAlbedoMap : register( t1 ); Texture2D SpecularAlbedoMap : register( t2 ); Texture2D PositionMap : register(t3); cbuffer WorldViewProjCB : register( b0 ) { matrix WorldViewProjMatrix; matrix WorldViewMatrix; } cbuffer CameraPosition : register ( b2 ) { float3 CameraPosition; } cbuffer LightInfo : register ( b3 ) { float3 LightPosition; float3 LightColor; float3 LightDirection; float2 SpotLightAngles; float4 LightRange; }; struct VertexShaderInput { float4 Position : POSITION; }; struct VertexShaderOutput { float4 PositionCS : SV_Position; float3 ViewRay : VIEWRAY; }; VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) { VertexShaderOutput output; output.PositionCS = mul( input.Position, WorldViewProjMatrix ); float3 positionVS = mul( input.Position, WorldViewMatrix ).xyz; output.ViewRay = positionVS; return output; } void GetGBufferAttributes(in float2 screenPos, out float3 normal, out float3 position, out float3 diffuseAlbedo, out float3 specularAlbedo, out float specularPower) { int3 sampleIndices = int3(screenPos.xy, 0); normal = NormalMap.Load(sampleIndices).xyz; position = PositionMap.Load(sampleIndices).xyz; diffuseAlbedo = DiffuseAlbedoMap.Load(sampleIndices).xyz; float4 spec = SpecularAlbedoMap.Load(sampleIndices); specularAlbedo = spec.xyz; specularPower = spec.w; } float3 CalcLighting(in float3 normal, in float3 position, in float3 diffuseAlbedo, in float3 specularAlbedo, in float specularPower) { float3 L = 0; float attenuation = 1.0f; L = LightPosition - position; float dist = length(L); attenuation = max(0, 1.0f - (dist / LightRange.x)); L /= dist; float nDotL = saturate(dot(normal, L)); float3 diffuse = nDotL * LightColor * diffuseAlbedo; float3 V = CameraPosition - position; float3 H = normalize( L + V); float3 specular = pow(saturate(dot(normal, H)), specularPower) * LightColor * specularAlbedo.xyz * nDotL; return (diffuse + specular) * attenuation; } float4 PixelShaderFunction( in float4 screenPos : SV_Position ) : SV_Target0 { float3 normal; float3 position; float3 diffuseAlbedo; float3 specularAlbedo; float specularPower; GetGBufferAttributes(screenPos.xy, normal, position, diffuseAlbedo, specularAlbedo, specularPower); float3 lighting = CalcLighting(normal, position, diffuseAlbedo, specularAlbedo, specularPower); return float4(lighting, 1.0f); }
  4. judeclarke

    Updating when a rigid body has two collisions

    @ Max Whitehead Thank you, that helped a lot
  5. For my test case I have a sphere sliding across a horizontal plane that will eventually come in contact with a vertical plane. I have figured out the correct way to deal with a moving sphere to plane for either sliding to resting contact or bouncing off of it. However, it was always with only one rigid body object to one static collision. Now there are two static collision objects. The way the static collisions are added are 1) Vertical plane 2) Horizontal plane. As a result it find the collision with the horizontal plane to slide across it (index 1) but it will find collision with the vertical plane (index 0) once it reaches it. With the logic I have below, it will never consider the collision with the vertical plane. How should I ensure that it will respond to collision with it? float fAccumulator = 0.0f; while(fAccumulator < fElapsedTime && mRigidBodyObjects.size() > 0) { F32 left_time = fElapsedTime - fAccumulator; for(unsigned int i = 0; i < mRigidBodyObjects.size(); ++i) { int j1 = -1; RigidBodyCollisionResult crFirstCollisionResult; crFirstCollisionResult.fCollisionTime = FLT_MAX; RigidBodyCollisionResult crCollisionResult; for(unsigned int j = 0; j < mStaticObjects.size(); ++j) { crCollisionResult = mRigidBodySolver.Collide(mRigidBodyObjects[i], mStaticObjects[j], left_time); if(crCollisionResult.enCollisionState == WILL_COLLIDE) { if(crCollisionResult.fCollisionTime <= crFirstCollisionResult.fCollisionTime) { crFirstCollisionResult = crCollisionResult; j1 = j; } } else if(crCollisionResult.enCollisionState == HAS_COLLISION || crCollisionResult.enCollisionState == RESTING_CONTACT) { crFirstCollisionResult = crCollisionResult; j1 = j; } } if(crCollisionResult.enCollisionState == WILL_COLLIDE || crCollisionResult.enCollisionState == NO_COLLISION) { mRigidBodyObjects[i]->ApplyGravity(); } if(j1 != -1) { if(crFirstCollisionResult.enCollisionState == WILL_COLLIDE && crFirstCollisionResult.fCollisionTime <= fElapsedTime) { mRigidBodyObjects[i]->Update(crFirstCollisionResult.fCollisionTime); mRigidBodySolver.HandleCollisionReponse(mRigidBodyObjects[i], mStaticObjects[j1], crFirstCollisionResult, crFirstCollisionResult.fCollisionTime); fAccumulator += crFirstCollisionResult.fCollisionTime; } else if(crFirstCollisionResult.enCollisionState == HAS_COLLISION || crFirstCollisionResult.enCollisionState == RESTING_CONTACT) { mRigidBodySolver.HandleCollisionReponse(mRigidBodyObjects[i], mStaticObjects[j1], crFirstCollisionResult, left_time); mRigidBodyObjects[i]->Update(left_time); fAccumulator += left_time; } else { mRigidBodySolver.HandleCollisionReponse(mRigidBodyObjects[i], mStaticObjects[j1], crFirstCollisionResult, left_time); mRigidBodyObjects[i]->Update(left_time); fAccumulator += left_time; } } else { mRigidBodyObjects[i]->Update(left_time); fAccumulator = fElapsedTime; } } }
  6. I am trying to render to a texture with a depth buffer that is a different size then one I traditionally render to. To do this am creating a texture with CreateTexture2D with the flags D3D11_BIND_SHADER_RESOURCE and D3D11_BIND_DEPTH_STENCIL. The problem I then run into is that I can not create a RenderTargetView because it will require me to use the flag D3D11_BIND_DEPTH_STENCIL, but I can not with D3D11_BIND_DEPTH_STENCIL. Since I can not create a RenderTargetView I can not end up creating my texture to use for rendering on my model.   How can I end up creating a render target that I render to with a custom depth buffer where I can create a texture for it to use with rendering?
  7. Are there any recent examples of QT and DirectX being used together? The old one from code.google.com/p/qtdxsample is nearly five years and no longer compiles when trying to "moc" the files.
  8. I am running into a really strange problem where the more I move away from the top-left of my windowed game the cursor position will slowly become further from the "correct" position. For example, I have an 800, 600 window that I print the mouse position to on the screen. When I move it to the bottom right of my window, it is saying the position is 784, 561.   I create using CreateWindowExA with WS_EX_APPWINDOW as the first parameter (extended style), and the only window syle flag is WS_VISIBLE.   I get the mouse position with       POINT winCursorPoint;     GetCursorPos(&winCursorPoint);     BOOL success = ScreenToClient(mWindowHandle, &winCursorPoint);     mCurrentMousePosition.x = winCursorPoint.x;     mCurrentMousePosition.y = winCursorPoint.y;   Is there some other window creation flag or mouse positioning calculation that needs to be done?
  9. I found assimp to be rather good
  10. I have been working on skinned animation and now that I have completed that, I want to start working on blending two animations together. I have found several resources on animation controllers such as http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/a-blending-animation-controller-for-a-skinned-mesh-r3592 and http://www.gamedev.net/topic/654326-skeletal-animation-system/ but I have not found anything that will explain in detail how you can blend between two animations.   Are there any tutorials out there that can explain blending between two animations? If there is any running code then that would be great as I would like to run, fiddle and play with some code before I am writing my own implementation.
  11. I have tried that with the VS2012 Graphics Debugger but there is no pixel history for the ones that were discarded and the vertex information seems correct when I debug the one vertex that it will debug.   Is there another way with the VS2012 Graphics Debugger?
  12. My CullMode is set to none and there are no state changes from my previous draw call of being able to render 2D find on the place. My entire D3D11DeviceContext state at the draw call is   (Sorry, the code tags are not showing up for me) d3d11 device context (obj:3) Input Assembler State Input Layout General Information Input Layout obj:16 Input Element Descriptions Slot SemanticName SemanticIndex Format InputSlot AlignedByteOffset InputSlotClass InstanceDataStepRate 0 POSITION 0 DXGI_FORMAT_R32G32B32_FLOAT 0 0 D3D11_INPUT_PER_VERTEX_DATA 0 1 COLOR 0 DXGI_FORMAT_R32G32B32A32_FLOAT 0 12 D3D11_INPUT_PER_VERTEX_DATA 0 Vertex Buffers Slot Buffer Stride Offset 0 obj:32 24 0 (1-31) NULL 0 0 Index Buffer Buffer obj:33 Format DXGI_FORMAT_R16_UINT Offset 0 Primitive Topology General Information Primitive Topology D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST Vertex Shader State Shader General Information Shader obj:30 Shader Resources Slot Shader Resource View Resource (0-127) NULL NULL Sampler States Slot Sampler Filter AddressU AddressV AddressW MipLODBias MaxAnisotropy ComparisonFunc BorderColor MinLOD MaxLOD (0-15) NULL           Constant Buffers Slot Buffer 0 obj:27 1 obj:8 (2-13) NULL Class Instances Slot Class Instance (0-252) NULL Hull Shader State Shader General Information Shader NULL Shader Resources Slot Shader Resource View Resource (0-127) NULL NULL Sampler States Slot Sampler Filter AddressU AddressV AddressW MipLODBias MaxAnisotropy ComparisonFunc BorderColor MinLOD MaxLOD (0-15) NULL           Constant Buffers Slot Buffer (0-13) NULL Class Instances Slot Class Instance (0-252) NULL Domain Shader State Shader General Information Shader NULL Shader Resources Slot Shader Resource View Resource (0-127) NULL NULL Sampler States Slot Sampler Filter AddressU AddressV AddressW MipLODBias MaxAnisotropy ComparisonFunc BorderColor MinLOD MaxLOD (0-15) NULL           Constant Buffers Slot Buffer (0-13) NULL Class Instances Slot Class Instance (0-252) NULL Geometry Shader State Shader General Information Shader NULL Shader Resources Slot Shader Resource View Resource (0-127) NULL NULL Sampler States Slot Sampler Filter AddressU AddressV AddressW MipLODBias MaxAnisotropy ComparisonFunc BorderColor MinLOD MaxLOD (0-15) NULL           Constant Buffers Slot Buffer (0-13) NULL Stream Output Buffers Slot Buffer Offset (0-3) NULL 0 Class Instances Slot Class Instance (0-252) NULL Rasterizer State Viewports Slot TopLeftX TopLeftY Width Height MinDepth MaxDepth 0 0.000f 0.000f 800.000f 600.000f 0.000f 1.000f (1-15) N/A N/A N/A N/A N/A N/A Scissor Rects Slot left top right bottom (0-15) N/A N/A N/A N/A Rasterizer Rasterizer obj:23 FillMode D3D11_FILL_SOLID CullMode D3D11_CULL_NONE FrontCounterClockwise FALSE DepthBias 0 DepthBiasClamp 1.000f SlopeScaleDepthBias 0.000f DepthClipEnable FALSE ScissorEnable FALSE MultisampleEnable TRUE AntialiasedLineEnable FALSE Compute Shader State Shader General Information Shader NULL Shader Resources Slot Shader Resource View Resource (0-127) NULL NULL Unordered Access Views Slot Unordered Access View 11 Resource (0-7) NULL NULL Sampler States Slot Sampler Filter AddressU AddressV AddressW MipLODBias MaxAnisotropy ComparisonFunc BorderColor MinLOD MaxLOD (0-15) NULL           Constant Buffers Slot Buffer (0-13) NULL Class Instances Slot Class Instance (0-252) NULL Pixel Shader State Shader General Information Shader obj:31 Shader Resources Slot Shader Resource View Resource 0 obj:12 obj:11 (1-127) NULL NULL Sampler States Slot Sampler Filter AddressU AddressV AddressW MipLODBias MaxAnisotropy ComparisonFunc BorderColor MinLOD MaxLOD 0 obj:10 D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR D3D11_TEXTURE_ADDRESS_WRAP D3D11_TEXTURE_ADDRESS_WRAP D3D11_TEXTURE_ADDRESS_WRAP 0.000f 0 D3D11_COMPARISON_NEVER (0.000f, 0.000f, 0.000f, 0.000f) 0.000f 340282346638528860000000000000000000000.000f (1-15) NULL           Constant Buffers Slot Buffer 0 obj:13 (1-13) NULL Class Instances Slot Class Instance (0-252) NULL Output Merger State Depth Stencil Description Depth Stencil State obj:25 DepthEnable FALSE DepthFunc D3D11_COMPARISON_LESS DepthWriteMask D3D11_DEPTH_WRITE_MASK_ALL StencilEnable FALSE StencilReadMask 11111111 StencilWriteMask 11111111 Stencil Reference Value 0 Front Face Stencil StencilFailOp D3D11_STENCIL_OP_KEEP StencilDepthFailOp D3D11_STENCIL_OP_KEEP StencilPassOp D3D11_STENCIL_OP_KEEP StencilFunc D3D11_COMPARISON_ALWAYS Back Face Stencil StencilFailOp D3D11_STENCIL_OP_KEEP StencilDepthFailOp D3D11_STENCIL_OP_KEEP StencilPassOp D3D11_STENCIL_OP_KEEP StencilFunc D3D11_COMPARISON_ALWAYS Blend State Blend Factor (0.000f, 0.000f, 0.000f, 0.000f) Sample Mask -1 Blend State 11 General Information Blend State obj:24 AlphaToCoverageEnable FALSE IndependentBlendEnable FALSE Render Targets Number BlendEnable SrcBlend DestBlend BlendOp SrcBlendAlpha DestBlendAlpha BlendOpAlpha RenderTargetWriteMask 0 TRUE D3D11_BLEND_SRC_ALPHA D3D11_BLEND_INV_SRC_ALPHA D3D11_BLEND_OP_ADD D3D11_BLEND_ONE D3D11_BLEND_ZERO D3D11_BLEND_OP_ADD 00001111 1 TRUE D3D11_BLEND_SRC_ALPHA D3D11_BLEND_INV_SRC_ALPHA D3D11_BLEND_OP_ADD D3D11_BLEND_ONE D3D11_BLEND_ZERO D3D11_BLEND_OP_ADD 00001111 2 TRUE D3D11_BLEND_SRC_ALPHA D3D11_BLEND_INV_SRC_ALPHA D3D11_BLEND_OP_ADD D3D11_BLEND_ONE D3D11_BLEND_ZERO D3D11_BLEND_OP_ADD 00001111 3 TRUE D3D11_BLEND_SRC_ALPHA D3D11_BLEND_INV_SRC_ALPHA D3D11_BLEND_OP_ADD D3D11_BLEND_ONE D3D11_BLEND_ZERO D3D11_BLEND_OP_ADD 00001111 4 TRUE D3D11_BLEND_SRC_ALPHA D3D11_BLEND_INV_SRC_ALPHA D3D11_BLEND_OP_ADD D3D11_BLEND_ONE D3D11_BLEND_ZERO D3D11_BLEND_OP_ADD 00001111 5 TRUE D3D11_BLEND_SRC_ALPHA D3D11_BLEND_INV_SRC_ALPHA D3D11_BLEND_OP_ADD D3D11_BLEND_ONE D3D11_BLEND_ZERO D3D11_BLEND_OP_ADD 00001111 6 TRUE D3D11_BLEND_SRC_ALPHA D3D11_BLEND_INV_SRC_ALPHA D3D11_BLEND_OP_ADD D3D11_BLEND_ONE D3D11_BLEND_ZERO D3D11_BLEND_OP_ADD 00001111 7 TRUE D3D11_BLEND_SRC_ALPHA D3D11_BLEND_INV_SRC_ALPHA D3D11_BLEND_OP_ADD D3D11_BLEND_ONE D3D11_BLEND_ZERO D3D11_BLEND_OP_ADD 00001111 Render Targets Slot Render Target View 11 Resource 0 obj:18 obj:17 (1-7) NULL NULL Unordered Access Views Slot Unordered Access View 11 Resource (0-7) NULL NULL General Information Depth Stencil View obj:20 Depth Buffer obj:19 Blend Factor (0.000f, 0.000f, 0.000f, 0.000f) Sample Mask 0xffffffff
  13.   I updated my post with my testing with the depth enabled false. With this there still will be no pixel shader shown
  14. For nearly a day now I have been trying to figure out why vertex buffer is not rendering and after debugging and rereading the documentation I am still clueless. According to the documentation the pixel shader can be missing from the output merger when there is not one set. I am totally setting one. I have been using the shader for rendering else where, so I know the shader works. It is just for some reason there is no pixel shader in my out merger for this draw call. What can cause a pixel shader to not be in the output merger?       My output merge state too d3d11 depth-stencil state (obj:25) DepthEnable FALSE DepthFunc D3D11_COMPARISON_LESS DepthWriteMask D3D11_DEPTH_WRITE_MASK_ALL StencilEnable FALSE StencilReadMask 11111111 StencilWriteMask 11111111 Back Face StencilDepthFailOp D3D11_STENCIL_OP_KEEP StencilFailOp D3D11_STENCIL_OP_KEEP StencilFunc D3D11_COMPARISON_ALWAYS StencilPassOp D3D11_STENCIL_OP_KEEP Front Face StencilDepthFailOp D3D11_STENCIL_OP_KEEP StencilFailOp D3D11_STENCIL_OP_KEEP StencilFunc D3D11_COMPARISON_ALWAYS StencilPassOp D3D11_STENCIL_OP_KEEP
  15. judeclarke

    Characters being offset by a pixel in BMFont

    I removed the .5 additions to the u and v and now everything works, thank you
  • 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!