The camera that owns this filter.
Optionalconfig: ImageLightConfig
The configuration object for the ImageLight effect.
Toggle this boolean to enable or disable this filter, without removing it from and re-adding it to the Camera's filter list.
ReadonlyallowIf true, this filter will be permitted to draw to the base texture.
This can be unwanted if, for example, the filter doesn't actually
draw anything.
This is an internal flag used by the renderer. You should not modify this value directly.
The amount of bulge to apply to the ImageLight effect. This distorts the surface slightly, preventing flat areas in the normal map from reflecting a single flat color. A value of 0.1 is often plenty.
A reference to the Camera that owns this filter.
The color factor to apply to the ImageLight effect. This multiplies the intensity of the light in each color channel. Use values above 1 to substitute for high dynamic range lighting.
The padding currently being used by this filter.
This is read during rendering via getPadding, and may be updated by subclass implementations.
It is necessary for filters being used in an external list.
You should not modify this value directly.
The underlying texture used for the ImageLight effect environment map.
Whether this filter controller will be destroyed when the FilterList that owns it is destroyed. If you enable this, you must ensure that you clean up the filter controller at an appropriate time. This allows you to reuse a controller for multiple objects; this is not recommended unless you know what you're doing. It tends to work best with external filters.
The initial rotation of the model in radians. This will be overridden by the modelRotationSource if it is set.
The source of the model rotation, used when the filter renders. If a function, it will be called to get the rotation. If a GameObject, it will be used to get the rotation from the GameObject's world transform. If null, the model rotation will be taken from the modelRotation property.
The underlying texture used for the ImageLight effect normal map.
Padding override. This is on by default. If this is set,
the filter will use this padding instead of calculating it.
Prefer using setPaddingOverride instead of modifying this directly.
The ID of the RenderNode that this filter uses.
The view matrix used for the ImageLight effect. This controls the orientation of the environment map. You should set this to reflect the perspective of the camera.
Destroys this Controller and nulls any references it holds.
Gets the rotation to use for the ImageLight effect. This will use the modelRotationSource if it is set.undefined
The rotation to use for the ImageLight effect in radians.
Returns the raw padding required for this filter.
This is typically not what you want to call; use getPaddingCeil instead.
Values from this method are not rounded, which can cause quality loss.
Override this method when creating a Filter that requires extra room, e.g. a blur or glow effect.undefined
The padding required by this filter.
Returns the rounded padding required for this filter.
Most filters don't need extra padding, but some may sample beyond the texture boundaries, such as a blur or glow effect.
The bounds are encoded as a Rectangle. To enlarge the bounds, the top and left values should be negative, and the bottom and right values should be positive.
This method calls getPadding() to get the raw padding values,
and uses Math.ceil() to set the values of paddingOverride
and currentPadding.undefined
The rounded padding required by this filter.
Sets the active state of this filter.
A disabled filter will not be used.
true to enable this filter, or false to disable it.
This filter instance.
Sets the texture to use for the ImageLight effect environment map.
The texture to use for the ImageLight effect environment map.
This ImageLight instance.
Sets the texture to use for the ImageLight effect normal map. This should match the object being filtered.
The texture to use for the ImageLight effect normal map.
This ImageLight instance.
Sets the normal texture to use for the ImageLight effect from a GameObject. This will use the first data source image in the object's texture. Use this to extract a normal map which was loaded as a data source.
The GameObject to use for the ImageLight effect normal map.
This ImageLight instance.
Sets the padding override.
If this is set, the filter will use this padding instead of calculating it.
Call setPaddingOverride(null) to clear the override.
Call setPaddingOverride() to set the padding to 0.
Optionalleft: number | null
The left padding. Default 0.
Optionaltop: number
The top padding. Default 0.
Optionalright: number
The right padding. Default 0.
Optionalbottom: number
The bottom padding. Default 0.
The ImageLight Filter Controller.
This filter controller manages the ImageLight effect for a Camera.
ImageLight is a filter for image based lighting (IBL). It is used to simulate the lighting of an image using an environment map and a normal map.
The environment map is an image that describes the lighting of the scene. This filter uses a single panorama image as the environment map. The top of the image is the sky, the bottom is the ground, and the X axis covers a full rotation. This kind of image is distorted towards the top and bottom, as the X axis is stretched wider and wider, so be careful if you're creating your own environment maps.
Cube maps are not supported by Phaser at the time of writing.
The effect is basically a reflection of the environment at infinite range. A sharp environment map will produce a sharp reflection, while a blurry environment map will produce a diffuse reflection. Use the PanoramaBlur filter to create correctly blurred environment maps. Use the NormalTools filter to manipulate the normal map if necessary, using a DynamicTexture to capture the output.
An ImageLight effect is added to a Camera via the FilterList component: