sampler addressing modes not working?

Started by
0 comments, last by Hassanbasil 12 years, 9 months ago
Hello everyone,

basically, i'm trying to map a tiled texture to my mesh, according to msdn

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:

....
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;
}


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:
wrap.jpg

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.
Advertisement
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
One more note, i tried typing in random stuff inside the SamplerState states, and the code still compiles, for example:

SamplerState gAnisotropicSam
{
sdfsds = sdfasdfsd;
asdfasef = werwerwe;
AddressU = wsfrsdf;
fsfdfsf = Wrap;
};


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?

This topic is closed to new replies.

Advertisement