Show / Hide Table of Contents

Class MakeEffect

Provides helper methods for creating ShaderEffects.

Inheritance
System.Object
MakeEffect
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Fusee.Engine.Core
Assembly: Fusee.Engine.Core.dll
Syntax
public static class MakeEffect

Methods

Default()

The default Effect, that is used if a SceneNode has a mesh but no effect.

Declaration
public static SurfaceEffect Default()
Returns
Type Description
SurfaceEffect

DeferredLightingPassEffect(IRenderTarget, Light, WritableArrayTexture, float2[], Int32, float4)

[Parallel light only] ShaderEffect that performs the lighting calculation according to the textures from the Geometry Pass. Shadow is calculated with cascaded shadow maps.

Declaration
public static ShaderEffect DeferredLightingPassEffect(IRenderTarget srcRenderTarget, Light lc, WritableArrayTexture shadowMap, float2[] clipPlanes, int numberOfCascades, float4 backgroundColor)
Parameters
Type Name Description
IRenderTarget srcRenderTarget

The source render target.

Light lc

The light component.

WritableArrayTexture shadowMap

The cascaded shadow maps.

float2[] clipPlanes

The clip planes of the frustums. Each frustum is associated with one shadow map.

System.Int32 numberOfCascades

The number of sub-frustums, used for cascaded shadow mapping.

float4 backgroundColor

Sets the background color. Could be replaced with a texture or other sky color calculations in the future.

Returns
Type Description
ShaderEffect

DeferredLightingPassEffect(IRenderTarget, Light, float4, IWritableTexture)

ShaderEffect that performs the lighting calculation according to the textures from the Geometry Pass.

Declaration
public static ShaderEffect DeferredLightingPassEffect(IRenderTarget srcRenderTarget, Light lc, float4 backgroundColor, IWritableTexture shadowMap = null)
Parameters
Type Name Description
IRenderTarget srcRenderTarget

The source render target.

Light lc

The light component.

float4 backgroundColor

Sets the background color. Could be replaced with a texture or other sky color calculations in the future.

IWritableTexture shadowMap

The shadow map.

Returns
Type Description
ShaderEffect

FromBRDF(float4, Single, Single, Single, Single, Single, float3, float3, Texture, Single, float2, Texture, Single, Texture)

Builds a simple shader effect for physically-based lighting using a bidirectional reflectance distribution function.

Declaration
public static SurfaceEffect FromBRDF(float4 albedoColor, float roughness, float metallic, float specular, float ior, float subsurface = 0F, float3 subsurfaceColor = default(float3), float3 emissionColor = default(float3), Texture albedoTex = null, float albedoMix = 0F, float2 texTiles = default(float2), Texture normalTex = null, float normalMapStrength = 0.5F, Texture thicknessMap = null)
Parameters
Type Name Description
float4 albedoColor

The albedo color of the resulting effect.

System.Single roughness

The roughness of the specular and diffuse reflection.

System.Single metallic

Value used to blend between the metallic and the dielectric model.

System.Single specular

Amount of dielectric specular reflection.

System.Single ior

The index of refraction. Note that this is set to 0.04 for dielectrics when rendering deferred.

System.Single subsurface

Mix between diffuse and subsurface scattering.

float3 subsurfaceColor

Subsurface scattering base color.

float3 emissionColor

If this color isn't black the material emits it. Note that this will not have any effect on global illumination yet.

Texture albedoTex

The albedo texture.

System.Single albedoMix

Determines how much the diffuse color and the color from the texture are mixed.

float2 texTiles

The number of times the textures are repeated in x and y direction.

Texture normalTex

The normal map.

System.Single normalMapStrength

The strength of the normal mapping effect.

Texture thicknessMap

A texture containing the thickness of an object. Used for subsurface scattering.

Returns
Type Description
SurfaceEffect

FromDiffuse(float4, Single, float3, Texture, Single, float2, Texture, Single)

Builds a simple shader effect with diffuse lighting component.

Declaration
public static SurfaceEffect FromDiffuse(float4 albedoColor, float roughness = 0F, float3 emissionColor = default(float3), Texture albedoTex = null, float albedoMix = 0F, float2 texTiles = default(float2), Texture normalTex = null, float normalMapStrength = 0.5F)
Parameters
Type Name Description
float4 albedoColor

The albedo color of the resulting effect.

System.Single roughness

If 0.0 (default value) the diffuse component gives standard Lambertian reflection, higher values activate the Oren-Nayar calculation.

float3 emissionColor

If this color isn't black the material emits it. Note that this will not have any effect on global illumination yet.

Texture albedoTex

The albedo texture.

System.Single albedoMix

Determines how much the diffuse color and the color from the texture are mixed.

float2 texTiles

The number of times the textures are repeated in x and y direction.

Texture normalTex

The normal map.

System.Single normalMapStrength

The strength of the normal mapping effect.

Returns
Type Description
SurfaceEffect

FromDiffuseInstanced(float4, Single, float3, Texture, Single, float2, Texture, Single)

Builds a simple shader effect with diffuse lighting component. This will set up the underlying shader for instanced rendering.

Declaration
public static SurfaceEffect FromDiffuseInstanced(float4 albedoColor, float roughness = 0F, float3 emissionColor = default(float3), Texture albedoTex = null, float albedoMix = 0F, float2 texTiles = default(float2), Texture normalTex = null, float normalMapStrength = 0.5F)
Parameters
Type Name Description
float4 albedoColor

The albedo color of the resulting effect.

System.Single roughness

If 0.0 (default value) the diffuse component gives standard Lambertian reflection, higher values activate the Oren-Nayar calculation.

float3 emissionColor

If this color isn't black the material emits it. Note that this will not have any effect on global illumination yet.

Texture albedoTex

The albedo texture.

System.Single albedoMix

Determines how much the diffuse color and the color from the texture are mixed.

float2 texTiles

The number of times the textures are repeated in x and y direction.

Texture normalTex

The normal map.

System.Single normalMapStrength

The strength of the normal mapping effect.

Returns
Type Description
SurfaceEffect

FromDiffuseSpecular(float4, Single, Single, Single, float3, Texture, Single, float2, Texture, Single)

Builds a simple shader effect with diffuse and specular lighting components.

Declaration
public static SurfaceEffect FromDiffuseSpecular(float4 albedoColor, float roughness = 0F, float shininess = 255F, float specularStrength = 0.5F, float3 emissionColor = default(float3), Texture albedoTex = null, float albedoMix = 0F, float2 texTiles = default(float2), Texture normalTex = null, float normalMapStrength = 0.5F)
Parameters
Type Name Description
float4 albedoColor

The albedo color of the resulting effect.

System.Single roughness

If 0.0 (default value) the diffuse component gives standard Lambertian reflection, higher values activate the Oren-Nayar calculation.

System.Single shininess

The resulting effect's shininess.

System.Single specularStrength

The resulting effects specular intensity.

float3 emissionColor

If this color isn't black the material emits it. Note that this will not have any effect on global illumination yet.

Texture albedoTex

The albedo texture.

System.Single albedoMix

Determines how much the diffuse color and the color from the texture are mixed.

float2 texTiles

The number of times the textures are repeated in x and y direction.

Texture normalTex

The normal map.

System.Single normalMapStrength

The strength of the normal mapping effect.

Returns
Type Description
SurfaceEffect

FromGlossy(float4, Single, Texture, Single, float2, Texture, Single)

Builds a simple shader effect for a glossy lighting (full metallic setup).

Declaration
public static SurfaceEffect FromGlossy(float4 albedoColor, float roughness = 0F, Texture albedoTex = null, float albedoMix = 0F, float2 texTiles = default(float2), Texture normalTex = null, float normalMapStrength = 0.5F)
Parameters
Type Name Description
float4 albedoColor

The albedo color of the resulting effect.

System.Single roughness

Used to calculate the GGX micro facet distribution.

Texture albedoTex

The albedo texture.

System.Single albedoMix

Determines how much the diffuse color and the color from the texture are mixed.

float2 texTiles

The number of times the textures are repeated in x and y direction.

Texture normalTex

The normal map.

System.Single normalMapStrength

The strength of the normal mapping effect.

Returns
Type Description
SurfaceEffect

FromUnlit(float4, Texture, float2, Single)

Creates a simple unlit shader from an albedo color and texture.

Declaration
public static SurfaceEffect FromUnlit(float4 albedoColor, Texture albedoTex = null, float2 texTiles = default(float2), float albedoMix = 0F)
Parameters
Type Name Description
float4 albedoColor

The albedo color.

Texture albedoTex

The albedo texture.

float2 texTiles

The number of times the textures are repeated in x and y direction.

System.Single albedoMix

Determines how much the diffuse color and the color from the texture are mixed.

Returns
Type Description
SurfaceEffect

FXAARenderTargetEffect(WritableTexture, int2)

If rendered with FXAA we'll need an additional (final) pass, that takes the lighted scene, rendered to a texture, as input.

Declaration
public static ShaderEffect FXAARenderTargetEffect(WritableTexture srcTex, int2 screenParams)
Parameters
Type Name Description
WritableTexture srcTex

RenderTarget, that contains a single texture in the Albedo/Specular channel, that contains the lighted scene.

int2 screenParams

The width and height of the screen.

Returns
Type Description
ShaderEffect

LineEffect(Single, float4, Boolean)

Generates a line shader which can be used with a Mesh with MeshType set to Lines. /// Loads shader files via Get<T>(String) For an asynchronous version use LineEffectAsync(Single, float4, Boolean)

Declaration
public static Effect LineEffect(float lineThickness, float4 albedoColor, bool enableVertexColors = false)
Parameters
Type Name Description
System.Single lineThickness
float4 albedoColor
System.Boolean enableVertexColors
Returns
Type Description
Effect

LineEffectAsync(Single, float4, Boolean)

Generates a line shader which can be used with a Mesh with MeshType set to Lines. Loads shader files via GetAsync<T>(String) For an non asynchronous version use LineEffect(Single, float4, Boolean)

Declaration
public static async Task<Effect> LineEffectAsync(float lineThickness, float4 albedoColor, bool enableVertexColors = false)
Parameters
Type Name Description
System.Single lineThickness
float4 albedoColor
System.Boolean enableVertexColors
Returns
Type Description
System.Threading.Tasks.Task<Effect>

ShadowCubeMapEffect(float4x4[])

ShaderEffect that renders the depth map from a lights point of view - this depth map is used as a shadow map.

Declaration
public static ShaderEffect ShadowCubeMapEffect(float4x4[] lightSpaceMatrices)
Parameters
Type Name Description
float4x4[] lightSpaceMatrices
Returns
Type Description
ShaderEffect

ShadowCubeMapEffectPointPrimitives(float4x4[])

ShaderEffect that renders the depth map from a lights point of view - this depth map is used as a shadow map.

Declaration
public static ShaderEffect ShadowCubeMapEffectPointPrimitives(float4x4[] lightSpaceMatrices)
Parameters
Type Name Description
float4x4[] lightSpaceMatrices
Returns
Type Description
ShaderEffect

ShadowMapEffect()

ShaderEffect that renders the depth map from a lights point of view - this depth map is used as a shadow map.

Declaration
public static ShaderEffect ShadowMapEffect()
Returns
Type Description
ShaderEffect

SSAORenderTargetBlurEffect(WritableTexture)

Creates a blurred ssao texture, to hide rectangular artifacts originating from the noise texture;

Declaration
public static ShaderEffect SSAORenderTargetBlurEffect(WritableTexture ssaoRenderTex)
Parameters
Type Name Description
WritableTexture ssaoRenderTex

The non blurred ssao texture.

Returns
Type Description
ShaderEffect

SSAORenderTargetTextureEffect(IRenderTarget, Int32, int2, Int32)

Shader effect for the ssao pass.

Declaration
public static ShaderEffect SSAORenderTargetTextureEffect(IRenderTarget geomPassRenderTarget, int kernelLength, int2 screenParams, int noiseTexSize)
Parameters
Type Name Description
IRenderTarget geomPassRenderTarget

RenderTarget filled in the previous geometry pass.

System.Int32 kernelLength

SSAO kernel size.

int2 screenParams

Width and Height of the screen.

System.Int32 noiseTexSize

Width and height of the noise texture.

Returns
Type Description
ShaderEffect
Generated by DocFX
GitHub Repo
Back to top