Jump to content
  • Advertisement
Sign in to follow this  
thiago.pastor

[XNA 4.0] Multisample showing white borders

This topic is 2589 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

[color="#1c2837"][color="#000000"][font="arial, verdana, tahoma, sans-serif"]hi all,
iam using xna to make a deferred rendering.
dx 9 normally does not support msaa with mrt, so i render in a first pass the normal and the depth without msaa
and after in a second pass i render the diffuse color with msaa
after i make the light pass and finaly a combine pass

the problem is that im getting with boarder (https://picasaweb.google.com/lh/photo/gVaAUsCPs09aOCAG_-sd7b8h9DxdSU2auIMAsUbJnQ8?feat=directlink) when i enable MSAA, when i disable everything works
it should work (KKK), i dont undertand way it does not (followed the ideas here http://drilian.com/2...-texel-offsets/)

the shaders used to render the normal/depth and the color are "normal", i dont align pixel, texel .....

in the light pass (small part of the directional light -- fullscreen quad pass) i do:



VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;
input.Position.x = input.Position.x - 2*halfPixel.x;
input.Position.y = input.Position.y + 2*halfPixel.y;
output.Position = float4(input.Position,1);

output.TexCoord = input.TexCoord ;
///.....
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
///.....

//read depth
float depthVal = tex2D(depthSampler,input.TexCoord).r;

//compute screen-space position
float4 position;
position.x = input.TexCoord.x * 2.0f - 1.0f;
position.y = -(input.TexCoord.y * 2.0f - 1.0f);
position.z = depthVal;
position.w = 1.0f;
//transform to world space
position = mul(position, InvertViewProjection);
position /= position.w;
///....
}




the global variable halfPixel is the 0.5f/(viewport resolution)
(after i change to pixelsize and change the 2*halfPixel to just pixelsize)

Showed how i recover the depth to get the world position.
the other textures i access using input.TexCoord (without halfPixel)
Tried changing the PS (subtracting the halfpixel of the position but .... )

in the combine phase i use: (fullscreen quad pass)


float2 halfPixel;
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;
input.Position.x = input.Position.x - 2*halfPixel.x;
input.Position.y = input.Position.y + 2*halfPixel.y;
output.Position = float4(input.Position,1);
output.TexCoord = input.TexCoord ;
return output;
}


float4 PixelShaderFunctionNormal(VertexShaderOutput input) : COLOR0
{
float procces = tex2D(extraSampler,input.TexCoord).a;
float3 diffuseColor = tex2D(colorSampler,input.TexCoord).rgba;
///.... (just to show how i access the textures)




(iam not subtracting halpfixel in the texture coordinates)
All my render targets (except the MRTS are configured to use MSAA)

IT WORKS without MSAA (correct image), i thought using the shift in the position would resolve .... (is not theoricaly correct ?)
Pls, what iam doing wrong ?

If more info, or more code is needed, tell me that i add =P

[/font][color="#000000"][font="arial, verdana, tahoma, sans-serif"](i posted this in other gamedev forum, but got no answer)[/font][color="#000000"][font="arial, verdana, tahoma, sans-serif"]Thanks as always people =P[/font]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!