Jump to content
  • Advertisement
Sign in to follow this  
lipsryme

Horrible Artifacts, reading Texture Color Channels

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

I'm getting horrible artifacts while reading color channels of some textures (DDS, BMP, TGA,...) in my PixelShader. I tried saving it as PNG, which somehow works, but I can't just do everything in PNGs, plus I need the extra alpha/greyscale channel.

Can someone tell me what I'm doing wrong here?
I tried various options in the content explorer but nothing works.

Here's the output of a channel from a texture:
http://cl.ly/412n2a0H1r3T2N3S470p

Reading the texture with linear filtering makes those blocks turn into some kind of sphere artifacts.
What the hell is that ?

edit: Sorry forgot to say I'm using XNA 4.0

Share this post


Link to post
Share on other sites
Advertisement
I suspect what's going on is that the texture is being converted to a DXT compressed format, and is being dithered during conversion. This is usually a good thing as the compression ratio is up to 8:1 and the artefacts aren't usually visible when used as a normal texture at a decent resolution.

However it looks like you're mapping the texture so that there's only a handful of texels across the whole screen, which makes the dithering much more obvious.

Unfortunately I don't know enough about XNA to tell you how to turn that off.

Share this post


Link to post
Share on other sites
Well I'm using the texture either as normal or as a specular map (in the picture above) so I'm not sure what you mean by the mapping part.
Changing the texture size doesn't help either.

This seems to be on every map I use.
Except albedo textures, being PNG and all...

Share this post


Link to post
Share on other sites
Hurray, got it fixed. The solution was quite easy though not clear to someone who knows almost nothing about XNA's content import pipeline programming tongue.png
The problem was indeed the dxt compression, but in my content pipeline code there were those few lines missing, which made it impossible to change anything:

OpaqueDataDictionary processorParameters = new OpaqueDataDictionary();
processorParameters["ColorKeyColor"] = this.ColorKeyColor;
processorParameters["ColorKeyEnabled"] = this.ColorKeyEnabled;
processorParameters["TextureFormat"] = this.TextureFormat;
processorParameters["GenerateMipmaps"] = this.GenerateMipmaps;
processorParameters["ResizeTexturesToPowerOfTwo"] =
this.ResizeTexturesToPowerOfTwo;



I guess that's what you get for blindly copying code from other people's projects : /

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!