I've been working for some time on rendering with XNA GIS data, especialy WMS tiles. I tried to do something like NASA World Wind or Virtual Earth. I downloaded png files from the WMS server and loaded them using Texture2D.FromFile method. Because there were so many textures, I had to develop a method to load/unload them at runtime.
The problem was that Texture2D.FromFile performance was very poor. I did some research, and saw that NASA World Wind caches the textures in a .dds file. Direct Draw Surface format.It had to work better with dds files than with png (which is a compressed format by the way, and of course we expect the decoding to take some time...).
So I tried to convert the received png file into a dds format, in order to increase tile cache access speed when loading/unloading images. I did something like this:
Texture = Texture2D.FromFile(device, "image.png");
Texture.Save("image.dds", ImageFileFormat.Dds);
When calling Texture2D.FromFile(XnaFactory.Device, "image.Dds"), the performance was greatly improved. When you load the texture at first, from the png file, or whatever other format, you can also specify TextureCreationParameters. For example I use
TextureCreationParameters.SurfaceFormat = SurfaceFormat.Dxt1 so the textures will be compressed.
Also, the resulting dds file would give you a good approximation about how much memory would be used in the graphic card for the texture.
Subscribe to:
Post Comments (Atom)
1 comment:
I was very happy because I could find this very good information
thank you very much for sharing this interesting thing with us.
greetings and good luck always
Obat Gabagen Cara Mengatasi Perut Kembung Akibat Maag Cara Menghilangkan Uci Ucis Obat Kerumut Obat Luka Diabetes Cara Cepat Mengobati Benjolan Di Vagina Cara Mengatasi Campak Pada Anak Secara Alami Cara Mengatasi Vagina yang Gatal Cara Menghilangkan Bisul Di Kepala) Cara Menurunkan Kadar Trigliserida Tinggi
Post a Comment