Jump to content
  • Advertisement
Sign in to follow this  
Hassanbasil

sampler addressing modes not working?

This topic is 2551 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 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.

Share this post


Link to post
Share on other sites
Advertisement
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:

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? Edited by Hassanbasil

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!