I looked at it in PIX as you suggested, and it all looks fine to me (but then again, I have never used it before)
Here is all my render targets. (Why is there so many? I only create two)
[image]http://i.imagehost.org/0245/renderTargetDebug.jpg[/image]
And by looking though the callstack in PIX I have found this line.
When I look at the texture it is setting, it has my blurred image.
IDirect3DDevice9::SetTexture(1, 0x0607AFD8)
Here is my rendering code. If I change the showBlurBuffer to show the blurbuffer, it shows fine, but I can still not access it in my shader
m_graphics.GraphicsDevice.Clear(new Color(0, 0, 0, 0));// Change render target so that we draw all our textures onto the rendertarget.// This way we dont need to resolve the backbufferm_graphics.GraphicsDevice.SetRenderTarget(0, m_renderTarget);// Draw all the sprites that has a rimlight applid to them first, and then blur themint renderIndex = (int)RenderBatch.Rim_light;SpriteBatch.Begin();for (int i = 0; i < m_renderList[renderIndex].Count; i++){ BaseSprite sprite = m_renderList[renderIndex].Sprite; sprite.render(SpriteBatch, cameraPosition); }SpriteBatch.End();m_graphics.GraphicsDevice.SetRenderTarget(0, null);RenderTarget2D blurredRimLight;m_blurEffect.Render(m_renderTarget.GetTexture(), out blurredRimLight);// Draw all the sprites that should be effected by the bloom filter.// Set texture1 to be the blurred rimlight sprites, so that the sprites // that has a rimlight can use it.m_graphics.GraphicsDevice.SetRenderTarget(0, null); if (!showBlurBuffer){ renderIndex = (int)RenderBatch.Rim_light; Graphics.Textures[1] = blurredRimLight.GetTexture(); // This should make the texture available in the shader? SpriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None); for (int i = 0; i < m_renderList[renderIndex].Count; i++) { BaseSprite sprite = m_renderList[renderIndex].Sprite; SpriteEffectBase effect = m_renderList[renderIndex].Effect; effect.Begin(); effect.Draw(sprite, cameraPosition, this, m_renderTarget); effect.End(); } SpriteBatch.End();}else{ SpriteBatch.Begin(); SpriteBatch.Draw(blurredRimLight.GetTexture(), new Rectangle(0, 0, ScreenWidth, ScreenHeight), Color.White); SpriteBatch.End();}return;
My shader. TextureSampler0 has data, but TextureSampler1 does not.
sampler TextureSampler0 : register(s0); sampler TextureSampler1 : register(s1); float4 PixelShaderFunction(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0 { return tex2D(TextureSampler0, texCoord);}
Any ideas?
[Edited by - h3ro on March 7, 2010 9:35:44 AM]