Transparent GeometryModel3D

Jun 12, 2012 at 8:53 AM

Hello.

In Polyhedron example, I want to get transparent triangles.

I tried this (PanelModelBuilder class): 

// Line 59 in PanelModelBuilder.cs
var panelsGeometry = tm.ToMesh();
            Brush br = new SolidColorBrush(Colors.Red);
            br.Opacity = 0.5;
            m.Children.Add(new GeometryModel3D(panelsGeometry, new DiffuseMaterial(br)) { BackMaterial= new DiffuseMaterial(br) });

But it does not work, the faces are opaque.

How can I do that?

Coordinator
Jun 15, 2012 at 4:22 AM

I don't think it will work to set both Material and BackMaterial in the same model when you want transparency. The transparent triangles nearest the camera should be rendered last, and this doesn't happen automatically.

For simple geometries (e.g. sphere, cuboid) you could try to add two models using the same geometry, the first one with the BackMaterial set, the second one with the Material set. This ensures that triangles inside the shape (furthest away from camera) are rendered before outside triangles (near the camera).

For other geometries (e.g. doughnut) I don't know a good solution to render transparency in wpf 3d...