0

Transparent GeometryModel3D

Anonymous 5 years ago 0
This discussion was imported from CodePlex

finder_sl wrote at 2012-06-12 10:53:

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?


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

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...