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
a1d7c496
Commit
a1d7c496
authored
Aug 30, 2017
by
Juan Linietsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved default directional shadow params, added bias split scale, closes #9828
parent
fdc1a907
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
4 deletions
+10
-4
rasterizer_scene_gles3.cpp
drivers/gles3/rasterizer_scene_gles3.cpp
+3
-2
rasterizer_storage_gles3.cpp
drivers/gles3/rasterizer_storage_gles3.cpp
+1
-0
light.cpp
scene/3d/light.cpp
+4
-2
light.h
scene/3d/light.h
+1
-0
visual_server.h
servers/visual_server.h
+1
-0
No files found.
drivers/gles3/rasterizer_scene_gles3.cpp
View file @
a1d7c496
...
...
@@ -4445,9 +4445,10 @@ void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_
}
}
float
bias_mult
=
Math
::
lerp
(
1.0
f
,
light_instance
->
shadow_transform
[
p_pass
].
bias_scale
,
light
->
param
[
VS
::
LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE
]);
zfar
=
light
->
param
[
VS
::
LIGHT_PARAM_RANGE
];
bias
=
light
->
param
[
VS
::
LIGHT_PARAM_SHADOW_BIAS
]
*
light_instance
->
shadow_transform
[
p_pass
].
bias_scale
;
normal_bias
=
light
->
param
[
VS
::
LIGHT_PARAM_SHADOW_NORMAL_BIAS
]
*
light_instance
->
shadow_transform
[
p_pass
].
bias_scale
;
bias
=
light
->
param
[
VS
::
LIGHT_PARAM_SHADOW_BIAS
]
*
bias_mult
;
normal_bias
=
light
->
param
[
VS
::
LIGHT_PARAM_SHADOW_NORMAL_BIAS
]
*
bias_mult
;
fbo
=
directional_shadow
.
fbo
;
vp_height
=
directional_shadow
.
size
;
...
...
drivers/gles3/rasterizer_storage_gles3.cpp
View file @
a1d7c496
...
...
@@ -4448,6 +4448,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type) {
light
->
param
[
VS
::
LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET
]
=
0.3
;
light
->
param
[
VS
::
LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET
]
=
0.6
;
light
->
param
[
VS
::
LIGHT_PARAM_SHADOW_NORMAL_BIAS
]
=
0.1
;
light
->
param
[
VS
::
LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE
]
=
0.1
;
light
->
color
=
Color
(
1
,
1
,
1
,
1
);
light
->
shadow
=
false
;
...
...
scene/3d/light.cpp
View file @
a1d7c496
...
...
@@ -334,6 +334,7 @@ void DirectionalLight::_bind_methods() {
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"directional_shadow_split_3"
,
PROPERTY_HINT_RANGE
,
"0,1,0.001"
),
"set_param"
,
"get_param"
,
PARAM_SHADOW_SPLIT_3_OFFSET
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
BOOL
,
"directional_shadow_blend_splits"
),
"set_blend_splits"
,
"is_blend_splits_enabled"
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"directional_shadow_normal_bias"
,
PROPERTY_HINT_RANGE
,
"0,16,0.01"
),
"set_param"
,
"get_param"
,
PARAM_SHADOW_NORMAL_BIAS
);
ADD_PROPERTYI
(
PropertyInfo
(
Variant
::
REAL
,
"directional_shadow_bias_split_scale"
,
PROPERTY_HINT_RANGE
,
"0,1,0.01"
),
"set_param"
,
"get_param"
,
PARAM_SHADOW_BIAS_SPLIT_SCALE
);
BIND_ENUM_CONSTANT
(
SHADOW_ORTHOGONAL
);
BIND_ENUM_CONSTANT
(
SHADOW_PARALLEL_2_SPLITS
);
...
...
@@ -343,9 +344,10 @@ void DirectionalLight::_bind_methods() {
DirectionalLight
::
DirectionalLight
()
:
Light
(
VisualServer
::
LIGHT_DIRECTIONAL
)
{
set_param
(
PARAM_SHADOW_NORMAL_BIAS
,
0.
2
);
set_param
(
PARAM_SHADOW_BIAS
,
1.0
);
set_param
(
PARAM_SHADOW_NORMAL_BIAS
,
0.
8
);
set_param
(
PARAM_SHADOW_BIAS
,
0.1
);
set_param
(
PARAM_SHADOW_MAX_DISTANCE
,
200
);
set_param
(
PARAM_SHADOW_BIAS_SPLIT_SCALE
,
0.25
);
set_shadow_mode
(
SHADOW_PARALLEL_4_SPLITS
);
blend_splits
=
false
;
...
...
scene/3d/light.h
View file @
a1d7c496
...
...
@@ -58,6 +58,7 @@ public:
PARAM_SHADOW_SPLIT_3_OFFSET
=
VS
::
LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET
,
PARAM_SHADOW_NORMAL_BIAS
=
VS
::
LIGHT_PARAM_SHADOW_NORMAL_BIAS
,
PARAM_SHADOW_BIAS
=
VS
::
LIGHT_PARAM_SHADOW_BIAS
,
PARAM_SHADOW_BIAS_SPLIT_SCALE
=
VS
::
LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE
,
PARAM_MAX
=
VS
::
LIGHT_PARAM_MAX
};
...
...
servers/visual_server.h
View file @
a1d7c496
...
...
@@ -358,6 +358,7 @@ public:
LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET
,
LIGHT_PARAM_SHADOW_NORMAL_BIAS
,
LIGHT_PARAM_SHADOW_BIAS
,
LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE
,
LIGHT_PARAM_MAX
};
...
...
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