For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
Transparent without colour problem
duongthaiha wrote at 2013-05-01 12:42:
I am new to Helix and trying to create a simple box with transparent at run time with C#. I can see the box showing with transparency but there is no colour on the box. I dont know if i did anything wrong in my small piece of code:
Objects = new ObservableCollection<Visual3D>();
Objects.Add(new GridLinesVisual3D());
var color = Color.FromArgb(0x80, Colors.Red.R, Colors.Red.G, Colors.Red.B);
var b = new BoxVisual3D()
{
Width = 10,
Length = 10,
Height = 10,
};
var brush = new SolidColorBrush();
brush.Color = color;
b.Fill = brush;
Objects.Add(b);
Thank you very much in advance.Best regards
objo wrote at 2013-05-08 15:37:
- Did you add lights to your model?
- I checked the
BoxVisual3D
class with
<ht:BoxVisual3D Width="10" Height="10" Length="10" Fill="#80FF0000"/>
and this works fine Note that you cannot get 100% correct visualization of transparency for a box in WPF...
You could also use the
ChangeAlpha
extension method: b.Fill = new SolidColorBrush(Colors.Red.ChangeAlpha(0x80))
Click Rotation
chimou wrote at 2013-05-14 18:52:
In my scene i have tow superposed CubeVisual3D like this :
<ht:CubeVisual3D x:Name="plateau" Width="140" Length="180" Height="15" Center="0 0 -5" TopFace="False" BottomFace="False" Fill="SteelBlue">
<ht:CubeVisual3D.Children>
<ht:GridLinesVisual3D Width="140" Length="180" MinorDistance="5" Center="0 0 -11" Fill="SteelBlue"></ht:GridLinesVisual3D>
</ht:CubeVisual3D.Children>
</ht:CubeVisual3D>
<ht:CubeVisual3D x:Name="Cover" Width="140" Length="180" Height="15" Center="0 0 10" TopFace="False" BottomFace="False" Fill="#4C58ABF0">
<ht:CubeVisual3D.Children>
<ht:GridLinesVisual3D Width="140" Length="180" MinorDistance="5" Center="0 0 17" Fill="SteelBlue" Thickness="1"></ht:GridLinesVisual3D>
</ht:CubeVisual3D.Children>
</ht:CubeVisual3D>
for this moment i rotate le outside CubeVisual3D called "Cover" like this :
<ht:BindableRotateManipulator x:Name="Rotation1" InnerDiameter="1" Diameter="5" Length="175" Position="0 70 2 " Color="SteelBlue"
Value="{Binding CoverRotateValue}"
Axis="-1 0 0" AllowDrop="True" TargetTransform="{Binding ElementName=Cover, Path=Transform}">
I want please enable rotation by a click on the Cube called "Cover", Is It possible ??
thank you in advance
objo wrote at 2013-06-07 11:54:
CubeVisual3D
is based on ModelVisual3D
and does not support click events. I think you need to create a Visual3D based on
ModelUIElement3D
to handle mouse clicks on a cube. Try setting
IsHitTestVisible = false
on the manipulator to disable it (but I think a "Enabled" property on the
Manipulator
class could be a good idea!)Wireframe Cube using PipeVisual3D or LinesVisual3D ?
I have to use 12 PipeVisual3D objects for a cube. But, if I use LinesVisual3D, then only one object is enough to draw that.
but the LinesVisual3D is not getting refreshed automatically. I am using mouse drag/drop event to draw a wireframe cube. After drawn, I have to zoom in/out using mouse wheel to refresh the view to get the LinesVisual3D object.
but PipeVisual3D is drawn while moving the mouse.
so, how to auto draw or refresh the LinesVisual3D manually?
How to Configure HelixToolkit in our project
GhufranZahidi wrote at 2012-11-15 06:59:
Hi I am New to WPF 3D please tell me How to Build Helixtooll kit with our project
objo wrote at 2012-11-15 19:53:
I recommend using the Nuget package!
The main solution has been ugraded to VS2012 and .NET 4.5, but there is also a solution for VS2010 and .NET 4.0.
HelixToolkit.Wpf 'System.OutOfMemoryException' was thrown
Moez_rebai wrote at 2014-07-16 14:28:
Sometimes i tried to add a Mesh3D to the Mesh property of a MeshVisual3D, I get this exception:
'System.OutOfMemoryException' was thrown'
The code
MeshGeometry3D modeltodraw = new MeshGeometry3D();
// fill modeltodraw
var originalMesh = new Mesh3D(modeltodraw.Positions, modeltodraw.TriangleIndices);
var bounds = originalMesh.GetBounds();
var l = Math.Max(bounds.Size.X, Math.Max(bounds.Size.Y, bounds.Size.Z));
model1.Mesh = null;
try
{
model1.Mesh = originalMesh;
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show( ex.Message);
}
The Mesh3D seems to be a little bit huge : Edges Count = 125631
Faces Count = 612956
Vertices Count = 125631
Any idea why i got this exception
Best Regards,
everytimer wrote at 2014-07-16 21:22:
If you really need to see your mesh I recommend LinesVisual3D. It's not the best but you will be able to see your huge mesh with that. Good luck
Moez_rebai wrote at 2014-07-17 09:25:
BogusException wrote at 2014-07-18 00:08:
Do you run Anvir, or even Task Manager to see which resources are expended? I think there is a memory debugger built into VS I read about, but never used. I use the threading one all the time, though. I think you can 'profile' your app, and it will show you over time how it is performing.
Check out the "ANALYZE" pull-down menu in VS, too!
pat
:)
Exporting images from diffrent views of a 3D object
Hello,
I'm using ModelViewer example to view 3D objects and extract PNG images for them. Is there a way to modify it so that when I extract an image it automatically rotates the object for 45 degrees , export another image and so on untill it completes 360 degrees? I.e. 8 images will be automatically produced for different views for the object.
Sincerly,
Samuel Farid
Best way to draw a line
baucez wrote at 2012-04-30 16:38:
Which is the best way to draw a line (with highest performances)?
PipeVisual3D
LinesVisual3D
Something else..
objo wrote at 2012-04-30 17:26:
it depends on what you need:
LinesVisual3D is using two triangles per line segment. But it needs to update the vertices every time you change your camera. Remember this visual is working in 'screen space'.
PipeVisual3D is using more triangles per segment, but does not need to update the vertices (it is defined in 'model space').
The 'screen space' visuals can handle a few thousand points, but I think it gets too expensive with really high number of points. Then I think it is better to let the gpu handle more triangles in 'model space'. Does anyone know a better way to solve this? It's too bad WPF 3D does not support line primitives.
Adding color to point in mesh
VishwaPrasad wrote at 2014-07-23 14:17:
I am using the wpf sharpDX libraries of Helix, I want to render the mesh with colore. I want add color to each point of mesh, I don't want to use the material for mesh.
Please help me, how to do that.
Thanks
Vishwa
AddPolygon wrong number of normals
murray_b wrote at 2012-01-30 05:07:
Hi
I am trying to display a mesh created from a polygon.
But when I run the toMesh I am getting the message "Wrong number of normals" And I am not sure what that message is referring to.
List<Point3D> vrt = new List<Point3D>(); // Create a list of Points for (int i = 0; i < set.Count(); i++) { vrt.Add( new Point3D ( (double)set[i].X, (double)set[i].Y, (double)set[i].Z )); } var surface = new MeshBuilder(); surface.AddPolygon(vrt); var mesh = surface.ToMesh();
Any help will be greatly appreciated. I am very new to WPF 3D and am finding the learning curve quite steep.
Thanks a lot
Murray
objo wrote at 2012-01-30 08:41:
hi Murray,
I see this can be a bit confusing, it should be improved..
The parameterless MeshBuilder constructor will create a mesh with both normals and texture coordinates. The AddPolygon will currently only add vertices, not normals and texture coordinates.
I think changing the constructor to
new MeshBuilder(false,false)
should work.
I think there are two possible improvements here
a. Let AddPolygon calculate normals and texture coordinates if this is requested
b. Remove the parameterless constructor of MeshBuilder - so you _have to_ specify if normals/texture coordinates should be generated
murray_b wrote at 2012-01-31 09:07:
Thanks for the quick reply Objo
That fixed the error I was getting.
Great work!
murray_b wrote at 2012-01-31 09:34:
Objo
When the meshbuilder now creates the mesh I can only see it from one side.
How do I get the meshbuilder to generate a mesh that I can rotate around and see from both sides?
Regards
Murray
objo wrote at 2012-01-31 10:01:
Remember to set the BackMaterial, it can be the same as the (front) Material.
Customer support service by UserEcho