Skip to content
Open
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
16 changes: 8 additions & 8 deletions scene/resources/3d/sky_material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,43 +327,43 @@ void sky() {
float sun_angle = dot(LIGHT0_DIRECTION, EYEDIR);
float sun_size = cos(LIGHT0_SIZE);
if (sun_angle > sun_size) {
sky = LIGHT0_COLOR * LIGHT0_ENERGY;
sky += LIGHT0_COLOR * LIGHT0_ENERGY;
} else if (sun_angle > sun_angle_max) {
float c2 = (sun_size - sun_angle) / (sun_size - sun_angle_max);
sky = mix(sky, LIGHT0_COLOR * LIGHT0_ENERGY, clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0));
sky += LIGHT0_COLOR * LIGHT0_ENERGY * clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0);
}
}

if (LIGHT1_ENABLED) {
float sun_angle = dot(LIGHT1_DIRECTION, EYEDIR);
float sun_size = cos(LIGHT1_SIZE);
if (sun_angle > sun_size) {
sky = LIGHT1_COLOR * LIGHT1_ENERGY;
sky += LIGHT1_COLOR * LIGHT1_ENERGY;
} else if (sun_angle > sun_angle_max) {
float c2 = (sun_size - sun_angle) / (sun_size - sun_angle_max);
sky = mix(sky, LIGHT1_COLOR * LIGHT1_ENERGY, clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0));
sky += LIGHT1_COLOR * LIGHT1_ENERGY * clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0);
}
}

if (LIGHT2_ENABLED) {
float sun_angle = dot(LIGHT2_DIRECTION, EYEDIR);
float sun_size = cos(LIGHT2_SIZE);
if (sun_angle > sun_size) {
sky = LIGHT2_COLOR * LIGHT2_ENERGY;
sky += LIGHT2_COLOR * LIGHT2_ENERGY;
} else if (sun_angle > sun_angle_max) {
float c2 = (sun_size - sun_angle) / (sun_size - sun_angle_max);
sky = mix(sky, LIGHT2_COLOR * LIGHT2_ENERGY, clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0));
sky += LIGHT2_COLOR * LIGHT2_ENERGY * clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0);
}
}

if (LIGHT3_ENABLED) {
float sun_angle = dot(LIGHT3_DIRECTION, EYEDIR);
float sun_size = cos(LIGHT3_SIZE);
if (sun_angle > sun_size) {
sky = LIGHT3_COLOR * LIGHT3_ENERGY;
sky += LIGHT3_COLOR * LIGHT3_ENERGY;
} else if (sun_angle > sun_angle_max) {
float c2 = (sun_size - sun_angle) / (sun_size - sun_angle_max);
sky = mix(sky, LIGHT3_COLOR * LIGHT3_ENERGY, clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0));
sky += LIGHT3_COLOR * LIGHT3_ENERGY * clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0);
}
}

Expand Down