Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a mesh that is computer generated with a texture on top of it with transparancy on one side. The SamplerState is set to LinearWrap because I would like the texture to wrap. The problem I have is that this transparent edge has some weird aliasing. This does not occur when I set the SamplerState to LinearClamp.

I found that when letting the U coordinate go from 0.1 to 0.9 this does not happen. Probably on the transparent side it interpolates U coordinate 1 with U coordinate 0.

What could be the solution to prevent aside from not letting the U coordinate go all the way to 1?

enter image description here

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

Create a new SamplerState of your own and set it like this:

mySampler.Filter = TextureFilter.Linear;
mySampler.AddressU = TextureAddressMode.Clamp;
mySampler.AddressV = TextureAddressMode.Wrap;
mySampler.AddressW = TextureAddressMode.Wrap;

The V coordinate will be wrapped (since you want horizontal repeat) and the U will be clamped.

share|improve this answer
    
Why didn't I think of that! Thanks :-) –  Wouter Jul 15 '11 at 7:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.