Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point/Spot light docs #6813

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions crates/bevy_pbr/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ use crate::{
#[derive(Component, Debug, Clone, Copy, Reflect)]
#[reflect(Component, Default)]
pub struct PointLight {
/// Color of the light emitted.
pub color: Color,
/// Amount/strength of light emitted, in lumens.
pub intensity: f32,
/// How far light extends from the surface (TODO: or center?) of the point light.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// How far light extends from the surface (TODO: or center?) of the point light.
/// How far light extends from the center of the point light.

pub range: f32,
/// The size (radius) of the point light itself.
///
/// A radius of 0.0 (the default) is a point with no measureable size, while a radius of 1.0 is a unit sphere, etc.
Copy link
Contributor

@doup doup Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it's the case in Bevy, but usually the size of the light source affects the sharpness of the shadows. The bigger the light source (keeping the light source at the same distance from the object), the softer the shadows get as they are further from the object. I mention the distance, because the sun is a huge sphere, but since it's so far that it works as a directional light giving mostly sharp shadows (?).

Might be interesting to mention?

Rendered in Blender:

Light radius: 0.1m
image

Radius: 1m
image

Radius: 2m
image

Copy link
Contributor

@superdump superdump Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no soft shadows yet. This would be addressed by something like #3631 . When I was hacking on soft shadows using the PCSS method, I was using the light's radius for this kind of effect.

pub radius: f32,
pub shadows_enabled: bool,
pub shadow_depth_bias: f32,
Expand Down Expand Up @@ -92,9 +98,15 @@ impl Default for PointLightShadowMap {
#[derive(Component, Debug, Clone, Copy, Reflect)]
#[reflect(Component, Default)]
pub struct SpotLight {
/// Color of the light emitted.
pub color: Color,
/// Amount/strength of light emitted, in lumens.
pub intensity: f32,
/// How far light extends from the surface (TODO: or center?) of the spot light.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// How far light extends from the surface (TODO: or center?) of the spot light.
/// How far light extends from the center of the spot light.

pub range: f32,
/// The size (radius) of the spot light itself.
///
/// A radius of 0.0 (the default) is a point with no measureable size, while a radius of 1.0 is a unit sphere, etc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Radius 1.0 would give the cone cut from a unit sphere according to the outer angle.

pub radius: f32,
pub shadows_enabled: bool,
pub shadow_depth_bias: f32,
Expand Down