Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
a64d78a3
Commit
a64d78a3
authored
9 years ago
by
RealBadAngel
Committed by
est31
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Speed up and make more accurate relief mapping
using linear + binary search.
parent
696148e2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/shaders/nodes_shader/opengl_fragment.glsl
+19
-5
19 additions, 5 deletions
client/shaders/nodes_shader/opengl_fragment.glsl
with
19 additions
and
5 deletions
client/shaders/nodes_shader/opengl_fragment.glsl
+
19
−
5
View file @
a64d78a3
...
...
@@ -47,15 +47,29 @@ vec4 get_normal_map(vec2 uv)
float
find_intersection
(
vec2
dp
,
vec2
ds
)
{
const
float
depth_step
=
1
.
0
/
24
.
0
;
float
depth
=
1
.
0
;
for
(
int
i
=
0
;
i
<
24
;
i
++
)
{
float
best_depth
=
0
.
0
;
float
size
=
0
.
0625
;
for
(
int
i
=
0
;
i
<
15
;
i
++
)
{
depth
-=
size
;
float
h
=
texture2D
(
normalTexture
,
dp
+
ds
*
depth
).
a
;
if
(
h
>=
depth
)
if
(
depth
<=
h
)
{
best_depth
=
depth
;
break
;
depth
-=
depth_step
;
}
}
return
depth
;
depth
=
best_depth
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
size
*=
0
.
5
;
float
h
=
texture2D
(
normalTexture
,
dp
+
ds
*
depth
).
a
;
if
(
depth
<=
h
)
{
best_depth
=
depth
;
depth
+=
size
;
}
else
{
depth
-=
size
;
}
}
return
best_depth
;
}
float
find_intersectionRGB
(
vec2
dp
,
vec2
ds
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment