Skip to content

Commit

Permalink
Merge branch 'master' into in-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
hotsu0p authored Mar 24, 2024
2 parents 6d98a0a + a784197 commit 17f9a2d
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 100 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Welcome to an immersive visual experience! Beyond Vanilla is a shader pack designed to take your Minecraft adventures to the next level.

## Links
Modrinth: https://modrinth.com/shader/beyond-vanilla\
Modrinth: https://modrinth.com/shader/beyond-vanilla \
forge: (Soon)\
Github: https://github.com/hotsu0p/beyond-vanilla

Expand Down
7 changes: 7 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Security Policy

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Please open an issue
17 changes: 6 additions & 11 deletions shaders/block.properties
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,12 @@ block.10056=\ minecraft:powered_rail:powered=true
block.10057=\ minecraft:note_block:powered=true minecraft:jukebox:has_record=true
block.10100= \ minecraft:grass minecraft:fern minecraft:seagrass minecraft:oak_sapling minecraft:spruce_sapling minecraft:birch_sapling minecraft:jungle_sapling minecraft:acacia_sapling minecraft:dark_oak_sapling minecraft:cherry_sapling
minecraft:crimson_roots minecraft:warped_roots minecraft:nether_sprouts
block.10101= \
minecraft:poppy minecraft:dandelion minecraft:blue_orchid minecraft:allium minecraft:azure_bluet minecraft:red_tulip minecraft:orange_tulip minecraft:white_tulip minecraft:pink_tulip minecraft:oxeye_daisy minecraft:cornflower minecraft:lily_of_the_valley minecraft:wither_rose minecraft:sweet_berry_bush minecraft:pink_petals \
minecraft:tube_coral minecraft:brain_coral minecraft:bubble_coral minecraft:fire_coral minecraft:horn_coral minecraft:dead_tube_coral minecraft:dead_brain_coral minecraft:dead_bubble_coral minecraft:dead_fire_coral minecraft:dead_horn_coral minecraft:tube_coral_fan minecraft:brain_coral_fan minecraft:bubble_coral_fan minecraft:fire_coral_fan minecraft:horn_coral_fan minecraft:dead_tube_coral_fan minecraft:dead_brain_coral_fan minecraft:dead_bubble_coral_fan minecraft:dead_fire_coral_fan minecraft:dead_horn_coral_fan
block.10102= \
minecraft:sunflower:half=lower minecraft:lilac:half=lower minecraft:tall_grass:half=lower minecraft:large_fern:half=lower minecraft:rose_bush:half=lower minecraft:peony:half=lower minecraft:tall_seagrass:half=lower
block.10103= \
minecraft:sunflower:half=upper minecraft:lilac:half=upper minecraft:tall_grass:half=upper minecraft:large_fern:half=upper minecraft:rose_bush:half=upper minecraft:peony:half=upper minecraft:tall_seagrass:half=upper
block.10104= \
minecraft:wheat minecraft:carrots minecraft:potatoes minecraft:beetroots minecraft:pumpkin_stem minecraft:attached_pumpkin_stem minecraft:melon_stem minecraft:attached_melon_stem minecraft:torchflower
block.10105= \
minecraft:oak_leaves minecraft:spruce_leaves minecraft:birch_leaves minecraft:jungle_leaves minecraft:acacia_leaves minecraft:dark_oak_leaves minecraft:azalea_leaves minecraft:flowering_azalea_leaves minecraft:mangrove_leaves minecraft:cherry_leaves

block.10101= \ minecraft:poppy minecraft:dandelion minecraft:blue_orchid minecraft:allium minecraft:azure_bluet minecraft:red_tulip minecraft:orange_tulip minecraft:white_tulip minecraft:pink_tulip minecraft:oxeye_daisy minecraft:cornflower minecraft:lily_of_the_valley minecraft:wither_rose minecraft:sweet_berry_bush minecraft:pink_petals minecraft:tube_coral minecraft:brain_coral minecraft:bubble_coral minecraft:fire_coral minecraft:horn_coral minecraft:dead_tube_coral minecraft:dead_brain_coral minecraft:dead_bubble_coral minecraft:dead_fire_coral minecraft:dead_horn_coral minecraft:tube_coral_fan minecraft:brain_coral_fan minecraft:bubble_coral_fan minecraft:fire_coral_fan minecraft:horn_coral_fan minecraft:dead_tube_coral_fan minecraft:dead_brain_coral_fan minecraft:dead_bubble_coral_fan minecraft:dead_fire_coral_fan minecraft:dead_horn_coral_fan
block.10102= \ minecraft:sunflower:half=lower minecraft:lilac:half=lower minecraft:tall_grass:half=lower minecraft:large_fern:half=lower minecraft:rose_bush:half=lower minecraft:peony:half=lower minecraft:tall_seagrass:half=lower
block.10103= \ minecraft:sunflower:half=upper minecraft:lilac:half=upper minecraft:tall_grass:half=upper minecraft:large_fern:half=upper minecraft:rose_bush:half=upper minecraft:peony:half=upper minecraft:tall_seagrass:half=upper
block.10104= \ minecraft:wheat minecraft:carrots minecraft:potatoes minecraft:beetroots minecraft:pumpkin_stem minecraft:attached_pumpkin_stem minecraft:melon_stem minecraft:attached_melon_stem minecraft:torchflower
block.10105= \ minecraft:oak_leaves minecraft:spruce_leaves minecraft:birch_leaves minecraft:jungle_leaves minecraft:acacia_leaves minecraft:dark_oak_leaves minecraft:azalea_leaves minecraft:flowering_azalea_leaves minecraft:mangrove_leaves minecraft:cherry_leaves
block.10106= \
minecraft:vine minecraft:weeping_vines_plant minecraft:weeping_vines minecraft:twisting_vines_plant minecraft:twisting_vines
block.10107= \
Expand Down
10 changes: 7 additions & 3 deletions shaders/lib/vertex/waving.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,13 @@ vec3 WavingBlocks(vec3 position, float istopv) {
#endif

#ifdef WAVING_LEAF
if (mc_Entity.x == 10105)
wave += CalcMove(worldpos, 0.25, .80, vec2(0.04, 0.04));

if (mc_Entity.x == 10105 && istopv > 0.9) {
float swingSpeed = 0.05;
float swingAmplitude = 0.01;
float swingDirection = 1.0;
wave.x += sin(worldpos.y * swingSpeed + frametime) * swingAmplitude * swingDirection;
wave.z += cos(worldpos.y * swingSpeed + frametime) * swingAmplitude * swingDirection;
}
#endif

#ifdef WAVING_VINE
Expand Down
31 changes: 24 additions & 7 deletions shaders/program/gbuffers_water.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -677,13 +677,30 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;

//Common Functions//
float WavingWater(vec3 worldPos) {
float fractY = fract(worldPos.y + cameraPosition.y + 0.005);

float wave = sin(6.28 * (frametime * 0.7 + worldPos.x * 0.14 + worldPos.z * 0.07)) +
sin(6.28 * (frametime * 0.5 + worldPos.x * 0.10 + worldPos.z * 0.20));
if (fractY > 0.01) return wave * 0.0125;

return 0.0;
float fractY = fract(worldPos.y + cameraPosition.y + 0.005);

float distance = distance(worldPos, cameraPosition);
float waveFrequency = mix(0.7, 0.5, distance / 10.0);
float waveAmplitude = mix(0.035, 0.02, distance / 10.0);

// Adjust the wave frequency and amplitude based on distance to avoid glitches at far distances
waveFrequency *= 1.0 - smoothstep(0.0, 100.0, distance);
waveAmplitude *= 1.0 - smoothstep(0.0, 100.0, distance);

float wave = sin(6.28 * (frametime * waveFrequency + worldPos.x * 0.14 + worldPos.z * 0.07)) +
sin(6.28 * (frametime * waveFrequency + worldPos.x * 0.10 + worldPos.z * 0.20));

// Clamp the wave amplitude to prevent extreme values
waveAmplitude = clamp(waveAmplitude, 0.0, 0.02);

// Apply a smoothstep function to the wave to reduce the appearance of black lines
wave = smoothstep(-1.0, 1.0, wave);

if (fractY > 0.01) {
return wave * waveAmplitude;
}

return 0.0;
}

uniform sampler2D raindropTexture;
Expand Down
161 changes: 83 additions & 78 deletions shaders/program/shadow.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ varying vec4 color;

//Uniforms//
uniform int blockEntityId;

uniform sampler2D tex;

#ifdef WATER_CAUSTICS
uniform int worldTime;

uniform float frameTimeCounter;

uniform sampler2D noisetex;
uniform vec3 cameraPosition; // Add this line
#endif

//Common Variables//
Expand Down Expand Up @@ -68,92 +65,100 @@ float GetWaterHeightMap(vec3 worldPos, vec2 offset) {
#include "/lib/color/waterColor.glsl"
#endif

//Program//
//Program//
//Program//
//Program//
void main() {
#if MC_VERSION >= 11300
if (blockEntityId == 10205) discard;
#endif
if (blockEntityId == 10205) discard;
#endif

vec4 albedo = texture2D(tex, texCoord.xy);
albedo.rgb *= color.rgb;
albedo.rgb *= color.rgb;

float premult = float(mat > 0.98 && mat < 1.02);
float water = float(mat > 1.98 && mat < 2.02);
float disable = float(mat > 2.98 && mat < 3.02);
if (albedo.a < 0.01 || disable > 0.5) discard;

if (water > 0.5) {
#if !defined WATER_SHADOW_COLOR && !defined WATER_CAUSTICS
discard;
#else
#ifdef WATER_SHADOW_COLOR
#if WATER_MODE == 0
albedo.rgb = pow(waterColor.rgb / waterColor.a, vec3(0.25));
#elif WATER_MODE == 1
albedo.rgb = sqrt(albedo.rgb);
#elif WATER_MODE == 2
float waterLuma = length(albedo.rgb * albedo.rgb / pow(color.rgb, vec3(2.2))) * 2.0;
albedo.rgb = sqrt(waterLuma * sqrt(waterColor.rgb / waterColor.a));
#elif WATER_MODE == 3
albedo.rgb = sqrt(color.rgb * 0.59);
#endif

#if WATER_ALPHA_MODE == 0
albedo.a = waterAlpha;
#endif
#else
albedo.rgb = vec3(1.0);
#endif

#ifdef WATER_CAUSTICS
float normalOffset = WATER_SHARPNESS + 0.2;

float normalStrength = 0.35;

float h0 = GetWaterHeightMap(worldPos, vec2(0.0));
float h1 = GetWaterHeightMap(worldPos, vec2( normalOffset, 0.0));
float h2 = GetWaterHeightMap(worldPos, vec2(-normalOffset, 0.0));
float h3 = GetWaterHeightMap(worldPos, vec2(0.0, normalOffset));
float h4 = GetWaterHeightMap(worldPos, vec2(0.0, -normalOffset));

float xDeltaA = (h1 - h0) / normalOffset;
float xDeltaB = (h2 - h0) / normalOffset;
float yDeltaA = (h3 - h0) / normalOffset;
float yDeltaB = (h4 - h0) / normalOffset;

float height = max((xDeltaA * -xDeltaB + yDeltaA * -yDeltaB), 0.0);

#if WATER_NORMALS == 1
height *= 48.0;
#elif WATER_NORMALS == 2
height *= 24.0;
#endif

#ifdef WATER_SHADOW_COLOR
height /= length(albedo.rgb);
#endif

height /= sqrt(height * height / 9.0 + 1.0);

albedo.rgb *= 1.0 + height;
#endif
#endif
}
float water = float(mat > 1.98 && mat < 2.02);
float disable = float(mat > 2.98 && mat < 3.02);
if (albedo.a < 0.01 || disable > 0.5) discard;

if (water > 0.5) {
#if !defined WATER_SHADOW_COLOR && !defined WATER_CAUSTICS
discard;
#else
#ifdef WATER_SHADOW_COLOR
#if WATER_MODE == 0
albedo.rgb = pow(waterColor.rgb / waterColor.a, vec3(0.25));
#elif WATER_MODE == 1
albedo.rgb = sqrt(albedo.rgb);
#elif WATER_MODE == 2
float waterLuma = length(albedo.rgb * albedo.rgb / pow(color.rgb, vec3(2.2))) * 2.0;
albedo.rgb = sqrt(waterLuma * sqrt(waterColor.rgb / waterColor.a));
#elif WATER_MODE == 3
albedo.rgb = sqrt(color.rgb * 0.59);
#endif

#if WATER_ALPHA_MODE == 0
albedo.a = waterAlpha;
#endif
#else
albedo.rgb = vec3(1.0);
#endif

#ifdef WATER_CAUSTICS
// Smooth the caustics effect to prevent flashing
float normalOffset = WATER_SHARPNESS + 0.2;
float normalStrength = 0.35;

float h0 = GetWaterHeightMap(worldPos, vec2(0.0));
float h1 = GetWaterHeightMap(worldPos, vec2( normalOffset, 0.0));
float h2 = GetWaterHeightMap(worldPos, vec2(-normalOffset, 0.0));
float h3 = GetWaterHeightMap(worldPos, vec2(0.0, normalOffset));
float h4 = GetWaterHeightMap(worldPos, vec2(0.0, -normalOffset));

float xDeltaA = (h1 - h0) / normalOffset;
float xDeltaB = (h2 - h0) / normalOffset;
float yDeltaA = (h3 - h0) / normalOffset;
float yDeltaB = (h4 - h0) / normalOffset;

float height = max((xDeltaA * -xDeltaB + yDeltaA * -yDeltaB), 0.0);

#if WATER_NORMALS == 1
height *= 48.0;
#elif WATER_NORMALS == 2
height *= 24.0;
#endif

#ifdef WATER_SHADOW_COLOR
height /= length(albedo.rgb);
#endif

height /= sqrt(height * height / 9.0 + 1.0);

// Apply a smoothing function to the height to prevent flashing
height = smoothstep(0.0, 1.0, height);

albedo.rgb *= 1.0 + height;
#endif
#endif
}

#ifdef SHADOW_COLOR
albedo.rgb = mix(vec3(1.0), albedo.rgb, 1.0 - pow(1.0 - albedo.a, 1.5));
albedo.rgb *= 1.0 - pow(albedo.a, 96.0);
#else
if ((premult > 0.5 && albedo.a < 0.98)) albedo.a = 0.0;
#endif
albedo.rgb = mix(vec3(1.0), albedo.rgb, 1.0 - pow(1.0 - albedo.a, 1.5));
albedo.rgb *= 1.0 - pow(albedo.a, 96.0);
#else
if ((premult > 0.5 && albedo.a < 0.98)) albedo.a = 0.0;
#endif

#ifdef WATER_CAUSTICS
albedo.rgb *= 0.25;
#endif
#ifdef WATER_CAUSTICS
albedo.rgb *= 0.25;
#endif

gl_FragData[0] = albedo;
}
// Ensure that the albedo is not too dark during the day
albedo.rgb = max(albedo.rgb, vec3(0.1));

gl_FragData[0] = albedo;
}
#endif

//Vertex Shader/////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 17f9a2d

Please sign in to comment.