Jump to content
  • Advertisement

terrysworkstations

Member
  • Content count

    29
  • Joined

  • Last visited

Community Reputation

102 Neutral

About terrysworkstations

  • Rank
    Member

Personal Information

  • Role
    3D Animator
  • Interests
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. terrysworkstations

    Projecting a texture

    *My Solution, Crazy cdn The near plane adjustment fixed it. A near plane of 0.1.Now no intersecting the sphere.
  2. terrysworkstations

    Projecting a texture

    As the camera gets close to the sphere, the projection does not get occluded by the sphere. There should remain a occlusion but there is a projection on the back.
  3. terrysworkstations

    Projecting a texture

    Updated! Has anyone ever had this problem?
  4. terrysworkstations

    Projecting a texture

    Update! Everything is almost working. Getting weird effect when getting camera close to sphere. As in the picture. Why would this be happinging? Any ideas? The only thing I can think of is the depth map is messed up.??????? Here is my code. DrawGeoSphere() { md3dImmediateContext->IASetInputLayout(InputLayouts::Basic32); md3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); UINT stride = sizeof(Vertex::Basic32); UINT offset = 0; XMMATRIX view = XMLoadFloat4x4(&mView); XMMATRIX proj = XMLoadFloat4x4(&mProj); XMMATRIX viewProj = view*proj; ID3DX11EffectTechnique* activeTech = Effects::BasicFX->NormalScene; D3DX11_TECHNIQUE_DESC techDesc; activeTech->GetDesc( &techDesc ); for(UINT p = 0; p < techDesc.Passes; ++p) { md3dImmediateContext->IASetVertexBuffers(0, 1, &mBoxVB2, &stride, &offset); md3dImmediateContext->IASetIndexBuffer(mBoxIB2, DXGI_FORMAT_R32_UINT, 0); // Draw the box. XMMATRIX world = XMLoadFloat4x4(&mBoxWorld); XMMATRIX Correction( 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.5f, 0.5f, 0.0f, 1.0f); XMMATRIX worldInvTranspose = MathHelper::InverseTranspose(world); XMMATRIX worldViewProj = world*view*proj; XMMATRIX projectiveTextureMatrix = world * Projector->view() * Projector->proj() * Correction; Effects::BasicFX->SetWorld(world); Effects::BasicFX->SetWorldInvTranspose(worldInvTranspose); Effects::BasicFX->SetWorldViewProj(worldViewProj); Effects::BasicFX->SetTexTransform(XMLoadFloat4x4(&mTexTransform)); Effects::BasicFX->SetMaterial(mBoxMat); Effects::BasicFX->SetDiffuseMap(mDiffuseMapSRV); Effects::BasicFX->SetProjMap(mDiffuseMapSRV2); Effects::BasicFX->SetprojectiveTextureMatrix(projectiveTextureMatrix); Effects::BasicFX->SetDepthMap(mOutputTexture2); activeTech->GetPassByIndex(p)->Apply(0, md3dImmediateContext); md3dImmediateContext->DrawIndexed(mBoxIndexCount, mBoxIndexOffset, mBoxVertexOffset); } } Thnx for helping
  5. terrysworkstations

    Post Processing on quads

    Alright, running good.
  6. terrysworkstations

    Post Processing on quads

    Ok, so depth is needed. I need something specific. Anyone? I tried OMSetDepthStencilState with DepthEnable to true but still the haze is in front of box. here is my composite function if needed. DrawCompositeQuad() { md3dImmediateContext->RSSetViewports(1, &mScreenViewport); UINT stride = sizeof(Vertex::Basic32); UINT offset = 0; md3dImmediateContext->IASetInputLayout(InputLayouts::Basic32); md3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); md3dImmediateContext->IASetVertexBuffers(0, 1, &mScreenQuadVB, &stride, &offset); md3dImmediateContext->IASetIndexBuffer(mScreenQuadIB, DXGI_FORMAT_R32_UINT, 0); // Scale and shift quad to lower-right corner. XMMATRIX world( 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); ID3DX11EffectTechnique* tech = Effects::DistortionFX->composite; D3DX11_TECHNIQUE_DESC techDesc; tech->GetDesc( &techDesc ); for(UINT p = 0; p < techDesc.Passes; ++p) { Effects::DistortionFX->SetWorldViewProj(world); Effects::DistortionFX->SetDiffuseMap(second.GetSRV()); //normal scene quad Effects::DistortionFX->SetDiffuseMap2(first.GetSRV()); //cutout quad Effects::DistortionFX->SetHaze(mTimer.TotalTime()); tech->GetPassByIndex(p)->Apply(p, md3dImmediateContext); md3dImmediateContext->DrawIndexed(6, 0, 0); } }
  7. terrysworkstations

    Post Processing on quads

    Im doing post processing which involves drawing on quads. Im doing distortion. Like a haze from a fire. First, draw a distortion map to a quad. Next draw a normal scene to a quad. Then composite them together in the shader. Code is below the picture to see what im talking about. As in the picture, I turned the box so it would be in front of the haze. Shouldn't see the haze. but it is still poking through. How should I solve this problem? //CUT OUT MASK md3dImmediateContext->OMSetRenderTargets(1, &first.mRenderTargetView, first.GetDSV()); md3dImmediateContext->ClearRenderTargetView( first.GetRTV(), reinterpret_cast<const float*>(&Colors::Black)); md3dImmediateContext->ClearDepthStencilView(first.GetDSV(), D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0); md3dImmediateContext->IASetInputLayout(InputLayouts::Basic32); md3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); UINT stride = sizeof(Vertex::Basic32); UINT offset = 0; XMMATRIX view = XMLoadFloat4x4(&mView); XMMATRIX proj = XMLoadFloat4x4(&mProj); XMMATRIX viewProj = view*proj; // Set per frame constants. Effects::BasicFX->SetDirLights(mDirLights); Effects::BasicFX->SetEyePosW(mEyePosW); ID3DX11EffectTechnique* activeTech = Effects::DistortionFX->cutout; D3DX11_TECHNIQUE_DESC techDesc; activeTech->GetDesc( &techDesc ); for(UINT p = 0; p < techDesc.Passes; ++p) { md3dImmediateContext->IASetVertexBuffers(0, 1, &mBoxVB, &stride, &offset); md3dImmediateContext->IASetIndexBuffer(mBoxIB, DXGI_FORMAT_R32_UINT, 0); // Draw the box. XMMATRIX world = XMLoadFloat4x4(&mBoxWorld); XMMATRIX worldInvTranspose = MathHelper::InverseTranspose(world); XMMATRIX worldViewProj = world*view*proj; Effects::DistortionFX->SetWorldViewProj(worldViewProj); Effects::DistortionFX->SetDiffuseMap2(mDiffuseMapSRV2); activeTech->GetPassByIndex(p)->Apply(0, md3dImmediateContext); md3dImmediateContext->DrawIndexed(mBoxIndexCount, mBoxIndexOffset, mBoxVertexOffset); } md3dImmediateContext->OMSetRenderTargets(1, &mRenderTargetView, mDepthStencilView); md3dImmediateContext->ClearRenderTargetView( mRenderTargetView, reinterpret_cast<const float*>(&Colors::Black)); md3dImmediateContext->ClearDepthStencilView(mDepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0); md3dImmediateContext->OMSetRenderTargets(1, &second.mRenderTargetView, second.GetDSV()); md3dImmediateContext->ClearRenderTargetView( second.GetRTV(), reinterpret_cast<const float*>(&Colors::LightSteelBlue)); md3dImmediateContext->ClearDepthStencilView(second.GetDSV(), D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0); //NORMAL SCENE TO QUAD md3dImmediateContext->IASetInputLayout(InputLayouts::Basic32); md3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); stride = sizeof(Vertex::Basic32); offset = 0; view = XMLoadFloat4x4(&mView); proj = XMLoadFloat4x4(&mProj); viewProj = view*proj; // Set per frame constants. Effects::BasicFX->SetDirLights(mDirLights); Effects::BasicFX->SetEyePosW(mEyePosW); activeTech = Effects::BasicFX->Light2TexTech; activeTech->GetDesc( &techDesc ); for(UINT p = 0; p < techDesc.Passes; ++p) { md3dImmediateContext->IASetVertexBuffers(0, 1, &mBoxVB2, &stride, &offset); md3dImmediateContext->IASetIndexBuffer(mBoxIB2, DXGI_FORMAT_R32_UINT, 0); // Draw the box. XMMATRIX world = XMLoadFloat4x4(&mBoxWorld); world *= XMMatrixTranslation(-2,0,0); XMMATRIX worldInvTranspose = MathHelper::InverseTranspose(world); XMMATRIX worldViewProj = world*view*proj; Effects::BasicFX->SetWorld(world); Effects::BasicFX->SetWorldInvTranspose(worldInvTranspose); Effects::BasicFX->SetWorldViewProj(worldViewProj); Effects::BasicFX->SetTexTransform(XMLoadFloat4x4(&mTexTransform)); Effects::BasicFX->SetMaterial(mBoxMat); Effects::BasicFX->SetDiffuseMap(mDiffuseMapSRV); activeTech->GetPassByIndex(p)->Apply(0, md3dImmediateContext); md3dImmediateContext->DrawIndexed(mBoxIndexCount, mBoxIndexOffset, mBoxVertexOffset); } md3dImmediateContext->OMSetRenderTargets(1, &mRenderTargetView, mDepthStencilView); md3dImmediateContext->ClearRenderTargetView( mRenderTargetView, reinterpret_cast<const float*>(&Colors::Black)); md3dImmediateContext->ClearDepthStencilView(mDepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0); //COMPOSITE TEH QUADS TOGETHING FILTERING OUT THE HAZE AND NORMAL IMAGE DrawCompositeQuad(); HR(mSwapChain->Present(0, 0)); And the shader /************* Resources *************/ static const float ZeroCorrection = 0.5f / 255.0f; float4x4 gWorldViewProj; cbuffer CBufferPerObjectComposite { float DisplacementScale = 3.0f; float haze = 0.0f; } Texture2D SceneTexture; Texture2D DistortionMap; SamplerState TrilinearSampler { Filter = MIN_MAG_MIP_LINEAR; AddressU = CLAMP; AddressV = CLAMP; }; struct VertexIn { float3 PosL : POSITION; float3 NormalL : NORMAL; float2 Tex : TEXCOORD; }; struct VertexOut { float4 PosH : SV_POSITION; float2 Tex : TEXCOORD; }; /************* Cutout *************/ VertexOut VS(VertexIn vin) { VertexOut vout; vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj); vout.Tex = vin.Tex; return vout; } float4 PS(VertexOut pin) : SV_Target { float2 displacement = DistortionMap.Sample(TrilinearSampler, pin.Tex).xy; return float4(displacement.xy, 0, 1); } /************* Compositing *************/ VertexOut VS2(VertexIn vin) { VertexOut vout; vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj); vout.Tex = vin.Tex; return vout; } float4 PS2(VertexOut pin) : SV_Target { float4 OUT = (float4)0; float2 displacement = DistortionMap.Sample(TrilinearSampler, pin.Tex).xy; if (displacement.x == 0 && displacement.y == 0) { OUT = SceneTexture.Sample(TrilinearSampler, pin.Tex); } else { displacement -= 0.5f + ZeroCorrection; OUT = SceneTexture.Sample(TrilinearSampler, pin.Tex + (cos(haze) * displacement)); } return OUT; } /************* Techniques *************/ technique11 displacement_cutout { pass p0 { SetVertexShader(CompileShader(vs_5_0, VS())); SetGeometryShader(NULL); SetPixelShader(CompileShader(ps_5_0, PS())); } } technique11 distortion_composite { pass p0 { SetVertexShader(CompileShader(vs_5_0, VS2())); SetGeometryShader(NULL); SetPixelShader(CompileShader(ps_5_0, PS2())); } } -do=add#.url
  8. terrysworkstations

    Camera on Vehicle

    I want to attach a camera on a vehicle like so that it will be in the cockpit of the car. I tried messing around with the target position of the view camera. I know there is a current position and target in a view matrix. So I multiplied x and z components of target(view matrix) by 100 to give farther viewing capabilities. This did not work so I was wondering how to attach a a view camera to a vehicle. I just need a general idea on how to do it. | / | / | / CurrentPosition --*100--->target position View Matrix thank you
  9. terrysworkstations

    Shader Resource Binding

    Hello, I am trying to set some shader values in a cbuffer. Im not getting any response or values. My code is: cbuffer MatrixBuffer : register(b0) { float4 test; }; ------------------------------------------------- #pragma pack(push,1) struct CB_GBUFFER_UNPACK { D3DXVECTOR4 test; }; #pragma pack(pop) ------------------------------------------------- D3D11_BUFFER_DESC cbDesc; ZeroMemory( &cbDesc, sizeof(cbDesc) ); cbDesc.Usage = D3D11_USAGE_DYNAMIC; cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; cbDesc.ByteWidth = sizeof( CB_GBUFFER_UNPACK ); device->CreateBuffer( &cbDesc, NULL, &m_pGBufferUnpackCB ); D3D11_MAPPED_SUBRESOURCE MappedResource; ic->Map( m_pGBufferUnpackCB, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedResource ); CB_GBUFFER_UNPACK* pGBufferUnpackCB = ( CB_GBUFFER_UNPACK* )MappedResource.pData; pGBufferUnpackCB->test.x = 10.0f; pGBufferUnpackCB->test.y = 10.0f; pGBufferUnpackCB->test.z = 10.0f; pGBufferUnpackCB->test.w = 0.0f; ic->Unmap( m_pGBufferUnpackCB, 0 ); ic->PSSetConstantBuffers( 0, 1, &m_pGBufferUnpackCB ); What is wrong?
  10. terrysworkstations

    Assimp Object

    Ok seem to get the distortion working now. No stretching. Is there a way to invert indices on assimp?
  11. terrysworkstations

    Assimp Object

    I switched to Assimp for loading models in directx 11. The image seems to strectch and stuff for some reason.In the picture , the tail like gets real big and the front of the image gets smaller when it gets closer to the camera than it should be. Does anyone know why this Is happening. Also I can see through the fish on certain angles. Does this have to do with left/right handed coordinate systems?
  12. terrysworkstations

    Bone offsets Matrix

    Trying to get Bone Offsets. I have blend weights and indices. How can I get bone offsets.
  13. terrysworkstations

    Have to rotate 180 and flip horizontal to work

    I solved it. Thx
  14. terrysworkstations

    Textures in Directx 11

    Alright h8cplusplusGuru, got it. thx
  15. terrysworkstations

    Textures in Directx 11

    I still cannot get it to work even after the steps above. BTW, im using blender.
  • 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!