0

LinesVisual3D Aren't Rendering

Anonymous 10 years ago 0
This discussion was imported from CodePlex

jrhokie1 wrote at 2013-01-24 15:09:

I have a WPF app, with my HelixViewport3D's ModelVisual3D Content property bound to a Model3DGroup-type property.  I create some EllipsoidVisual3D objects, and add them to my model group by

      modelGroup.Children.Add(ev3.Model);

Now I want to create some line segments.  I do this

   LinesVisual3D lv3d = new LinesVisual3D();

   Point3D p1 = new Point3D(...);

   lv3d.Points.Add(p1);

   Point3D p2 = new Point3D(...);

   lv3d.Points.Add(p2);

   lv3d.Thickness = 20;

   modelGroup.Children.Add(lv3d.Content);

But my lines aren't visible.  Setting IsRendering to true doesn't help.

I'm doing MVVM, so I don't want to directly add a visual to my viewport, as is done in the Points and Lines sample.  I know I'm using it wrong, I just can't figure out where.  Any help will be appreciated.

Thanks.

-reilly.


jrhokie1 wrote at 2013-01-24 16:01:

Never mind.  I found and used MeshBuilder.  Works like a champ.

Seriously, objo, you should put a PayPal "Donate" button up here.  I don't know how much they skim off the top, but I would pay you for your work.


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

Ok. I will check if there is a bug in the LinesVisual3D change notifications, though.

I added an Amazon wish list link at the home page, if you feel for donating a book! :)

jrhokie1 wrote at 2013-02-04 16:25:

I had to do it: "Practical Rendering and Computation with Direct3D 11" is on the way.

[FYI, I'm working on a tool to extract statistics from 50 micron scans of coupons which have been subjected to corrosive environments. We read the scan data and visualize it in 3D. The tool provides controls to process the image, detect corroded pits, and extract their statistics for use in modeling. I used Helix to show and annotate the data. It couldn't have been easier.]

Please keep up the good work.

Regards,

-reilly.

objo wrote at 2013-02-05 08:55:

Great! Thank you!
Regarding the code - it seems like you are 'stealing' the Model3D from the LinesVisual3D instance. The screen space visuals must be updated every time the camera or transforms are changed, currently this is handled by the CompositionTarget.Rendering event. I guess there was no updating going on in your case where you had disconnected the LinesVisual3D from the visual tree.