简体   繁体   English

WPF 3D动态纹理

[英]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). 我正在编写一个渲染地球切片的程序(c#.NET 4.0 WPF 3D)(如OpendTect或Petrel的地震模块)。

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. 我尝试了一个非常详细的纹理(5000x5000),但它吃了太多的内存(200-300 MB),并在我尝试增​​加大小时崩溃。

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. 5000 * 5000 * 4大约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. 我有一个应用程序 ,可以渲染1100个3d对象并使用300MB内存,性能足够好。 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. 我的WPF 3D,感谢分析器,我发现我做了无用的细分。
  • 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. 使用XNA。 You can host XNA inside WPF and use DXT texture. 您可以在WPF中托管XNA并使用DXT纹理。 I'm not sure, but WPF doesn't support that texture formant directly. 我不确定,但WPF不直接支持纹理共振峰。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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