Table of Contents

Class EnvironmentMapEffect

Namespace
Microsoft.Xna.Framework.Graphics
Assembly
MonoGame.Framework.dll

Built-in effect that supports environment mapping.

public class EnvironmentMapEffect : Effect, IDisposable, IEffectMatrices, IEffectLights, IEffectFog
Inheritance
EnvironmentMapEffect
Implements
Inherited Members

Constructors

EnvironmentMapEffect(EnvironmentMapEffect)

Creates a new EnvironmentMapEffect by cloning parameter settings from an existing instance.

protected EnvironmentMapEffect(EnvironmentMapEffect cloneSource)

Parameters

cloneSource EnvironmentMapEffect

EnvironmentMapEffect(GraphicsDevice)

Creates a new EnvironmentMapEffect with default parameter settings.

public EnvironmentMapEffect(GraphicsDevice device)

Parameters

device GraphicsDevice

Properties

Alpha

Gets or sets the material alpha.

public float Alpha { get; set; }

Property Value

float

AmbientLightColor

Gets or sets the ambient light color (range 0 to 1).

public Vector3 AmbientLightColor { get; set; }

Property Value

Vector3

DiffuseColor

Gets or sets the material diffuse color (range 0 to 1).

public Vector3 DiffuseColor { get; set; }

Property Value

Vector3

DirectionalLight0

Gets the first directional light.

public DirectionalLight DirectionalLight0 { get; }

Property Value

DirectionalLight

DirectionalLight1

Gets the second directional light.

public DirectionalLight DirectionalLight1 { get; }

Property Value

DirectionalLight

DirectionalLight2

Gets the third directional light.

public DirectionalLight DirectionalLight2 { get; }

Property Value

DirectionalLight

EmissiveColor

Gets or sets the material emissive color (range 0 to 1).

public Vector3 EmissiveColor { get; set; }

Property Value

Vector3

EnvironmentMap

Gets or sets the current environment map texture.

public TextureCube EnvironmentMap { get; set; }

Property Value

TextureCube

EnvironmentMapAmount

Gets or sets the amount of the environment map RGB that will be blended over the base texture. Range 0 to 1, default 1. If set to zero, the RGB channels of the environment map will completely ignored (but the environment map alpha may still be visible if EnvironmentMapSpecular is greater than zero).

public float EnvironmentMapAmount { get; set; }

Property Value

float

EnvironmentMapSpecular

Gets or sets the amount of the environment map alpha channel that will be added to the base texture. Range 0 to 1, default 0. This can be used to implement cheap specular lighting, by encoding one or more specular highlight patterns into the environment map alpha channel, then setting EnvironmentMapSpecular to the desired specular light color.

public Vector3 EnvironmentMapSpecular { get; set; }

Property Value

Vector3

FogColor

Gets or sets the fog color.

public Vector3 FogColor { get; set; }

Property Value

Vector3

FogEnabled

Gets or sets the fog enable flag.

public bool FogEnabled { get; set; }

Property Value

bool

FogEnd

Gets or sets the fog end distance.

public float FogEnd { get; set; }

Property Value

float

FogStart

Gets or sets the fog start distance.

public float FogStart { get; set; }

Property Value

float

FresnelFactor

Gets or sets the Fresnel factor used for the environment map blending. Higher values make the environment map only visible around the silhouette edges of the object, while lower values make it visible everywhere. Setting this property to 0 disables Fresnel entirely, making the environment map equally visible regardless of view angle. The default is 1. Fresnel only affects the environment map RGB (the intensity of which is controlled by EnvironmentMapAmount). The alpha contribution (controlled by EnvironmentMapSpecular) is not affected by the Fresnel setting.

public float FresnelFactor { get; set; }

Property Value

float

Projection

Gets or sets the projection matrix.

public Matrix Projection { get; set; }

Property Value

Matrix

Texture

Gets or sets the current texture.

public Texture2D Texture { get; set; }

Property Value

Texture2D

View

Gets or sets the view matrix.

public Matrix View { get; set; }

Property Value

Matrix

World

Gets or sets the world matrix.

public Matrix World { get; set; }

Property Value

Matrix

Methods

Clone()

Creates a clone of the current EnvironmentMapEffect instance.

public override Effect Clone()

Returns

Effect

EnableDefaultLighting()

Sets up the standard key/fill/back lighting rig.

public void EnableDefaultLighting()

OnApply()

Lazily computes derived parameter values immediately before applying the effect.

protected override void OnApply()