diff --git a/VertexFadeRP/assets/minecraft/shaders/core/convert_rendertype.py b/VertexFadeRP/assets/minecraft/shaders/core/convert_rendertype.py new file mode 100644 index 0000000..1a45a5d --- /dev/null +++ b/VertexFadeRP/assets/minecraft/shaders/core/convert_rendertype.py @@ -0,0 +1,63 @@ +import os + +shaders = [ + "rendertype_beacon_beam", + "rendertype_crumbling", + "rendertype_cutout_mipped", + "rendertype_cutout", + #"rendertype_entity_alpha", + #"rendertype_entity_cutout_no_cull_z_offset", + #"rendertype_entity_cutout_no_cull", + #"rendertype_entity_cutout", + #"rendertype_entity_decal", + #"rendertype_entity_glint_direct", + #"rendertype_entity_glint", + #"rendertype_entity_no_outline", + #"rendertype_entity_shadow", + #"rendertype_entity_smooth_cutout", + #"rendertype_entity_solid", + #"rendertype_entity_translucent_cull", + #"rendertype_entity_translucent", + #"rendertype_eyes", + "rendertype_solid", + "rendertype_translucent_moving_block", + "rendertype_translucent_no_crumbling", + "rendertype_translucent", + "rendertype_water_mask" + ] + +for file in os.listdir('.'): + rendertype_block = False + for shader in shaders: + if file.find(shader) != -1 and file.startswith("rendertype_") and file.endswith(".json"): + rendertype_block = True + break + + if True: + if not file.endswith(".json"): + continue + with open(file, 'r') as f: + fread = f.readlines() + modify = True + for line in fread: + if line.find("main/rendertype_block") != -1 or line.find("main/rendertype_entity") != -1: + modify = False + if not modify: + continue + gread = fread.copy() + for i,line in enumerate(fread): + if line.find("vertex") != -1: + if rendertype_block: + line = ' "vertex": "main/rendertype_block",\n' + else: + line = ' "vertex": "main/rendertype_entity",\n' + gread[i] = line + if line.find("]\n") != -1 and i > len(fread) - 5: + gread[i-1] = gread[i-1].replace("}","},") + gread.insert(i, ' { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] }\n') + with open(file, 'w') as f: + f.write("".join(gread)) + + + + diff --git a/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_block.vsh b/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_block.vsh index b07a00d..2efc398 100644 --- a/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_block.vsh +++ b/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_block.vsh @@ -14,6 +14,7 @@ uniform sampler2D Sampler2; uniform mat4 ModelViewMat; uniform mat4 ProjMat; uniform vec3 ChunkOffset; +uniform float GameTime; out float vertexDistance; out vec4 vertexColor; @@ -73,7 +74,8 @@ void main() { float blockDistance = max(0.0, length((ModelViewMat * vec4(Position - uvOffset + vec3(0.5) + ChunkOffset, 1.0)).xyz) - distanceThreshold); blockDistance *= blockDistance; - float scale = clamp(blockDistance * 0.1 / fadeScale, 0.0, 1.0); + float animation = (sin((rand(Position - uvOffset) + GameTime) * 1600.0) / 8.0) * 0.25 + 0.75; + float scale = clamp(blockDistance * animation * 0.1 / fadeScale, 0.0, 1.0); vec3 uvScale = vec3(0.5 - uv.x, 0.0, 0.5 - uv.y) * scale; if (Normal == vec3(1.0, 0.0, 0.0)) { // Positive X uvScale = vec3(0.0, uv.y - 0.5, uv.x - 0.5) * scale; @@ -95,7 +97,7 @@ void main() { } else { gl_Position = ProjMat * ModelViewMat * vec4(floor(Position) + uvScale + ChunkOffset, 1.0); } - gl_Position += normal * blockDistance * 0.2 / fadeScale * rand(Position - uvOffset); + gl_Position += normal * blockDistance * animation * 0.2 / fadeScale * rand(Position - uvOffset); if (blockDistance > 10.0 * fadeScale) { gl_Position = vec4(0.0); } diff --git a/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_entity.vsh b/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_entity.vsh index d978881..a67bcf6 100644 --- a/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_entity.vsh +++ b/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_entity.vsh @@ -15,6 +15,7 @@ uniform sampler2D Sampler2; uniform mat4 ModelViewMat; uniform mat4 ProjMat; +uniform float GameTime; uniform vec3 Light0_Direction; uniform vec3 Light1_Direction; @@ -25,7 +26,6 @@ out vec4 lightMapColor; out vec4 overlayColor; out vec2 texCoord0; out vec4 normal; -out vec3 light0; float mod289(float x){return x - floor(x * (1.0 / 289.0)) * 289.0;} vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;} @@ -54,7 +54,6 @@ float rand(vec3 p){ } void main() { - light0 = Light0_Direction; vec2 uv = mod(UV0, 16.0/1024.0) * 1024.0/16.0; vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz); @@ -83,7 +82,8 @@ void main() { float blockDistance = max(0.0, length((ModelViewMat * vec4(Position - uvOffset + vec3(0.5), 1.0)).xyz) - distanceThreshold); blockDistance *= blockDistance; - float scale = clamp(blockDistance * 0.1 / fadeScale, 0.0, 1.0); + float animation = (sin((rand(Position - uvOffset) + GameTime) * 1600.0) / 8.0) * 0.25 + 0.75; + float scale = clamp(blockDistance * animation * 0.1 / fadeScale, 0.0, 1.0); vec3 uvScale = vec3(0.5 - uv.x, 0.0, 0.5 - uv.y) * scale; if (Normal == vec3(1.0, 0.0, 0.0)) { // Positive X uvScale = vec3(0.0, uv.y - 0.5, uv.x - 0.5) * scale; @@ -102,7 +102,7 @@ void main() { gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); // Skip inventory items if (Light0_Direction.y > 67.0/255.0 || (Light0_Direction.y < 66.0/255.0 && Light0_Direction.y > 44.0/255.0) || Light0_Direction.y < 43.0/255.0) { - gl_Position += normal * blockDistance * 0.2 / fadeScale * rand(Position - uvOffset); + gl_Position += normal * blockDistance * animation * 0.2 / fadeScale * rand(Position - uvOffset); if (blockDistance > 10.0 * fadeScale) { gl_Position = vec4(0.0); } diff --git a/VertexFadeRP/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.json b/VertexFadeRP/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.json index 4f15510..7f4d4f0 100644 --- a/VertexFadeRP/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.json +++ b/VertexFadeRP/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.json @@ -27,6 +27,7 @@ { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, - { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] } + { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, + { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] } ] } diff --git a/VertexFadeRP/assets/minecraft/shaders/core/rendertype_entity_solid.json b/VertexFadeRP/assets/minecraft/shaders/core/rendertype_entity_solid.json index 72b47e5..8f76a35 100644 --- a/VertexFadeRP/assets/minecraft/shaders/core/rendertype_entity_solid.json +++ b/VertexFadeRP/assets/minecraft/shaders/core/rendertype_entity_solid.json @@ -27,6 +27,7 @@ { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, - { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] } + { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, + { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] } ] }