![](/img/trans.png)
[英]C#, display and navigate structural 3D FEM model (helix-toolkit, SharpDX?)
[英]How to visualize 3D scalar field with Helix.SharpDX Volume Rendering?
我有一个任务是使用Helix Toolkit可视化标量的3D字段。 输入数组包含双重值而没有限制,但通常介于[-50000,+ 50000]之间。 标量值会影响立方体的颜色:最小值为蓝色,0 - 白色,最大 - 红色。 对应于该值插值所有其他颜色值。
现在我正试图了解Color Transfer Map在HelixToolkit.Wpf.SharpDX中的工作原理。 为此,我创建了一个2x2x1标量的简单字段。
MainWindow.xaml
<hx:Viewport3DX
Name="view1"
Grid.Row="1"
BackgroundColor="SkyBlue"
Camera="{Binding Camera}"
EffectsManager="{Binding EffectsManager}"
EnableDesignModeRendering="True"
UseDefaultGestures="False"
CameraRotationMode="Trackball">
<hx:Viewport3DX.InputBindings>
<KeyBinding Key="B" Command="hx:ViewportCommands.BackView" />
<KeyBinding Key="F" Command="hx:ViewportCommands.FrontView" />
<KeyBinding Key="U" Command="hx:ViewportCommands.TopView" />
<KeyBinding Key="D" Command="hx:ViewportCommands.BottomView" />
<KeyBinding Key="L" Command="hx:ViewportCommands.LeftView" />
<KeyBinding Key="R" Command="hx:ViewportCommands.RightView" />
<KeyBinding Command="hx:ViewportCommands.ZoomExtents" Gesture="Control+E" />
<MouseBinding Command="hx:ViewportCommands.Rotate" Gesture="RightClick" />
<MouseBinding Command="hx:ViewportCommands.Zoom" Gesture="MiddleClick" />
<MouseBinding Command="hx:ViewportCommands.Pan" Gesture="LeftClick" />
</hx:Viewport3DX.InputBindings>
<hx:VolumeTextureModel3D VolumeMaterial="{Binding VolumeMaterial}" />
</hx:Viewport3DX>
MainWindowViewModel.cs
public MainWindowViewModel()
{
Nx = 2;
Ny = 2;
Nz = 1;
var m = new VolumeTextureDiffuseMaterial();
var data = new[] {0.0f, 0.25f, 0.5f, 1.0f};
var gradients = VolumeDataHelper.GenerateGradients(data, Nx, Ny, Nz, 1);
m.Texture = new VolumeTextureGradientParams(gradients, Nx, Ny, Nz);
m.TransferMap = new[]
{Colors.Red.ToColor4(), Colors.Blue.ToColor4(), Colors.Lime.ToColor4(), Color4.White};
m.SampleDistance = 0.1;
m.Freeze();
VolumeMaterial = m;
}
我期待有4个不同颜色的不同立方体,例如(由于插值和采样,可能在立方体之间有渐变):
但我不断得到这种奇怪的三角形颜色组合:
颜色转移图数组的工作原理是什么? 如何使用HelixToolkit.SharpDX的体积渲染实现多维数据集的预期结果?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.