Jump to content
  • Advertisement
Sign in to follow this  
AvengerDr

Texture Problem

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

Hello there, I was trying to create a sky-box. As texture I wanted to use the result of several pixel shader which modified a noise image to generate a procedural starfield. The texture is created with levels 0 and Usage.Rendertarget. So when i use device.SetTexture(0, myTexture) to map the insides of the skybox, If I move the camera I get garbage results. As you can see from the image: The texture (ignore the seams, I've not yet got around to do that) is mixed with another texture (the earth texture). The problem is that if I remove the code that loads that earth texture from disk, the result is the same. So it must be some memory problem or something like that. The problem is also connected with the MipMap levels: if I set levels to 1, it works fine but I get some unwantend "blinking" effect (I suppose it's due to the fact that the mip map levels are too low), if I set them to 0 or >1 I get the result you can see. If I save the texture to disk and then reload it (via TextureLoader.FromFile(...)) everything works fine. So I'm guessing the problem is also related to the fact that the texture is created as a rendertarget in the backbuffer.. So I guessed that I would just have to copy the texture in a non-rendertarget one to avoid the problem. But how can I do that? Using: starfield = TextureLoader.FromStream(device, TextureLoader.SaveToStream(ImageFileFormat.Png, background)); does not work.. So does anyone recognize the problem? Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Problem solved! As I eventually learned, mip maps are not automatically generated for render targets textures. The problem became visible because I tried to blend a texture with a scaled up texture (that did not have mipmap generated).

To solve this problem I just had to set Usage.RenderTarget | Usage.AutoGenerateMipMap..

Thanks anyway :)

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.

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!