Make a transparent 3D model

How can I make a particular 3d model transparent? Is it as simple as changing the opacity of the model material?

I tried the following:

SolidColorBrush br = (SolidColorBrush)matDif.Brush; //matDif = DiffuseMaterial
br.Opacity = 0.3;

When he tries to set the opacity, does he say that he is in a read-only state and cannot be changed?

+3
source share
2 answers

Try

        Color c = new Color();
        c.A = 128;
        c.R = Colors.PeachPuff.R;
        c.G = Colors.PeachPuff.G;
        c.B = Colors.PeachPuff.B;
        Material Material = new DiffuseMaterial(new SolidColorBrush(c));

works for me

+2
source

In this page (which, admittedly, the XAML, instead of C # is as follows:

<GeometryModel3D.Material>
    <DiffuseMaterial Brush="#8000FFFF" />
</GeometryModel3D.Material>

<GeometryModel3D.BackMaterial>
    <DiffuseMaterial Brush="#80FF0000" />
</GeometryModel3D.BackMaterial>

So it looks like you just set Brush to ARGB color.

There are interesting links on social.msdn in this thread . I did not look at them all, but some of them may be useful.

+1

Source: https://habr.com/ru/post/1717294/


All Articles