Table of Contents

Class SkyboxGenerator

Namespace
Stride.CommunityToolkit.Skyboxes
Assembly
Stride.CommunityToolkit.Skyboxes.dll

Provides functionality to generate a skybox with diffuse and specular lighting parameters from a given texture.

public static class SkyboxGenerator
Inheritance
SkyboxGenerator

Remarks

This class handles the conversion of a texture to a cubemap, performs spherical harmonics filtering for diffuse lighting, and prefilters the texture for specular lighting using GGX reflection. The original logic is from Stride.Assets.Skyboxes

Methods

Generate(Skybox, SkyboxGeneratorContext, Texture)

Generates a skybox using the provided texture and context, applying both diffuse and specular lighting.

public static Skybox Generate(Skybox skybox, SkyboxGeneratorContext context, Texture skyboxTexture)

Parameters

skybox Skybox

The skybox instance to apply the generated parameters to.

context SkyboxGeneratorContext

The context required for rendering, which includes services and draw context.

skyboxTexture Texture

The texture used to generate the skybox cubemap.

Returns

Skybox

The modified Skybox with diffuse and specular lighting applied.

Remarks

The method performs the following:

  1. Converts the provided texture into a cubemap with a computed resolution based on the texture width.
  2. Applies Lambertian spherical harmonics filtering for diffuse lighting.
  3. Performs GGX prefiltering for specular lighting and generates a cubemap for reflection purposes.