-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xCollateral
committed
Oct 25, 2023
1 parent
e3dbe71
commit fd6becc
Showing
6 changed files
with
146 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 1 addition & 8 deletions
9
src/main/resources/assets/vulkanmod/shaders/basic/terrain_direct/terrain_direct.fsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 1 addition & 8 deletions
9
src/main/resources/assets/vulkanmod/shaders/basic/terrain_indirect/terrain_indirect.fsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/resources/assets/vulkanmod/shaders/include/light.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//light.glsl | ||
#define MINECRAFT_LIGHT_POWER (0.6) | ||
#define MINECRAFT_AMBIENT_LIGHT (0.4) | ||
|
||
vec4 minecraft_mix_light(vec3 lightDir0, vec3 lightDir1, vec3 normal, vec4 color) { | ||
lightDir0 = normalize(lightDir0); | ||
lightDir1 = normalize(lightDir1); | ||
float light0 = max(0.0, dot(lightDir0, normal)); | ||
float light1 = max(0.0, dot(lightDir1, normal)); | ||
float lightAccum = min(1.0, (light0 + light1) * MINECRAFT_LIGHT_POWER + MINECRAFT_AMBIENT_LIGHT); | ||
return vec4(color.rgb * lightAccum, color.a); | ||
} | ||
|
||
//vec4 minecraft_sample_lightmap(sampler2D lightMap, ivec2 uv) { | ||
// return texture(lightMap, clamp(uv / 256.0, vec2(0.5 / 16.0), vec2(15.5 / 16.0))); | ||
//} | ||
|
||
vec4 sample_lightmap(sampler2D lightMap, ivec2 uv) { | ||
return texelFetch(lightMap, (uv & 255) >> 4, 0); | ||
} | ||
|
||
vec4 linear_fog(vec4 inColor, float vertexDistance, float fogStart, float fogEnd, vec4 fogColor) { | ||
if (vertexDistance <= fogStart) { | ||
return inColor; | ||
} | ||
|
||
float fogValue = vertexDistance < fogEnd ? smoothstep(fogStart, fogEnd, vertexDistance) : 1.0; | ||
return vec4(mix(inColor.rgb, fogColor.rgb, fogValue * fogColor.a), inColor.a); | ||
} |