Sign in to follow this  

How to make tile texture

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

OK, but what means in this situation variable: AddresU,V,W with value D3D11_TEXTURE_ADDRESS_WRAP in D3D11_SAMPLER_DESC structure?

 

Does this variables not intended for this?

Edited by BlackJoker

Share this post


Link to post
Share on other sites

I can't quite understand what you're asking, but for 2D textures, you generally only use the U and V texture coordinates.  TEXTURE_ADDRESS_WRAP does mean that the texture coordinates on your vertices are modded with 1.0f, in order to tile the texture.

 

I think the W texture coordinate is usually only used for cubemaps, and sometimes texture arrays.

Share this post


Link to post
Share on other sites

Is this the only way to do this?


You could wrap manually in the pixel shader. Not that it is simple (derivatives go bad at the border if you just mod and sample normally), or performant. But I think it has its use (texture atlas, say).

Share this post


Link to post
Share on other sites

You can supply a texture coordinate transformation matrix to your shader, and use that to transform your vertex texture coordinates.

So, if you wanted to tile the texture 4x4 across a quad, and the vertex texture coordinates are setup to go [0,1], you'd use this matrix:

[[4, 0, 0, 0]
 [0, 4, 0, 0]
 [0, 0, 1, 0]
 [0, 0, 0, 1]]

You can also use this technique to apply other transformations, like rotating the texture or offsetting the starting point.

Share this post


Link to post
Share on other sites

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

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