Sign in to follow this  

Need a simple pixel shader code which just draws given texture to screen/viewport ..

This topic is 2590 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all .. I need a simple shader code to use with my XNA application which just draws a given texture to the screen .. Essentially, I'm trying to do post processing, but my aim here is to not apply any post processing effect, but to just display the texture as itself ..

I tried the following pixel shader code but I'm getting some problem (explained below):

sampler textureSampler;

float4 PostProcessingPS(float2 texCoord: TEXCOORD0, float4 Position : POSITION0) : COLOR0
{
float4 color = tex2D(textureSampler,texCoord);
return color;
}

technique PostProcessingEffect
{
pass Pass1
{
PixelShader = compile ps_2_0 PostProcessingPS();
}
}


The issue I'm getting is that the entire texture is not drawn .. Only the borders are being drawn for some reason ?! And even regarding the borders, I'm not sure if they are being drawn properly .. I'm just saying they are being drawn because the pixel values there change as the scene itself changes ..

This is what it should be like:



And this is what I see:


Any ideas ?

Share this post


Link to post
Share on other sites
What you see is wireframe of your screen quad or similar. Try changing the material type or whatever it's called in XNA. You're shader code seems fine.

Share this post


Link to post
Share on other sites

This topic is 2590 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this