-
-
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?
Conversation
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.
This needs explanation because I have no clue how this works^^"
Also you updated that shader but it's not the only one using that technique (there is a fair amount of copypasta to make once this is finalized)
@@ -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; |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Careful with pow
, it's a transcendental math function, it's expensive. Here you raise to power 0.5, which is actually square root, so maybe use sqrt
instead?
Not sure what this formula does
|
||
float dh = height_boost; | ||
bumps.r = 1.0 - pow(1.0 - bumps.r, 0.5); | ||
bumps.g = pow(bumps.g, 2.0); |
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.
pow
again, prefer squaring by multiplying by itself. Are GLSL compilers smart enough to replace the call with that? Still no idea why you do this though, it's like some textures are more important than others or something
Could you add comparison screenshots between the old and new shader? |
The pow in the function is to alleviate issues when there are more than 4 textures blending at the same time. If you paint with low opacity brushes with more than 4 textures you'll see abrupt cuts starting to show. I can't show the assets i tested with but I can show in a clean project later. As for the names, i have no idea either exactly what they do :D that's why they are not very descriptive. I'm open to any name you will propose ^^ |
When I have 5+ textures in one area, I often get lines like the dashed line across textures as you can see on the rock faces on the right and left (not the rock cracks). By pushing around the textures more I can eventually brush these out. I inserted the changes to bump into my Regarding the functions:
|
My own attempt at more organic blending for the multisplat plugin and preventing hard cuts when painting with low opacity