Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Leprosy

Expert Advice needed...

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

In DX8 I have recently become aware of a nasty situation that come around by using linear blending. If your triangle or quad has texture coordinates of 0.0f and 1.0f, the very edge or your texture will sample colors from the other side of your texture. This is all fine and good if your texture has similar colors on both sides, but if you are trying to tile several textures together without similar edged colors then it produces very insightly lines. Is there any way to get rid of this without have to use point sampling texture filter. Thanks so much Leprosy

Share this post


Link to post
Share on other sites
Advertisement
Whatever is correct lep, you need to clamp our texture addressing.

Try this on the relevant texture stage:-

lpDevice->SetTextureStageState(0,D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP );

lpDevice->SetTextureStageState(0,D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP );

HTH

Gary Simmons
www.mr-gamemaker.com

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hehe.. this top is old as hell, but I thought I''d add my .02 anyhow.

Clamp might keep pixels from "wrapping", but it''ll still leave some artifacts. Most pixels will be blurry, but at texture boundaries, you''ll have sharp lines instead, and they''ll most likely stick out like a sore thumb.

I''ve found that you need to duplicate the edge pixels between textures. So the right side of the left texture has the same pixels as the left side of the right texture. That, and clamping (or mirroring works too) will get rid of the boundaries.

This leaves a double pixel line that blends, but.. it''s still not right. Someone suggested offsetting the texture coordinates a little to get rid of your double pixel line too. That should work, but I''ve been unable to try yet.

Well, just putting this down for anyone who may be searching the boards for an answer to this







-ns-

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
I''ve found that you need to duplicate the edge pixels between textures. So the right side of the left texture has the same pixels as the left side of the right texture. That, and clamping (or mirroring works too) will get rid of the boundaries.

Well, just putting this down for anyone who may be searching the boards for an answer to this



it may be an old topic but its still relevent.

You could duplicate pixels on the borders and it will work, but it''s hard enough getting artists to give you textures in sizes of the 2^ let alone put THAT restriction on them!

clamping is ok, except that it will widen the texture
boarders giving you some nasty double (or more) width pixels which maybe ok for a proper 3D scene, but not good if you''re trying to do a 2D front end (eg. a menu system)

I have two methods, either

1) get the textures to be one pixel smaller in all directions and have a alpha''d out boundery on the texture (so if it wraps you only get invisible pixels) it''s hard to tell you''ve done that, and easier to "oversize" the quad to compensate,

or,
2) the other way is to use
SetTextureStageState(0,D3DTSS_ADDRESSU,D3DTADDRESS_BORDER)
and set
SetTextureStageState(0,D3DTSS_BORDERCOLOR, D3DCOLOR_RGBA(0,0,0,0))
to make a transparent border


at least thats the way I''ve been doing it



"Bad Day... F**K it!" -Stephen Baldwin (Usual Suspects)

Share this post


Link to post
Share on other sites

  • 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!