mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-23 01:59:39 +08:00
Make seasonal snow only in winter - early spring, make rain less when not under a cloud
This commit is contained in:
parent
fa9608c859
commit
35ee91b5d0
@ -72,6 +72,8 @@ uniform vec3 sunVec;
|
||||
uniform ivec2 eyeBrightnessSmooth;
|
||||
uniform ivec2 eyeBrightness;
|
||||
|
||||
flat varying float WinterTimeForSnow;
|
||||
|
||||
// uniform int worldTime;
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
@ -1064,6 +1066,8 @@ void main() {
|
||||
SnowPatches = 1.0 - clamp( exp(pow(SnowPatches,3.5) * -100.0) ,0,1);
|
||||
SnowPatches *= clamp(sqrt(normal.y),0,1) * clamp(pow(lightmap.y,25)*25,0,1);
|
||||
|
||||
SnowPatches = mix(0.0, SnowPatches, WinterTimeForSnow);
|
||||
|
||||
if(!hand && !iswater){
|
||||
albedo = mix(albedo, vec3(0.8,0.9,1.0), SnowPatches);
|
||||
SpecularTex.rg = mix(SpecularTex.rg, vec2(1,0.05), SnowPatches);
|
||||
@ -1119,7 +1123,7 @@ void main() {
|
||||
}
|
||||
|
||||
|
||||
// gl_FragData[0].rgb = worldToView(normal); if(z >= 1) gl_FragData[0].rgb = vec3(0.5);
|
||||
// gl_FragData[0].rgb *= GetCloudSkyOcclusion(p3 + cameraPosition);
|
||||
// if (abs(filtered.b-0.1) < 0.0004 ) gl_FragData[0].rgb = vec3(0,1,0);
|
||||
|
||||
/* DRAWBUFFERS:3 */
|
||||
|
@ -33,6 +33,19 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
|
||||
#include "/lib/util.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define SEASONS_VSH
|
||||
#include "/lib/climate_settings.glsl"
|
||||
|
||||
flat varying float WinterTimeForSnow;
|
||||
|
||||
|
||||
|
||||
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
@ -57,5 +70,11 @@ void main() {
|
||||
zMults = vec3((far * near)*2.0,far+near,far-near);
|
||||
|
||||
|
||||
WinterTimeForSnow = 0.0;
|
||||
|
||||
#ifdef Snowy_Winter
|
||||
vec3 color1 = vec3(0.0);
|
||||
vec3 color2 = color1;
|
||||
YearCycleColor(color1, color2, WinterTimeForSnow);
|
||||
#endif
|
||||
}
|
||||
|
@ -276,7 +276,10 @@ void main() {
|
||||
color += vl.rgb;
|
||||
|
||||
float rainDrops = clamp(texture2D(colortex9,texcoord).a, 0.0,1.0); // bloomy rain effect
|
||||
if(rainDrops > 0.0) vl.a *= clamp(exp2(-rainDrops*5),0.,1.); // bloomy rain effect
|
||||
|
||||
|
||||
|
||||
if(rainDrops > 0.0) vl.a *= clamp(1.0 - rainDrops ,0.,1.); // bloomy rain effect
|
||||
gl_FragData[0].r = vl.a;
|
||||
|
||||
/// lava.
|
||||
@ -302,7 +305,6 @@ void main() {
|
||||
if(texcoord.x < 0.45 && luma(thingy) > 0.0 ) color.rgb = thingy;
|
||||
#endif
|
||||
|
||||
|
||||
gl_FragData[1].rgb = clamp(color.rgb,0.0,68000.0);
|
||||
|
||||
// gl_FragData[1].rgb = vec3(tangentNormals,0.0);
|
||||
|
@ -97,20 +97,25 @@ void main() {
|
||||
|
||||
vec4 TEXTURE = texture2D(texture, lmtexcoord.xy)*color;
|
||||
|
||||
gl_FragData[1].a = TEXTURE.a; // for bloomy rain and stuff
|
||||
|
||||
|
||||
#ifndef WEATHER
|
||||
|
||||
gl_FragData[1].a = 1.0 - TEXTURE.a; // for bloomy rain and stuff
|
||||
|
||||
vec3 Albedo = toLinear(TEXTURE.rgb);
|
||||
|
||||
vec2 tempOffset = offsets[framemod8];
|
||||
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
|
||||
vec3 p3 = mat3(gbufferModelViewInverse) * fragpos;
|
||||
vec3 np3 = normVec(p3);
|
||||
|
||||
float cloudOcclusion = 0.0;
|
||||
|
||||
if(TEXTURE.a > 0.0) cloudOcclusion = 1.0 - GetCloudSkyOcclusion(p3 + cameraPosition)*0.9;
|
||||
gl_FragData[1].a = TEXTURE.a * cloudOcclusion; // for bloomy rain and stuff
|
||||
|
||||
#ifndef WEATHER
|
||||
|
||||
gl_FragData[1].a = 1.0 - TEXTURE.a;
|
||||
gl_FragData[0].a = TEXTURE.a;
|
||||
|
||||
vec3 Albedo = toLinear(TEXTURE.rgb);
|
||||
|
||||
// do the maths only if the pixels exist....
|
||||
if(TEXTURE.a > 0.0){
|
||||
|
||||
float Shadows = 1.0;
|
||||
vec3 p3_shadow = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz;
|
||||
@ -138,8 +143,10 @@ void main() {
|
||||
vec3 Direct_lighting = DoDirectLighting(lightCol.rgb/80., Shadows, 1.0, 0.0) * phase * lightleakfix;
|
||||
|
||||
vec3 Indirect_lighting = DoAmbientLighting(avgAmbient, vec3(TORCH_R,TORCH_G,TORCH_B), lmtexcoord.zw, 5.0);
|
||||
|
||||
gl_FragData[0].a = TEXTURE.a;
|
||||
// gl_FragData[0].a = TEXTURE.a;
|
||||
gl_FragData[0].rgb = (Direct_lighting + Indirect_lighting) * Albedo;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
@ -229,17 +229,6 @@ vec3 blackbody2(float Temp)
|
||||
|
||||
return srgbToLinear2(col);
|
||||
}
|
||||
float densityAtPosSNOW(in vec3 pos){
|
||||
pos /= 18.;
|
||||
pos.xz *= 0.5;
|
||||
vec3 p = floor(pos);
|
||||
vec3 f = fract(pos);
|
||||
f = (f*f) * (3.-2.*f);
|
||||
vec2 uv = p.xz + f.xz + p.y * vec2(0.0,193.0);
|
||||
vec2 coord = uv / 512.0;
|
||||
vec2 xy = texture2D(noisetex, coord).yx;
|
||||
return mix(xy.r,xy.g, f.y);
|
||||
}
|
||||
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
@ -53,7 +53,6 @@ flat varying int LIGHTNING;
|
||||
|
||||
flat varying float SSSAMOUNT;
|
||||
flat varying float EMISSIVE;
|
||||
|
||||
flat varying int NameTags;
|
||||
|
||||
in vec3 at_velocity;
|
||||
@ -298,7 +297,8 @@ void main() {
|
||||
#ifndef BLOCKENTITIES
|
||||
#ifndef ENTITIES
|
||||
#ifndef HAND
|
||||
YearCycleColor(color.rgb, gl_Color.rgb);
|
||||
float blank = 0.0;
|
||||
YearCycleColor(color.rgb, gl_Color.rgb, blank);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
@ -29,7 +29,8 @@
|
||||
|
||||
void YearCycleColor (
|
||||
inout vec3 FinalColor,
|
||||
vec3 glcolor
|
||||
vec3 glcolor,
|
||||
inout float SnowySeason
|
||||
){
|
||||
// colors for things that arent leaves and using the tint index.
|
||||
vec3 SummerCol = vec3(Summer_R, Summer_G, Summer_B);
|
||||
@ -79,6 +80,15 @@
|
||||
|
||||
// multiply final color by the final lerped color, because it contains all the other colors.
|
||||
if(IsTintIndex) FinalColor = SpringToSummer;
|
||||
|
||||
#ifdef Snowy_Winter
|
||||
// this is to make snow only exist in winter
|
||||
float FallToWinter_snowfall = mix(0.0, 1.0, AutumnTime);
|
||||
float WinterToSpring_snowfall = mix(FallToWinter_snowfall, 0.0, WinterTime);
|
||||
SnowySeason = WinterToSpring_snowfall;
|
||||
#else
|
||||
SnowySeason = 0.0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -216,7 +216,8 @@
|
||||
|
||||
#define Seasons
|
||||
#define Season_Length 24 // how long each season lasts in minecraft days. 91 is roughly how long each season is in reality. 1 will make a year last 4 days [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91]
|
||||
// #define Snowy_Winter // snow in the winter, yes or no?
|
||||
#define Snowy_Winter // snow in the winter, yes or no?
|
||||
|
||||
#define Summer_R 1.0 // the color of the plants during this season [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0]
|
||||
#define Summer_G 1.0 // the color of the plants during this season [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0]
|
||||
#define Summer_B 1.0 // the color of the plants during this season [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0]
|
||||
|
@ -393,3 +393,22 @@ float GetCloudShadow_VLFOG(vec3 WorldPos){
|
||||
|
||||
return shadow;
|
||||
}
|
||||
|
||||
float GetCloudSkyOcclusion(vec3 WorldPos){
|
||||
|
||||
float shadow = 0.0;
|
||||
|
||||
vec3 shadowDir = vec3(0,1,0);
|
||||
|
||||
|
||||
// assume a flat layer of cloud, and stretch the sampled density along the sunvector, starting from some vertical layer in the cloud.
|
||||
#ifdef Cumulus
|
||||
vec3 lowShadowStart = WorldPos + shadowDir/abs(shadowDir.y) * max((MaxCumulusHeight - 60) - WorldPos.y,0.0) ;
|
||||
shadow += GetCumulusDensity(lowShadowStart,0)*Cumulus_density;
|
||||
#endif
|
||||
|
||||
|
||||
shadow = clamp(exp(-shadow*25.0) ,0.0,1.0);
|
||||
|
||||
return shadow;
|
||||
}
|
Loading…
Reference in New Issue
Block a user