0

EllipsoidVisual3D problems

Frank 8 years ago updated 8 years ago 7

I am rendering a point cloud in WPF using PointsVisual3D and Point3DCollection. This all works well, and I now want to put a set of 3 principal plane-oriented 3D ellipses into the view as a set of reference circles. I am currently using 3 EllipsoidVisual3D objects with two of the radii set to 1 and the third set to zero to accomplish this, but I have a couple of problems

  • I can't seem to change the fill color. I have tried using the material and/or Fill properties for this, but nothing seems to affect the default (black) color
  • I would really like to have these objects be rings instead of disks, so they obscure as few data points as possible, but I can't figure out how to do this, either :-(

Any thoughts or pointers would be appreciated.


TIA,


Frank


For circles use short TubeVisuals3D

Black sounds like you don't have a light. Default color is blue

Hmm, I'll look into TubeVisual3D. Regarding the light - The rest of the objects in the view have color (red dots, yellow dots). Only the Ellipsoid object shows in black. Do I need to define the light separately for each item in the model?


TIA,


Frank


Maybe it's the same problem I had with the TruncatedConeVisual... Because no normals where generated, it was rendered black (most of the time, sometimes they had colors)


Try create your own class like so:


   public class MyEllipsoidVisual3D : EllipsoidVisual3D
   {
       protected override MeshGeometry3D Tessellate()
       {
           var builder = new MeshBuilder(true, true);
           builder.AddEllipsoid(this.Center, this.RadiusX, this.RadiusY, this.RadiusZ, this.ThetaDiv, this.PhiDiv);
           return builder.ToMesh();
       }
   }

Thanks Egon - I'll give that a try and report back. Does that class have to be in any particular namespace? IOW, can I place this class in it's own file as part of my current WPF project, or does it need to reside somewhere in the Helix Toolkit source tree?


TIA,


Frank


Ergon,


Tried the new class - no change in behavior. Here's the relevant code:


            //try adding an ellipse to view            
            //EllipsoidVisual3D ell1 = new EllipsoidVisual3D();
            MyEllpsoidVisual ell1 = new MyEllpsoidVisual();
            SolidColorBrush perimeterbrush = new SolidColorBrush(Colors.Red);
            System.Windows.Media.Media3D.Material mat = MaterialHelper.CreateMaterial(new SolidColorBrush(Colors.Red));
            ell1.Material = mat;
            ell1.BackMaterial = mat;
            ell1.Fill = perimeterbrush;
            ell1.Center = new Point3D(0, 0, 0);
            ell1.RadiusX = 1;
            ell1.RadiusZ = 1;
            ell1.RadiusY = 1;
            ell1.Model.BackMaterial = mat;
            ell1.Model.Material = mat;
            ell1.Fill = new SolidColorBrush(Colors.White);
            vp_cal.Children.Add(ell1);

And here's a screenshot of the result. As you can see, I still get a completely black sphere.


Note: In the above code snippet, you'll see that I tried setting every visual property I could think of, including 'Material', 'BackMaterial', 'Fill', 'Model.Material', etc. None of these property changes had any effect on the displayed object color.


Any other thoughts?


Frank


Sorry, no more ideas

Ergon,


You were correct - it was the lack of a lighting source. I didn't realize the problem, as the PointVisual3D collection renders fine without any lighting! Once I figured that out, and added a light to the scene, at least that part works well now ;-).


Frank