melculetz
melculetz

Reputation: 1971

Materials for 3D objects

As I was playing around with the WPF's 3D support, I wanted to try different options for the 3d objects material types, so at first I created a simple scene, with just a triangle (which is rendered ok):

<Viewport3D>
            <Viewport3D.Camera>
                <PerspectiveCamera Position="-2,2,2" LookDirection="2,-2,-2" UpDirection="0,1,0" />
            </Viewport3D.Camera>
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <DirectionalLight Color="White" Direction="-1,-1,-1" />
                </ModelVisual3D.Content>
            </ModelVisual3D>
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <GeometryModel3D>
                        <GeometryModel3D.Geometry>
                            <MeshGeometry3D Positions="-1,0,0 0,1,0 1,0,0" TriangleIndices="0,2,1" />
                        </GeometryModel3D.Geometry>
                        <GeometryModel3D.Material>
                            <DiffuseMaterial Brush="Yellow" />
                        </GeometryModel3D.Material>
                    </GeometryModel3D>
                </ModelVisual3D.Content>
            </ModelVisual3D>
        </Viewport3D>

But it seems that the triangle is no longer rendered when I changed the GeometryModel3D.Material to another material like

<SpecularMaterial Brush="Yellow" Color="Yellow" SpecularPower="24" />

or

<EmissiveMaterial Brush="Yellow" ></EmissiveMaterial>

Why is that? should I be using different lights for the specular or emissive materials to work?

Upvotes: 4

Views: 5792

Answers (1)

Felice Pollano
Felice Pollano

Reputation: 33252

Emissive material does not work by its own, use it in combination with other materials. As for example:

<GeometryModel3D.Material>
  <MaterialGroup>
    <DiffuseMaterial Brush="Black"></DiffuseMaterial>
    <EmissiveMaterial Brush="Yellow" ></EmissiveMaterial>
  </MaterialGroup>
</GeometryModel3D.Material>

Upvotes: 7

Related Questions