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
d4737438
Commit
d4737438
authored
Dec 21, 2019
by
Bruno Lourenço
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix GLES3 light cutoff.
parent
a10449bb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
scene.glsl
drivers/gles3/shaders/scene.glsl
+12
-2
No files found.
drivers/gles3/shaders/scene.glsl
View file @
d4737438
...
...
@@ -1254,7 +1254,12 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi
vec3
light_rel_vec
=
omni_lights
[
idx
].
light_pos_inv_radius
.
xyz
-
vertex
;
float
light_length
=
length
(
light_rel_vec
);
float
normalized_distance
=
light_length
*
omni_lights
[
idx
].
light_pos_inv_radius
.
w
;
float
omni_attenuation
=
pow
(
max
(
1
.
0
-
normalized_distance
,
0
.
0
),
omni_lights
[
idx
].
light_direction_attenuation
.
w
);
float
omni_attenuation
;
if
(
normalized_distance
<
1
.
0
)
{
omni_attenuation
=
pow
(
normalized_distance
,
omni_lights
[
idx
].
light_direction_attenuation
.
w
);
}
else
{
omni_attenuation
=
0
.
0
;
}
vec3
light_attenuation
=
vec3
(
omni_attenuation
);
#if !defined(SHADOWS_DISABLED)
...
...
@@ -1313,7 +1318,12 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi
vec3
light_rel_vec
=
spot_lights
[
idx
].
light_pos_inv_radius
.
xyz
-
vertex
;
float
light_length
=
length
(
light_rel_vec
);
float
normalized_distance
=
light_length
*
spot_lights
[
idx
].
light_pos_inv_radius
.
w
;
float
spot_attenuation
=
pow
(
max
(
1
.
0
-
normalized_distance
,
0
.
001
),
spot_lights
[
idx
].
light_direction_attenuation
.
w
);
float
spot_attenuation
;
if
(
normalized_distance
<
1
.
0
)
{
spot_attenuation
=
pow
(
1
.
0
-
normalized_distance
,
spot_lights
[
idx
].
light_direction_attenuation
.
w
);
}
else
{
spot_attenuation
=
0
.
0
;
}
vec3
spot_dir
=
spot_lights
[
idx
].
light_direction_attenuation
.
xyz
;
float
spot_cutoff
=
spot_lights
[
idx
].
light_params
.
y
;
float
scos
=
max
(
dot
(
-
normalize
(
light_rel_vec
),
spot_dir
),
spot_cutoff
);
...
...
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