Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
34ee273e
Commit
34ee273e
authored
May 01, 2020
by
clayjohn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Calculate sun diameter even when not using shadows
parent
d2887ea7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
rasterizer_scene_high_end_rd.cpp
.../rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
+13
-9
No files found.
servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
View file @
34ee273e
...
...
@@ -1720,6 +1720,16 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
light_data
.
shadow_enabled
=
p_using_shadows
&&
storage
->
light_has_shadow
(
base
);
float
angular_diameter
=
storage
->
light_get_param
(
base
,
RS
::
LIGHT_PARAM_SIZE
);
if
(
angular_diameter
>
0.0
)
{
// I know tan(0) is 0, but let's not risk it with numerical precision.
// technically this will keep expanding until reaching the sun, but all we care
// is expand until we reach the radius of the near plane (there can't be more occluders than that)
angular_diameter
=
Math
::
tan
(
Math
::
deg2rad
(
angular_diameter
));
}
else
{
angular_diameter
=
0.0
;
}
if
(
light_data
.
shadow_enabled
)
{
RS
::
LightDirectionalShadowMode
smode
=
storage
->
light_directional_get_shadow_mode
(
base
);
...
...
@@ -1775,15 +1785,9 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
light_data
.
fade_to
=
-
light_data
.
shadow_split_offsets
[
3
];
light_data
.
soft_shadow_scale
=
storage
->
light_get_param
(
base
,
RS
::
LIGHT_PARAM_SHADOW_BLUR
);
light_data
.
softshadow_angle
=
angular_diameter
;
float
softshadow_angle
=
storage
->
light_get_param
(
base
,
RS
::
LIGHT_PARAM_SIZE
);
if
(
softshadow_angle
>
0.0
)
{
// I know tan(0) is 0, but let's not risk it with numerical precision.
// technically this will keep expanding until reaching the sun, but all we care
// is expand until we reach the radius of the near plane (there can't be more occluders than that)
light_data
.
softshadow_angle
=
Math
::
tan
(
Math
::
deg2rad
(
softshadow_angle
));
}
else
{
light_data
.
softshadow_angle
=
0
;
if
(
angular_diameter
<=
0.0
)
{
light_data
.
soft_shadow_scale
*=
directional_shadow_quality_radius_get
();
// Only use quality radius for PCF
}
}
...
...
@@ -1806,7 +1810,7 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
sky_light_data
.
color
[
2
]
=
light_data
.
color
[
2
];
sky_light_data
.
enabled
=
true
;
sky_light_data
.
size
=
light_data
.
softshadow_angle
;
sky_light_data
.
size
=
angular_diameter
;
sky_scene_state
.
directional_light_count
++
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment