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

How to fill with tile texture?

Anonymous 10 years ago updated by Michael Powell 9 years ago 2
This discussion was imported from CodePlex

veerammalkumaran wrote at 2014-08-01 08:53:

I want to fill a polygon with image (tile).

below is my XAML
         <h:HelixViewport3D Name="viewPort3D" >
            <h:SunLight />
            <ModelVisual3D x:Name="vis3D">
            </ModelVisual3D>
         </h:HelixViewport3D>
below is my code
            var mb = new MeshBuilder(false, true);

            IList<Point3D> pnts = new List<Point3D>();
            pnts.Add(new Point3D(0, 0, 0));
            pnts.Add(new Point3D(100, 0, 0));
            pnts.Add(new Point3D(100, 100, 0));
            pnts.Add(new Point3D(0, 100, 0));

            mb.AddPolygon(pnts);

            var mesh = mb.ToMesh(true);

            ImageBrush brush = new ImageBrush();
            brush.ImageSource = new BitmapImage(new Uri(@"C:\box.jpg"));
            brush.TileMode = TileMode.Tile;
            brush.ViewportUnits = BrushMappingMode.Absolute;
            brush.ViewboxUnits = BrushMappingMode.Absolute;
            brush.Stretch = Stretch.None;
            brush.AlignmentX = AlignmentX.Left;
            brush.AlignmentY = AlignmentY.Top;
            brush.Viewport = new Rect(0, 0, brush.ImageSource.Width, brush.ImageSource.Height);
            DiffuseMaterial mat = new DiffuseMaterial(brush);

            GeometryModel3D gModel3D = new GeometryModel3D { Geometry = mesh, Material = mat };

            vis3D.Content = gModel3D;
The above code doesn't work. What I missed in this?

veerammalkumaran wrote at 2014-08-01 10:12:

This is the output window I am getting


below is the box.jpg


veerammalkumaran wrote at 2014-08-14 06:53:

I have found the solution and the detailed code is available here
http://uselesstechnical.wordpress.com/2014/08/14/helix-3d-toolkit-tile-texture/
0

HalfEdge mesh representation

Anonymous 10 years ago 0
This discussion was imported from CodePlex

govert wrote at 2012-02-03 13:57:

HalfEdge-based representations of unstructured polygonal meshes are common in contemporary mesh processing libraries like OpenMesh, VCG and CGAL. A previous discussion here mentioned the HalfEdge representations briefly, and I wanted to add some links I've run into recently and start a discussion on the topic, as some integration of such representations and related algorithms into the Helix Toolkit would be great (though not an urgent priority for me).

The typical HalfEdge implementations are template heavy C++ code, using traits to embed additional data into the structures. This makes the conversion of such data types to .NET quite tricky, though keeping some compatibility with the C++ data structures can be useful to ease porting of the processing algorithms to .NET.

Having a look around a bit, I found this article by Alexander Kolliopoupos which discusses the implementation issues and suggests an elegant implementation in C#: http://www.dgp.toronto.edu/~alexk/halfedge.pdf. He also has an open source (liberal zlib/libpng license) library that implements these data structures here: http://www.dgp.toronto.edu/~alexk/lydos.html. It doesn't look like it is actively maintained, but might be a good start for integrating such a mesh representation into the Helix Toolkit.

If other users have some experience working with HalfEdge or related mesh representations in .NET, I'd be interested in any pointers. I'm particularly interested in pragmatic algorithms for model repair, smoothing and simplification. I also wonder what people think about implementing these in C# vs. wrapping one of the C++- based libraries in a .NET wrapper. (The GPL licensing of the existing libraries is a bit of a problem for me.)

Any thoughts appreciated...


objo wrote at 2012-02-03 14:09:

This looks very interesting! Will have a look at Kolliopoulos' article and code.


objo wrote at 2012-02-21 21:29:

I tried to make a naive halfedge class using LINQ, but don't have time to finish it right now. I checked it into the examples anyway. See HalfEdgeMeshDemo. I hope to continue this class later, it's an interesting algorithm to explore :)

At this point I did not include any generic traits (as the referenced libraries do) and did not focus on performance, I just wanted to see if I could get the data structure right. I also added a Visual3D class that lets you point and click to see adjacent vertices/edges/faces.

0

Texture Can't be seen after loading

Anonymous 10 years ago 0
This discussion was imported from CodePlex

charismatubagus wrote at 2013-01-23 15:31:

Hi,

I have successfully displayed a 3ds file in my WPF scene. But, the material color is just black and no texture is applied on it. 

 

<h:FileModelVisual3D x:Name="model3D" >
                <h:FileModelVisual3D.Transform>
                    <Transform3DGroup>
                        <ScaleTransform3D ScaleY="5.0" ScaleX="3.0" ScaleZ="2.0"/>
                        <TranslateTransform3D OffsetX="0" OffsetY="3" OffsetZ="0"/>
                        
                    </Transform3DGroup>
                </h:FileModelVisual3D.Transform>
</h:FileModelVisual3D>
How can I load the texture as well automatically? Thanks in a million.

objo wrote at 2013-01-23 20:21:

is the texture in .tga format? .tga is not supported. Change the images to .png, and the importer will replace .tga with .png in the file names when loading the textures...


charismatubagus wrote at 2013-01-25 07:53:

The texture format is jpg. So you're saying I just need to convert the image format into png?


objo wrote at 2013-02-04 15:15:

No, JPEG should be supported. Then I think the error is somewhere else. Can you debug the code? Check if the image is loaded correctly. Set a breakpoint on line 527 in StudioReader.cs

zoras wrote at 2013-06-02 21:29:

I say sorry if i'm replying to a post a little bit old, ma my issue is nearly similar to this one.

My problem:
I'm reading all the .3ds and .obj file in the execution folder and loading them in a list where i can choose the one i want and show it in an HelixViewPort3D. All this part goes really well, the problem is with the texture. I don't see them at all :(
the way i'm loading the models:
FileModelVisual3D MyModel = new FileModelVisual3D();
MyModel.Source = MODELS[i];   //where MODELS[i] is a string containing the path of a model (i.e. .../.../ship.3ds)
this.view1.Children.Add(MyModel);   //where view1 is my HelixViewPort3D
I also read in this forum that i can use the StudioReader. Well, i tried, but i cannot figure out on how convert the Model3D from the reader into something Visual that i can then add as a children to my viewport.
I also tried to use a ModelVisual3D in the .xaml file, like in this sample http://helixtoolkit.codeplex.com/discussions/354077, binding its content to MyModel, but it doesn't work for me, for two reasons: first of all it does not load the .obj file; second one, when it loads a .3ds, in the viewport i cannot see nothing :(

pls help! :(

i just want to show or attach the texture to my model! :)

thanks so much for the library!

objo wrote at 2013-06-08 07:24:

Do you have lights in your scene?
I recommend setting a breakpoint on line 527 in StudioReader.cs, then you can check if the texture is loaded correctly!
0

meshbuilder use in SurfacePlotDemo

Anonymous 10 years ago 0
This discussion was imported from CodePlex

lizichao wrote at 2011-07-09 10:44:

How to use meshbuilder in SurfacePlotDemo? I guess there should be a subclass of ParametricSurface3D. But I didnt find it.

Thanks.

 

Best regards!


objo wrote at 2011-07-11 11:58:

hi Lizichao,
I combined both the surface and the axes into the SurfacePlotVisual3D class in the demo. You can define the surface simply by setting the Points property.
This demo is currently not working with other Visual3Ds, but the plan is to move the axis visuals over to the HelixToolkit to make it easier to reuse!

0

VB.net simple program

Anonymous 10 years ago 0
This discussion was imported from CodePlex

rinaldin wrote at 2013-09-25 17:09:

Hi all,
I'm new to the Helix 3D Toolkit, and I just want to use it in VB.net programs. I started a new WPF project, referenced the libraries needed, and added the following code:
Imports System
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Media
Imports System.Windows.Media.Media3D
Imports HelixToolkit.Wpf

Class MainWindow
    Dim visualChild As New ModelVisual3D
    Dim plotmodel As New Model3DGroup

    Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded

        Dim label1 As GeometryModel3D = TextCreator.CreateTextLabelModel3D("test", Brushes.White, True, 32,
                                                           New Point3D(0, 0, 0),
                                                           New Vector3D(1, 0, 0), New Vector3D(0, 1, 0))
        plotmodel.Children.Add(label1)
        visualChild.Content = plotmodel
        HelixViewport3D1.Children.Add(visualChild)

    End Sub

End Class
The XAML code is:
<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Prova" Height="378" Width="605" xmlns:h="http://helixtoolkit.codeplex.com" WindowStartupLocation="CenterScreen">
    <Grid>
        <h:HelixViewport3D HorizontalAlignment="Stretch" Name="HelixViewport3D1" VerticalAlignment="Stretch" Background="Black" Margin="0" TextBrush="White" CoordinateSystemLabelForeground="White" InfoForeground="White" />
    </Grid>
</Window>
I get no error messages, but I expect to see in the viewport the string "text", but nothing happens! Can you help me please? I think this thread would be very important for who wants to start developing with Helix in VB.net.

Thank you,
Giovanni

rinaldin wrote at 2013-09-25 21:30:

SOLVED

I think there's a bug in the Helix code, because the code I posted worked fine, exept for the TextColor property in the line:
Dim label1 As GeometryModel3D = TextCreator.CreateTextLabelModel3D("test", Brushes.White, True, 32,
The value Brushes.White has no effect!!! The text is still rendered in black. I try to modify also the HelixViewport3D1.TextBrush property, but still no changes!

I'm opening a new issue on this site.

Giovanni

objo wrote at 2013-09-25 23:16:

Did you remember to add light(s) to your scene?

rinaldin wrote at 2013-09-26 10:46:

Thank you, solved. I added the line:
plotmodel.Children.Add(New AmbientLight(Colors.White))
and all text has the proper color.
0

3dxml?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

Provagino wrote at 2011-10-06 21:16:

Can i import files in 3DXML?


objo wrote at 2011-10-06 22:29:

http://en.wikipedia.org/wiki/3DXML ?

No, 3DXML is not implemented.

0

holes in the box

Anonymous 10 years ago 0
This discussion was imported from CodePlex

DongMini wrote at 2012-08-02 02:07:

Hi, First, great toolkit, thank you! 

 

holes in the box, what should I do?


objo wrote at 2012-08-09 00:48:

The best solution would be to create a MeshGeometry where the holes are modelled. It should not be difficult to do the tessellation if the holes have regular shape.

I would not recommend using textures with transparency to show 'holes' with wpf 3d...


DongMini wrote at 2012-08-09 02:46:

 

var point3d_Out = new[] {new Point3D(0, 0, 0), new Point3D(6, 0, 0), new Point3D(4, 3, 0), new Point3D(6, 7, 0), new Point3D(0, 7, 0)};

var point3d_Hole = new[] {new Point3D(1, 2, 0), new Point3D(3, 2, 0), new Point3D(2, 4, 0), new Point3D(3, 5, 0), new Point3D(1, 5, 0)};

 

 

 

The hole was created by using CuttingEarsTriangulator.Triangulate to you Is there any plan to support.


objo wrote at 2012-08-09 08:48:

I don't think the ear clipping method supports holes (http://en.wikipedia.org/wiki/Polygon_triangulation).

I have not planned to implement other triangulation methods, but maybe you can use code from other .net libraries?


DongMini wrote at 2012-08-10 02:23:

 

Other ". NET libraries" could not be found

hard to sell in the hole  wpf3d


I can not speak English well.
So, more brutal.
google translator, I can not thank you enough  

 

^^;; Hahaha


Thank you so much for letting me answer


0

How to create a circle in 3D with known center point and it is on a plane which perpendicular to a line?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

chinh_nguyen wrote at 2013-01-07 13:15:

Hi all, I am newbie in term of 3D programming with WPF, so please bear with my beginner question: how to create a circle in 3D with known center point and it is on a plane which perpendicular to a line?


chinh_nguyen wrote at 2013-01-09 10:15:

Found the answer when asking in stackoverflow, post here in case anyone interested:

http://stackoverflow.com/questions/14195196/how-to-create-a-circle-in-3d-with-known-center-point-radius-and-it-is-on-a-plan

0

Getting started guide

Anonymous 10 years ago 0
This discussion was imported from CodePlex

lightxx wrote at 2012-11-29 07:28:

Hi guys!

I just stared using helix and WOW is this toolkit powerful. Probably a bit too powerful for programmers inexperienced in 3D modeling like me.

Are there any good primers for the Helix 3D Toolkit? A getting started guide, some sort of walk through or whatever? I tried to find something on google but failed.

 

thanks!


objo wrote at 2012-11-30 18:10:

I recommend Charles Petzold's book "3D programming for Windows".

In this library, the examples are probably the best ways to learn how to use it. All classes should also be XML commented, giving you some info through intellisense.


lightxx wrote at 2012-12-01 16:23:

thank you very much!

0

SharpDX -- MeshGeometry3D -- Normals property

Anonymous 10 years ago 0
This discussion was imported from CodePlex

eonxxx wrote at 2014-03-09 15:19:

hi there,

in helixwpf, the Normals property for a MeshGeometry3D are provided as a sequence of String as follows:
 <MeshGeometry3D Normals="0,1,0 0,1,0 0,0.99620003,-0.087200001 0,0.99620003,-0.087200001 1,0,0 1,0,0 1,0,0 1,0,0 0,-1,0 0,-1,0 0,-0.99620003,0.087200001 0,-0.99620003,0.087200001 -1,0,0
-1,0,0 -1,0,0 -1,0,0 0,0.98479998,-0.1736 0,0.98479998,-0.1736 1,0,0>
...for example.
In the SharpDF version of MeshGeometry3D I'll get an error, says TypeConverter isn't able to convert the sequence to Vector3D[].

The MeshGeometry3D is the result of an import of wavefront.obj model into VSBlend.
Someone has any ideas?