Jump to content
  • Advertisement

Archived

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

Tornado

Weird lines on textures

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

When I create surfaces as textures I sometimes get weird lines at the end of the image. Let me explain: The mouse pointer (32x32) has weird lines at the end of the surface, I tried it on another computer and it''s fine there so I thought it''s my video card. Then I tried a couple of tiles (Also 32x32) which creates the same effect (Very weird lines), when I tried it on another computer some tiles had this problem and some didn''t. I''m setting the color key using DDraw and then I tell D3D to draw with the color key (lpD3DDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE,true). Note: When I draw the mouse, for example, with lpsurface->Blt() it works great, the problem''s when I try to draw it with DrawPrimitive(). Thanks for your help The road to success is always under construction

Share this post


Link to post
Share on other sites
Advertisement
Hi!

It might be artifacts from bilinear filtering. If you use bilinear filtering, the pixels next to the edge can get ''blended'' into the actual color. If your texture is only 32x32 then make sure you clamp the texture values and don''t wrap them. If your 32x32 image is on a larger texture with other image data, this effect can be really nasty, since it is very cumbersome to get rid of. You can try scaling the UV coords, so that the bilinear filtering will only sample on the 32x32 image, or you can repeat the edge pixels, so the bilinear filtering will blend the expected color at the edges, but this wastes texture space and your image would be 34x34 ...

You could check this by turning bilinear filtering off and using point sampling ... looks ugly, but if the artifacts are gone then you have yourself a bilinear filtering problem.

- MK42

Share this post


Link to post
Share on other sites
Man, you right! That was the problem, How didn't I think of it?
But I want Bilinear filtering, I got used to it!
I tried using 31x31 of the texture (Instead of 32x32), and it works, but part of the texture is lost.
What can I do about it?
There must be something...
Anyone know what can I do about this?
Thanks MK for your help

BTW, What do you mean "Make sure you clamp the texture values and don't wrap them"?

Edited by - Tornado on September 3, 2000 7:33:08 AM

Share this post


Link to post
Share on other sites
Anyone have any ideas?
But I don't want to waste memory... Anyone?
Thanks in advance

Edited by - Tornado on September 3, 2000 2:52:16 PM

Share this post


Link to post
Share on other sites
BTW, What do you mean "Make sure you clamp the texture values and don't wrap them"?

use GL_CLAMP not GL_REPEAT

vvvvvvv -- sorry didnt see the stuff in the first post

Edited by - zedzeek on September 4, 2000 6:45:19 AM

Share this post


Link to post
Share on other sites
Hi Tornado!

Use IDirect3DDevice7::SetTextureStageState() ... setting the state of D3DTSS_ADDRESS to D3DTADDRESS_CLAMP. Use the SDK - Help for further info on this. This will clamp your texture values to the range [0,1]. So, if the bilinear filtering tries to get information from outside that range, it will always read the border pixels. If you are using a single surface for this mouse pointer, then you should not use the ''waste memory'' approach, only use that when you have multiple images on a single texture. Due to hardware limits you would have been forced to go up to 64x64 ... not good. Also note, an alternative would have been to make the mouse pointer smaller 30x30 and use the remaining pixels for the duplication. That way you''d sacrifice image quality over texture space.

Hope this helps,

MK42

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!