-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update multisplat16.shader #301
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,9 @@ uniform bool u_depth_blending = true; | |
uniform float u_globalmap_blend_start; | ||
uniform float u_globalmap_blend_distance; | ||
uniform bool u_tile_reduction = false; | ||
uniform float low_edge = 0.1; | ||
uniform float smoothness = 0.2; | ||
uniform float height_boost = 0.1; | ||
|
||
varying float v_hole; | ||
varying vec3 v_tint; | ||
|
@@ -52,13 +55,16 @@ vec4 pack_normal(vec3 n, float a) { | |
// Blends weights according to the bump of detail textures, | ||
// so for example it allows to have sand fill the gaps between pebbles | ||
vec4 get_depth_blended_weights(vec4 splat, vec4 bumps) { | ||
float dh = 0.2; | ||
|
||
float dh = height_boost; | ||
bumps.r = 1.0 - pow(1.0 - bumps.r, 0.5); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Careful with |
||
bumps.g = pow(bumps.g, 2.0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
bumps.b = pow(bumps.b, 3.0); | ||
bumps.a = pow(bumps.a, 4.0); | ||
vec4 h = bumps + splat; | ||
|
||
// TODO Keep improving multilayer blending, there are still some edge cases... | ||
// Mitigation: nullify layers with near-zero splat | ||
h *= smoothstep(0, 0.05, splat); | ||
h *= smoothstep(low_edge, smoothness, splat); | ||
|
||
vec4 d = h + dh; | ||
d.r -= max(h.g, max(h.b, h.a)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should respect naming convention, uniforms start with
u_
(I wish I could use_
only but Godot reserves that).Also I have no idea what these do just from the name. I see they all affect how textures are blended (when depth blending is on) but their name alone doesnt reflect that either.