Skip to content

createLightEffect

createLightEffect<S, C>(config): LightEffectClass<S>

Defined in: packages/three-flatland/src/lights/LightEffect.ts:758

Create a LightEffect class from a configuration object.

Supports lifecycle hooks (init/update/resize/dispose) for effects that manage GPU resources. Use factory function fields in the schema for per-instance constants (e.g., ForwardPlusLighting).

S extends EffectSchema

C extends readonly keyof ChannelNodeMap[] = readonly []

LightEffectConfig<S, C>

LightEffectClass<S>

const DefaultLightEffect = createLightEffect({
name: 'defaultLight',
schema: { ambientIntensity: 0.2 },
light: ({ uniforms, lightStore }) => {
// build light loop using lightStore.readLightData()
},
})
const lighting = new DefaultLightEffect()
flatland.setLighting(lighting)
lighting.ambientIntensity = 0.4 // zero-cost uniform update