• Content count

  • Joined

  • Last visited

Community Reputation

104 Neutral

About Dutcher

  • Rank
  1. Render to Texture within HLSL

    First of all, thank you for the reply. The loads of code really helps a lot. I'm not really sure what you're doing in the second coding piece though. Maybe it's because I'm experienced with C# instead of C++ (that's C++ right)? Can you perhaps explain the second part a bit more so I could succesfully translate it to C#?   To clarify, this is how I currently draw the texture: //PostProEffect is the Effect //renderTarget is the 2DTexture //graphics is the GraphicsDevice spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullClockwise, PostProEffect); spriteBatch.Draw(renderTarget, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White); spriteBatch.End();
  2. Hello,   I've been looking all over the web for the past week to discover whether it's possible to render the result of a pass to a texture to use it in a second pass. Especially this part creates the impression it should be possible: http://books.google.nl/books?id=5FAWBK9g-wAC&pg=PA97&lpg=PA97&dq=hlsl+rendercolortarget&source=bl&ots=UWTa8puvst&sig=J5Ov8F357RsccYhh_ftRT4E7sZw&hl=nl&sa=X&ei=bjTEUcnkLoqQ7Aad3IDIAQ&ved=0CC8Q6AEwAA%20-#v=onepage&q=hlsl%20rendercolortarget&f=false The idea of setting the result of a pass to a texture to use it again is very interesting for a lot of things (in this case I need it for gaussian blur), but I can't seem to get it to work.   The effect file I'm using is for post-processing only and has two textures: ScreenContent and HorBlurTexture. Furthermore I used the following passes: pass HorBlurPass < string Script = "RenderColorTarget0=HorBlurTexture;" "Draw=Buffer;"; > { PixelShader = compile ps_2_0 GaussianShaderHorizontal(); } pass VerBlurPass < string Script = "RenderColorTarget0=;" "Draw=Buffer;"; > { PixelShader = compile ps_2_0 GaussianShaderVertical(); } There are two theories I have at the moment: Because it's Post-processing all textures are automatically set to the given Screen (which was rendered earlier) RenderColorTarget does not work as I think it does.   Can anybody help me?   Thanks in advance,