Sign in to follow this  

Filter and Shader help

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

Is there a way to filter only a specific part of a texture? I made a tile based engine in Direct3D but i can only use the tilemaps when i have filtering disabled or at point, since if i have it linear the texture is changed and i get parts of another area in the texture? Alternatively, is there a way to simulate the effects of linear filtering with a shader?

Share this post


Link to post
Share on other sites
You could put a one pixel wide border around each texture which represents the other side in order for the filtering to work. e.g. duplicate the right hand edge of the texture on the left hand edge.

Share this post


Link to post
Share on other sites
Thanks for the reply.
I Understand what youu mean but i have many of the textures in one image, so its not the border of the texture that iam seeing, but its part of the rest of the texture.
What occured to me was perhaps rendering the whole image to a texture and applying the filter from there, giving it a full screen filter.
Would this be too much of a performance hit though?

Share this post


Link to post
Share on other sites
I was not very clear what I meant was each tile would have a pixel beyond the edge solely so the filtering will work, this could be a repeat of the last pixel and would prevent you seeing the next texture filtered in. The problem with this of course is you end up with odd sized tiles. e.g. if they were 64 by 64 they will need to be 65 by 65. Copying to another texture and using that could work - I also vaguely remember there is a way of setting a border colour but that may be an old method and may not be related.

Share this post


Link to post
Share on other sites
Since the texture coordinates around the very edges the tile texture are going to be either 0 or 1, you might be able to use use a shader and iff either the x or y texture coordinate is within a tolerance of 0 or 1 then return black (or whatever color you want the border to be).

I'm not sure if this applies to your question -- I admit it's late and I kind of just skimmed the post :P

Share this post


Link to post
Share on other sites

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