Shaders: Rendering onto texture then onto screen? (RenderMonkey)
I'm currently trying to create some shaders..now i started with a shader, which renders the 3d things into a texture and applies a pixel shader on this texture.
The part of rendering everything into a texture works (I'm using ATI RenderMonkey for all this), but i can't Get back the texture on screen.
I tried to use a "ScreenAlignedQuad" as a surface for the texture; But the screen will remain black..
Shader:
float4x4 view_proj_matrix;
float fInverseViewportWidth;
float fInverseViewportHeight;
float fViewportWidth;
float fViewportHeight;
struct VS_OUTPUT
{
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
};
VS_OUTPUT vs_main(float4 Pos: POSITION)
{
VS_OUTPUT Out;
Out.Pos = float4(Pos.xy, 0, 1);
Out.texCoord.x = 0.5 * (1 + Pos.x - fInverseViewportWidth);
Out.texCoord.y = 0.5 * (1 - Pos.y - fInverseViewportHeight);
return Out;
}
sampler Texture;
float4 ps_main(float2 texCoord: TEXCOORD0) : COLOR
{
return tex2D(Texture, texCoord);
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement