Sign in to follow this  

sampler addressing modes not working?

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

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
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
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
Sign in to follow this