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

problem with opacity change of objects

Anonymous 11 years ago 0
This discussion was imported from CodePlex

soheilvb wrote at 2012-04-14 09:22:

hi .

i am using lot's of models that overlap a lot. when i change opacity of a model the models behind that model just don't refresh ....

i use a method to remove the model and add it again to viewport3d and that somehow do the trick . but there's a lot of problem with this ...

isn't any method to just refresh the viewport ?

tnx a lot


soheilvb wrote at 2012-04-14 11:10:

i'm pretty sure the problem is when to add models to viewport3d. models that are added after the model that it's opacity has changed have problems.

but the models that are added before are ok with opacity and ... .

i mean the arrange in viewport3d.children is important.

so when i remove the model with opacity change and add it again to viewport . everything is fine . until in some point i want to change another model opacity and remove and add that again and that gets messy ...

i don't test it with Viewport3d and just tested it with Helixviewport3d .


murray_b wrote at 2012-04-16 05:52:

It sounds like your problem is to do with WPF transparency being determined by the order of the objects

See this article

http://www.ericsink.com/wpf3d/2_Transparency.html

I hope that helps


soheilvb wrote at 2012-04-16 06:15:

yes . the problem is z order .

my problem is a little complicated because i may have thousand transplant models that have intersections . then the simple remove add and remove won't solve it .the problem is managing lot's of transplant objects that have overlap ...

i wanna use Emissive Material but that has a lot of problems and ...


objo wrote at 2012-04-16 21:49:

It is hard to get around this with wpf 3D, unless you have a single transparent object. See the TransparencyDemo (using the HelixToolkit.SortingVisual3D) which demonstrates sorting within the limitations of wpf 3D.

To create renderings with transparent objects you can export the wpf model to an .obj file, and render in a package like Octane. See the ExportDemo, which will even start the renderer for you.


soheilvb wrote at 2012-04-17 04:17:

i have used SortingVisual3D. that's extremely slow and produce really strange results ...

tnx by the way ...


objo wrote at 2012-04-17 07:58:

Let us know if you find a bug or improvement to the code - I think it is quite limited what is currently possible to do with wpf 3d. The demo application shows what the SortingVisual3D can do, but it can of course not handle complex models.

Consider using directx/opengl and other techniques such as depth peeling!

0

Grid Lines working only for square

Anonymous 11 years ago 0
This discussion was imported from CodePlex

siv_inreco wrote at 2012-09-10 11:46:

Hi, i tried to use GridLines from Rhino Example, but when define Width = Length the grid lines drawing not correct. Please help to solve a problem.

 

http://helixtoolkit.codeplex.com/Download/AttachmentDownload.ashx?ProjectName=helixtoolkit&WorkItemId=9966&FileAttachmentId=483371

0

Rotations query

Anonymous 11 years ago 0
This discussion was imported from CodePlex

Nikk wrote at 2013-07-03 03:07:

Hi there,
I'm new to this toolkit and it looks pretty good :) Nice and quick to get good controls and objects in place quickly.

I am building a simple app to help our users understand some 3D geometry. To that end
I have built some spheres with manipulators which seem to function as expected. I can move them around and rotate at will. What I would like to do now, is get a report out that details the bearings, in polar coordinates of the rotated objects. However I am unsure of what to query to get the new bearings of a shape after it has been rotated?
I'd really like to eventually be able to manipulate other 3D objects too, so knowing how to query either the manipulators, or the objects for their directions would be great.

Can anyone offer any guidance?

Here is a snippet of the code I have used to generate the sphere and manipulator:
            var builder = new MeshBuilder(true, true);
            var position = new Point3D(0, 0, 0);
            builder.AddSphere(position, 1);
            var geom = new GeometryModel3D(builder.ToMesh(), Materials.Red);
            var visual = new ModelVisual3D();
            visual.Content = geom;

            r1Manip = new RotateManipulator();
            r1Manip.Color = Colors.Orange;
            r1Manip.Axis = new Vector3D(0, 0, 1);
            r1Manip.Diameter = 1;
            r1Manip.Bind(visual);

            r2Manip = new RotateManipulator();
            r2Manip.Color = Colors.Blue;
            r2Manip.Axis = new Vector3D(0, 1,0);
            r2Manip.Diameter = 1;
            r2Manip.Bind(visual);
            
            r3Manip = new RotateManipulator();
            r3Manip.Color = Colors.Green;
            r3Manip.Axis = new Vector3D(1, 0, 0);
            r3Manip.Diameter = 1;
            r3Manip.Bind(visual);

            ModelArea.Children.Add(r1Manip);
            ModelArea.Children.Add(r2Manip);
            ModelArea.Children.Add(r3Manip);
            
            ModelArea.Children.Add(visual);
ModelArea is my ModelVisual3D element in the XAML

Thanks
Nikk

objo wrote at 2013-07-12 23:14:

I think you should query the Transform property to find the orientation of the objects. You can use the rotation matrix to find Euler angles.

hbdev wrote at 2014-04-21 09:11:

I am new to Helix 3D.

I copied and pasted this code, but i don't see the colors mentioned in the code. What i get is completely black figure though i can rotate it. Can please post full code for this?

0

Where are the example sources?

Anonymous 11 years ago 0
This discussion was imported from CodePlex

JayDevelop wrote at 2012-06-13 11:15:

The example sources seem to be missing, what's the best way to keep updated? and also - is there a way of getting bone animation into this?


objo wrote at 2012-06-15 06:07:

You find the source code for all example under Source\Examples

I also added the source code links on all the example wiki pages.

0

overlaying 2D controls on 3D (OverlayDemo) - where to transform and update coordinates

Anonymous 11 years ago 0
This discussion was imported from CodePlex

d3p0 wrote at 2012-08-29 09:41:

Hi,

I've created a matlab style 3D plot with a lot of help from Helix Toolkit. 

For axes labels, grid lines, tick marks etc, I used WPF 2D geometry and text objects, and transformed the 3D points to 2D in a similar way to the OverlayDemo. (These lines look cleaner than screen space 3D lines, especially since I can apply SnapsToDevicePixels).

In the OverlayDemo, the transformation of coordinates is performed in the window's CompositionTarget.Rendering event. In my case I have a serious amount of layout logic and coordinates to transform, and having all of this called every frame is wasting CPU. I'd like to just update the coordinates when something changes - the camera, the host layout control resizes etc.

So that's cool, I can update coordinates on CameraChanged event (and a few other places). That seems to work with normal mouse interaction (rotation, zooming etc). But when I try and set the camera view in another way (e.g. with HelixViewport3D.SetView()), the 3D to 2D transformation blows up and my 2D coords end up with infinity and NaN. I'm unsure, but I think what happens is one aspect of the camera is changed (e.g. lookDirection), and then this fires the camera changed event. Since coordinates are transformed inside this event handler, that code tries to execute but the transformation matrix isn't formed properly yet (still requires position and upDirection to be set?). Specifically the matrix offset data seems to be wrong. Anyway, this yields incorrect values and the program fails. 

(1) Is there a more sensible place to transform 3D to 2D coordinates?

(2) Why doesn't this fail with normal mouse interaction? Are all camera settings set before the CameraChanged event is fired?

(3) Is there some way to keep this logic in CompositionTarget.Rendering but unhook the event handler when nothing is happening and hook it back up when something does change? What should it depend on? - relying on CameraChanged would still cause the transformation to blow up.

Any ideas will be very much appreciated. I'm totally new at this stuff, so please excuse me.

Thanks!


objo wrote at 2012-09-02 23:02:

Sorry, I am not sure what the problem is caused by here. Can you create a small example application that reproduces this behaviour?


d3p0 wrote at 2012-09-03 07:05:

Hi, thanks for your response. I've come up with a solution to get me by for now. I don't know where this falls on the scale of clunky, but time-constraints restrain me from too much elegance:

In my CompositionTarget.Rendering handler, I check to see if the camera has changed (LookDirection, Position & UpDirection) or if its parent panel has resized before allowing any coordinates to update. When nothing has changed, CompositionTarget.Rendering is doing almost nothing, so CPU usage is negligible.

I thought it would be required to ensure that LookDirection, Position and UpDirection have all changed collectively before allowing coordinates to update. This would ensure the transform matrix (Viewport3DHelper.GetTotalTransform()) would be correctly formed before any coordinates are transformed. However, this doesn't seem to matter when the update of coordinates happens inside CompositionTarget.Rendering - just checking to see that one aspect of the camera has changed (e.g. LookDirection) is enough. I don't know why, but not too concerned about this.

I hope this makes some amount of sense - its probably not relevant to most users of WPF 3D anyway... 

 

0

Help using meshbuilder

Anonymous 11 years ago 0
This discussion was imported from CodePlex

GilbertF wrote at 2012-07-13 02:11:

first thanks for this great tool, im looking for samples of how to build a 3d mesh using meshbuilder  poly by poly maybe using addpolygon also will like to find examples how to use CuttingEarsTriangulator.cs and where i can download this class.

thanks


objo wrote at 2012-08-09 01:04:

The cutting ears triangulator is located in the HelixToolkit.Wpf/Geometry folder.

0

SortingVisual3D

Anonymous 11 years ago 0
This discussion was imported from CodePlex

hulahoops wrote at 2012-11-01 10:10:

Hi

 

Is it possible to use ContainerUIElement3D in conjunction with SortingVisual3D?  I would like sorted visuals that have the power of the ContainerUIElement3D class.

 

Best regards

Simon


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

Hi Simon! I have not tried this, but I guess it should be possible. Let us know if there is a bug. And remember that the SortingVisual3D is only a 'basic' work-around for the transparency problem... 


hulahoops wrote at 2012-11-05 10:08:

Hi Objo

Thanks for replying.  I was asking if it is possible as I can't get it to work.  If I add a ModelUIElement3D object as a child of a ContainerUIElement3D object, and add the ContainerUIElement3D object as a child of a SortingVisual3D object, I find that the mouse events are not fired.

e.g.  (geometry code excluded)

var element = new ModelUIElement3D();
element.Model = geometry;
element.MouseDown += this.ContainerElementMouseDown;
var containerUI = new ContainerUIElement3D();
containerUI.Children.Add(element);
var uiTransparentElements = new SortingVisual3D();
uiTransparentElements.Children.Add(containerUI);
viewport.Children.Add(uiTransparentElements);

It is not too big a deal since I could use VisualTreeHelper.HitTest instead of  ContainerUIElement3D, but I was wondering if I was missing something simple.

Regards

Simon


objo wrote at 2012-11-05 10:28:

ok, could changing the base class of HelixToolkit.Wpf.RenderingModelVisual help? Try replace ModelVisual3D by ContainerUIElement3D (I am guessing - no time to test right now).


hulahoops wrote at 2012-11-05 13:33:

I did start to try that but unfortunately abandoned as didn't resolve all the build errors.  I will use HitTest workaround for now.  Is it possible to add to future enhancement list?

Thanks, Simon


objo wrote at 2012-11-06 19:29:

added http://helixtoolkit.codeplex.com/workitem/9971


bennasi wrote at 2012-11-26 11:48:

ContainerUIElement3D is a noniheritable class...

http://msdn.microsoft.com/en-us/library/system.windows.media.media3d.containeruielement3d.aspx


objo wrote at 2012-11-26 11:53:

Then try to add a ContainerUIElement3D to the ModelVisual3D.

0

Set zoom in/out capability

Michael Powell 11 years ago updated 11 years ago 1
More specifically, how to I set up a PerspectiveCamera (or better Camera, fit-to-purpose, i.e. orthogonal?) so that I can zoom in further than the default will allow?

Thank you...
0
Under review

Anyone any luck with WPF Attached Properties

Michael Powell 11 years ago updated by Øystein Bjørke 10 years ago 1
Hello,

I am interested to inject a ViewModel into the mix via the parent UserControl DataContext, which subsequently should relay that value to an Attached Dependency Property.

I'd like for interested views and models contained by the UserControl, or children therein, to be able to access the same attached property value.

I am studying some issues and 'tutorials' online, but thus far haven't had much luck retrieving the attached property value. I can listen for DataContext, no problem however.

Has anyone ever dealt with Attached Dependency Properties, or perhaps knows a good tutorial that explains it?

It's also possible that I need for 'children' of the problem to register with the property, but none of the examples stipulate that, or have conveniently left that part out (i.e. it's been alluded to in places).

Any insight is welcome.

Thank you...
0

DrawingBrush as Material

Anonymous 11 years ago 0
This discussion was imported from CodePlex

jacobya wrote at 2012-02-18 22:19:

Hi objo,

I have another question for you, this time it is around an issue I'm having with applying a DrawingBrush as the Material for a Tube.  I'm using the Meshbuilder.AddTube function to create a Tube that is 2000 units in length and has a diameter of 5.0.  I've created a DrawingBrush that has a width of 2000 and a height of Math.PI * 5.0.  The DrawingBrush also includes a small Blue rectangle with a Black border.  I've uploaded a copy of the rendered model here:

http://www.ironbyte.ca/temp/pipe.jpg

As you can see in the screenshot, both sides of the Rectangle are faded and the top and the bottom are not.  I would like the rectangle to display without any fading of any sort.  I have tried using an Ambient light, as well as setting RenderOptions.EdgeMode to Alias, but still can't get it to render without fading.  I noticed that if I make my Tube and my DrawingBrush much smaller in width, the fading is much, much less.

Thanks again for your help.

 


objo wrote at 2012-02-21 20:34:

Is your texture too wide? And the blue rectangle too small? Which means your left/right edges will be 'smeared away' to invisible? The fading is hard to avoid when using a texture to draw the rectangle. 

But I think you could create a texture with a rectangle that spans from e.g. 0.1 to 0.9 in texture coordinates. Then use texture coordinates 0, 0, 0, 0, 0, 0, 0.1, 0.9, 1, 1, 1, 1... along your pipe. This would probably improve the resolution. If you want the width of the edges to be the same both horizontally and vertically you need to do some calculations.

And if you need to show more than one rectangle maybe the following texture coordinates could work: 0,0,0,0,0,0,0.1,0.9,1,1,1,1,1,0.9,0.1,0,0,0,0,0,0,0.1,0.9,1,1,1,..... 

Sorry if I don't understand the problem properly, a tiny compilable example could help :)


jacobya wrote at 2012-02-22 23:44:

Hi objo,

I'm remapping the TextureCoordinates to be exactly the same dimensions as the material I'm using, but the behaviour you describe is exactly what I'm seeing.  Here is a small example that illustrates the problem I'm using.  This is using HelixToolkit build 74172.

http://www.ironbyte.ca/temp/CylinderMaterialTest.zip

Thanks!


objo wrote at 2012-03-10 16:37:

thanks for the example project. sorry, I was not able to find a solution to this yet...