├── .gitignore ├── img ├── info.xcf ├── button.xcf ├── ESBE_3G.xcf ├── button0.png ├── button1.png └── expanded.png ├── docs ├── soon.jpg ├── esbe3g.png └── photo │ ├── 0.4-0.jpg │ ├── 0.4-1.jpg │ ├── 0.4-2.jpg │ ├── 1.0-0.jpg │ ├── 2.0-0.jpg │ ├── 2.0-1.jpg │ ├── 2.0-2.jpg │ ├── 2.1-0.jpg │ ├── 2.1-1.jpg │ └── 2.0teaser.jpg ├── ESBE_3G ├── info.png ├── button.png ├── pack_icon.png ├── ui │ ├── tabbed_upsell_screen.json │ ├── win10_trial_conversion_screen.json │ ├── pause_screen.json │ └── start_screen.json ├── textures │ └── environment │ │ ├── sun.png │ │ ├── clouds.png │ │ └── moon_phases.png ├── materials │ ├── sky.material │ └── terrain.material ├── texts │ ├── ja_JP.lang │ └── en_US.lang ├── manifest.json ├── shaders │ ├── hlsl │ │ ├── stars.fragment.hlsl │ │ ├── pnoise.fxh │ │ ├── snoise.fxh │ │ ├── sky.vertex.hlsl │ │ ├── sun.vsh.hlsl │ │ ├── sun.fsh.hlsl │ │ ├── sky.fsh.hlsl │ │ ├── terrain.vsh.hlsl │ │ ├── entity.vertex.hlsl │ │ ├── terrain.fsh.hlsl │ │ └── entity.fragment.hlsl │ └── glsl │ │ ├── sky.vertex │ │ ├── stars.fragment │ │ ├── sun.vsh │ │ ├── pnoise.h │ │ ├── snoise.h │ │ ├── sun.fsh │ │ ├── sky.fsh │ │ ├── terrain.vsh │ │ ├── entity.vertex │ │ ├── entity.fragment │ │ └── terrain.fsh ├── LICENSE └── biomes_client.json ├── README.md ├── his&memo_ja.txt └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /img/info.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/img/info.xcf -------------------------------------------------------------------------------- /docs/soon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/soon.jpg -------------------------------------------------------------------------------- /img/button.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/img/button.xcf -------------------------------------------------------------------------------- /ESBE_3G/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/ESBE_3G/info.png -------------------------------------------------------------------------------- /docs/esbe3g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/esbe3g.png -------------------------------------------------------------------------------- /img/ESBE_3G.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/img/ESBE_3G.xcf -------------------------------------------------------------------------------- /img/button0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/img/button0.png -------------------------------------------------------------------------------- /img/button1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/img/button1.png -------------------------------------------------------------------------------- /img/expanded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/img/expanded.png -------------------------------------------------------------------------------- /ESBE_3G/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/ESBE_3G/button.png -------------------------------------------------------------------------------- /ESBE_3G/pack_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/ESBE_3G/pack_icon.png -------------------------------------------------------------------------------- /docs/photo/0.4-0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/photo/0.4-0.jpg -------------------------------------------------------------------------------- /docs/photo/0.4-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/photo/0.4-1.jpg -------------------------------------------------------------------------------- /docs/photo/0.4-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/photo/0.4-2.jpg -------------------------------------------------------------------------------- /docs/photo/1.0-0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/photo/1.0-0.jpg -------------------------------------------------------------------------------- /docs/photo/2.0-0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/photo/2.0-0.jpg -------------------------------------------------------------------------------- /docs/photo/2.0-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/photo/2.0-1.jpg -------------------------------------------------------------------------------- /docs/photo/2.0-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/photo/2.0-2.jpg -------------------------------------------------------------------------------- /docs/photo/2.1-0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/photo/2.1-0.jpg -------------------------------------------------------------------------------- /docs/photo/2.1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/photo/2.1-1.jpg -------------------------------------------------------------------------------- /docs/photo/2.0teaser.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/docs/photo/2.0teaser.jpg -------------------------------------------------------------------------------- /ESBE_3G/ui/tabbed_upsell_screen.json: -------------------------------------------------------------------------------- 1 | {"namespace":"tabbed_upsell","tabbed_upseel_screen_panel@start.esbe_main":{}} 2 | -------------------------------------------------------------------------------- /ESBE_3G/textures/environment/sun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/ESBE_3G/textures/environment/sun.png -------------------------------------------------------------------------------- /ESBE_3G/textures/environment/clouds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/ESBE_3G/textures/environment/clouds.png -------------------------------------------------------------------------------- /ESBE_3G/ui/win10_trial_conversion_screen.json: -------------------------------------------------------------------------------- 1 | {"namespace":"win10_trial_conversion","win10_trial_conversion_panel@start.esbe_main":{}} 2 | -------------------------------------------------------------------------------- /ESBE_3G/textures/environment/moon_phases.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/McbeEringi/esbe-3g/HEAD/ESBE_3G/textures/environment/moon_phases.png -------------------------------------------------------------------------------- /ESBE_3G/materials/sky.material: -------------------------------------------------------------------------------- 1 | {"sun_moon":{"vertexShader":"shaders/sun.vsh","fragmentShader":"shaders/sun.fsh"},"skyplane":{"fragmentShader":"shaders/sky.fsh"}} 2 | -------------------------------------------------------------------------------- /ESBE_3G/materials/terrain.material: -------------------------------------------------------------------------------- 1 | {"materials":{"version":"1.0.0","terrain_base":{"vertexShader":"shaders/terrain.vsh","fragmentShader":"shaders/terrain.fsh"}}} 2 | -------------------------------------------------------------------------------- /ESBE_3G/ui/pause_screen.json: -------------------------------------------------------------------------------- 1 | {"namespace":"pause","skin_panel_interior":{"modifications":[{"array_name":"controls","operation":"insert_back","value":[{"c":{"type":"panel","size":["100%","100%c"],"controls":[{"esbe@start.esbe_btn":{}}]}}]}]}} 2 | -------------------------------------------------------------------------------- /ESBE_3G/texts/ja_JP.lang: -------------------------------------------------------------------------------- 1 | esbe.c0=旧win10対応…@MCH_YamaRinに感謝 2 | esbe.c1=オーロラに縞模様が映る問題の修正 3 | esbe.c2=鉄格子とレッドストーンと水の継ぎ目が揺れる問題の修正 4 | esbe.c3=夜間に側面の影が松明で消えない問題の修正 5 | esbe.c4=水面に映る雲の位置を調整 6 | esbe.c5=太陽と月の処理の改善 7 | esbe.c6= 8 | esbe.c7=既知の不具合: アンチエイリアシングを有効にした状態において太陽と月が表示されない 9 | -------------------------------------------------------------------------------- /ESBE_3G/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "format_version":1, 3 | "header":{ 4 | "name":"ESBE_3G v2.2", 5 | "description":"A shader for Bedrock\nby @McbeEringi", 6 | "uuid":"ABD3317D-86B6-4490-84DB-1609C1B8040D", 7 | "version":[0,2,2], 8 | "min_engine_version":[1,8,0] 9 | }, 10 | "modules":[{ 11 | "type":"resources", 12 | "uuid":"FC4050EE-8F77-4D84-A4EC-63B9B295C214", 13 | "version":[0,2,2] 14 | }] 15 | } 16 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/hlsl/stars.fragment.hlsl: -------------------------------------------------------------------------------- 1 | //huge thanks to @MCH_YamaRin 2 | #include "ShaderConstants.fxh" 3 | struct PS_Input{ 4 | float4 position : SV_Position; 5 | float4 color : COLOR; 6 | }; 7 | struct PS_Output{ 8 | float4 color : SV_Target; 9 | }; 10 | ROOT_SIGNATURE 11 | void main(in PS_Input PSInput, out PS_Output PSOutput){PSOutput.color.rgb=float4(CURRENT_COLOR.rgb*abs(sin(TOTAL_REAL_WORLD_TIME*PSInput.color.a)),PSInput.color.a);} 12 | -------------------------------------------------------------------------------- /ESBE_3G/texts/en_US.lang: -------------------------------------------------------------------------------- 1 | esbe.v=v2.2 2 | esbe.c0=Added support for old Windows10…huge thanks to @MCH_YamaRin 3 | esbe.c1=Fixed stripe bug on aurora 4 | esbe.c2=Fixed bug that iron bars, redstone and water seams waving 5 | esbe.c3=Fixed bug side shadow won't disappear with torch at night 6 | esbe.c4=Improved position of cloud reflection of water 7 | esbe.c5=Improved technical part of sun & moon 8 | esbe.c6= 9 | esbe.c7=Known issue: sun & moon disappear with antialiasing enabled 10 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/glsl/sky.vertex: -------------------------------------------------------------------------------- 1 | // __multiversion__ 2 | // This signals the loading code to prepend either #version 100 or #version 300 es as apropriate. 3 | #include "vertexVersionSimple.h" 4 | uniform MAT4 WORLDVIEWPROJ; 5 | attribute mediump vec4 POSITION; 6 | attribute vec4 COLOR; 7 | varying float fog; 8 | varying vec2 pos; 9 | void main(){ 10 | 11 | vec4 p=POSITION; 12 | p.y-=length(p.xz)*.2; 13 | gl_Position=WORLDVIEWPROJ*p; 14 | pos=POSITION.xz; 15 | fog=COLOR.r; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/glsl/stars.fragment: -------------------------------------------------------------------------------- 1 | // __multiversion__ 2 | // This signals the loading code to prepend either #version 100 or #version 300 es as apropriate. 3 | #ifdef GL_FRAGMENT_PRECISION_HIGH 4 | #define HM highp 5 | #else 6 | #define HM mediump 7 | #endif 8 | #include "fragmentVersionSimple.h" 9 | uniform vec4 CURRENT_COLOR; 10 | uniform HM float TOTAL_REAL_WORLD_TIME; 11 | varying vec4 color; 12 | void main(){gl_FragColor=vec4(CURRENT_COLOR.rgb*abs(sin(TOTAL_REAL_WORLD_TIME*color.a)),color.a);} 13 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/glsl/sun.vsh: -------------------------------------------------------------------------------- 1 | // __multiversion__ 2 | // This signals the loading code to prepend either #version 100 or #version 300 es as apropriate. 3 | #include "vertexVersionCentroid.h" 4 | attribute POS4 POSITION; 5 | attribute vec2 TEXCOORD_0; 6 | uniform MAT4 WORLDVIEWPROJ; 7 | uniform MAT4 WORLDVIEW; 8 | _centroid varying vec2 uv; 9 | varying vec2 rpos; 10 | varying vec2 pos; 11 | void main(){ 12 | 13 | POS4 p=POSITION*vec2(10.,1.).xyxy; 14 | gl_Position=WORLDVIEWPROJ*p; 15 | uv=TEXCOORD_0; 16 | rpos=mat2(.6,-.8,.8,.6)*p.xz; 17 | pos=p.xz; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ESBE_3G 2 | ##### A shader for Minecraft Bedrock 3 | ![img](docs/esbe3g.png) 4 | [twitter](https://twitter.com/mcbeeringi) 5 | # Download 6 | See [release](https://github.com/McbeEringi/esbe-3g/releases) 7 | 8 | or 9 | [Official(ja)](https://mcbeeringi.github.io/esbe-3g) 10 | [MCPEDL](https://mcpedl.com/esbe-3g-shader) 11 | # LICENSE 12 | Published under MITlicense 13 | See '[LICENSE](https://github.com/McbeEringi/esbe-3g/blob/master/LICENSE)' 14 | # Photos 15 | v2.1 16 | ![img](docs/photo/2.0teaser.jpg) 17 | ![img](docs/photo/2.1-0.jpg) 18 | ![img](docs/photo/2.1-1.jpg) 19 | -------------------------------------------------------------------------------- /his&memo_ja.txt: -------------------------------------------------------------------------------- 1 | ver: mf{name,ver*2} en.lang button.xcf 2 | 3 | 0.1 4 | トーンマップの追加 5 | 影の追加 6 | 葉と水の揺れの追加 7 | 水の反射の追加 8 | 0.2 9 | 水の改良 10 | 葉や水の揺れが屋内で減少するように 11 | 星の描写の追加 12 | 雨天時の地面にエフェクトを追加 13 | その他軽微な不具合の原因を修正 14 | 0.3 15 | 水の改良 16 | ネザーゲートと線路にエフェクトを追加 17 | 面の向きによる明るさの変化を追加 18 | 光源処理の改良 19 | ゆらぎのエフェクトの追加と改良 20 | UIの改良 21 | 22 | 1.0 23 | 開発再開に伴いリセット 24 | 2.0 25 | エンティティのシェーディングの追加 26 | 太陽及び月のシェーディングの追加(テクスチャ自動切り替え) 27 | 雨天時の地面のエフェクトの追加 28 | 雨天時の雲の描写の改良 29 | 水面にノイズが出る問題の修正及び反射の改良 30 | 水面がA10デバイスで表示されない問題の修正 31 | 蝋燭と鉄格子が揺れる問題の修正 32 | UIの調整 33 | 2.1 34 | ブロックの側面に影を追加 35 | 昼間の光源の改良 36 | 水の改良 37 | 空が予期せず雨天時の描写になる問題の修正 38 | エンドの空における問題の修正 39 | 軽微な不具合の修正 40 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/glsl/pnoise.h: -------------------------------------------------------------------------------- 1 | #ifndef PNOISE_H 2 | #define PNOISE_H 3 | HM vec2 hash22(HM vec2 p){ 4 | HM vec3 p3=fract(vec3(p.xyx)*vec3(.1031,.1030,.0973)); 5 | p3+=dot(p3,p3.yzx+33.33); 6 | return fract((p3.xx+p3.yz)*p3.zy)*2.-1.; 7 | } 8 | HM float pnoise(HM vec2 p,HM float a,HM float oda){ 9 | HM vec2 fl=floor(p); 10 | HM vec2 fr=fract(p); 11 | HM vec2 sfr=fr*fr*fr*(fr*(fr*6.-15.)+10.); 12 | return mix( 13 | mix(dot(hash22(fract((fl+vec2(0,0))*oda)*a),fr-vec2(0,0)), 14 | dot(hash22(fract((fl+vec2(1,0))*oda)*a),fr-vec2(1,0)),sfr.x), 15 | mix(dot(hash22(fract((fl+vec2(0,1))*oda)*a),fr-vec2(0,1)), 16 | dot(hash22(fract((fl+vec2(1,1))*oda)*a),fr-vec2(1,1)),sfr.x),sfr.y); 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/hlsl/pnoise.fxh: -------------------------------------------------------------------------------- 1 | //huge thanks to @MCH_YamaRin 2 | #ifndef PNOISE_H 3 | #define PNOISE_H 4 | float2 hash22(float2 p){ 5 | float3 p3=frac(float3(p.xyx)*float3(.1031,.1030,.0973)); 6 | p3+=dot(p3,p3.yzx+33.33); 7 | return frac((p3.xx+p3.yz)*p3.zy)*2.-1.; 8 | } 9 | float pnoise(float2 p,float a,float oda){ 10 | float2 fl=floor(p); 11 | float2 fr=frac(p); 12 | float2 sfr=fr*fr*fr*(fr*(fr*6.-15.)+10.); 13 | return lerp( 14 | lerp(dot(hash22(frac((fl+float2(0,0))*oda)*a),fr-float2(0,0)), 15 | dot(hash22(frac((fl+float2(1,0))*oda)*a),fr-float2(1,0)),sfr.x), 16 | lerp(dot(hash22(frac((fl+float2(0,1))*oda)*a),fr-float2(0,1)), 17 | dot(hash22(frac((fl+float2(1,1))*oda)*a),fr-float2(1,1)),sfr.x),sfr.y); 18 | } 19 | #endif 20 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/glsl/snoise.h: -------------------------------------------------------------------------------- 1 | #ifndef SNOISE_H 2 | #define SNOISE_H 3 | // (C) Ashima Arts and Stefan Gustavson MIT License 4 | // https://github.com/ashima/webgl-noise 5 | HM vec3 mod289(HM vec3 x){return x-floor(x*(1./289.))*289.;} 6 | HM vec2 mod289(HM vec2 x){return x-floor(x*(1./289.))*289.;} 7 | HM vec3 permute(HM vec3 x){return mod289(((x*34.)+10.)*x);} 8 | HM float snoise(HM vec2 v){ 9 | const HM vec4 C=vec4(.211324865405187,.366025403784439,-.577350269189626,.024390243902439); 10 | HM vec2 i=floor(v+dot(v,C.yy)); 11 | HM vec2 x0=v-i+dot(i,C.xx); 12 | HM vec2 i1=x0.x>x0.y?vec2(1,0):vec2(0,1); 13 | HM vec4 x12=x0.xyxy+C.xxzz;x12.xy-=i1; 14 | i=mod289(i); 15 | HM vec3 p=permute(permute(i.y+vec3(0,i1.y,1))+i.x+vec3(0,i1.x,1)); 16 | HM vec3 m=max(.5-vec3(dot(x0,x0),dot(x12.xy,x12.xy),dot(x12.zw,x12.zw)),0.); 17 | m=m*m;m=m*m; 18 | HM vec3 x=2.*fract(p*C.www)-1.; 19 | HM vec3 h=abs(x)-.5; 20 | HM vec3 ox=floor(x+.5); 21 | HM vec3 a0=x-ox; 22 | m*=1.79284291400159-.85373472095314*(a0*a0+h*h); 23 | HM vec3 g; 24 | g.x=a0.x*x0.x+h.x*x0.y; 25 | g.yz=a0.yz*x12.xz+h.yz*x12.yw; 26 | return 130.*dot(m,g); 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 McbeEringi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ESBE_3G/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 McbeEringi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/hlsl/snoise.fxh: -------------------------------------------------------------------------------- 1 | //huge thanks to @MCH_YamaRin 2 | #ifndef SNOISE_H 3 | #define SNOISE_H 4 | // (C) Ashima Arts and Stefan Gustavson MIT License 5 | // https://github.com/ashima/webgl-noise 6 | float3 mod289(float3 x){return x-floor(x*(1./289.))*289.;} 7 | float2 mod289(float2 x){return x-floor(x*(1./289.))*289.;} 8 | float3 permute(float3 x){return mod289(((x*34.)+10.)*x);} 9 | float snoise(float2 v){ 10 | const float4 C=float4(.211324865405187,.366025403784439,-.577350269189626,.024390243902439); 11 | float2 i=floor(v+dot(v,C.yy)); 12 | float2 x0=v-i+dot(i,C.xx); 13 | float2 i1=x0.x>x0.y?float2(1,0):float2(0,1); 14 | float4 x12=x0.xyxy+C.xxzz;x12.xy-=i1; 15 | i=mod289(i); 16 | float3 p=permute(permute(i.y+float3(0,i1.y,1))+i.x+float3(0,i1.x,1)); 17 | float3 m=max(.5-float3(dot(x0,x0),dot(x12.xy,x12.xy),dot(x12.zw,x12.zw)),0.); 18 | m=m*m;m=m*m; 19 | float3 x=2.*frac(p*C.www)-1.; 20 | float3 h=abs(x)-.5; 21 | float3 ox=floor(x+.5); 22 | float3 a0=x-ox; 23 | m*=1.79284291400159-.85373472095314*(a0*a0+h*h); 24 | float3 g; 25 | g.x=a0.x*x0.x+h.x*x0.y; 26 | g.yz=a0.yz*x12.xz+h.yz*x12.yw; 27 | return 130.*dot(m,g); 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/hlsl/sky.vertex.hlsl: -------------------------------------------------------------------------------- 1 | //huge thanks to @MCH_YamaRin 2 | #include "ShaderConstants.fxh" 3 | struct VS_Input{ 4 | float3 position : POSITION; 5 | float4 color : COLOR; 6 | #ifdef INSTANCEDSTEREO 7 | uint instanceID : SV_InstanceID; 8 | #endif 9 | }; 10 | struct PS_Input{ 11 | float4 position : SV_Position; 12 | float4 color : COLOR; 13 | float fog : Fog_Position; 14 | float2 pos : Position; 15 | #ifdef GEOMETRY_INSTANCEDSTEREO 16 | uint instanceID : SV_InstanceID; 17 | #endif 18 | #ifdef VERTEXSHADER_INSTANCEDSTEREO 19 | uint renTarget_id : SV_RenderTargetArrayIndex; 20 | #endif 21 | }; 22 | ROOT_SIGNATURE 23 | void main(in VS_Input VSInput, out PS_Input PSInput){ 24 | 25 | float4 p=float4(VSInput.position,1); 26 | p.y-=length(p.xz)*.2; 27 | PSInput.pos=VSInput.position.xz; 28 | PSInput.fog=VSInput.color.r; 29 | 30 | #ifdef INSTANCEDSTEREO 31 | PSInput.position=mul(WORLDVIEWPROJ_STEREO[VSInput.instanceID],p); 32 | #else 33 | PSInput.position=mul(WORLDVIEWPROJ,p); 34 | #endif 35 | #ifdef GEOMETRY_INSTANCEDSTEREO 36 | PSInput.instanceID=VSInput.instanceID; 37 | #endif 38 | #ifdef VERTEXSHADER_INSTANCEDSTEREO 39 | PSInput.renTarget_id=VSInput.instanceID; 40 | #endif 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/hlsl/sun.vsh.hlsl: -------------------------------------------------------------------------------- 1 | //huge thanks to @MCH_YamaRin 2 | #include "ShaderConstants.fxh" 3 | struct VS_Input{ 4 | float3 position : POSITION; 5 | float2 uv : TEXCOORD_0; 6 | #ifdef INSTANCEDSTEREO 7 | uint instanceID : SV_InstanceID; 8 | #endif 9 | }; 10 | struct PS_Input{ 11 | float4 position : SV_Position; 12 | float2 uv : TEXCOORD_0; 13 | float2 rpos : rpos; 14 | float2 pos : pos; 15 | #ifdef GEOMETRY_INSTANCEDSTEREO 16 | uint instanceID : SV_InstanceID; 17 | #endif 18 | #ifdef VERTEXSHADER_INSTANCEDSTEREO 19 | uint renTarget_id : SV_RenderTargetArrayIndex; 20 | #endif 21 | }; 22 | 23 | ROOT_SIGNATURE 24 | void main(in VS_Input VSInput, out PS_Input PSInput){ 25 | 26 | float4 p=float4(VSInput.position,1)*float2(10.,1.).xyxy; 27 | #ifdef INSTANCEDSTEREO 28 | PSInput.position=mul(WORLDVIEWPROJ_STEREO[VSInput.instanceID],p); 29 | #else 30 | PSInput.position=mul(WORLDVIEWPROJ,p); 31 | #endif 32 | PSInput.uv=VSInput.uv; 33 | PSInput.rpos=mul(float2x2(.6,.8,-.8,.6),p.xz); 34 | PSInput.pos=p.xz; 35 | 36 | #ifdef GEOMETRY_INSTANCEDSTEREO 37 | PSInput.instanceID=VSInput.instanceID; 38 | #endif 39 | #ifdef VERTEXSHADER_INSTANCEDSTEREO 40 | PSInput.renTarget_id=VSInput.instanceID; 41 | #endif 42 | 43 | } 44 | -------------------------------------------------------------------------------- /ESBE_3G/ui/start_screen.json: -------------------------------------------------------------------------------- 1 | { 2 | "namespace":"start", 3 | "esbe_panel":{ 4 | "type":"stack_panel","orientation":"vertical", 5 | "controls":[ 6 | {"i":{"type":"image","texture":"info","size":["100%-16px","27%x"]}},{"c":{"type":"label","font_scale_factor":1.5,"text":"esbe.v","color":[0.4,0.8,0.67]}}, 7 | {"0":{"type":"label","text":"esbe.c0"}},{"1":{"type":"label","text":"esbe.c1"}},{"2":{"type":"label","text":"esbe.c2"}},{"3":{"type":"label","text":"esbe.c3"}}, 8 | {"4":{"type":"label","text":"esbe.c4"}},{"5":{"type":"label","text":"esbe.c5"}},{"6":{"type":"label","text":"esbe.c6"}},{"7":{"type":"label","text":"esbe.c7"}} 9 | ] 10 | }, 11 | "esbe_scr@common.scrolling_panel":{"$show_background":false,"$scrolling_content":"start.esbe_panel"},"esbe_fsc@common.fullscreen_header":{"$back_button_has_title":true,"$button_text":"ESBE info","$child_control":"start.esbe_scr"}, 12 | "esbe_main@common.base_screen":{"button_mappings":[{"from_button_id":"button.menu_cancel","to_button_id":"button.menu_exit","mapping_type":"global"}],"$screen_bg_content":"persona.persona_screen_background_content","$screen_content":"start.esbe_fsc"}, 13 | "esbe_img":{"type":"image","texture":"button","size":[43,16]}, 14 | "esbe_btn@common_buttons.light_content_button":{"size":[49,22],"$pressed_button_name":"button.menu_buy_game","$button_content":"start.esbe_img","$default_button_alpha":0.5,"$default_hover_alpha":0.5}, 15 | "copyright@start.esbe_btn":{"anchor_from":"bottom_left","anchor_to":"bottom_left"} 16 | } 17 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/hlsl/sun.fsh.hlsl: -------------------------------------------------------------------------------- 1 | //huge thanks to @MCH_YamaRin 2 | #include "ShaderConstants.fxh" 3 | #include "util.fxh" 4 | struct PS_Input{ 5 | float4 position : SV_Position; 6 | float2 uv : TEXCOORD_0_FB_MSAA; 7 | float2 rpos : rpos; 8 | float2 pos : pos; 9 | }; 10 | struct PS_Output{ 11 | float4 color : SV_Target; 12 | }; 13 | float4 tex0(float2 uv_){ 14 | #if !defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE) || (VERSION<0xa000) 15 | return TEXTURE_0.Sample(TextureSampler0,uv_); 16 | #else 17 | return texture2D_AA(TEXTURE_0,TextureSampler0,uv_); 18 | #endif 19 | } 20 | ROOT_SIGNATURE 21 | void main(in PS_Input PSInput, out PS_Output PSOutput){ 22 | 23 | float4 col=TEXTURE_0.Sample(TextureSampler0,0.); 24 | 25 | //DEFAULT 26 | float2 uv_=lerp(float2(floor(PSInput.uv.x*4.)*.25+.125,floor(PSInput.uv.y*2.)*.5+.25),.5,step(.5,TEXTURE_0.Sample(TextureSampler0,.5).r)); 27 | uv_=(PSInput.uv-uv_)*10.+uv_; 28 | 29 | //ESBE_3G 30 | float l=length(PSInput.rpos); 31 | float mp=(floor(PSInput.uv.x*4.)*.25+step(PSInput.uv.y,.5))*3.1415926536;//[0~2pi] 32 | float r=.13; 33 | float3 n=normalize(float3(PSInput.rpos,sqrt(r*r-l*l))); 34 | float2 np=float2(-atan2(n.x,n.z),asin(n.y))*.6366197724;// 2/pi [-1~1] 35 | //float weather=smoothstep(.3,.8,FOG_CONTROL.x); 36 | 37 | col=lerp( 38 | lerp(tex0(uv_),0.,step(.5,max(abs(PSInput.pos.x),abs(PSInput.pos.y)))), 39 | lerp( 40 | lerp( 41 | cos(min(l*2.,1.58))*sin(mp*.5)*.6, 42 | tex0(np*.5+.5)*.6+.4, 43 | smoothstep(-.3,.5,dot(-float3(sin(mp),0.,cos(mp)),n))*smoothstep(r,r*.9,l) 44 | ), 45 | max(cos(min(l*12.,1.58)),(.5-l*.7)), 46 | step(.95,col.r) 47 | )*float4(1.,.95,.81,1), 48 | step(.05,col.r*col.a) 49 | ); 50 | 51 | PSOutput.color=col*CURRENT_COLOR; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/glsl/sun.fsh: -------------------------------------------------------------------------------- 1 | // __multiversion__ 2 | // This signals the loading code to prepend either #version 100 or #version 300 es as apropriate. 3 | #ifdef GL_FRAGMENT_PRECISION_HIGH 4 | #define HM highp 5 | #else 6 | #define HM mediump 7 | #endif 8 | #include "fragmentVersionCentroid.h" 9 | #if __VERSION__ >420 10 | #define LAYOUT_BINDING(x) layout(binding = x) 11 | #else 12 | #define LAYOUT_BINDING(x) 13 | #endif 14 | LAYOUT_BINDING(0) uniform sampler2D TEXTURE_0; 15 | uniform vec2 FOG_CONTROL; 16 | uniform vec4 CURRENT_COLOR; 17 | _centroid varying HM vec2 uv; 18 | varying HM vec2 rpos; 19 | varying HM vec2 pos; 20 | vec4 tex0(vec2 uv_){ 21 | #if !defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE) 22 | return texture2D(TEXTURE_0,uv_); 23 | #else 24 | return texture2D_AA(TEXTURE_0,uv_); 25 | #endif 26 | } 27 | void main(){ 28 | 29 | vec4 col=texture2D(TEXTURE_0,vec2(0)); 30 | 31 | //DEFAULT 32 | vec2 uv_=mix(vec2(floor(uv.x*4.)*.25+.125,floor(uv.y*2.)*.5+.25),vec2(.5),step(.5,texture2D(TEXTURE_0,vec2(.5)).r)); 33 | uv_=(uv-uv_)*10.+uv_; 34 | 35 | //ESBE_3G 36 | float l=length(rpos); 37 | float mp=(floor(uv.x*4.)*.25+step(uv.y,.5))*3.1415926536;//[0~2pi] 38 | float r=.13; 39 | vec3 n=normalize(vec3(rpos,sqrt(r*r-l*l))); 40 | vec2 np=vec2(-atan(n.x,n.z),asin(n.y))*.6366197724;// 2/pi [-1~1] 41 | //float weather=smoothstep(.3,.8,FOG_CONTROL.x); 42 | 43 | col=mix( 44 | mix(tex0(uv_),vec4(0),step(.5,max(abs(pos.x),abs(pos.y)))), 45 | mix( 46 | mix( 47 | vec4(cos(min(l*2.,1.58))*sin(mp*.5)*.6), 48 | tex0(np*.5+.5)*.6+.4, 49 | smoothstep(-.3,.5,dot(-vec3(sin(mp),0.,cos(mp)),n))*smoothstep(r,r*.9,l) 50 | ), 51 | vec4(max(cos(min(l*12.,1.58)),(.5-l*.7))), 52 | step(.95,col.r) 53 | )*vec4(1.,.95,.81,1), 54 | step(.05,col.r*col.a) 55 | ); 56 | 57 | gl_FragColor=col*CURRENT_COLOR; 58 | 59 | } 60 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/hlsl/sky.fsh.hlsl: -------------------------------------------------------------------------------- 1 | //huge thanks to @MCH_YamaRin 2 | #include "ShaderConstants.fxh" 3 | #include "snoise.fxh" 4 | 5 | struct PS_Input{ 6 | float4 position : SV_Position; 7 | float4 color : COLOR; 8 | float fog : Fog_Position; 9 | float2 pos : Position; 10 | }; 11 | struct PS_Output{ 12 | float4 color : SV_Target; 13 | }; 14 | 15 | float amap(float2 p){return dot(float2(snoise(p),snoise(p*4.+float2(TOTAL_REAL_WORLD_TIME*.02,16))),float2(.8,.3));} 16 | float cmap(float2 p){ 17 | float2 t=float2(-TOTAL_REAL_WORLD_TIME,64); 18 | return dot(float3(snoise(p*4.+t*.01),snoise(p*16.+t*.1),snoise(p*60.+t*.1)),float3(1,.1,.027)); 19 | } 20 | 21 | ROOT_SIGNATURE 22 | void main(in PS_Input PSInput, out PS_Output PSOutput){ 23 | 24 | float day=smoothstep(0.15,0.25,FOG_COLOR.g); 25 | float weather=smoothstep(.3,.7,FOG_CONTROL.x); 26 | float dusk=clamp(FOG_COLOR.r-FOG_COLOR.g,0.,.5)*2.; 27 | //bool uw=FOG_CONTROL.x==0.; 28 | float l=length(PSInput.pos); 29 | float aflag=(1.-day)*weather; 30 | 31 | float4 col=float4(lerp( 32 | CURRENT_COLOR.rgb+lerp(lerp(float3(0,0,.1),float3(-.1,0,.1),day),.5,dusk*.5)*weather,//top 33 | FOG_COLOR.rgb+lerp(lerp(float3(0,.1,.2),float3(.2,.1,-.05),day),.7,dusk*.5)*weather,//horizon 34 | smoothstep(.1,.5,l)),1); 35 | //AURORA 36 | if(aflag>0.){ 37 | float2 apos=float2(PSInput.pos.x+TOTAL_REAL_WORLD_TIME*.004,PSInput.pos.y*10.);apos.y+=sin(PSInput.pos.x*20.-TOTAL_REAL_WORLD_TIME*.1)*.1; 38 | float3 acol=lerp( 39 | float3(0.,.8,.4),//col1 40 | float3(.4,.2,.8),//col2 41 | sin(dot(apos,1.)+TOTAL_REAL_WORLD_TIME*.01)*.5+.5); 42 | col.rgb+=acol*smoothstep(.5,1.,amap(apos))*smoothstep(.5,0.,l)*aflag; 43 | } 44 | //CLOUDS 45 | float3 ccol=lerp(lerp(.2,//night rain 46 | .8,//day rain 47 | day),lerp(lerp(float3(.1,.18,.38),//night 48 | float3(.97,.96,.90),//day 49 | day),float3(.97,.72,.38),//dusk 50 | dusk),weather); 51 | col.rgb=lerp(col.rgb,ccol,smoothstep(lerp(-.6,.3,weather),.9,cmap(PSInput.pos))*smoothstep(.6,.3,l)); 52 | 53 | PSOutput.color=lerp(col,FOG_COLOR,PSInput.fog); 54 | 55 | } 56 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/glsl/sky.fsh: -------------------------------------------------------------------------------- 1 | // __multiversion__ 2 | // This signals the loading code to prepend either #version 100 or #version 300 es as apropriate. 3 | #ifdef GL_FRAGMENT_PRECISION_HIGH 4 | #define HM highp 5 | #else 6 | #define HM mediump 7 | #endif 8 | #include "fragmentVersionSimple.h" 9 | varying float fog; 10 | varying HM vec2 pos; 11 | uniform HM float TOTAL_REAL_WORLD_TIME; 12 | uniform vec4 FOG_COLOR; 13 | uniform vec2 FOG_CONTROL; 14 | uniform vec4 CURRENT_COLOR; 15 | #include "snoise.h" 16 | 17 | HM float amap(HM vec2 p){return dot(vec2(snoise(p),snoise(p*4.+vec2(TOTAL_REAL_WORLD_TIME*.02,16))),vec2(.8,.3));} 18 | HM float cmap(HM vec2 p){ 19 | HM vec2 t=vec2(-TOTAL_REAL_WORLD_TIME,64); 20 | return dot(vec3(snoise(p*4.+t*.01),snoise(p*16.+t*.1),snoise(p*60.+t*.1)),vec3(1,.1,.027)); 21 | } 22 | void main(){ 23 | 24 | float day=smoothstep(0.15,0.25,FOG_COLOR.g); 25 | float weather=smoothstep(.3,.7,FOG_CONTROL.x); 26 | float dusk=clamp(FOG_COLOR.r-FOG_COLOR.g,0.,.5)*2.; 27 | //bool uw=FOG_CONTROL.x==0.; 28 | float l=length(pos); 29 | float aflag=(1.-day)*weather; 30 | 31 | vec4 col=vec4(mix( 32 | CURRENT_COLOR.rgb+mix(mix(vec3(0,0,.1),vec3(-.1,0,.1),day),vec3(.5),dusk*.5)*weather,//top 33 | FOG_COLOR.rgb+mix(mix(vec3(0,.1,.2),vec3(.2,.1,-.05),day),vec3(.7),dusk*.5)*weather,//horizon 34 | smoothstep(.1,.5,l)),1); 35 | //AURORA 36 | if(aflag>0.){ 37 | HM vec2 apos=vec2(pos.x+TOTAL_REAL_WORLD_TIME*.004,pos.y*10.);apos.y+=sin(pos.x*20.-TOTAL_REAL_WORLD_TIME*.1)*.1; 38 | vec3 acol=mix( 39 | vec3(0.,.8,.4),//col1 40 | vec3(.4,.2,.8),//col2 41 | sin(dot(apos,vec2(1))+TOTAL_REAL_WORLD_TIME*.01)*.5+.5); 42 | col.rgb+=acol*smoothstep(.5,1.,amap(apos))*smoothstep(.5,0.,l)*aflag; 43 | } 44 | //CLOUDS 45 | vec3 ccol=mix(mix(vec3(.2),//night rain 46 | vec3(.8),//day rain 47 | day),mix(mix(vec3(.1,.18,.38),//night 48 | vec3(.97,.96,.90),//day 49 | day),vec3(.97,.72,.38),//dusk 50 | dusk),weather); 51 | col.rgb=mix(col.rgb,ccol,smoothstep(mix(-.6,.3,weather),.9,cmap(pos))*smoothstep(.6,.3,l)); 52 | 53 | gl_FragColor=mix(col,FOG_COLOR,fog); 54 | 55 | } 56 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/glsl/terrain.vsh: -------------------------------------------------------------------------------- 1 | // __multiversion__ 2 | // This signals the loading code to prepend either #version 100 or #version 300 es as apropriate. 3 | #include "vertexVersionCentroid.h" 4 | #ifndef BYPASS_PIXEL_SHADER 5 | _centroid varying vec2 uv0; 6 | _centroid varying vec2 uv1; 7 | varying vec4 color; 8 | #endif 9 | 10 | #ifdef FOG 11 | varying float fog; 12 | #endif 13 | 14 | varying float block; 15 | varying vec3 wpos; 16 | varying vec3 cpos; 17 | 18 | #include "uniformWorldConstants.h" 19 | #include "uniformPerFrameConstants.h" 20 | #include "uniformRenderChunkConstants.h" 21 | uniform highp float TOTAL_REAL_WORLD_TIME; 22 | 23 | attribute POS4 POSITION; 24 | attribute vec4 COLOR; 25 | attribute vec2 TEXCOORD_0; 26 | attribute vec2 TEXCOORD_1; 27 | 28 | highp float hash11(highp float p){p=fract(p*.1031);p*=p+33.33;return fract((p+p)*p);} 29 | highp float random(highp float p){ 30 | p=p*.3+TOTAL_REAL_WORLD_TIME; 31 | return mix(hash11(floor(p)),hash11(ceil(p)),smoothstep(0.,1.,fract(p)))*2.; 32 | } 33 | 34 | void main(){ 35 | POS4 worldPos; 36 | block=0.; 37 | #ifndef BYPASS_PIXEL_SHADER 38 | uv0=TEXCOORD_0; 39 | uv1=TEXCOORD_1; 40 | color=COLOR; 41 | #endif 42 | // wave 43 | POS3 p=fract(POSITION.xyz*.0625)*16.; 44 | vec3 frp=fract(POSITION.xyz); 45 | float wav=sin(TOTAL_REAL_WORLD_TIME*3.5-dot(p,vec3(2,1.5,1))); 46 | float rand= 47 | #ifdef FANCY 48 | random(dot(p,vec3(1))); 49 | #else 50 | 1.; 51 | #endif 52 | float sun=mix(.5,1.,smoothstep(0.,.5,uv1.y)); 53 | float uw= 54 | #ifdef FOG 55 | step(FOG_CONTROL.x,0.); 56 | #else 57 | 0.; 58 | #endif 59 | float nether= 60 | #ifdef FOG 61 | FOG_CONTROL.x/FOG_CONTROL.y;nether=step(.1,nether)-step(.12,nether); 62 | #else 63 | 0.; 64 | #endif 65 | 66 | // water 67 | #ifndef SEASONS 68 | if(color.a<.95 && color.a>.05)block=1.; 69 | #endif 70 | 71 | #ifdef AS_ENTITY_RENDERER 72 | POS4 pos=WORLDVIEWPROJ*POSITION; 73 | worldPos=pos; 74 | #else 75 | worldPos=vec4(POSITION.xyz*CHUNK_ORIGIN_AND_SCALE.w+CHUNK_ORIGIN_AND_SCALE.xyz,1); 76 | float camDist=1.; 77 | #ifdef BLEND 78 | camDist=clamp(length(-worldPos.xyz)/FAR_CHUNKS_DISTANCE,0.,1.); 79 | color.a=mix(color.a,1.,camDist); 80 | if(abs(frp.x-.5)==.125 && frp.z==0.)worldPos.x+=wav*.05*rand; 81 | else if(abs(frp.z-.5)==.125 && frp.x==0.)worldPos.z+=wav*.05*rand; 82 | #endif 83 | if(block==1.)worldPos.y+=wav*.05*fract(floor(POSITION.y*20.+.5)*.05)*rand*sun*(1.-camDist); 84 | POS4 pos=WORLDVIEW*worldPos; 85 | pos=PROJ*pos; 86 | #ifdef ALPHA_TEST 87 | vec2 hexg=fract(frp.xz*16.);vec2 frpd=abs(frp.xz-.5); 88 | if((max(max(color.r,color.g),color.b)-min(min(color.r,color.g),color.b)>.01&&frp.y!=.015625&&frpd.x!=.484375&&frpd.y!=.484375)|| 89 | (frp.y==.9375&&(frp.x==0.||frp.z==0.))|| 90 | ((frp.y==0.||frp.y>.6)&&hexg.x!=0.&&hexg.y!=0.&&frpd.x>.1&&frpd.y>.1))pos.x+=wav*.016*rand*sun*PROJ[0].x; 91 | #endif 92 | #endif 93 | gl_Position=pos; 94 | wpos=worldPos.xyz; 95 | cpos=POSITION.xyz; 96 | 97 | #ifdef FOG 98 | float len=length(-worldPos.xyz)/RENDER_DISTANCE; 99 | #ifdef ALLOW_FADE 100 | len+=RENDER_CHUNK_FOG_ALPHA; 101 | #endif 102 | fog=clamp((len-FOG_CONTROL.x)/(FOG_CONTROL.y-FOG_CONTROL.x),0.,1.); 103 | if(nether>.5)gl_Position.xy+=wav*fog*.15*(rand*.5+.5)*nether; 104 | else if(uw>.5)gl_Position.x+=wav*fog*.1*rand*uw; 105 | #endif 106 | 107 | #ifndef BYPASS_PIXEL_SHADER 108 | #ifndef FOG 109 | // If the FOG_COLOR isn't used, the reflection on NVN fails to compute the correct size of the constant buffer as the uniform will also be gone from the reflection data 110 | color.rgb+=FOG_COLOR.rgb*.000001; 111 | #endif 112 | #endif 113 | } 114 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/glsl/entity.vertex: -------------------------------------------------------------------------------- 1 | // __multiversion__ 2 | // This signals the loading code to prepend either #version 100 or #version 300 es as apropriate. 3 | 4 | #include "vertexVersionCentroidUV.h" 5 | 6 | #include "uniformWorldConstants.h" 7 | #include "uniformEntityConstants.h" 8 | #include "uniformPerFrameConstants.h" 9 | #ifdef USE_SKINNING 10 | #include "uniformAnimationConstants.h" 11 | #endif 12 | 13 | #line 13 14 | 15 | attribute mediump vec4 POSITION; 16 | attribute vec2 TEXCOORD_0; 17 | attribute vec4 NORMAL; 18 | #if defined(USE_SKINNING) 19 | #ifdef MCPE_PLATFORM_NX 20 | attribute uint BONEID_0; 21 | #else 22 | attribute float BONEID_0; 23 | #endif 24 | #endif 25 | 26 | #ifdef COLOR_BASED 27 | attribute vec4 COLOR; 28 | varying vec4 vertColor; 29 | #endif 30 | 31 | varying vec4 light; 32 | varying vec4 fogColor; 33 | 34 | #ifdef USE_OVERLAY 35 | // When drawing horses on specific android devices, overlay color ends up being garbage data. 36 | // Changing overlay color to high precision appears to fix the issue on devices tested 37 | varying highp vec4 overlayColor; 38 | #endif 39 | 40 | #ifdef TINTED_ALPHA_TEST 41 | varying float alphaTestMultiplier; 42 | #endif 43 | 44 | #ifdef GLINT 45 | varying vec2 layer1UV; 46 | varying vec2 layer2UV; 47 | varying vec4 tileLightColor; 48 | varying vec4 glintColor; 49 | #endif 50 | 51 | const float AMBIENT = 0.45; 52 | 53 | const float XFAC = -0.1; 54 | const float ZFAC = 0.1; 55 | 56 | float lightIntensity(vec4 position, vec4 normal) { 57 | #ifdef FANCY 58 | vec3 N = normalize( WORLD * normal ).xyz; 59 | 60 | N.y *= TILE_LIGHT_COLOR.w; //TILE_LIGHT_COLOR.w contains the direction of the light 61 | 62 | //take care of double sided polygons on materials without culling 63 | #ifdef FLIP_BACKFACES 64 | vec3 viewDir = normalize((WORLD * position).xyz); 65 | if( dot(N, viewDir) > 0.0 ) 66 | N *= -1.0; 67 | #endif 68 | 69 | float yLight = (1.0+N.y) * 0.5; 70 | yLight=yLight * (1.0-AMBIENT) + N.x*N.x * XFAC + N.z*N.z * ZFAC + AMBIENT; 71 | return mix(yLight,dot(N,vec3(0.,.8,.6))*.4+.6,smoothstep(.6,.8,TILE_LIGHT_COLOR.b)); 72 | #else 73 | return .9; 74 | #endif 75 | } 76 | 77 | #ifdef GLINT 78 | vec2 calculateLayerUV(float offset, float rotation) { 79 | vec2 uv = TEXCOORD_0; 80 | uv -= 0.5; 81 | float rsin = sin(rotation); 82 | float rcos = cos(rotation); 83 | uv = mat2(rcos, -rsin, rsin, rcos) * uv; 84 | uv.x += offset; 85 | uv += 0.5; 86 | 87 | return uv * GLINT_UV_SCALE; 88 | } 89 | #endif 90 | 91 | void main() 92 | { 93 | POS4 entitySpacePosition; 94 | POS4 entitySpaceNormal; 95 | 96 | #ifdef USE_SKINNING 97 | #if defined(LARGE_VERTEX_SHADER_UNIFORMS) 98 | entitySpacePosition = BONES[int(BONEID_0)] * POSITION; 99 | entitySpaceNormal = BONES[int(BONEID_0)] * NORMAL; 100 | #else 101 | entitySpacePosition = BONE * POSITION; 102 | entitySpaceNormal = BONE * NORMAL; 103 | #endif 104 | #else 105 | entitySpacePosition = POSITION * vec4(1, 1, 1, 1); 106 | entitySpaceNormal = NORMAL * vec4(1, 1, 1, 0); 107 | #endif 108 | POS4 pos = WORLDVIEWPROJ * entitySpacePosition; 109 | gl_Position = pos; 110 | 111 | float L = lightIntensity(entitySpacePosition, entitySpaceNormal); 112 | 113 | #ifdef USE_OVERLAY 114 | L += OVERLAY_COLOR.a * 0.35; 115 | #endif 116 | 117 | #ifdef TINTED_ALPHA_TEST 118 | alphaTestMultiplier = OVERLAY_COLOR.a; 119 | #endif 120 | 121 | light = vec4(vec3(L) * TILE_LIGHT_COLOR.xyz, 1.0); 122 | 123 | #ifdef COLOR_BASED 124 | vertColor = COLOR; 125 | #endif 126 | 127 | #ifdef USE_OVERLAY 128 | overlayColor = OVERLAY_COLOR; 129 | #endif 130 | 131 | #ifndef NO_TEXTURE 132 | uv = TEXCOORD_0; 133 | #endif 134 | 135 | #ifdef USE_UV_ANIM 136 | uv.xy = UV_ANIM.xy + (uv.xy * UV_ANIM.zw); 137 | #endif 138 | 139 | #ifdef GLINT 140 | glintColor = GLINT_COLOR; 141 | layer1UV = calculateLayerUV(UV_OFFSET.x, UV_ROTATION.x); 142 | layer2UV = calculateLayerUV(UV_OFFSET.y, UV_ROTATION.y); 143 | tileLightColor = TILE_LIGHT_COLOR; 144 | #endif 145 | 146 | //fog 147 | fogColor.rgb = FOG_COLOR.rgb; 148 | fogColor.a = clamp(((pos.z / RENDER_DISTANCE) - FOG_CONTROL.x) / (FOG_CONTROL.y - FOG_CONTROL.x), 0.0, 1.0); 149 | } 150 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/hlsl/terrain.vsh.hlsl: -------------------------------------------------------------------------------- 1 | //huge thanks to @MCH_YamaRin 2 | #include "ShaderConstants.fxh" 3 | 4 | struct VS_Input{ 5 | float3 position : POSITION; 6 | float4 color : COLOR; 7 | float2 uv0 : TEXCOORD_0; 8 | float2 uv1 : TEXCOORD_1; 9 | #ifdef INSTANCEDSTEREO 10 | uint instanceID : SV_InstanceID; 11 | #endif 12 | }; 13 | struct PS_Input{ 14 | float4 position : SV_Position; 15 | #ifndef BYPASS_PIXEL_SHADER 16 | lpfloat4 color : COLOR; 17 | snorm float2 uv0 : TEXCOORD_0_FB_MSAA; 18 | snorm float2 uv1 : TEXCOORD_1_FB_MSAA; 19 | #endif 20 | #ifdef FOG 21 | float fog : fog; 22 | #endif 23 | float block : block; 24 | float3 cpos : cpos; 25 | float3 wpos : wpos; 26 | #ifdef GEOMETRY_INSTANCEDSTEREO 27 | uint instanceID : SV_InstanceID; 28 | #endif 29 | #ifdef VERTEXSHADER_INSTANCEDSTEREO 30 | uint renTarget_id : SV_RenderTargetArrayIndex; 31 | #endif 32 | }; 33 | 34 | float hash11(float p){p=frac(p*.1031);p*=p+33.33;return frac((p+p)*p);} 35 | float random(float p){ 36 | p=p*.3+TOTAL_REAL_WORLD_TIME; 37 | return lerp(hash11(floor(p)),hash11(ceil(p)),smoothstep(0.,1.,frac(p)))*2.; 38 | } 39 | 40 | ROOT_SIGNATURE 41 | void main(in VS_Input VSInput, out PS_Input PSInput){ 42 | PSInput.block=0.; 43 | #ifndef BYPASS_PIXEL_SHADER 44 | PSInput.uv0=VSInput.uv0; 45 | PSInput.uv1=VSInput.uv1; 46 | PSInput.color=VSInput.color; 47 | #endif 48 | // wave 49 | float3 p=frac(VSInput.position*.0625)*16.; 50 | float3 frp=frac(VSInput.position); 51 | float wav=sin(TOTAL_REAL_WORLD_TIME*3.5-dot(p,float3(2,1.5,1))); 52 | float rand= 53 | #ifdef FANCY 54 | random(dot(p,1.)); 55 | #else 56 | 1.; 57 | #endif 58 | float sun=lerp(.5,1.,smoothstep(0.,.5,VSInput.uv1.y)); 59 | float uw= 60 | #ifdef FOG 61 | step(FOG_CONTROL.x,0.); 62 | #else 63 | 0.; 64 | #endif 65 | float nether= 66 | #ifdef FOG 67 | FOG_CONTROL.x/FOG_CONTROL.y;nether=step(.1,nether)-step(.12,nether); 68 | #else 69 | 0.; 70 | #endif 71 | 72 | // water 73 | #ifndef SEASONS 74 | if(VSInput.color.a<.95 && VSInput.color.a>.05)PSInput.block=1.; 75 | #endif 76 | 77 | #ifdef AS_ENTITY_RENDERER 78 | #ifdef INSTANCEDSTEREO 79 | PSInput.position=mul(WORLDVIEWPROJ_STEREO[VSInput.instanceID],float4(VSInput.position,1)); 80 | #else 81 | PSInput.position=mul(WORLDVIEWPROJ,float4(VSInput.position,1)); 82 | #endif 83 | float3 worldPos=PSInput.position; 84 | #else 85 | float3 worldPos=(VSInput.position.xyz*CHUNK_ORIGIN_AND_SCALE.w)+CHUNK_ORIGIN_AND_SCALE.xyz; 86 | float camDist=1.; 87 | #ifdef BLEND 88 | camDist=saturate(length(-worldPos.xyz)/FAR_CHUNKS_DISTANCE); 89 | PSInput.color.a=lerp(VSInput.color.a,1.,camDist); 90 | if(abs(frp.x-.5)==.125 && frp.z==0.)worldPos.x+=wav*.05*rand; 91 | else if(abs(frp.z-.5)==.125 && frp.x==0.)worldPos.z+=wav*.05*rand; 92 | #endif 93 | if(PSInput.block==1.)worldPos.y+=wav*.05*frac(floor(VSInput.position.y*20.+.5)*.05)*rand*sun*(1.-camDist); 94 | #ifdef INSTANCEDSTEREO 95 | PSInput.position=mul(WORLDVIEW_STEREO[VSInput.instanceID],float4(worldPos,1)); 96 | PSInput.position=mul(PROJ_STEREO[VSInput.instanceID],PSInput.position); 97 | #else 98 | PSInput.position=mul(WORLDVIEW,float4(worldPos,1)); 99 | PSInput.position=mul(PROJ,PSInput.position); 100 | #endif 101 | #ifdef ALPHA_TEST 102 | float2 hexg=frac(frp.xz*16.);float2 frpd=abs(frp.xz-.5); 103 | if((max(max(VSInput.color.r,VSInput.color.g),VSInput.color.b)-min(min(VSInput.color.r,VSInput.color.g),VSInput.color.b)>.01&&frp.y!=.015625&&frpd.x!=.484375&&frpd.y!=.484375)|| 104 | (frp.y==.9375&&(frp.x==0.||frp.z==0.))|| 105 | ((frp.y==0.||frp.y>.6)&&hexg.x!=0.&&hexg.y!=0.&&frpd.x>.1&&frpd.y>.1))PSInput.position.x+=wav*.016*rand*sun*PROJ[0].x; 106 | #endif 107 | 108 | #endif 109 | PSInput.cpos=VSInput.position; 110 | PSInput.wpos=worldPos; 111 | #ifdef GEOMETRY_INSTANCEDSTEREO 112 | PSInput.instanceID=VSInput.instanceID; 113 | #endif 114 | #ifdef VERTEXSHADER_INSTANCEDSTEREO 115 | PSInput.renTarget_id=VSInput.instanceID; 116 | #endif 117 | 118 | #ifdef FOG 119 | float len=length(-worldPos.xyz)/RENDER_DISTANCE; 120 | #ifdef ALLOW_FADE 121 | len+=RENDER_CHUNK_FOG_ALPHA; 122 | #endif 123 | PSInput.fog=saturate((len-FOG_CONTROL.x)/(FOG_CONTROL.y-FOG_CONTROL.x)); 124 | if(nether>.5)PSInput.position.xy+=wav*PSInput.fog*.15*(rand*.5+.5)*nether; 125 | else if(uw>.5)PSInput.position.x+=wav*PSInput.fog*.1*rand*uw; 126 | #endif 127 | 128 | #ifndef BYPASS_PIXEL_SHADER 129 | #ifndef FOG 130 | // If the FOG_COLOR isn't used, the reflection on NVN fails to compute the correct size of the constant buffer as the uniform will also be gone from the reflection data 131 | PSInput.color.rgb+=FOG_COLOR.rgb*.000001; 132 | #endif 133 | #endif 134 | } 135 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/hlsl/entity.vertex.hlsl: -------------------------------------------------------------------------------- 1 | //huge thanks to @MCH_YamaRin 2 | #include "ShaderConstants.fxh" 3 | 4 | struct VS_Input{ 5 | float3 position : POSITION; 6 | #ifdef USE_SKINNING 7 | uint boneId : BONEID_0; 8 | #endif 9 | float4 normal : NORMAL; 10 | float2 texCoords : TEXCOORD_0; 11 | #ifdef COLOR_BASED 12 | float4 color : COLOR; 13 | #endif 14 | #ifdef INSTANCEDSTEREO 15 | uint instanceID : SV_InstanceID; 16 | #endif 17 | }; 18 | struct PS_Input{ 19 | float4 position : SV_Position; 20 | float4 light : LIGHT; 21 | float4 fogColor : FOG_COLOR; 22 | #ifdef GLINT 23 | // there is some alignment issue on the Windows Phone 1320 that causes the position 24 | // to get corrupted if this is two floats and last in the struct memory wise 25 | float4 layerUV : GLINT_UVS; 26 | #endif 27 | #ifdef COLOR_BASED 28 | float4 color : COLOR; 29 | #endif 30 | #ifdef USE_OVERLAY 31 | float4 overlayColor : OVERLAY_COLOR; 32 | #endif 33 | #ifdef TINTED_ALPHA_TEST 34 | // With MSAA Enabled, making this field a float results in a DX11 internal compiler error 35 | // We assume it is trying to pack the single float with the centroid-interpolated UV coordinates, which it can't do 36 | float4 alphaTestMultiplier : ALPHA_MULTIPLIER; 37 | #endif 38 | float2 uv : TEXCOORD_0_FB_MSAA; 39 | #ifdef GEOMETRY_INSTANCEDSTEREO 40 | uint instanceID : SV_InstanceID; 41 | #endif 42 | #ifdef VERTEXSHADER_INSTANCEDSTEREO 43 | uint renTarget_id : SV_RenderTargetArrayIndex; 44 | #endif 45 | }; 46 | 47 | static const float AMBIENT = 0.45; 48 | 49 | static const float XFAC = -0.1; 50 | static const float ZFAC = 0.1; 51 | 52 | 53 | float4 TransformRGBA8_SNORM(const float4 RGBA8_SNORM) { 54 | #ifdef R8G8B8A8_SNORM_UNSUPPORTED 55 | return RGBA8_SNORM * float(2.0).xxxx - float(1.0).xxxx; 56 | #else 57 | return RGBA8_SNORM; 58 | #endif 59 | } 60 | 61 | 62 | float lightIntensity(const float4x4 worldMat, const float4 position, const float3 normal) { 63 | #ifdef FANCY 64 | float3 N = normalize(mul(worldMat, normal)).xyz; 65 | 66 | N.y *= TILE_LIGHT_COLOR.a; 67 | 68 | //take care of double sided polygons on materials without culling 69 | #ifdef FLIP_BACKFACES 70 | float3 viewDir = normalize((mul(worldMat, position)).xyz); 71 | if (dot(N, viewDir) > 0.0) { 72 | N *= -1.0; 73 | } 74 | #endif 75 | 76 | float yLight = (1.0 + N.y) * 0.5; 77 | yLight=yLight * (1.0 - AMBIENT) + N.x*N.x * XFAC + N.z*N.z * ZFAC + AMBIENT; 78 | return lerp(yLight,dot(N,float3(0.,.8,.6))*.4+.6,smoothstep(.6,.8,TILE_LIGHT_COLOR.b)); 79 | #else 80 | return .9; 81 | #endif 82 | } 83 | 84 | #ifdef GLINT 85 | float2 calculateLayerUV(float2 origUV, float offset, float rotation) { 86 | float2 uv = origUV; 87 | uv -= 0.5; 88 | float rsin = sin(rotation); 89 | float rcos = cos(rotation); 90 | uv = mul(uv, float2x2(rcos, -rsin, rsin, rcos)); 91 | uv.x += offset; 92 | uv += 0.5; 93 | 94 | return uv * GLINT_UV_SCALE; 95 | } 96 | #endif 97 | 98 | ROOT_SIGNATURE 99 | void main(in VS_Input VSInput, out PS_Input PSInput) { 100 | float4 entitySpacePosition = float4(VSInput.position, 1); 101 | float3 entitySpaceNormal = TransformRGBA8_SNORM(VSInput.normal); 102 | #ifdef USE_SKINNING 103 | entitySpacePosition = mul(BONES[VSInput.boneId], entitySpacePosition); 104 | entitySpaceNormal = mul(BONES[VSInput.boneId], entitySpaceNormal); 105 | #endif 106 | 107 | #ifdef INSTANCEDSTEREO 108 | int i = VSInput.instanceID; 109 | PSInput.position = mul(WORLDVIEWPROJ_STEREO[i], entitySpacePosition); 110 | #else 111 | PSInput.position = mul(WORLDVIEWPROJ, entitySpacePosition); 112 | #endif 113 | 114 | #ifdef GEOMETRY_INSTANCEDSTEREO 115 | PSInput.instanceID = VSInput.instanceID; 116 | #endif 117 | 118 | #ifdef VERTEXSHADER_INSTANCEDSTEREO 119 | PSInput.renTarget_id = VSInput.instanceID; 120 | #endif 121 | 122 | #ifdef INSTANCEDSTEREO 123 | float L = lightIntensity(WORLD_STEREO, entitySpacePosition, entitySpaceNormal); 124 | #else 125 | float L = lightIntensity(WORLD, entitySpacePosition, entitySpaceNormal); 126 | #endif 127 | 128 | #ifdef USE_OVERLAY 129 | L += OVERLAY_COLOR.a * 0.35; 130 | #endif 131 | 132 | #ifdef TINTED_ALPHA_TEST 133 | PSInput.alphaTestMultiplier = OVERLAY_COLOR.aaaa; 134 | #endif 135 | 136 | PSInput.light = float4(L.xxx * TILE_LIGHT_COLOR.rgb, 1.0); 137 | 138 | #ifdef COLOR_BASED 139 | PSInput.color = VSInput.color; 140 | #endif 141 | 142 | #ifdef USE_OVERLAY 143 | PSInput.overlayColor = OVERLAY_COLOR; 144 | #endif 145 | 146 | #if( !defined(NO_TEXTURE) || !defined(COLOR_BASED) || defined(USE_COLOR_BLEND) ) 147 | PSInput.uv = VSInput.texCoords; 148 | #endif 149 | 150 | #ifdef USE_UV_ANIM 151 | PSInput.uv.xy = UV_ANIM.xy + (PSInput.uv.xy * UV_ANIM.zw); 152 | #endif 153 | 154 | #ifdef GLINT 155 | PSInput.layerUV.xy = calculateLayerUV(VSInput.texCoords, UV_OFFSET.x, UV_ROTATION.x); 156 | PSInput.layerUV.zw = calculateLayerUV(VSInput.texCoords, UV_OFFSET.y, UV_ROTATION.y); 157 | #endif 158 | 159 | //fog 160 | PSInput.fogColor.rgb = FOG_COLOR.rgb; 161 | PSInput.fogColor.a = clamp(((PSInput.position.z / RENDER_DISTANCE) - FOG_CONTROL.x) / (FOG_CONTROL.y - FOG_CONTROL.x), 0.0, 1.0); 162 | } 163 | -------------------------------------------------------------------------------- /ESBE_3G/biomes_client.json: -------------------------------------------------------------------------------- 1 | /////ESBE_3G @McbeEringi 2 | { 3 | "biomes":{ 4 | "default":{ 5 | "water_surface_color":"#44AFF5","water_fog_color":"#44AFF5", 6 | "water_surface_transparency":0.5,"water_fog_distance":75 7 | }, 8 | "plains":{"water_surface_color":"#44AFF5","water_fog_color":"#44AFF5"}, 9 | "sunflower_plains":{"water_surface_color":"#44AFF5","water_fog_color":"#44AFF5"}, 10 | "desert":{"water_surface_color":"#32A598","water_fog_color":"#32A598"}, 11 | "extreme_hills":{"water_surface_color":"#007BF7","water_fog_color":"#007BF7"}, 12 | "forest":{"water_surface_color":"#1E97F2","water_fog_color":"#1E97F2"}, 13 | "flower_forest":{"water_surface_color":"#20A3CC","water_fog_color":"#20A3CC"}, 14 | "taiga":{"water_surface_color":"#287082","water_fog_color":"#287082"}, 15 | "taiga_mutated":{"water_surface_color":"#1E6B82","water_fog_color":"#1E6B82"}, 16 | "swampland":{"water_surface_color":"#4c6559","water_fog_color":"#4c6559","water_surface_transparency":0.7,"water_fog_distance":50}, 17 | "swampland_mutated":{"water_surface_color":"#4c6156","water_fog_color":"#4c6156","water_surface_transparency":0.7,"water_fog_distance":50}, 18 | "river":{"water_surface_color":"#0084FF","water_fog_color":"#0084FF","water_fog_distance":75}, 19 | "frozen_river":{"water_surface_color":"#185390","water_fog_color":"#185390","water_fog_distance":75}, 20 | "ice_plains":{"water_surface_color":"#14559b","water_fog_color":"#14559b"}, 21 | "ice_plains_spikes":{"water_surface_color":"#14559b","water_fog_color":"#14559b"}, 22 | "ice_mountains":{"water_surface_color":"#1156a7","water_fog_color":"#1156a7"}, 23 | "mushroom_island":{"water_surface_color":"#8a8997","water_fog_color":"#8a8997"}, 24 | "mushroom_island_shore":{"water_surface_color":"#818193","water_fog_color":"#818193"}, 25 | "beach":{"water_surface_color":"#157cab","water_fog_color":"#157cab","water_fog_distance":100}, 26 | "desert_hills":{"water_surface_color":"#1a7aa1","water_fog_color":"#1a7aa1"}, 27 | "forest_hills":{"water_surface_color":"#056bd1","water_fog_color":"#056bd1"}, 28 | "taiga_hills":{"water_surface_color":"#236583","water_fog_color":"#236583"}, 29 | "extreme_hills_edge":{"water_surface_color":"#045cd5","water_fog_color":"#045cd5"}, 30 | "jungle":{"water_surface_color":"#14A2C5","water_fog_color":"#14A2C5"}, 31 | "bamboo_jungle":{"water_surface_color":"#14A2C5","water_fog_color":"#14A2C5"}, 32 | "jungle_mutated":{"water_surface_color":"#1B9ED8","water_fog_color":"#1B9ED8"}, 33 | "jungle_hills":{"water_surface_color":"#1B9ED8","water_fog_color":"#1B9ED8"}, 34 | "bamboo_jungle_hills":{"water_surface_color":"#1B9ED8","water_fog_color":"#1B9ED8"}, 35 | "jungle_edge":{"water_surface_color":"#0D8AE3","water_fog_color":"#0D8AE3"}, 36 | "stone_beach":{"water_surface_color":"#0d67bb","water_fog_color":"#0d67bb"}, 37 | "cold_beach":{"water_surface_color":"#1463a5","water_fog_color":"#1463a5","water_fog_distance":100}, 38 | "birch_forest":{"water_surface_color":"#0677ce","water_fog_color":"#0677ce"}, 39 | "birch_forest_hills":{"water_surface_color":"#0a74c4","water_fog_color":"#0a74c4"}, 40 | "roofed_forest":{"water_surface_color":"#3B6CD1","water_fog_color":"#3B6CD1"}, 41 | "cold_taiga":{"water_surface_color":"#205e83","water_fog_color":"#205e83"}, 42 | "cold_taiga_mutated":{"water_surface_color":"#205e83","water_fog_color":"#205e83"}, 43 | "cold_taiga_hills":{"water_surface_color":"#245b78","water_fog_color":"#245b78"}, 44 | "mega_taiga":{"water_surface_color":"#2d6d77","water_fog_color":"#2d6d77"}, 45 | "mega_spruce_taiga":{"water_surface_color":"#2d6d77","water_fog_color":"#2d6d77"}, 46 | "mega_taiga_mutated":{"water_surface_color":"#2d6d77","water_fog_color":"#2d6d77"}, 47 | "mega_spruce_taiga_mutated":{"water_surface_color":"#2d6d77","water_fog_color":"#2d6d77"}, 48 | "mega_taiga_hills":{"water_surface_color":"#286378","water_fog_color":"#286378"}, 49 | "extreme_hills_plus_trees":{"water_surface_color":"#0E63AB","water_fog_color":"#0E63AB"}, 50 | "extreme_hills_plus_trees_mutated":{"water_surface_color":"#0E63AB","water_fog_color":"#0E63AB"}, 51 | "extreme_hills_mutated":{"water_surface_color":"#0E63AB","water_fog_color":"#0E63AB"}, 52 | "savanna":{"water_surface_color":"#2C8B9C","water_fog_color":"#2C8B9C"}, 53 | "savanna_plateau":{"water_surface_color":"#2590A8","water_fog_color":"#2590A8"}, 54 | "savanna_mutated":{"water_surface_color":"#2590A8","water_fog_color":"#2590A8"}, 55 | "mesa":{"water_surface_color":"#4E7F81","water_fog_color":"#4E7F81"}, 56 | "mesa_bryce":{"water_surface_color":"#497F99","water_fog_color":"#497F99"}, 57 | "mesa_mutated":{"water_surface_color":"#497F99","water_fog_color":"#497F99"}, 58 | "mesa_plateau_stone":{"water_surface_color":"#55809E","water_fog_color":"#55809E"}, 59 | "mesa_plateau":{"water_surface_color":"#55809E","water_fog_color":"#55809E"}, 60 | "ocean":{"water_surface_color":"#1787D4","water_fog_color":"#1165b0","water_fog_distance":100}, 61 | "deep_ocean":{"water_surface_color":"#1787D4","water_fog_color":"#1463a5","water_fog_distance":100}, 62 | "warm_ocean":{"water_surface_color":"#02B0E5","water_fog_color":"#0289d5","water_surface_transparency":0.4,"water_fog_distance":100}, 63 | "deep_warm_ocean":{"water_surface_color":"#02B0E5","water_fog_color":"#0686ca","water_fog_distance":100}, 64 | "lukewarm_ocean":{"water_surface_color":"#0D96DB","water_fog_color":"#0a74c4","water_fog_distance":100}, 65 | "deep_lukewarm_ocean":{"water_surface_color":"#0D96DB","water_fog_color":"#0e72b9","water_fog_distance":100}, 66 | "cold_ocean":{"water_surface_color":"#2080C9","water_fog_color":"#14559b","water_fog_distance":100}, 67 | "deep_cold_ocean":{"water_surface_color":"#2080C9","water_fog_color":"#185390","water_fog_distance":100}, 68 | "frozen_ocean":{"water_surface_color":"#2570B5","water_fog_color":"#174985","water_fog_distance":100}, 69 | "deep_frozen_ocean":{"water_surface_color":"#2570B5","water_fog_color":"#1a4879","water_fog_distance":100} 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/hlsl/terrain.fsh.hlsl: -------------------------------------------------------------------------------- 1 | //huge thanks to @MCH_YamaRin 2 | #include "ShaderConstants.fxh" 3 | #include "util.fxh" 4 | #include "snoise.fxh" 5 | #include "pnoise.fxh" 6 | 7 | struct PS_Input{ 8 | float4 position : SV_Position; 9 | #ifndef BYPASS_PIXEL_SHADER 10 | lpfloat4 color : COLOR; 11 | snorm float2 uv0 : TEXCOORD_0_FB_MSAA; 12 | snorm float2 uv1 : TEXCOORD_1_FB_MSAA; 13 | #endif 14 | #ifdef FOG 15 | float fog : fog; 16 | #endif 17 | float block : block; 18 | float3 cpos : cpos; 19 | float3 wpos : wpos; 20 | }; 21 | struct PS_Output{ 22 | float4 color : SV_Target; 23 | }; 24 | #ifdef FANCY 25 | #define USE_NORMAL 26 | #endif 27 | 28 | #define linearstep(a,b,x) saturate((x-a)/(b-a)) 29 | bool is(float x,float a){return a-.01.5)diffuse=water(PSInput.cpos,PSInput.wpos,diffuse,weather,uw,sun.x,day,n);//water 156 | #ifdef USE_NORMAL 157 | else if(uw<.5)diffuse.rgb=lerp(diffuse.rgb,ambient.rgb,(1.-weather)*smoothstep(-.7,1.,n.y)*pow5(1.-dot(normalize(-PSInput.wpos),n))*sun.x*day*(pnoise(PSInput.cpos.xz,16.,.0625)*.2+.8));//wet 158 | diffuse.rgb*=lerp(1.,lerp(dot(n,float3(0.,.8,.6))*.4+.6,max(dot(n,float3(.9,.44,0.)),dot(n,float3(-.9,.44,0.)))*1.3+.2,dusk),sun.x*min(1.25-uv1_.x,1.)*dayw);//flatShading 159 | #endif 160 | diffuse.rgb+=uv1_.x*uv1_.x*float3(1,.67,.39)*.1*(1.-sun.x);//light 161 | diffuse.rgb=tone(diffuse.rgb,ambient);//tonemap 162 | //=*=*= 163 | 164 | #ifdef FOG 165 | diffuse.rgb=lerp(diffuse.rgb,FOG_COLOR.rgb,PSInput.fog); 166 | #endif 167 | 168 | PSOutput.color=diffuse; 169 | #ifdef VR_MODE 170 | PSOutput.color=max(PSOutput.color,1/255.); 171 | #endif 172 | 173 | #endif 174 | } 175 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/hlsl/entity.fragment.hlsl: -------------------------------------------------------------------------------- 1 | //huge thanks to @MCH_YamaRin 2 | #include "ShaderConstants.fxh" 3 | #include "util.fxh" 4 | 5 | struct PS_Input{ 6 | float4 position : SV_Position; 7 | float4 light : LIGHT; 8 | float4 fogColor : FOG_COLOR; 9 | #ifdef GLINT 10 | // there is some alignment issue on the Windows Phone 1320 that causes the position 11 | // to get corrupted if this is two floats and last in the struct memory wise 12 | float4 layerUV : GLINT_UVS; 13 | #endif 14 | #ifdef COLOR_BASED 15 | float4 color : COLOR; 16 | #endif 17 | #ifdef USE_OVERLAY 18 | float4 overlayColor : OVERLAY_COLOR; 19 | #endif 20 | #ifdef TINTED_ALPHA_TEST 21 | float4 alphaTestMultiplier : ALPHA_MULTIPLIER; 22 | #endif 23 | float2 uv : TEXCOORD_0_FB_MSAA; 24 | }; 25 | struct PS_Output{ 26 | float4 color : SV_Target; 27 | }; 28 | 29 | #ifdef USE_EMISSIVE 30 | #ifdef USE_ONLY_EMISSIVE 31 | #define NEEDS_DISCARD(C) (C.a == 0.0f ||C.a == 1.0f ) 32 | #else 33 | #define NEEDS_DISCARD(C) (C.a + C.r + C.g + C.b == 0.0) 34 | #endif 35 | #else 36 | #ifndef USE_COLOR_MASK 37 | #define NEEDS_DISCARD(C) (C.a < 0.5) 38 | #else 39 | #define NEEDS_DISCARD(C) (C.a == 0.0) 40 | #endif 41 | #endif 42 | 43 | float4 glintBlend(float4 dest, float4 source) { 44 | // glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE, GL_ONE, GL_ZERO) 45 | return float4(source.rgb * source.rgb, source.a) + float4(dest.rgb, 0.0); 46 | } 47 | float3 aces(float3 x){return saturate((x*(2.51*x+.03))/(x*(2.43*x+.59)+.14));} 48 | float3 tone(float3 col, float4 gs){ 49 | col=pow(col,1./gs.rgb); 50 | float lum=dot(col,float3(.298912,.586611,.114478)); 51 | col=aces((col-lum)*gs.a+lum); 52 | return col/aces(1.7);//exposure 53 | } 54 | 55 | ROOT_SIGNATURE 56 | void main(in PS_Input PSInput, out PS_Output PSOutput) 57 | { 58 | float4 color = float4( 1.0f, 1.0f, 1.0f, 1.0f ); 59 | 60 | #if( !defined(NO_TEXTURE) || !defined(COLOR_BASED) || defined(USE_COLOR_BLEND) ) 61 | 62 | #if !defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE) || (VERSION < 0xa000 /*D3D_FEATURE_LEVEL_10_0*/) 63 | color = TEXTURE_0.Sample( TextureSampler0, PSInput.uv ); 64 | #else 65 | color = texture2D_AA(TEXTURE_0, TextureSampler0, PSInput.uv); 66 | #endif 67 | 68 | #ifdef MASKED_MULTITEXTURE 69 | float4 tex1 = TEXTURE_1.Sample(TextureSampler1, PSInput.uv); 70 | 71 | // If tex1 has a non-black color and no alpha, use color; otherwise use tex1 72 | float maskedTexture = ceil( dot( tex1.rgb, float3(1.0f, 1.0f, 1.0f) ) * ( 1.0f - tex1.a ) ); 73 | color = lerp(tex1, color, saturate(maskedTexture)); 74 | #endif // MASKED_MULTITEXTURE 75 | 76 | #if defined(ALPHA_TEST) && !defined(USE_MULTITEXTURE) && !defined(MULTIPLICATIVE_TINT) 77 | if( NEEDS_DISCARD( color ) ) 78 | { 79 | discard; 80 | } 81 | #endif 82 | 83 | #ifdef TINTED_ALPHA_TEST 84 | float4 testColor = color; 85 | testColor.a = testColor.a * PSInput.alphaTestMultiplier.r; 86 | if( NEEDS_DISCARD( testColor ) ) 87 | { 88 | discard; 89 | } 90 | #endif 91 | 92 | #endif 93 | 94 | #ifdef COLOR_BASED 95 | color *= PSInput.color; 96 | #endif 97 | 98 | #ifdef MULTI_COLOR_TINT 99 | // Texture is a mask for tinting with two colors 100 | float2 colorMask = color.rg; 101 | 102 | // Apply the base color tint 103 | color.rgb = colorMask.rrr * CHANGE_COLOR.rgb; 104 | 105 | // Apply the secondary color mask and tint so long as its grayscale value is not 0 106 | color.rgb = lerp(color.rgb, colorMask.ggg * MULTIPLICATIVE_TINT_CHANGE_COLOR.rgb, ceil(colorMask.g)); 107 | #else 108 | 109 | #ifdef USE_COLOR_MASK 110 | color.rgb = lerp( color, color * CHANGE_COLOR, color.a ).rgb; 111 | color.a *= CHANGE_COLOR.a; 112 | #endif 113 | 114 | #ifdef ITEM_IN_HAND 115 | color.rgb = lerp(color, color * CHANGE_COLOR, color.a).rgb; 116 | #endif 117 | 118 | #endif 119 | 120 | #ifdef USE_MULTITEXTURE 121 | float4 tex1 = TEXTURE_1.Sample(TextureSampler1, PSInput.uv); 122 | float4 tex2 = TEXTURE_2.Sample(TextureSampler2, PSInput.uv); 123 | color.rgb = lerp(color.rgb, tex1, tex1.a); 124 | #ifdef ALPHA_TEST 125 | if (color.a < 0.5f && tex1.a == 0.0f) { 126 | discard; 127 | } 128 | #endif 129 | 130 | #ifdef COLOR_SECOND_TEXTURE 131 | if (tex2.a > 0.0f) { 132 | color.rgb = lerp(tex2.rgb, tex2 * CHANGE_COLOR, tex2.a); 133 | } 134 | #else 135 | color.rgb = lerp(color.rgb, tex2, tex2.a); 136 | #endif 137 | #endif 138 | 139 | #ifdef MULTIPLICATIVE_TINT 140 | float4 tintTex = TEXTURE_1.Sample(TextureSampler1, PSInput.uv); 141 | 142 | #ifdef MULTIPLICATIVE_TINT_COLOR 143 | tintTex.rgb = tintTex.rgb * MULTIPLICATIVE_TINT_CHANGE_COLOR.rgb; 144 | #endif 145 | 146 | #ifdef ALPHA_TEST 147 | color.rgb = lerp(color.rgb, tintTex.rgb, tintTex.a); 148 | if (color.a + tintTex.a <= 0.0f) { 149 | discard; 150 | } 151 | #endif 152 | #endif 153 | 154 | #ifdef USE_OVERLAY 155 | //use either the diffuse or the OVERLAY_COLOR 156 | color.rgb = lerp( color, PSInput.overlayColor, PSInput.overlayColor.a ).rgb; 157 | #endif 158 | 159 | #ifdef USE_EMISSIVE 160 | //make glowy stuff 161 | color *= lerp( float( 1.0 ).xxxx, PSInput.light, color.a ); 162 | #else 163 | color *= PSInput.light; 164 | #endif 165 | 166 | float uw= 167 | #ifdef FOG 168 | step(FOG_CONTROL.x,0.); 169 | #else 170 | 0.; 171 | #endif 172 | float nether= 173 | #ifdef FOG 174 | FOG_CONTROL.x/FOG_CONTROL.y;nether=step(.1,nether)-step(.12,nether); 175 | #else 176 | 0.; 177 | #endif 178 | color.rgb=tone(color.rgb, 179 | lerp( 180 | float4(1.,.98,0.96,1.1), 181 | float4((PSInput.fogColor.rgb+2.)*.4,1),//from fog 182 | max(uw,nether) 183 | ) 184 | ); 185 | 186 | //apply fog 187 | color.rgb = lerp( color.rgb, PSInput.fogColor.rgb, PSInput.fogColor.a ); 188 | 189 | #ifdef GLINT 190 | // Applies color mask to glint texture instead and blends with original color 191 | float4 layer1 = TEXTURE_1.Sample(TextureSampler1, frac(PSInput.layerUV.xy)).rgbr * GLINT_COLOR; 192 | float4 layer2 = TEXTURE_1.Sample(TextureSampler1, frac(PSInput.layerUV.zw)).rgbr * GLINT_COLOR; 193 | float4 glint = (layer1 + layer2) * TILE_LIGHT_COLOR; 194 | color = glintBlend(color, glint); 195 | #endif 196 | 197 | //WARNING do not refactor this 198 | PSOutput.color = color; 199 | #ifdef UI_ENTITY 200 | PSOutput.color.a *= HUD_OPACITY; 201 | #endif 202 | 203 | #ifdef VR_MODE 204 | // On Rift, the transition from 0 brightness to the lowest 8 bit value is abrupt, so clamp to 205 | // the lowest 8 bit value. 206 | PSOutput.color = max(PSOutput.color, 1 / 255.0f); 207 | #endif 208 | } 209 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/glsl/entity.fragment: -------------------------------------------------------------------------------- 1 | // __multiversion__ 2 | // This signals the loading code to prepend either #version 100 or #version 300 es as apropriate. 3 | 4 | 5 | #include "fragmentVersionCentroidUV.h" 6 | #include "uniformEntityConstants.h" 7 | 8 | 9 | #include "uniformShaderConstants.h" 10 | #include "util.h" 11 | 12 | LAYOUT_BINDING(0) uniform sampler2D TEXTURE_0; 13 | LAYOUT_BINDING(1) uniform sampler2D TEXTURE_1; 14 | 15 | #ifdef USE_MULTITEXTURE 16 | LAYOUT_BINDING(2) uniform sampler2D TEXTURE_2; 17 | #endif 18 | uniform vec2 FOG_CONTROL; 19 | 20 | varying vec4 light; 21 | varying vec4 fogColor; 22 | 23 | #ifdef COLOR_BASED 24 | varying vec4 vertColor; 25 | #endif 26 | 27 | #ifdef USE_OVERLAY 28 | // When drawing horses on specific android devices, overlay color ends up being garbage data. 29 | // Changing overlay color to high precision appears to fix the issue on devices tested 30 | varying highp vec4 overlayColor; 31 | #endif 32 | 33 | #ifdef TINTED_ALPHA_TEST 34 | varying float alphaTestMultiplier; 35 | #endif 36 | 37 | #ifdef GLINT 38 | varying vec2 layer1UV; 39 | varying vec2 layer2UV; 40 | varying vec4 tileLightColor; 41 | varying vec4 glintColor; 42 | #endif 43 | 44 | vec4 glintBlend(vec4 dest, vec4 source) { 45 | // glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE, GL_ONE, GL_ZERO) 46 | return vec4(source.rgb * source.rgb, source.a) + vec4(dest.rgb, 0.0); 47 | } 48 | vec3 aces(vec3 x){return clamp((x*(2.51*x+.03))/(x*(2.43*x+.59)+.14),0.,1.);} 49 | vec3 tone(vec3 col, vec4 gs){ 50 | col=pow(col,1./gs.rgb); 51 | float lum=dot(col,vec3(.298912,.586611,.114478)); 52 | col=aces((col-lum)*gs.a+lum); 53 | return col/aces(vec3(1.7));//exposure 54 | } 55 | 56 | #ifdef USE_EMISSIVE 57 | #ifdef USE_ONLY_EMISSIVE 58 | #define NEEDS_DISCARD(C) (C.a == 0.0 || C.a == 1.0 ) 59 | #else 60 | #define NEEDS_DISCARD(C) (C.a + C.r + C.g + C.b == 0.0) 61 | #endif 62 | #else 63 | #ifndef USE_COLOR_MASK 64 | #define NEEDS_DISCARD(C) (C.a < 0.5) 65 | #else 66 | #define NEEDS_DISCARD(C) (C.a == 0.0) 67 | #endif 68 | #endif 69 | 70 | void main() 71 | { 72 | vec4 color = vec4(1.0); 73 | 74 | #ifndef NO_TEXTURE 75 | #if !defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE) 76 | color = texture2D( TEXTURE_0, uv ); 77 | #else 78 | color = texture2D_AA(TEXTURE_0, uv); 79 | #endif // !defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE) 80 | 81 | #ifdef MASKED_MULTITEXTURE 82 | vec4 tex1 = texture2D( TEXTURE_1, uv ); 83 | 84 | // If tex1 has a non-black color and no alpha, use color; otherwise use tex1 85 | float maskedTexture = ceil( dot( tex1.rgb, vec3(1.0, 1.0, 1.0) ) * ( 1.0 - tex1.a ) ); 86 | color = mix(tex1, color, clamp(maskedTexture, 0.0, 1.0)); 87 | #endif // MASKED_MULTITEXTURE 88 | 89 | #if defined(ALPHA_TEST) && !defined(USE_MULTITEXTURE) && !defined(MULTIPLICATIVE_TINT) 90 | if(NEEDS_DISCARD(color)) 91 | discard; 92 | #endif // ALPHA_TEST 93 | 94 | #ifdef TINTED_ALPHA_TEST 95 | vec4 testColor = color; 96 | testColor.a *= alphaTestMultiplier; 97 | if(NEEDS_DISCARD(testColor)) 98 | discard; 99 | #endif // TINTED_ALPHA_TEST 100 | #endif // NO_TEXTURE 101 | 102 | #ifdef COLOR_BASED 103 | color *= vertColor; 104 | #endif 105 | 106 | #ifdef MULTI_COLOR_TINT 107 | // Texture is a mask for tinting with two colors 108 | vec2 colorMask = color.rg; 109 | 110 | // Apply the base color tint 111 | color.rgb = colorMask.rrr * CHANGE_COLOR.rgb; 112 | 113 | // Apply the secondary color mask and tint so long as its grayscale value is not 0 114 | color.rgb = mix(color, colorMask.gggg * MULTIPLICATIVE_TINT_CHANGE_COLOR, ceil(colorMask.g)).rgb; 115 | #else 116 | 117 | #ifdef USE_COLOR_MASK 118 | color.rgb = mix(color.rgb, color.rgb*CHANGE_COLOR.rgb, color.a); 119 | color.a *= CHANGE_COLOR.a; 120 | #endif 121 | 122 | #ifdef ITEM_IN_HAND 123 | color.rgb = mix(color.rgb, color.rgb*CHANGE_COLOR.rgb, vertColor.a); 124 | #if defined(MCPE_PLATFORM_NX) && defined(NO_TEXTURE) && defined(GLINT) 125 | // TODO(adfairfi): This needs to be properly fixed soon. We have a User Story for it in VSO: 102633 126 | vec3 dummyColor = texture2D(TEXTURE_0, vec2(0.0, 0.0)).rgb; 127 | color.rgb += dummyColor * 0.000000001; 128 | #endif 129 | #endif // MULTI_COLOR_TINT 130 | 131 | #endif 132 | 133 | #ifdef USE_MULTITEXTURE 134 | vec4 tex1 = texture2D( TEXTURE_1, uv ); 135 | vec4 tex2 = texture2D( TEXTURE_2, uv ); 136 | color.rgb = mix(color.rgb, tex1.rgb, tex1.a); 137 | #ifdef ALPHA_TEST 138 | if (color.a < 0.5 && tex1.a == 0.0) { 139 | discard; 140 | } 141 | #endif 142 | 143 | #ifdef COLOR_SECOND_TEXTURE 144 | if (tex2.a > 0.0) { 145 | color.rgb = tex2.rgb + (tex2.rgb * CHANGE_COLOR.rgb - tex2.rgb)*tex2.a;//lerp(tex2.rgb, tex2 * changeColor.rgb, tex2.a) 146 | } 147 | #else 148 | color.rgb = mix(color.rgb, tex2.rgb, tex2.a); 149 | #endif 150 | #endif 151 | 152 | #ifdef MULTIPLICATIVE_TINT 153 | vec4 tintTex = texture2D(TEXTURE_1, uv); 154 | #ifdef MULTIPLICATIVE_TINT_COLOR 155 | tintTex.rgb = tintTex.rgb * MULTIPLICATIVE_TINT_CHANGE_COLOR.rgb; 156 | #endif 157 | 158 | #ifdef ALPHA_TEST 159 | color.rgb = mix(color.rgb, tintTex.rgb, tintTex.a); 160 | if (color.a + tintTex.a <= 0.0) { 161 | discard; 162 | } 163 | #endif 164 | 165 | #endif 166 | 167 | #ifdef USE_OVERLAY 168 | //use either the diffuse or the OVERLAY_COLOR 169 | color.rgb = mix(color, overlayColor, overlayColor.a).rgb; 170 | #endif 171 | 172 | #ifdef USE_EMISSIVE 173 | //make glowy stuff 174 | color *= mix(vec4(1.0), light, color.a ); 175 | #else 176 | color *= light; 177 | #endif 178 | 179 | float uw= 180 | #ifdef FOG 181 | step(FOG_CONTROL.x,0.); 182 | #else 183 | 0.; 184 | #endif 185 | float nether= 186 | #ifdef FOG 187 | FOG_CONTROL.x/FOG_CONTROL.y;nether=step(.1,nether)-step(.12,nether); 188 | #else 189 | 0.; 190 | #endif 191 | color.rgb=tone(color.rgb, 192 | mix( 193 | vec4(1.,.98,0.96,1.1), 194 | vec4((fogColor.rgb+2.)*.4,1),//from fog 195 | max(uw,nether) 196 | ) 197 | ); 198 | 199 | //apply fog 200 | color.rgb = mix( color.rgb, fogColor.rgb, fogColor.a ); 201 | 202 | #ifdef GLINT 203 | // Applies color mask to glint texture instead and blends with original color 204 | vec4 layer1 = texture2D(TEXTURE_1, fract(layer1UV)).rgbr * glintColor; 205 | vec4 layer2 = texture2D(TEXTURE_1, fract(layer2UV)).rgbr * glintColor; 206 | vec4 glint = (layer1 + layer2) * tileLightColor; 207 | 208 | color = glintBlend(color, glint); 209 | #endif 210 | 211 | //WARNING do not refactor this 212 | #ifdef UI_ENTITY 213 | color.a *= HUD_OPACITY; 214 | #endif 215 | gl_FragColor = color; 216 | } 217 | -------------------------------------------------------------------------------- /ESBE_3G/shaders/glsl/terrain.fsh: -------------------------------------------------------------------------------- 1 | // __multiversion__ 2 | // This signals the loading code to prepend either #version 100 or #version 300 es as apropriate. 3 | #ifdef GL_FRAGMENT_PRECISION_HIGH 4 | #define HM highp 5 | #else 6 | #define HM mediump 7 | #endif 8 | #include "fragmentVersionCentroid.h" 9 | #if __VERSION__ >= 300 10 | #ifdef FANCY 11 | #define USE_NORMAL 12 | #endif 13 | #endif 14 | 15 | #ifndef BYPASS_PIXEL_SHADER 16 | _centroid varying HM vec2 uv0; 17 | _centroid varying HM vec2 uv1; 18 | #endif 19 | varying vec4 color; 20 | 21 | #ifdef FOG 22 | varying float fog; 23 | #endif 24 | 25 | varying float block; 26 | varying HM vec3 wpos; 27 | varying HM vec3 cpos; 28 | 29 | #include "util.h" 30 | LAYOUT_BINDING(0) uniform sampler2D TEXTURE_0; 31 | LAYOUT_BINDING(1) uniform sampler2D TEXTURE_1; 32 | LAYOUT_BINDING(2) uniform sampler2D TEXTURE_2; 33 | uniform vec4 FOG_COLOR; 34 | uniform vec2 FOG_CONTROL; 35 | uniform HM float TOTAL_REAL_WORLD_TIME; 36 | #include "snoise.h" 37 | #include "pnoise.h" 38 | 39 | #define linearstep(a,b,x) clamp((x-a)/(b-a),0.,1.) 40 | bool is(float x,float a){return a-.01.5)diffuse=water(diffuse,weather,uw,sun.x,day,n);//water 166 | #ifdef USE_NORMAL 167 | else if(uw<.5)diffuse.rgb=mix(diffuse.rgb,ambient.rgb,(1.-weather)*smoothstep(-.7,1.,n.y)*pow5(1.-dot(normalize(-wpos),n))*sun.x*day*(pnoise(cpos.xz,16.,.0625)*.2+.8));//wet 168 | diffuse.rgb*=mix(1.,mix(dot(n,vec3(0.,.8,.6))*.4+.6,max(dot(n,vec3(.9,.44,0.)),dot(n,vec3(-.9,.44,0.)))*1.3+.2,dusk),sun.x*min(1.25-uv1_.x,1.)*dayw);//flatShading 169 | #endif 170 | diffuse.rgb+=uv1_.x*uv1_.x*vec3(1,.67,.39)*.1*(1.-sun.x);//light 171 | diffuse.rgb=tone(diffuse.rgb,ambient);//tonemap 172 | //=*=*= 173 | 174 | #ifdef FOG 175 | diffuse.rgb=mix(diffuse.rgb,FOG_COLOR.rgb,fog); 176 | #endif 177 | 178 | //#define DEBUG 179 | #ifdef DEBUG 180 | HM vec2 subdisp = gl_FragCoord.xy/512.; 181 | if(subdisp.x<1. && subdisp.y<1.){ 182 | vec3 subback=vec3(1); 183 | #define sdif(S,E,Y,C) if(subdisp.x>S && subdisp.x<=E && subdisp.y<=Y)subback.rgb=C; 184 | sdif(0.,.1,day,vec3(.5)) 185 | sdif(.2,.3,FOG_CONTROL.x,vec3(.5)) 186 | sdif(.3,.4,FOG_CONTROL.y,vec3(.5)) 187 | diffuse=mix(diffuse,vec4(subback,1),.5); 188 | vec3 tm=tone(subdisp.xxx,ambient); 189 | if(subdisp.y<=tm.r+.005 && subdisp.y>=tm.r-.005)diffuse.rgb=vec3(1,0,0); 190 | if(subdisp.y<=tm.g+.005 && subdisp.y>=tm.g-.005)diffuse.rgb=vec3(0,1,0); 191 | if(subdisp.y<=tm.b+.005 && subdisp.y>=tm.b-.005)diffuse.rgb=vec3(0,0,1); 192 | } 193 | #endif 194 | 195 | gl_FragColor=diffuse; 196 | 197 | #endif 198 | } 199 | --------------------------------------------------------------------------------