ModelDecorator3D question/problem
I'm a using ModelDecorator3D created via code as follows:

            decorator = new ModelDecoratorVisual3D()
                ShowBoundingBox = true,
                BoundingBoxLineColor = Colors.Red,
                BoundingBoxLineThickness = 2,
                ShowNormals = true,
                NormalsLineColor = Colors.Blue,
                NormalsLineThickness = 2,
                NormalsLineLength = 200,
                ShowTriangles = true,
                TrianglesLineColor = Colors.Green,
                TrianglesLineThickness = 2,

I'm assigning TargetModel3D my Model3D (loaded from STL, if that matters), but all I get is the bounding box.  I've found other examples on how to do the normals and the wireframe, but it would be nice to be able to just toggle these 3 visuals on/off via a single object, rather than need to manage each thing separately.

Second, somewhat related question: I'm experimenting with Ab3d.Models.WireframeFactory.CreateNormals for displaying normals (which is not something I need on the screen all that often) and it's abysmally slow creating the normals and also navigating the scene.  I'm assuming that it's related to my triangle count, which is about 715K right now, but some models are > 3M triangles.  Any way I can speed this up?

Any suggestions?
It is hard to say what is the exact reason for not showing normals. But here are two possibilities:

To show normals you need to assign a GeometryModel3D to TragetModel3D. If it is a Model3DGroup, then normals are not shown (as described in the XML documentation for ShowNormals field -

The other reason may be that if the TragetModel3D has some parent Visual3D objects with Transformation, you also need to set the RootModelVisual3D to the root Visual3D object. This way the ModelDecorator3D will be able to calculate the transformation that is applied by parent Visual3D objects.

The reason why showing many normals is very slow is that by default normals are shown with arrows. In this case the lines are not hardware accelerated (are generated on the CPU). To prevent that you can set the addArrow parameter in the call to WireframeFactory.CreateNormals to false to create normal lines without arrows. In this case the line rendering will super fast. 

There is currently no option to do that when using ModelDecorator3D. But I have added a new ShowNormalLineArrow property that will be available with the next version of Ab3d.PowerToys and will allow user to show normal lines instead of lines with arrows.
Andrej Benedik

Forum Jump:

Users browsing this thread:
1 Guest(s)