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).
Type Parameters
Section titled “Type Parameters”S extends EffectSchema
C extends readonly keyof ChannelNodeMap[] = readonly []
Parameters
Section titled “Parameters”config
Section titled “config”LightEffectConfig<S, C>
Returns
Section titled “Returns”Example
Section titled “Example”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