Commit Graph

2 Commits

Author SHA1 Message Date
Richard Braakman e626337b00 Use the shorthand functions to construct Val in examples (#24096)
This is my first bevy PR, please tell me if I'm doing anything wrong.

# Objective

Contribute to #22695.
Showcase the preferred coding style in all examples.

## Solution

Replace Val:: constructors with the more ergonomic shorthand functions.
Change their float literals to integer literals if they are integral.

Exceptions:
  - const contexts (the shorthand functions are not const)
- inside bsn! macros (these are new and presumably know what they are
doing)
  - in testbed (these are not really examples)
  - Val::ZERO (no helper function)

## Testing

Ran the changed examples before and after, except the library example
`widgets` where I just checked that it still builds.

## Context

There was PR #22765 that fixed the same thing but only in the UI
examples.

---------

Co-authored-by: ickshonpe <david.curthoys@googlemail.com>
2026-05-03 23:54:21 +00:00
Dylan Sechet 128450bdcc Add rectangular area lights (#23288)
# Objective

Adds initial support for rectangle area lights, closing #7662.

Implements Linearly Transformed Cosines ([Heitz et al,
2016](https://eheitzresearch.wordpress.com/415-2/)), with some tricks
from [these
slides](https://advances.realtimerendering.com/s2016/s2016_ltc_rnd.pdf)
and [the reference
implementation](https://github.com/selfshadow/ltc_code).

## Limitations
There's currently no support for:
- Anisotropic materials (there's [a follow-up
paper](https://aakashkt.github.io/ltc_anisotropic.html) that shouldn't
be too hard to implement on top of this, though)
- Shadows
- Textured lights
- Clustering

## Testing

-  Compared results to eevee/cycles, see showcase section.
- Ran the new example with `cargo run --example rect_light --features
free_camera`, and made sure everythign works at grazing angles and from
behind the light.
- Clearcoat and transmission could probably use more testing, I just
made sure nothing looked obviously broken.
 
---

## Showcase


<img width="1919" height="941" alt="Showcase"
src="https://github.com/user-attachments/assets/f506f05c-4869-4387-aeba-d16944497825"
/>
<img width="1919" height="941" alt="Screenshot From 2026-03-11 11-43-42"
src="https://github.com/user-attachments/assets/c4a44903-784f-4c3e-bd44-84c3fe7bff29"
/>


Varying ground plane roughness:


![grid](https://github.com/user-attachments/assets/4426e9df-cde0-450e-b3b7-5e8c2b9fbdcb)
2026-04-06 22:28:53 +00:00