简体   繁体   中英

WPF 3D Dynamic Textures

I am writing a program (c# .NET 4.0 WPF 3D) that renders earth slices (like OpendTect's or Petrel's seismics module).

The problem is that I need to be able to zoom in deeply, and still see the details.

I tried putting a huge detailed texture (5000x5000), but it eats too much memory (200-300 MB), and crashes when I try to increase the size.

Now I want to see if there is any way of using something like a dynamic texture - the one that will change depending on distance to the camera.

Or maybe there is some other way of dealing with high-resolution surfaces?

I use this code to load texture:

wbm = new WriteableBitmap(
(int)1306*scale,
(int)ns*scale,
96,
96,
PixelFormats.Indexed8,
new BitmapPalette(getColors()));

...

visual3d.Material = visual3d.BackMaterial
= new DiffuseMaterial(new ImageBrush(wbm));

You have several options here:

  • Optimize current solution. 5000 * 5000 * 4 is around 100 MB. How do you load and show the texture? I have an app that renders up to 1100 3d objects and uses 300MB of memory and the performance is good enough. I strongly advice you to run a profiler, not only for pure performance reasons, but it helps to catch bugs! I my WPF 3D, thanks to the profiler I found that I was doing useless tessellation.
  • Create one low resolution image of whole texture and a few small high resolution images which are parts of the texture. If the user clicks/zooms-in you will load small high resolution image that will fit viewport. Similar effect to google maps.
  • Use XNA. You can host XNA inside WPF and use DXT texture. I'm not sure, but WPF doesn't support that texture formant directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM