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
animated Fix validation errors in Fox.glb (#17801) 2025-02-11 22:19:24 +00:00
AnisotropyBarnLamp
barycentric
CornellBox
cube
cubes
DepthOfFieldExample
extras
Faces Light Textures (#18031) 2025-06-30 21:56:17 +00:00
FlightHelmet
FlightHelmetLowPoly
GltfPrimitives Cosmetic tweaks to query_gltf_primitives (#16102) 2024-10-27 19:06:19 +00:00
GolfBall
IrradianceVolumeExample
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
SimpleSkin
sphere
terrain Procedural atmospheric scattering (#16314) 2025-01-23 22:52:46 +00:00
TonemappingTest
torus
VolumetricFogExample
Box0.bin