diff --git a/pack/assets/minecraft/shaders/core/rendertype_beacon_beam.fsh b/pack/assets/minecraft/shaders/core/rendertype_beacon_beam.fsh index ab794d6..decd6b2 100644 --- a/pack/assets/minecraft/shaders/core/rendertype_beacon_beam.fsh +++ b/pack/assets/minecraft/shaders/core/rendertype_beacon_beam.fsh @@ -9,13 +9,16 @@ uniform vec4 ColorModulator; uniform float FogStart; uniform float FogEnd; uniform vec4 FogColor; -uniform vec4 Pink; in vec4 vertexColor; in vec2 texCoord0; out vec4 fragColor; +vec4 pink = vec4(0.957, 0.722, 0.859, 1); + +// This file slightly alters the colour of the beacon beam + void main() { vec4 color = texture(Sampler0, texCoord0); color *= vertexColor * ColorModulator; @@ -34,6 +37,6 @@ void main() { nuts /= 3; nuts += 0.25; - color.rgb = mix(color.rgb, Pink.rgb, nuts); + color.rgb = mix(color.rgb, pink.rgb, nuts); fragColor = linear_fog(color, fragmentDistance, FogStart, FogEnd, FogColor); } diff --git a/pack/assets/minecraft/shaders/core/rendertype_beacon_beam.json b/pack/assets/minecraft/shaders/core/rendertype_beacon_beam.json deleted file mode 100644 index 6e8155b..0000000 --- a/pack/assets/minecraft/shaders/core/rendertype_beacon_beam.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "blend": { - "func": "add", - "srcrgb": "srcalpha", - "dstrgb": "1-srcalpha" - }, - "vertex": "rendertype_beacon_beam", - "fragment": "rendertype_beacon_beam", - "attributes": [ - "Position", - "Color", - "UV0" - ], - "samplers": [ - { "name": "Sampler0" } - ], - "uniforms": [ - { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, - { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.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": "Pink", "type": "float", "count": 4, "values": [ 0.957, 0.722, 0.859, 1 ] } - ] -} diff --git a/pack/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh b/pack/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh new file mode 100644 index 0000000..fd88faf --- /dev/null +++ b/pack/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh @@ -0,0 +1,50 @@ +#version 150 + +#moj_import +#moj_import + +uniform sampler2D Sampler0; + +uniform vec4 ColorModulator; +uniform float FogStart; +uniform float FogEnd; +uniform vec4 FogColor; + +in float vertexDistance; +in vec4 vertexColor; +in vec2 texCoord0; +in vec2 texCoord1; +in vec4 normal; +in vec4 tintColour; + +out vec4 fragColor; + +/** + * This changes the colour of XP orbs. + * + * I stole some of the code from this funky individual (planet minecraft, point and laugh): + * https://www.planetminecraft.com/texture-pack/rainbow-xp-vanilla/ + * + * Simply hue shifting the XP colours worked sufficiently well for me, but if I wanted + * better control over the resulting colours I'd have to put more effort into this. + * The resulting colour pulses between purple and dark pink. + */ + +void main() { + vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator; + if (color.a < 0.1) { + discard; + } + + // detect xp orbs using their tint colour + vec4 col255 = tintColour * 255; + if( + 0 <= col255.r && col255.r <= 255 && + 253 <= col255.g && col255.g <= 255 && + 0 <= col255.b && col255.b <= 51 + ) { + color = vec4(hueShift(color.rgb, 160), color.a); + } + + fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); +} diff --git a/pack/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh b/pack/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh new file mode 100644 index 0000000..14e4c81 --- /dev/null +++ b/pack/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh @@ -0,0 +1,43 @@ +#version 150 + +#moj_import +#moj_import + +in vec3 Position; +in vec4 Color; +in vec2 UV0; +in vec2 UV1; +in ivec2 UV2; +in vec3 Normal; + +uniform sampler2D Sampler2; + +uniform mat4 ModelViewMat; +uniform mat4 ProjMat; +uniform mat3 IViewRotMat; +uniform int FogShape; + +uniform vec3 Light0_Direction; +uniform vec3 Light1_Direction; + +out float vertexDistance; +out vec4 vertexColor; +out vec2 texCoord0; +out vec2 texCoord1; +out vec2 texCoord2; +out vec4 normal; +out vec4 tintColour; + +// This file is modified to pass `tintColour` as output. + +void main() { + gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); + + vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape); + vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * texelFetch(Sampler2, UV2 / 16, 0); + tintColour = Color; + texCoord0 = UV0; + texCoord1 = UV1; + texCoord2 = UV2; + normal = ProjMat * ModelViewMat * vec4(Normal, 0.0); +} diff --git a/pack/assets/minecraft/shaders/include/hue_shift.glsl b/pack/assets/minecraft/shaders/include/hue_shift.glsl new file mode 100644 index 0000000..f17a8b7 --- /dev/null +++ b/pack/assets/minecraft/shaders/include/hue_shift.glsl @@ -0,0 +1,28 @@ +#version 150 + +// https://gist.github.com/mairod/a75e7b44f68110e1576d77419d608786 + +vec3 hueShift( vec3 color, float hueAdjust ) { + const vec3 kRGBToYPrime = vec3 (0.299, 0.587, 0.114); + const vec3 kRGBToI = vec3 (0.596, -0.275, -0.321); + const vec3 kRGBToQ = vec3 (0.212, -0.523, 0.311); + + const vec3 kYIQToR = vec3 (1.0, 0.956, 0.621); + const vec3 kYIQToG = vec3 (1.0, -0.272, -0.647); + const vec3 kYIQToB = vec3 (1.0, -1.107, 1.704); + + float YPrime = dot (color, kRGBToYPrime); + float I = dot (color, kRGBToI); + float Q = dot (color, kRGBToQ); + float hue = atan (Q, I); + float chroma = sqrt (I * I + Q * Q); + + hue += hueAdjust; + + Q = chroma * sin (hue); + I = chroma * cos (hue); + + vec3 yIQ = vec3 (YPrime, I, Q); + + return vec3( dot (yIQ, kYIQToR), dot (yIQ, kYIQToG), dot (yIQ, kYIQToB) ); +}