├── .gitattributes ├── screenshots ├── concave.png ├── rainbow.png └── tinted.png ├── shaders ├── shaders.properties ├── gbuffers_basic.fsh ├── gbuffers_skybasic.vsh ├── block.properties ├── gbuffers_skytextured.vsh ├── gbuffers_clouds.vsh ├── gbuffers_skytextured.fsh ├── gbuffers_skybasic.fsh ├── gbuffers_clouds.fsh ├── gbuffers_hand.fsh ├── gbuffers_basic.vsh ├── gbuffers_hand.vsh ├── gbuffers_textured.fsh └── gbuffers_textured.vsh └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /screenshots/concave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XorDev/Trippy-Shaderpack/HEAD/screenshots/concave.png -------------------------------------------------------------------------------- /screenshots/rainbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XorDev/Trippy-Shaderpack/HEAD/screenshots/rainbow.png -------------------------------------------------------------------------------- /screenshots/tinted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XorDev/Trippy-Shaderpack/HEAD/screenshots/tinted.png -------------------------------------------------------------------------------- /shaders/shaders.properties: -------------------------------------------------------------------------------- 1 | screen = [Uncube] [Globe] [Technicolor] [Waviness] 2 | screen.Uncube = Terrain Shininess Hand Offset 3 | screen.Globe = Radius Toggle 4 | screen.Technicolor = Color Animation Spread 5 | screen.Waviness = Amount Frequency Speed 6 | 7 | sliders = Terrain Shininess Radius Color Animation Spread Amount Frequency Speed 8 | -------------------------------------------------------------------------------- /shaders/gbuffers_basic.fsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform float blindness; 4 | uniform int isEyeInWater; 5 | 6 | varying vec4 color; 7 | 8 | void main() 9 | { 10 | float fog = (isEyeInWater>0) ? 1.-exp(-gl_FogFragCoord * gl_Fog.density): 11 | clamp((gl_FogFragCoord-gl_Fog.start) * gl_Fog.scale, 0., 1.); 12 | 13 | vec4 col = color * vec4(vec3(1.-blindness),1); 14 | col.rgb = mix(col.rgb, gl_Fog.color.rgb, fog); 15 | gl_FragData[0] = col; 16 | } 17 | -------------------------------------------------------------------------------- /shaders/gbuffers_skybasic.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform mat4 gbufferModelView; 4 | uniform mat4 gbufferModelViewInverse; 5 | 6 | varying vec4 color; 7 | varying vec3 world; 8 | 9 | void main() 10 | { 11 | vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; 12 | pos = (gbufferModelViewInverse * vec4(pos,1)).xyz; 13 | world = pos; 14 | 15 | gl_Position = gl_ProjectionMatrix * gbufferModelView * vec4(pos,1); 16 | gl_FogFragCoord = length(pos); 17 | 18 | color = gl_Color; 19 | } 20 | -------------------------------------------------------------------------------- /shaders/block.properties: -------------------------------------------------------------------------------- 1 | block.1 = water 2 | block.2 = grass tall_grass fern large_fern wheat beetroots carrots potatoes sweet_berry_bush mushrooms kelp nether_wart fire tube_coral brain_coral bubble_coral fire_coral horn_coral dead_tube_coral dead_brain_coral dead_bubble_coral dead_fire_coral dead_horn_coral dandelion poppy blue_orchid allium azure_bluet red_tulip orange_tulip white_tulip pink_tulip oxeye_daisy cornflower lily_of_the_valley wither_rose sunflower lilac rose_bush peony seagrass sugar_cane dead_bush cobweb torch redstone_torch end_rod 3 | -------------------------------------------------------------------------------- /shaders/gbuffers_skytextured.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform mat4 gbufferModelView; 4 | uniform mat4 gbufferModelViewInverse; 5 | 6 | varying vec4 color; 7 | varying vec3 world; 8 | varying vec2 coord0; 9 | 10 | void main() 11 | { 12 | vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; 13 | pos = (gbufferModelViewInverse * vec4(pos,1)).xyz; 14 | world = pos; 15 | 16 | gl_Position = gl_ProjectionMatrix * gbufferModelView * vec4(pos,1); 17 | 18 | color = vec4(gl_Color.rgb, gl_Color.a); 19 | coord0 = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; 20 | } 21 | -------------------------------------------------------------------------------- /shaders/gbuffers_clouds.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform mat4 gbufferModelView; 4 | uniform mat4 gbufferModelViewInverse; 5 | uniform vec3 cameraPosition; 6 | 7 | varying vec4 color; 8 | varying vec3 world; 9 | varying vec2 coord0; 10 | 11 | void main() 12 | { 13 | vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; 14 | pos = mat3(gbufferModelViewInverse) * pos + gbufferModelViewInverse[3].xyz; 15 | world = pos+cameraPosition; 16 | 17 | gl_Position = gl_ProjectionMatrix * gbufferModelView * vec4(pos,1); 18 | gl_FogFragCoord = length(pos); 19 | 20 | coord0 = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; 21 | color = gl_Color; 22 | } 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Trippy-Shaderpack 2 | Here's a conglomeration of my crazy Minecraft shaders all in one shaderpack! There are plenty of settings to tweak waviness, color intensity, distortion, curvature and more. 3 | 4 | To use this pack, [download the shaders here](https://github.com/XorDev/Trippy-Shaderpack/archive/master.zip) and put them in you .minecraft/shaderpacks folder. 5 | NOTE: You need to get [Optifine](https://optifine.net/downloads) first! 6 | 7 | ![Concave](/screenshots/concave.png) 8 | ![Tinted](/screenshots/tinted.png) 9 | ![Rainbow](/screenshots/rainbow.png) 10 | 11 | Play around with it and let me know what you think or 12 | send me screenshots on [Twitter](https://twitter.com/XorDev)! 13 | -------------------------------------------------------------------------------- /shaders/gbuffers_skytextured.fsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | #define Color 1. //Rainbow intensity [.0 .2 .5 .8 1.] 4 | #define Animation 0. //Animation speed [.0 .2 .5 .8 1.] 5 | #define Spread .5 //Color Spread [.0 .2 .5 .8 1.] 6 | 7 | uniform sampler2D texture; 8 | 9 | uniform float frameTimeCounter; 10 | uniform float blindness; 11 | 12 | varying vec4 color; 13 | varying vec3 world; 14 | varying vec2 coord0; 15 | 16 | vec3 hash3(vec3 p) 17 | { 18 | return fract(cos(p*mat3(-31.14,15.92,65.35,-89.79,-32.38,46.26,43.38,32.79,-02.88))*41.97); 19 | } 20 | vec3 value3(vec3 p) 21 | { 22 | vec3 f = floor(p); 23 | vec3 s = p-f; s*= s*s*(3.-s-s); 24 | const vec2 o = vec2(0,1); 25 | return mix(mix(mix(hash3(f+o.xxx),hash3(f+o.yxx),s.x), 26 | mix(hash3(f+o.xyx),hash3(f+o.yyx),s.x),s.y), 27 | mix(mix(hash3(f+o.xxy),hash3(f+o.yxy),s.x), 28 | mix(hash3(f+o.xyy),hash3(f+o.yyy),s.x),s.y),s.z); 29 | } 30 | void main() 31 | { 32 | float light = 1.-blindness; 33 | 34 | vec4 tex = texture2D(texture,coord0); 35 | vec3 col = value3(world*.04)*8.+value3((world+world.zxy)*.1*Spread)*3.+frameTimeCounter*Animation; 36 | gl_FragData[0] = color * mix(tex, tex * vec4((cos(col)*.5+.5)*light,1), Color); 37 | } 38 | -------------------------------------------------------------------------------- /shaders/gbuffers_skybasic.fsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | #define Color 1. //Rainbow intensity [.0 .2 .5 .8 1.] 4 | #define Animation 0. //Animation speed [.0 .2 .5 .8 1.] 5 | #define Spread .5 //Color Spread [.0 .2 .5 .8 1.] 6 | 7 | uniform sampler2D texture; 8 | 9 | uniform float frameTimeCounter; 10 | uniform float blindness; 11 | uniform int isEyeInWater; 12 | 13 | varying vec4 color; 14 | varying vec3 world; 15 | 16 | vec3 hash3(vec3 p) 17 | { 18 | return fract(cos(p*mat3(-31.14,15.92,65.35,-89.79,-32.38,46.26,43.38,32.79,-02.88))*41.97); 19 | } 20 | vec3 value3(vec3 p) 21 | { 22 | vec3 f = floor(p); 23 | vec3 s = p-f; s*= s*s*(3.-s-s); 24 | const vec2 o = vec2(0,1); 25 | return mix(mix(mix(hash3(f+o.xxx),hash3(f+o.yxx),s.x), 26 | mix(hash3(f+o.xyx),hash3(f+o.yyx),s.x),s.y), 27 | mix(mix(hash3(f+o.xxy),hash3(f+o.yxy),s.x), 28 | mix(hash3(f+o.xyy),hash3(f+o.yyy),s.x),s.y),s.z); 29 | } 30 | void main() 31 | { 32 | float light = 1.-blindness; 33 | 34 | float fog = (isEyeInWater>0) ? 1.-exp(-gl_FogFragCoord * gl_Fog.density): 35 | clamp((gl_FogFragCoord-gl_Fog.start) * gl_Fog.scale, 0., 1.); 36 | 37 | vec4 col = vec4(vec3(value3(world*.04*Spread)*8.+value3((world+world.zxy)*.1*Spread)*3.),0)*light; 38 | col = mix(color,vec4(cos(color.rgb*3.+col.rgb+frameTimeCounter*Animation)*.5+.5,color.a),Color); 39 | col.rgb = mix(col.rgb, gl_Fog.color.rgb, fog); 40 | 41 | gl_FragData[0] = col; 42 | } 43 | -------------------------------------------------------------------------------- /shaders/gbuffers_clouds.fsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | #define Color 1. //Rainbow intensity [.0 .2 .5 .8 1.] 4 | #define Animation 0. //Animation speed [.0 .2 .5 .8 1.] 5 | #define Spread .5 //Color Spread [.0 .2 .5 .8 1.] 6 | 7 | uniform sampler2D texture; 8 | 9 | uniform float frameTimeCounter; 10 | uniform float blindness; 11 | uniform int isEyeInWater; 12 | 13 | varying vec4 color; 14 | varying vec3 world; 15 | varying vec2 coord0; 16 | 17 | vec3 hash3(vec3 p) 18 | { 19 | return fract(cos(p*mat3(-31.14,15.92,65.35,-89.79,-32.38,46.26,43.38,32.79,-02.88))*41.97); 20 | } 21 | vec3 value3(vec3 p) 22 | { 23 | vec3 f = floor(p); 24 | vec3 s = p-f; s*= s*s*(3.-s-s); 25 | const vec2 o = vec2(0,1); 26 | return mix(mix(mix(hash3(f+o.xxx),hash3(f+o.yxx),s.x), 27 | mix(hash3(f+o.xyx),hash3(f+o.yyx),s.x),s.y), 28 | mix(mix(hash3(f+o.xxy),hash3(f+o.yxy),s.x), 29 | mix(hash3(f+o.xyy),hash3(f+o.yyy),s.x),s.y),s.z); 30 | } 31 | void main() 32 | { 33 | float fog = (isEyeInWater>0) ? 1.-exp(-gl_FogFragCoord * gl_Fog.density): 34 | clamp((gl_FogFragCoord-gl_Fog.start) * gl_Fog.scale, 0., 1.); 35 | 36 | vec4 tex = texture2D(texture,coord0); 37 | vec4 col = vec4(value3(world*.04*Spread)*8.+value3((world+world.zxy)*.1*Spread)*3.,0); 38 | col = mix(color * tex, color * vec4(cos(tex.rgb*3.+col.rgb+frameTimeCounter*Animation)*.5+.5,tex.a), Color); 39 | col.rgb = mix(col.rgb, gl_Fog.color.rgb, fog)*(1.-blindness); 40 | gl_FragData[0] = col; 41 | } 42 | -------------------------------------------------------------------------------- /shaders/gbuffers_hand.fsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | #define Shininess 1. //Water shine intensity [.0 .5 1.] 4 | 5 | #define Color 1. //Rainbow intensity [.0 .2 .5 .8 1.] 6 | #define Animation 0. //Animation speed [.0 .2 .5 .8 1.] 7 | #define Spread .5 //Color Spread [.0 .2 .5 .8 1.] 8 | 9 | uniform sampler2D texture; 10 | uniform sampler2D lightmap; 11 | 12 | uniform mat4 gbufferModelViewInverse; 13 | uniform vec3 shadowLightPosition; 14 | uniform float frameTimeCounter; 15 | uniform float blindness; 16 | uniform int isEyeInWater; 17 | 18 | varying vec4 color; 19 | varying vec3 model; 20 | varying vec3 world; 21 | varying vec2 coord0; 22 | varying vec2 coord1; 23 | 24 | vec3 hash3(vec3 p) 25 | { 26 | return fract(cos(p*mat3(-31.14,15.92,65.35,-89.79,-32.38,46.26,43.38,32.79,-02.88))*41.97); 27 | } 28 | vec3 value3(vec3 p) 29 | { 30 | vec3 f = floor(p); 31 | vec3 s = p-f; s*= s*s*(3.-s-s); 32 | const vec2 o = vec2(0,1); 33 | return mix(mix(mix(hash3(f+o.xxx),hash3(f+o.yxx),s.x), 34 | mix(hash3(f+o.xyx),hash3(f+o.yyx),s.x),s.y), 35 | mix(mix(hash3(f+o.xxy),hash3(f+o.yxy),s.x), 36 | mix(hash3(f+o.xyy),hash3(f+o.yyy),s.x),s.y),s.z); 37 | } 38 | void main() 39 | { 40 | vec3 dir = normalize((gbufferModelViewInverse * vec4(shadowLightPosition,0)).xyz); 41 | float flip = clamp(dir.y/.1,-1.,1.); dir *= flip; 42 | vec3 norm = normalize(cross(dFdx(world),dFdy(world))); 43 | float lambert = dot(norm,dir)*.5+.5; 44 | 45 | float sun = exp((dot(reflect(normalize(world),norm),dir)-1.)*15.*(1.5-.5*flip)); 46 | 47 | vec3 light = (lambert*.5+.5)*(1.-blindness) * texture2D(lightmap,coord1).rgb; 48 | vec4 tex = color * texture2D(texture,coord0); 49 | vec4 col = vec4(value3(model*.2*Spread)*8.+value3((model+model.zxy)*.4*Spread)*3.,1); 50 | col = mix(tex, vec4(cos(tex.rgb*3.+col.rgb+frameTimeCounter*Animation)*.5+.5,tex.a), Color) * vec4(light,1); 51 | gl_FragData[0] = col; 52 | } 53 | -------------------------------------------------------------------------------- /shaders/gbuffers_basic.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | #define Radius 16. //Globe radius [4. 10. 12. 16. 24. 32.] 4 | #define Toggle 1. //Enable, disable or invert globe [-1. 0. 1.] 5 | 6 | #define Terrain .4 //Terrain distortion level [.0 .2 .4 .6 .8 1.] 7 | #define Offset 1. //Camera height offset [.0 1.] 8 | 9 | #define Amount .2 //Wave distortion intensity [.0 .2 .5 .8 1.] 10 | #define Frequency .5 //Wave frequency [.0 .2 .5 .8 1.] 11 | #define Speed .5 //Wave animation speed [.0 .2 .5 .8 1.] 12 | 13 | attribute vec2 mc_Entity; 14 | 15 | uniform mat4 gbufferModelView; 16 | uniform mat4 gbufferModelViewInverse; 17 | uniform vec3 cameraPosition; 18 | uniform float frameTimeCounter; 19 | 20 | varying vec4 color; 21 | 22 | vec3 hash3(vec3 p) 23 | { 24 | return fract(cos(p*mat3(-31.14,15.92,65.35,-89.79,-32.38,46.26,43.38,32.79,-02.88))*41.97); 25 | } 26 | vec3 value3(vec3 p) 27 | { 28 | vec3 f = floor(p); 29 | vec3 s = p-f; s*= s*s*(3.-s-s); 30 | const vec2 o = vec2(0,1); 31 | return mix(mix(mix(hash3(f+o.xxx),hash3(f+o.yxx),s.x), 32 | mix(hash3(f+o.xyx),hash3(f+o.yyx),s.x),s.y), 33 | mix(mix(hash3(f+o.xxy),hash3(f+o.yxy),s.x), 34 | mix(hash3(f+o.xyy),hash3(f+o.yyy),s.x),s.y),s.z); 35 | } 36 | vec3 off(vec3 p) 37 | { 38 | vec3 wave = cos(p.zxy*.5*Frequency+frameTimeCounter*Speed)*Amount; 39 | return (value3(p)*.4+value3(p/2.)*.6+value3(p/8.)-1.)*Terrain+wave; 40 | } 41 | 42 | void main() 43 | { 44 | vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; 45 | pos = mat3(gbufferModelViewInverse) * pos + gbufferModelViewInverse[3].xyz; 46 | 47 | pos += off(pos+cameraPosition); 48 | vec3 h = pos+cameraPosition; 49 | pos.y -= off(cameraPosition-vec3(0,1,0)).y*Offset; 50 | pos.y -= dot(pos.xz,pos.xz)/Radius/Radius*Toggle; 51 | 52 | gl_Position = gl_ProjectionMatrix * gbufferModelView * vec4(pos,1); 53 | gl_FogFragCoord = length(pos); 54 | 55 | color = gl_Color; 56 | } 57 | -------------------------------------------------------------------------------- /shaders/gbuffers_hand.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | #define Terrain .4 //Terrain distortion level [.0 .2 .4 .6 .8 1.] 4 | #define Hand 1. //Hand distortion level [.0 1.] 5 | #define Offset 1. //Camera height offset [.0 1.] 6 | 7 | #define Amount .2 //Wave distortion intensity [.0 .2 .5 .8 1.] 8 | #define Frequency .5 //Wave frequency [.0 .2 .5 .8 1.] 9 | #define Speed .5 //Wave animation speed [.0 .2 .5 .8 1.] 10 | 11 | attribute vec2 mc_Entity; 12 | 13 | uniform mat4 gbufferModelView; 14 | uniform mat4 gbufferModelViewInverse; 15 | uniform vec3 cameraPosition; 16 | uniform float frameTimeCounter; 17 | 18 | varying vec4 color; 19 | varying vec3 model; 20 | varying vec3 world; 21 | varying vec2 coord0; 22 | varying vec2 coord1; 23 | varying float id; 24 | 25 | vec3 hash3(vec3 p) 26 | { 27 | return fract(cos(p*mat3(-31.14,15.92,65.35,-89.79,-32.38,46.26,43.38,32.79,-02.88))*41.97); 28 | } 29 | vec3 value3(vec3 p) 30 | { 31 | vec3 f = floor(p); 32 | vec3 s = p-f; s*= s*s*(3.-s-s); 33 | const vec2 o = vec2(0,1); 34 | return mix(mix(mix(hash3(f+o.xxx),hash3(f+o.yxx),s.x), 35 | mix(hash3(f+o.xyx),hash3(f+o.yyx),s.x),s.y), 36 | mix(mix(hash3(f+o.xxy),hash3(f+o.yxy),s.x), 37 | mix(hash3(f+o.xyy),hash3(f+o.yyy),s.x),s.y),s.z); 38 | } 39 | vec3 off(vec3 p) 40 | { 41 | vec3 wave = cos(p.zxy*.5*Frequency+frameTimeCounter*Speed)*Amount; 42 | return (value3(p)*.4+value3(p/2.)*.6+value3(p/8.)-1.)*Terrain+wave; 43 | } 44 | 45 | void main() 46 | { 47 | vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; 48 | pos = mat3(gbufferModelViewInverse) * pos + gbufferModelViewInverse[3].xyz; 49 | model = pos+cameraPosition; 50 | 51 | pos += off(pos+cameraPosition)*Hand; 52 | pos.y -= off(cameraPosition-vec3(0,1,0)).y*Offset*Hand; 53 | 54 | gl_Position = gl_ProjectionMatrix * gbufferModelView * vec4(pos,1); 55 | gl_FogFragCoord = length(pos); 56 | 57 | color = gl_Color; 58 | world = pos; 59 | coord0 = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; 60 | coord1 = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; 61 | id = mc_Entity.x; 62 | } 63 | -------------------------------------------------------------------------------- /shaders/gbuffers_textured.fsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | #define Color 1. //Rainbow intensity [.0 .2 .5 .8 1.] 4 | #define Animation 0. //Animation speed [.0 .2 .5 .8 1.] 5 | #define Spread .5 //Color Spread [.0 .2 .5 .8 1.] 6 | 7 | #define Shininess 1. //Water shine intensity [.0 .5 1.] 8 | 9 | uniform sampler2D texture; 10 | uniform sampler2D lightmap; 11 | 12 | uniform mat4 gbufferModelViewInverse; 13 | uniform vec4 entityColor; 14 | uniform vec3 shadowLightPosition; 15 | uniform vec3 skyColor; 16 | uniform float frameTimeCounter; 17 | uniform float blindness; 18 | uniform int isEyeInWater; 19 | 20 | varying vec4 color; 21 | varying vec3 model; 22 | varying vec3 world; 23 | varying vec2 coord0; 24 | varying vec2 coord1; 25 | varying float id; 26 | 27 | vec3 hash3(vec3 p) 28 | { 29 | return fract(cos(p*mat3(-31.14,15.92,65.35,-89.79,-32.38,46.26,43.38,32.79,-02.88))*41.97); 30 | } 31 | vec3 value3(vec3 p) 32 | { 33 | vec3 f = floor(p); 34 | vec3 s = p-f; s*= s*s*(3.-s-s); 35 | const vec2 o = vec2(0,1); 36 | return mix(mix(mix(hash3(f+o.xxx),hash3(f+o.yxx),s.x), 37 | mix(hash3(f+o.xyx),hash3(f+o.yyx),s.x),s.y), 38 | mix(mix(hash3(f+o.xxy),hash3(f+o.yxy),s.x), 39 | mix(hash3(f+o.xyy),hash3(f+o.yyy),s.x),s.y),s.z); 40 | } 41 | void main() 42 | { 43 | vec3 dir = normalize((gbufferModelViewInverse * vec4(shadowLightPosition,0)).xyz); 44 | float flip = clamp(dir.y/.1,-1.,1.); dir *= flip; 45 | vec3 norm = normalize(cross(dFdx(world),dFdy(world))); 46 | float lambert = (id>1.)?dir.y*.5+.5:dot(norm,dir)*.5+.5; 47 | 48 | float sun = exp((dot(reflect(normalize(world),norm),dir)-1.)*15.*(1.5-.5*flip)); 49 | float shine = sun*flip*flip*Shininess*step(.9,id)*step(id,1.1); 50 | 51 | float fog = (isEyeInWater>0) ? 1.-exp(-gl_FogFragCoord * gl_Fog.density): 52 | clamp((gl_FogFragCoord-gl_Fog.start) * gl_Fog.scale, 0., 1.); 53 | 54 | vec3 light = (lambert*.5+.5)*(1.-blindness) * texture2D(lightmap,coord1).rgb + shine; 55 | vec4 tex = color * texture2D(texture,coord0); 56 | vec4 col = vec4(value3(model*.2*Spread)*8.+value3((model+model.zxy)*.4*Spread)*3.,1); 57 | col = mix(tex, vec4(cos(tex.rgb*3.+col.rgb+frameTimeCounter*Animation)*.5+.5,tex.a), Color) * vec4(light,1); 58 | col.rgb = mix(col.rgb, gl_Fog.color.rgb, fog); 59 | col.rgb = mix(col.rgb, entityColor.rgb, entityColor.a); 60 | gl_FragData[0] = col; 61 | } 62 | -------------------------------------------------------------------------------- /shaders/gbuffers_textured.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | #define Radius 16. //Globe radius [4. 10. 12. 16. 24. 32.] 4 | #define Toggle 1. //Enable, disable or invert globe [-1. 0. 1.] 5 | 6 | #define Terrain .4 //Terrain distortion level [.0 .2 .4 .6 .8 1.] 7 | #define Offset 1. //Camera height offset [.0 1.] 8 | 9 | #define Amount .2 //Wave distortion intensity [.0 .2 .5 .8 1.] 10 | #define Frequency .5 //Wave frequency [.0 .2 .5 .8 1.] 11 | #define Speed .5 //Wave animation speed [.0 .2 .5 .8 1.] 12 | 13 | attribute vec2 mc_Entity; 14 | 15 | uniform mat4 gbufferModelView; 16 | uniform mat4 gbufferModelViewInverse; 17 | uniform vec3 cameraPosition; 18 | uniform float frameTimeCounter; 19 | 20 | varying vec4 color; 21 | varying vec3 model; 22 | varying vec3 world; 23 | varying vec2 coord0; 24 | varying vec2 coord1; 25 | varying float id; 26 | 27 | vec3 hash3(vec3 p) 28 | { 29 | return fract(cos(p*mat3(-31.14,15.92,65.35,-89.79,-32.38,46.26,43.38,32.79,-02.88))*41.97); 30 | } 31 | vec3 value3(vec3 p) 32 | { 33 | vec3 f = floor(p); 34 | vec3 s = p-f; s*= s*s*(3.-s-s); 35 | const vec2 o = vec2(0,1); 36 | return mix(mix(mix(hash3(f+o.xxx),hash3(f+o.yxx),s.x), 37 | mix(hash3(f+o.xyx),hash3(f+o.yyx),s.x),s.y), 38 | mix(mix(hash3(f+o.xxy),hash3(f+o.yxy),s.x), 39 | mix(hash3(f+o.xyy),hash3(f+o.yyy),s.x),s.y),s.z); 40 | } 41 | vec3 off(vec3 p) 42 | { 43 | vec3 wave = cos(p.zxy*.5*Frequency+frameTimeCounter*Speed)*Amount; 44 | return (value3(p)*.4+value3(p/2.)*.6+value3(p/8.)-1.)*Terrain+wave; 45 | } 46 | 47 | void main() 48 | { 49 | vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; 50 | pos = mat3(gbufferModelViewInverse) * pos + gbufferModelViewInverse[3].xyz; 51 | model = pos+cameraPosition; 52 | 53 | float c = fract(pos.y+cameraPosition.y); 54 | c *= min(10.-c/.1,1.); 55 | pos += off(pos+cameraPosition); 56 | vec3 h = pos+cameraPosition; 57 | pos.y -= off(cameraPosition-vec3(0,1,0)).y*Offset; 58 | float water = float(mc_Entity.x==1.); 59 | pos.y += ((cos(h.x*2.+h.y*1.+h.z*2.+frameTimeCounter*4.)*.1-.1)*c)*water*Terrain; 60 | world = pos; 61 | pos.y -= dot(pos.xz,pos.xz)/Radius/Radius*Toggle; 62 | 63 | gl_Position = gl_ProjectionMatrix * gbufferModelView * vec4(pos,1); 64 | gl_FogFragCoord = length(pos); 65 | 66 | color = gl_Color; 67 | coord0 = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; 68 | coord1 = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; 69 | id = mc_Entity.x; 70 | } 71 | --------------------------------------------------------------------------------