   Upsampling-problems with multiple RenderTargets (D3D10)
  Hi,I'm currently implementing a small bloom-effect. The way I do this is:1) Render the scene to a Full-Screen Texture2) Render the Texture (horizontally) blurred to another Texture //for debugging-reasons I currently do only one blur-direction3) Add both  Textures together to create the bloom effect.In all steps I'm using Fullscreen quads for rendering (not sure if there are even other choices...)Now this is all working well as long as I keep my RenderTarget - textures the same size as my BackBuffer. But since I want to make a bloom-effect, smaller render-textures which even occupy less memory then are more desireable.So what I did is to render the blur (step 2) to a texture half the size of the backbuffer (The depth/Stencil Texture is also half the size). The color-Texture (from step 1) is still the original size. Step 3 doesn't change.But what I get now are wierd-looking ghost-images as shown in the screenshot.What I also noticed is that the ghost-Image (the content of the downsampled image) seems to move slightly different than the original image when moving the camera. It's as if the downsampled texture is actually bigger and I'm seeing only a portion of that texture - mimiking the effect of wrong movement-vectors (hard to describe...)And now I'm stuck! I already spent the entire day on figuring out why I'm getting these wierd results :-(here the screenshots:correct behavior using fullscreen-Bufferswrong ghost-images I get when using downsampled Textureand here a bit if code:Texture-, and DSView-Creation:UINT width = pBackBufferSurfaceDesc->Width;UINT height = pBackBufferSurfaceDesc->Height;D3D10_TEXTURE2D_DESC texDesc;texDesc.ArraySize = 1;texDesc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;texDesc.CPUAccessFlags = 0;texDesc.Format = pBackBufferSurfaceDesc->Format;texDesc.Height = height;texDesc.MipLevels = 1;texDesc.MiscFlags = 0;texDesc.SampleDesc.Count = 1;texDesc.SampleDesc.Quality = 0;texDesc.Usage = D3D10_USAGE_DEFAULT;texDesc.Width = width;hr = pd3dDevice->CreateTexture2D(&texDesc, NULL, &m_pColorTX);V_RETURN(hr);texDesc.Width /= 2;texDesc.Height /= 2;hr = pd3dDevice->CreateTexture2D(&texDesc, NULL, &m_pColorTX_horBlurred);V_RETURN(hr);//Create the depth/stencil Textures and DSViewstexDesc.Format = DXGI_FORMAT_R16_TYPELESS;texDesc.BindFlags = D3D10_BIND_DEPTH_STENCIL;texDesc.Width = width;texDesc.Height = height;hr = pd3dDevice->CreateTexture2D(&texDesc, NULL, &m_pColorDSTX);V_RETURN(hr);texDesc.Width /= 2;texDesc.Height /= 2;hr = pd3dDevice->CreateTexture2D(&texDesc, NULL, &m_pColor_horBlurredDSTX);V_RETURN(hr);D3D10_DEPTH_STENCIL_VIEW_DESC dsDesc;dsDesc.Format = DXGI_FORMAT_D16_UNORM;dsDesc.ViewDimension = D3D10_DSV_DIMENSION_TEXTURE2D;dsDesc.Texture2D.MipSlice = 0;hr = pd3dDevice->CreateDepthStencilView(m_pColorDSTX, &dsDesc, &m_pColorDSV);V_RETURN(hr);hr = pd3dDevice->CreateDepthStencilView(m_pColor_horBlurredDSTX, &dsDesc, &m_pColor_horBlurredDSV);V_RETURN(hr);Shader-code, which blurs the scene:float4 horizontalBlur(float x, float y){//return 1 / (sqrt(2* PI * pow(omega, 2))) * exp(-pow(x, 2) / (2 * pow(omega, 2)));float4 colorSum = float4(0, 0, 0, 0);colorSum += colorTX.Sample( g_samLinear, float2( x - 4 * sampleSize, y )) * 0.05;colorSum += colorTX.Sample( g_samLinear, float2( x - 3 * sampleSize, y )) * 0.09;colorSum += colorTX.Sample( g_samLinear, float2( x - 2* sampleSize, y ))  * 0.12;colorSum += colorTX.Sample( g_samLinear, float2( x - 1 * sampleSize, y )) * 0.15;colorSum += colorTX.Sample( g_samLinear, float2( x, y ))  * 0.16;   //original PixelcolorSum += colorTX.Sample( g_samLinear, float2( x + 1 * sampleSize, y )) * 0.15;colorSum += colorTX.Sample( g_samLinear, float2( x + 2 * sampleSize, y )) * 0.12;colorSum += colorTX.Sample( g_samLinear, float2( x + 3 * sampleSize, y )) * 0.09;colorSum += colorTX.Sample( g_samLinear, float2( x + 4 * sampleSize, y )) * 0.05;//colorSum = colorSum / 9;return colorSum;}PSSceneIn VSQuad( VSSceneIn input ){PSSceneIn output;output.pos = float4(input.pos, 1);output.tex = input.tex;return output;}float4 PSQuadHorizontal(PSSceneIn input, uniform bool bSampleMSAA ) : SV_Target{    float4 outputColor; outputColor = horizontalBlur(input.tex.x, input.tex.y); return outputColor;}//PS doing the upsampling and blendingfloat4 PSQuadVertical(PSSceneIn input, uniform bool bSampleMSAA ) : SV_Target{    float4 outputColor;float4 originalColor = colorTX.Sample( g_samLinear,  input.tex); //original Fullscreen-texturefloat4 blurredColor = colorBlurredHorizontalTX.Sample( g_samLinear,  input.tex); //blurred (smaller) textureoutputColor = originalColor + blurredColor; return outputColor;}and finally the interesting part of my draw-code//Blur pass 1: Horizontal Blur to small texturepd3dDevice->OMSetRenderTargets(1, &m_pColorRTV_horBlurred, m_pColor_horBlurredDSV);m_pShader_QuadColor->SetResource(m_pColorSRV);pd3dDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);UINT stride = sizeof(VertexposNormTexStruct);UINT offset = 0;pd3dDevice->IASetVertexBuffers(0, 1, &fsQuad.pQuadVB, &stride, &offset);m_pTechnique_Quad->GetPassByIndex(0)->Apply(0); //apply horizontal Blur- Passpd3dDevice->Draw(4, 0);//Blur pass 2: Upsampling and blendingpd3dDevice->OMSetRenderTargets(1, &pBackBufferRTView, pBackBufferDSView);m_pShader_QuadColor_horBlurred->SetResource(m_pColorSRV_horBlurred);m_pTechnique_Quad->GetPassByIndex(1)->Apply(0);pd3dDevice->Draw(4, 0);
  It looks like you're forgetting to set the viewport when you set render targets. [wink]Also you don't need to use a half-size depth-stencil surface if you don't need depth/stencil testing...you can just set it to NULL when you set the render targets.   