Skip to content

Easy access to sun light data in shader#1536

Merged
C-Core merged 3 commits into
devfrom
user/ck/sun-index
Apr 17, 2025
Merged

Easy access to sun light data in shader#1536
C-Core merged 3 commits into
devfrom
user/ck/sun-index

Conversation

@C-Core
Copy link
Copy Markdown
Member

@C-Core C-Core commented Apr 17, 2025

EZ does not have the concept of a "sun" light but often you need this information in custom shaders. With this change ez exposes the "brightest" directional light, which is typically the sun, and allows you to access its data in any shader like so:

ezPerLightData sunData = GetBrightestDirectionalLightData();
float3 sunDir = GetLightDirection(sunData);
float3 sunColor = GetLightColor(sunData);
float sunIntensity = sunData.intensity;

Note that some data like e.g. direction and color is accessed with helper functions because the data is stored compressed and requires custom unpacking. Other data like itensity can be just accessed as is.

@C-Core C-Core merged commit fa49ee0 into dev Apr 17, 2025
10 of 14 checks passed
@C-Core C-Core deleted the user/ck/sun-index branch April 17, 2025 21:00
@jankrassnigg jankrassnigg added new feature improvement Improves an existing feature labels May 1, 2025
@jankrassnigg jankrassnigg added this to the Next Release milestone May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants