Expert Advice needed...

Started by
3 comments, last by Leprosy 22 years, 10 months ago
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
Advertisement
I''m not familiar with D3D, but I do know that you need to clamp your texture if you don''t want the seam.
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
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-
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)
"Bad Day... F**K it!" -Stephen Baldwin (Usual Suspects)

This topic is closed to new replies.

Advertisement