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
2c44b2ce
Unverified
Commit
2c44b2ce
authored
Feb 20, 2018
by
Rémi Verschelde
Committed by
GitHub
Feb 20, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16718 from Chaosus/triplanarfix
Add refraction possibility when triplanar uv mode enabled
parents
4b562aaf
b5e4f637
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
material.cpp
scene/resources/material.cpp
+6
-3
No files found.
scene/resources/material.cpp
View file @
2c44b2ce
...
...
@@ -737,15 +737,18 @@ void SpatialMaterial::_update_shader() {
}
}
if
(
features
[
FEATURE_REFRACTION
]
&&
!
flags
[
FLAG_UV1_USE_TRIPLANAR
])
{
//refraction not supported with triplanar
if
(
features
[
FEATURE_REFRACTION
]
)
{
if
(
features
[
FEATURE_NORMAL_MAPPING
])
{
code
+=
"
\t
vec3 ref_normal = normalize( mix(NORMAL,TANGENT * NORMALMAP.x + BINORMAL * NORMALMAP.y + NORMAL * NORMALMAP.z,NORMALMAP_DEPTH) );
\n
"
;
}
else
{
code
+=
"
\t
vec3 ref_normal = NORMAL;
\n
"
;
}
code
+=
"
\t
vec2 ref_ofs = SCREEN_UV - ref_normal.xy * dot(texture(texture_refraction,base_uv),refraction_texture_channel) * refraction;
\n
"
;
if
(
flags
[
FLAG_UV1_USE_TRIPLANAR
])
{
code
+=
"
\t
vec2 ref_ofs = SCREEN_UV - ref_normal.xy * dot(triplanar_texture(texture_refraction,uv1_power_normal,uv1_triplanar_pos),refraction_texture_channel) * refraction;
\n
"
;
}
else
{
code
+=
"
\t
vec2 ref_ofs = SCREEN_UV - ref_normal.xy * dot(texture(texture_refraction,base_uv),refraction_texture_channel) * refraction;
\n
"
;
}
code
+=
"
\t
float ref_amount = 1.0 - albedo.a * albedo_tex.a;
\n
"
;
code
+=
"
\t
EMISSION += textureLod(SCREEN_TEXTURE,ref_ofs,ROUGHNESS * 8.0).rgb * ref_amount;
\n
"
;
code
+=
"
\t
ALBEDO *= 1.0 - ref_amount;
\n
"
;
...
...
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