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

Cuttingplane demo

Anonymous 10 years ago 0
This discussion was imported from CodePlex

etick wrote at 2013-02-16 11:56:

Great work on this, will tryuto create a IFC importer for it and create some functions to select objects that can be manipulated (Hide, Transparent etc..)

But have a question about the cutting plane demo!

Is it possible to draw the wall transparent or an simple axis where the cutting planes are.
And how can you manipulate them (move, add, remove)

objo wrote at 2013-03-12 11:44:

Yes, it should be possible to add a (semi-)transparent plane and a TranslateManipulator to do this. Use bindings to control the cutting plane. See the Manipulator example in the 'Example Browser'!
0

Light problem in Helix Sharp DX

Amit Pathak 9 years ago updated 9 years ago 1

Hello,

I am trying to build an obj file viewer using Helix Toolkit with SharpDX. So far I am able to load an object file and render it's contents to Helix Viewport3DX. Model looks good with some obj files but for others there are some lightning problem and back surfaces are always black. I am not sure what am I doing wrong. Is this light problem due to the fact that SharpDX does not support back materials??


Problem using Helix Sharp DX:

Image 21


Original model looks like this in Adobe DC Reader:

Image 22


Viewport3DX settings are:


<Window.Resources>

<DataTemplate x:Key="Template1">
<hx:MyMeshGeometryModel3D Geometry="{Binding Geometry}" Transform="{Binding Transform}" Material="{Binding Material}"/>
</DataTemplate>
<hx:RenderTechniqueConverter x:Key="RenderTechniqueConverter"/></Window.Resources>

<hx:Viewport3DX x:Name="helixViewport"

Camera="{Binding Camera}" CameraRotationMode="Trackball"
RenderTechnique="{Binding RenderTechnique}"
RenderTechniquesManager="{Binding RenderTechniquesManager}"
EffectsManager="{Binding EffectsManager}"
BackgroundColor="{Binding BackgroundColor}"
UseDefaultGestures="False">
<hx:Viewport3DX.InputBindings>
<MouseBinding Gesture="LeftClick" Command="hx:ViewportCommands.Rotate"/>
<MouseBinding Gesture="MiddleClick" Command="hx:ViewportCommands.Zoom"/>
<MouseBinding Gesture="RightClick" Command="hx:ViewportCommands.Pan"/>
</hx:Viewport3DX.InputBindings>
<hx:AmbientLight3D Color="{Binding AmbientLightColor}"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor1}" Direction="-1,-1,-1"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor2}" Direction="1,-1,-0.1"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor3}" Direction="0.1,1,-1"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor4}" Direction="0.1,0.1,1"/>
<hx:ItemsModel3D x:Name="itemsModel3d" ItemTemplate="{StaticResource Template1}" ItemsSource="{Binding Items}/">
</hx:Viewport3DX>
0

relationship between HelixViewPort3D and ViewPort3D

Anonymous 10 years ago 0
This discussion was imported from CodePlex

Mrme wrote at 2013-08-05 11:09:

Hi, I hope someone would reply me this time, I don't understand the relationship between these two controls, there is a read only Viewport3D property for the HelixViewPort3D (thus we can't assign it a value), we can't have Viewport3D as a children/content for HelixViewPort3D. then when I export a HelixViewPort3D content to XAML file , I get instead a normal Viewport3D control. of course now the problem I want to load this back, since the Viewport3D property of HelixViewPort3D is read only I can't apply back this Viewport3D to the main HelixViewport3D , is there is any thing that I don't know or this is a bug needs to be corrected ? like not making the Viewport3D property of the HelixViewPort3D as read only ? any "comment" would be appreciated

Mrme wrote at 2013-08-06 10:17:

I found out there is no reason , at least at this stage , for the Viewport3D property on the HelixViewPort3D to be read only, I changed that and I made a new constructor for the HelixViewPort3D that takes a Viewport3D as an argument, so I extract my Viewport3D from the exported ResourceDictionary , I make a new HelixViewPort3D and I pass my Viewport3D to the constructor, that successfully load back my scene, I would like to submit these changes as well if there was really no reason to make the Viewport3D property read only in the first place.

objo wrote at 2013-08-08 08:26:

Yes, it should be possible to replace the Viewport3D control after the HelixViewport3D has been created, but I think you have to be careful with the Children collection and the cameras.
But do you need to replace the Viewport3D? Isn't it easier to replace the content of the viewport and update the properties of the camera?

Mrme wrote at 2013-08-08 10:41:

Viewport.Children is also read only, replacing the Viewport3D loaded the scene , but the CoordinateSystem control and the direction cube are not associated with this Viewport3D anymore, an overloaded constructor did the trick, you are right that the cameras are not preserved but that is not an issue, I don't see why I should worry about the Children collection ? I will keep experimenting and I will update the thread.
0

How to get the viewport 2D coordinates from a Point3D and viceversa?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

fdhaene wrote at 2012-10-25 18:32:

Hi,

Is it possible to get the Viewport3D screen 2D coordinates from a Point3D and

viceversa: getting the Point3D from a 2D point in the Viewport3D.

thanks,

Filip 


objo wrote at 2012-10-26 08:53:

See Viewport3DHelper.Point2DtoPoint3D and Viewport3DHelper.Point3DtoPoint2D


fdhaene wrote at 2012-10-26 10:10:

Hello, I'm trying to convert a 2D screen coordinate to a Point3D in the Viewport. But the following code don't give any result. How exactly should I get the 3D coordinates from 2D screen coordinates with this function?
 Point3D p1, p2;
 Point pIn = new Point(3, 3);
 if (Viewport3DHelper.Point2DtoPoint3D(viewport3D.Viewport, pIn, out p1, out p2))
 {
      MessageBox.Show(p1.X.ToString() + "," + p1.Y.ToString());
 }
In the HelixToolit source code the Viewport3DHelper.Point2DtoPoint3D function has no inverse of the matrixCamera and returns with false
thanks, filip

objo wrote at 2012-11-02 22:36:

hi Filip, if your MatrixCamera has no inverse for the view/projection matrix I don't think it will be possible to un-project the point...

0

taking care of transforms with GetContourSegments and multiple models?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

3dguy wrote at 2013-04-11 00:12:

I'm trying to us GetContourSegments as shown in the Contour example but it doesn't seem to apply post transform. I've examined the code and it appears Visual3DHelper.Traverse<GeometryModel3D>(model1, this.AddContours); should take care of transforms?

I put out the example below and it gives the contours for the original sphere and not the end resulting scaled sphere.

Also is there a way to compute contours of a model group or is the only way computing contours of each object then joining them together?

Thanks.

Code:
        //add a sphere to the model
        MeshBuilder myMeshBuilder = new MeshBuilder();
        myMeshBuilder.AddSphere(new Point3D(0, 0, 0), 2);

        GeometryModel3D mySphere = new GeometryModel3D { Geometry = myMeshBuilder.ToMesh(true), Material = MaterialHelper.CreateMaterial(Colors.Pink), BackMaterial = MaterialHelper.CreateMaterial(Colors.Blue) };

        ScaleTransform3D scaletrans = new ScaleTransform3D(2, 2, 2);
        mySphere.Transform = scaletrans;

        ModelVisual3D myMod3d = new ModelVisual3D();
        myMod3d.Content = mySphere;

        view1.Children.Add(myMod3d);
        AddContours(myMod3d, 20, 20, 20);
//end result is the contoured original sphere and not the scaled up version

objo wrote at 2013-04-15 12:45:

I would like to keep the GetContourSegments function as it is - working on a single MeshGeometry3D and not transforming the positions.
To support the transforms I think you should inverse(?) transform the position and normal of the contour plane! I think this is the best choice for performance...
0

Mouse Click

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

chimou wrote at 2013-06-06 11:09:

Hello,
In my scene I have some cylinder and I want to select one of them by clicking on.

Thank you in advance

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

Try to use a ModelUIElement3D, then you can handle MouseDown events
http://msdn.microsoft.com/en-us/library/system.windows.uielement3d.mousedown.aspx
0
Under review

How to get MeshGeometry3D after applying ScaleTransform3D

KotNitro 10 years ago updated by Øystein Bjørke 10 years ago 1
Hello!
First of all, many thanks for the great toolkit!
My app is simple STL viewer and it also could transform 3d models and apply cutting planes.
So, I make a trnasform:
model.Transform = new ScaleTransform3D(1, 1, 1 / compression);
How can I get an updated MeshGeometry3D? I need it to call MeshGeometryHelper.Cut()
Thank you!
0

Stl Color

Anonymous 10 years ago 0
This discussion was imported from CodePlex

cedre wrote at 2013-03-21 12:09:

Hi,

Thankx for your library !!! So great.

I add a Property Color on StLReader and FileModelVisual3D to set the color of the stl imported File.

and do this on the code : this.Materials.Add(MaterialHelper.CreateMaterial(Brush));
where Brush is my property

Do you think you could add this feature on a next release ?

Thankz

Cedre

objo wrote at 2013-04-15 12:24:

I added a DefaultMaterial property, which should be more general than a color. I hope this is ok!

cedrelo wrote at 2013-04-15 13:08:

Hi,

Perfect!


It will be include in the next release or is it in the source code now?


Thanks so much.

cedrelo wrote at 2013-04-15 13:10:

Ok

i just see your commit of today!!


Thanks

cedrelo wrote at 2013-05-23 11:25:

Hi thanks


It's ok fot stl reader but you not include the defaultMatertial Property to FileModelVisual3D


so we can't do this :
            <ht:FileModelVisual3D x:Name="Vehicle"  DefaultMaterial="{ht:Material Blue}" />


Could you add it in a next release please ?

Thanks

Cedre

objo wrote at 2013-06-07 11:39:

done! I also added DefaultMaterial properties to the .off, .obj and .lwo loaders.

cedrelo wrote at 2013-06-07 11:57:

Perfect!!


Really Thanks

cedrelo wrote at 2013-06-07 12:06:

I added SourceChanged on DependencyProperty DefaultMaterial for works with datatemplate3D
    /// <summary>
    /// The default material property.
    /// </summary>
    public static readonly DependencyProperty DefaultMaterialProperty =
        DependencyProperty.Register(
            "DefaultMaterial", typeof(Material), typeof(FileModelVisual3D), new PropertyMetadata(null, SourceChanged));
0

Error on textured 3DS model load

Anonymous 10 years ago 0
This discussion was imported from CodePlex

LanceJZ wrote at 2012-12-04 00:35:

Here is a screen shot of the error, I was loading up a textured 3DS model using your model viewer sample. The same model exported to obj works. I tried it on a number of models as well, I get the same error. The model has a texture in the diffuse slot.

Screen Shot


objo wrote at 2012-12-04 19:51:

ok, how is a material selected when you have multiple materials with the same name in the file? Use the latest defined material?

Then I think we can simply change the line with error to

this.materials[name] = mg;

objo wrote at 2012-12-13 23:01:

I have checked in the code. Let us know if it is still a problem.

0

UIElement3D and Camera movement

Anonymous 10 years ago 0
This discussion was imported from CodePlex

ddklo wrote at 2011-02-25 12:06:

Hi.

First off, thanks for a great toolkit.

By default IsHitTestVisible is set to "false" on the Viewport3D in the HelixView3D and this causes the UIElement3D's to not fire events. By changing IsHitTestVisible to "true" on the Viewport3D (would also be great if this could be done through XAML) the UIElement3D's fire events, but then it is not possible to move the camera. Do you know how I can have my UIElements3D's fire events and still be able to move the camera around when the mouse is over an UIElemnt3D?

 

Regards

Dagfinn


objo wrote at 2011-02-25 12:53:

hi Dagfinn, I think the CameraController should be modified so we can have IsHitTestVisible=true on the Viewport3D.

I'm not sure how to do this yet - I see the CameraController does not receive mouse events when the mouse is over elements in the viewport. 

Adding it to the issue tracker!