Sign in to follow this  
Hassanbasil

sampler addressing modes not working?

Recommended Posts

Hassanbasil    195
Hello everyone,

basically, i'm trying to map a tiled texture to my mesh, according to [url="http://msdn.microsoft.com/en-us/library/ff476256%28v=VS.85%29.aspx"]msdn[/url]
[quote]
D3D11_TEXTURE_ADDRESS_WRAP Tile the texture at every (u,v) integer junction. For example, for u values between 0 and 3, the texture is repeated three times.

[/quote]

here's my shader code:
[code]
....
Texture2D gDiffuseMap;
.....
SamplerState gAnisotropicSam
{
Filter = ANISOTROPIC;
AddressU = wrap;
AddressV = wrap;
};
...
float4 PS ( VS_OUT pIn ) : SV_Target
{
float4 diffuse = gDiffuseMap.Sample ( gAnisotropicSam, pIn.texC * 3 ); //<----
return diffuse;
}
[/code]

it works fine without the * 3, but with it, and since im using wrap address modes, shouldn't it be tiled after multiplication? here's my result:
[img]http://img546.imageshack.us/img546/3784/wrap.jpg[/img]

looks like the clamp mode? note that when i remove the multiplication, i get the texture mapped to the whole quad (well, terrain..), so the mesh uv's are fine, what's going on there? (im using Direct3D 11)

Thanks.

Share this post


Link to post
Share on other sites
Hassanbasil    195
Hidden
Sorry for bumping & double post but i can't seem to find the cause - why is this happening? if any other source code is needed please let me know

Share this post


Link to post
Hassanbasil    195
One more note, i tried typing in random stuff inside the SamplerState states, and the code still compiles, for example:
[code]
SamplerState gAnisotropicSam
{
sdfsds = sdfasdfsd;
asdfasef = werwerwe;
AddressU = wsfrsdf;
fsfdfsf = Wrap;
};
[/code]

compiles fine, somehow.
though it seems to always go for the default sample state which is clamp, any ideas on what's wrong?

EDIT:
setting the sampler state from outside the shader works fine, can't it be set from within the shader? Edited by Hassanbasil

Share this post


Link to post
Share on other sites

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