For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
3d cube with colored cells
I am working on a code to build a 3D cube that has mesh/cell in each direction and each cell has its own color. now i sue this method which produces exactly what i want:
private void BuildCustomCube22(int x, int y, int z)
{
double cubeSize = 1.0; // Size of each cube cell
Random random = new Random();
var modelGroup = new Model3DGroup();
for (int i = 0; i < x; i++)
{
for (int j = 0; j < y; j++)
{
for (int k = 0; k < z; k++)
{
var position = new Point3D(
i * cubeSize + cubeSize / 2,
j * cubeSize + cubeSize / 2,
k * cubeSize + cubeSize / 2);
// Generate a random color for each cube
Color color = Color.FromRgb((byte)random.Next(256), (byte)random.Next(256),
(byte)random.Next(256));
var cube = new BoxVisual3D
{
Center = position,
Width = cubeSize,
Height = cubeSize,
Length = cubeSize,
Material = MaterialHelper.CreateMaterial(color),
};
// Add the cube to the model group
modelGroup.Children.Add(cube.Model);
}
}
}
// Add the model group to the viewport
viewport.Children.Add(new ModelVisual3D { Content = modelGroup });
}
and the result is:

The issue is when i increase mesh like 100*100*100, i get very poor performance like not being able to easily zoom in/out or move object around. I wonder how can i achieve the result i want event with high number of cells with no lag.
P.S: somebody told me: You are making way too many models. You can try to use Helix toolkit sharpdx version with instancing rendering capability
but i don't know if it can solve my issue and i don't know how to implement it.
Is it possible to draw a simple text
Hi,
I want to draw a text with helix anny suggestions how to do that?
Greeting Michael
Rotating Label
Hi, I made an application which render a panel that might have different texture on each side. The model is free of rotation over all axes. My boss asked me if would be possible to identify each panel side with a label (one digit for each side) and let it rotate with the panel... but sincerely I dunno how to achieve this, expecally to keep each label "in front" of the view point.
Any hints?

Can helix toolkit be used with .NET 5.0? And which nuget SharpDX package should be used?
Hi,
I'm guessing helix toolkit can be used with .NET 5.0 because it works in my wpf project - but i did notice in the package tab it says "Package 'HelixToolkit.Wpf.2.17.0 " was restored using .NetFramework.Version=4.6.1, etc.""
I wasn't 100% sure which nuget package to use - the "HelixToolkit" or "HelixToolkit.Wpf".
And at the link https://github.com/helix-toolkit/helix-toolkit there are a list of sharpDX packages and wasn't sure whether to use HelixToolkit.SharpDX.wpf or HelixToolkit.SharpDx.core.
Thanks.
HelixToolKit 3d How to add shadows?
I'm building an engine with helix toolkit, but I can't add shadows, I'm new to helix, and I need your help, please.......
How can I draw many circles with SharpDX
Hi,
I want to draw many circles on the viewport.
Each circle should have a differnt color.
How can I do that.
I try it with the LineBuilder but then circle has many colors.
foreach (var _ in Lines.LineGeometry.Lines)
{
var color = GetNewColor(); //Ttis method just return a clolor
Lines.LineGeometry.Colors.Add(color);
Lines.LineGeometry.Colors.Add(color);
}
Any suggestions?
How can I zoom in and out in Helix with SharpDX with C#
I try to zoom in and out in the code behind.
<hx:Viewport3DX
Name="Viewport"
BackgroundColor="Black"
Camera="{Binding Camera}"
EffectsManager="{Binding EffectsManager}"
ShowViewCube="False">
</hx:Viewport3DX>
public OrthographicCamera Camera { get; }
public void ZoomIn()
{
var newPosition = new Point3D(Camera.Position.X, Camera.Position.Y, Camera.Position.Z * 1.5);
Camera.AnimateTo(newPosition, Camera.LookDirection, Camera.UpDirection, 500);
}
but nothing changed.
The Camera.Position.Z was changed but not the view of hte application.
Any suggestions?
Greeting Michael
How to invert Zoom In/Out with MouseWheel ?
Hello,
How can I invert to Zoom In/Out Direction with the MouseWheel?
I want zoom in if I scroll down with the mouse wheel and zoom out if I scroll up with the mousewheel.
How can I solve this?
regards, mx
Draw Triangle from "for cycles" iusse
I need to draw from code behind, (not from xaml), a large number of triangle. For calculation I calc half Triangleindices with a for cycle and the other half with another. Here the code : xaml:
<Window x:Name="MainWindowX" x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:HelixTest"
xmlns:HelixToolkit="clr-namespace:HelixToolkit.Wpf;assembly=HelixToolkit.Wpf"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<HelixToolkit:HelixViewport3D Name="myviewport" ZoomExtentsWhenLoaded="True" Background="Black" ShowCoordinateSystem="True" >
<!-- Remember to add light to the scene -->
<HelixToolkit:SunLight/>
<ModelVisual3D>
<ModelVisual3D.Content>
<GeometryModel3D x:Name="myGeometryModel3D">
<GeometryModel3D.Geometry>
<MeshGeometry3D x:Name="myMeshGeometry3D">
</MeshGeometry3D>
</GeometryModel3D.Geometry >
<GeometryModel3D.Material>
<MaterialGroup>
<DiffuseMaterial>
<DiffuseMaterial.Brush>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="red" Offset="2" />
<GradientStop Color="Red" Offset="3" />
<GradientStop Color="Blue" Offset="4" />
<GradientStop Color="LimeGreen" Offset="5" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</DiffuseMaterial.Brush>
</DiffuseMaterial>
</MaterialGroup>
</GeometryModel3D.Material>
</GeometryModel3D>
</ModelVisual3D.Content>
</ModelVisual3D>
<HelixToolkit:BillboardTextVisual3D Position="11 0 0" Text="X" Foreground="Yellow"/>
<HelixToolkit:BillboardTextVisual3D Position="0 11 0" Text="Y" Foreground="Yellow" />
<HelixToolkit:BillboardTextVisual3D Position="0 0 11" Text="Z" Foreground="Yellow"/>
</HelixToolkit:HelixViewport3D>
</Grid>
and vb.net code behind
Imports System.Windows.Media.Media3D
Imports HelixToolkit
Class MainWindow
Dim punti = 5
Dim curve = 5
Dim valori As New List(Of Integer)
Dim indices As New List(Of Integer)
Dim triangoli = (punti - 1) * (curve - 1) * 2
Private Sub MainWindowX_Loaded(sender As Object, e As RoutedEventArgs) Handles MyBase.Loaded, MyBase.Loaded
myMeshGeometry3D.Positions.Clear()
myMeshGeometry3D.TriangleIndices.Clear()
valori.Add(0)
valori.Add(1)
valori.Add(2)
valori.Add(3)
valori.Add(3)
valori.Add(0)
valori.Add(1)
valori.Add(2)
valori.Add(3)
valori.Add(3)
valori.Add(0)
valori.Add(1)
valori.Add(2)
valori.Add(3)
valori.Add(3)
valori.Add(0)
valori.Add(1)
valori.Add(2)
valori.Add(3)
valori.Add(3)
valori.Add(0)
valori.Add(1)
valori.Add(2)
valori.Add(3)
valori.Add(3)
'load myMeshGeometry3d.Positions
For I = 0 To curve - 1
'per ogni curva
For b = 0 To punti - 1
myMeshGeometry3D.Positions.Add(New Point3D(b, I, valori(I * punti + b)))
Next
Next
'First half
For d = punti + 1 To triangoli - 2 Step punti
For f = 0 To punti - 2 Step 1
myMeshGeometry3D.TriangleIndices.Add(d + f)
myMeshGeometry3D.TriangleIndices.Add((d - 1) + f)
myMeshGeometry3D.TriangleIndices.Add((d - punti) + f)
Next
Next
'second half
For j = 0 To triangoli Step punti
For i = 0 To punti - 2 Step 1
myMeshGeometry3D.TriangleIndices.Add(j + i)
myMeshGeometry3D.TriangleIndices.Add((j + 1) + i)
myMeshGeometry3D.TriangleIndices.Add((j + punti) + i)
Next
Next
End Sub
End Class
My iusse is that only the triagles that are generate from the first cycle are showed, the second not. I tried to swap the cycle and they are both correct. I also tryed to add 2 button, one for cycle. they work to show half triangle, but only it first I clear the triangleindices.What am I missing? Any advice?
Customer support service by UserEcho