This is the discussion forum for Helix Toolkit.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
0

Transparent without colour problem

Anonymous 10 years ago 0
This discussion was imported from CodePlex

duongthaiha wrote at 2013-05-01 12:42:

Hi
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:

  1. Did you add lights to your model?
  2. 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))
0

Current position

Anonymous 10 years ago 0
This discussion was imported from CodePlex

eugenco wrote at 2012-06-10 16:00:

What is current position property and how to work with it.

0

Click Rotation

Anonymous 10 years ago 0
This discussion was imported from CodePlex

chimou wrote at 2013-05-14 18:52:

First of all I would like to thank you for this great job.
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!)
0

Wireframe Cube using PipeVisual3D or LinesVisual3D ?

Kumaran M 10 years ago 0
I am trying to create a wire-frame cube using PipeVisual3D. Everything works fine.
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?
0

How to Configure HelixToolkit in our project

Anonymous 10 years ago 0
This discussion was imported from CodePlex

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.

0

HelixToolkit.Wpf 'System.OutOfMemoryException' was thrown

Anonymous 10 years ago 0
This discussion was imported from CodePlex

Moez_rebai wrote at 2014-07-16 14:28:

Hello.
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:

I haven't used MeshVisual3D yet but I think it creates a geometry from your mesh. The geometry is made with cylinders and spheres for the vertices and edges. So each edge/vertex converts into several (maybe 10-50 times more complex). So I think it's normal for you to get that exception as your computer can't handle it.

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:

Thanks for your reply, but did you know how to create mesh from Positions and TriangleIndices using LinesVisual3D .

BogusException wrote at 2014-07-18 00:08:

@Moez_rebai,

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
:)
0

Exporting images from diffrent views of a 3D object

Samuel Medhat 9 years ago updated by ไอยดา สุรีวงค์ 4 years ago 1

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

0

Best way to draw a line

Anonymous 10 years ago 0
This discussion was imported from CodePlex

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.


baucez wrote at 2012-04-30 17:50:

Thanks objo,

your reply remember me that I already read something about this topic on Petzold blog but I don't remember it very much.
Probably you already read it too, however if it can be useful here is the post.

0

Adding color to point in mesh

Anonymous 10 years ago 0
This discussion was imported from CodePlex

VishwaPrasad wrote at 2014-07-23 14:17:

Hi,

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
0

AddPolygon wrong number of normals

Anonymous 10 years ago 0
This discussion was imported from CodePlex

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.