From 2f711456bdc33a3c21f85630c4000dbed7e26234 Mon Sep 17 00:00:00 2001 From: onnowhere <17817284+onnowhere@users.noreply.github.com> Date: Sat, 27 Mar 2021 08:09:41 -0700 Subject: [PATCH] Fix entity position visual bug --- .../minecraft/blockstates/dirt_path.json | 9 +++ .../assets/minecraft/blockstates/podzol.json | 12 ++++ .../shaders/core/convert_rendertype.py | 63 ------------------- .../shaders/core/main/rendertype_block.vsh | 4 +- .../shaders/core/main/rendertype_entity.vsh | 4 +- .../shaders/include/vertex_fade.glsl | 2 +- 6 files changed, 26 insertions(+), 68 deletions(-) create mode 100644 VertexFadeRP/assets/minecraft/blockstates/dirt_path.json create mode 100644 VertexFadeRP/assets/minecraft/blockstates/podzol.json delete mode 100644 VertexFadeRP/assets/minecraft/shaders/core/convert_rendertype.py diff --git a/VertexFadeRP/assets/minecraft/blockstates/dirt_path.json b/VertexFadeRP/assets/minecraft/blockstates/dirt_path.json new file mode 100644 index 0000000..fe1cfad --- /dev/null +++ b/VertexFadeRP/assets/minecraft/blockstates/dirt_path.json @@ -0,0 +1,9 @@ +{ + "variants": { + "": [ + { + "model": "minecraft:block/dirt_path" + } + ] + } +} \ No newline at end of file diff --git a/VertexFadeRP/assets/minecraft/blockstates/podzol.json b/VertexFadeRP/assets/minecraft/blockstates/podzol.json new file mode 100644 index 0000000..dc33475 --- /dev/null +++ b/VertexFadeRP/assets/minecraft/blockstates/podzol.json @@ -0,0 +1,12 @@ +{ + "variants": { + "snowy=false": [ + { + "model": "minecraft:block/podzol" + } + ], + "snowy=true": { + "model": "minecraft:block/grass_block_snow" + } + } +} \ No newline at end of file diff --git a/VertexFadeRP/assets/minecraft/shaders/core/convert_rendertype.py b/VertexFadeRP/assets/minecraft/shaders/core/convert_rendertype.py deleted file mode 100644 index 1a45a5d..0000000 --- a/VertexFadeRP/assets/minecraft/shaders/core/convert_rendertype.py +++ /dev/null @@ -1,63 +0,0 @@ -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 2efc398..58e4dc4 100644 --- a/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_block.vsh +++ b/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_block.vsh @@ -98,7 +98,7 @@ void main() { gl_Position = ProjMat * ModelViewMat * vec4(floor(Position) + uvScale + ChunkOffset, 1.0); } gl_Position += normal * blockDistance * animation * 0.2 / fadeScale * rand(Position - uvOffset); - if (blockDistance > 10.0 * fadeScale) { - gl_Position = vec4(0.0); + if (blockDistance > 15.0 * fadeScale) { + gl_Position = vec4(100.0, 100.0, 100.0, -1.0); } } diff --git a/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_entity.vsh b/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_entity.vsh index a67bcf6..b18557c 100644 --- a/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_entity.vsh +++ b/VertexFadeRP/assets/minecraft/shaders/core/main/rendertype_entity.vsh @@ -103,8 +103,8 @@ void main() { // 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 * animation * 0.2 / fadeScale * rand(Position - uvOffset); - if (blockDistance > 10.0 * fadeScale) { - gl_Position = vec4(0.0); + if (blockDistance > 15.0 * fadeScale) { + gl_Position = vec4(100.0, 100.0, 100.0, -1.0); } } } diff --git a/VertexFadeRP/assets/minecraft/shaders/include/vertex_fade.glsl b/VertexFadeRP/assets/minecraft/shaders/include/vertex_fade.glsl index df44a4f..11265d6 100644 --- a/VertexFadeRP/assets/minecraft/shaders/include/vertex_fade.glsl +++ b/VertexFadeRP/assets/minecraft/shaders/include/vertex_fade.glsl @@ -1,2 +1,2 @@ -#define distanceThreshold 12.0 +#define distanceThreshold 16.0 #define fadeScale 5.0