bevy/assets/models
robtfm a2992fcffd
Light Textures (#18031)
# Objective

add support for light textures (also known as light cookies, light
functions, and light projectors)


![image](https://github.com/user-attachments/assets/afdb23e2-b35f-4bf0-bf92-f883cd7db771)

## Solution

- add components:

```rs
/// Add to a [`PointLight`] to add a light texture effect.
/// A texture mask is applied to the light source to modulate its intensity,  
/// simulating patterns like window shadows, gobo/cookie effects, or soft falloffs.
pub struct PointLightTexture {
    /// The texture image. Only the R channel is read.
    pub image: Handle<Image>,
    /// The cubemap layout. The image should be a packed cubemap in one of the formats described by the [`CubemapLayout`] enum.
    pub cubemap_layout: CubemapLayout,
}

/// Add to a [`SpotLight`] to add a light texture effect.
/// A texture mask is applied to the light source to modulate its intensity,  
/// simulating patterns like window shadows, gobo/cookie effects, or soft falloffs.
pub struct SpotLightTexture {
    /// The texture image. Only the R channel is read.
    /// Note the border of the image should be entirely black to avoid leaking light.
    pub image: Handle<Image>,
}

/// Add to a [`DirectionalLight`] to add a light texture effect.
/// A texture mask is applied to the light source to modulate its intensity,  
/// simulating patterns like window shadows, gobo/cookie effects, or soft falloffs.
pub struct DirectionalLightTexture {
    /// The texture image. Only the R channel is read.
    pub image: Handle<Image>,
    /// Whether to tile the image infinitely, or use only a single tile centered at the light's translation
    pub tiled: bool,
}
```

- store images to the `RenderClusteredDecals` buffer
- read the image and modulate the lights
- add `light_textures` example to showcase the new features

## Testing

see light_textures example
2025-06-30 21:56:17 +00:00
..
AlienCake add an example using UI & states to create a game menu (#2960) 2022-01-14 19:09:42 +00:00
animated Fix validation errors in Fox.glb (#17801) 2025-02-11 22:19:24 +00:00
AnisotropyBarnLamp Implement PBR anisotropy per KHR_materials_anisotropy. (#13450) 2024-06-03 23:46:06 +00:00
barycentric Add support for custom glTF vertex attributes. (#5370) 2023-04-24 14:20:13 +00:00
CornellBox Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
cube Hot asset reloading 2020-05-16 20:18:30 -07:00
cubes Implement minimal reflection probes (fixed macOS, iOS, and Android). (#11366) 2024-01-19 07:33:52 +00:00
DepthOfFieldExample fix lava emissive strength in depth of field example (#13449) 2024-05-21 19:35:08 +00:00
extras add handling of all missing gltf extras: scene, mesh & materials (#13453) 2024-06-03 13:16:38 +00:00
Faces Light Textures (#18031) 2025-06-30 21:56:17 +00:00
FlightHelmet Asset system rework and GLTF scene loading (#693) 2020-10-18 13:48:15 -07:00
FlightHelmetLowPoly Implement visibility ranges, also known as hierarchical levels of detail (HLODs). (#12916) 2024-05-03 00:11:35 +00:00
GltfPrimitives Cosmetic tweaks to query_gltf_primitives (#16102) 2024-10-27 19:06:19 +00:00
GolfBall Implement clearcoat per the Filament and the KHR_materials_clearcoat specifications. (#13031) 2024-05-05 22:57:05 +00:00
IrradianceVolumeExample Implement irradiance volumes. (#10268) 2024-02-06 23:23:20 +00:00
MixedLightingExample Introduce support for mixed lighting by allowing lights to opt out of contributing diffuse light to lightmapped objects. (#16761) 2024-12-16 23:48:33 +00:00
PalmTree Implement percentage-closer soft shadows (PCSS). (#13497) 2024-09-18 18:07:17 +00:00
ship Use a ship in Transform::align example (#13935) 2024-06-20 00:58:00 +00:00
SimpleSkin Mesh Skinning. Attempt #3 (#4238) 2022-03-29 18:31:13 +00:00
sphere Hot asset reloading 2020-05-16 20:18:30 -07:00
terrain Procedural atmospheric scattering (#16314) 2025-01-23 22:52:46 +00:00
TonemappingTest Implement filmic color grading. (#13121) 2024-05-02 12:18:59 +00:00
torus Remove monkey.gltf (#9974) 2023-09-30 02:50:31 +00:00
VolumetricFogExample Implement volumetric fog and volumetric lighting, also known as light shafts or god rays. (#13057) 2024-05-16 17:13:18 +00:00
Box0.bin organize examples and add ecs guide 2020-05-01 13:12:47 -07:00