mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 00:37:35 +08:00
Added resourecpack sky support. made use of iris dimensions.properties and added fallback shader.
This commit is contained in:
@ -76,4 +76,23 @@ void DoRTAmbientLighting (vec3 TorchColor, vec2 Lightmap, inout float SkyLM, ino
|
||||
return TorchLight + AmbientLight;// + AmbientLight + FogTint;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef FALLBACK_SHADER
|
||||
vec3 DoAmbientLighting_Fallback(vec3 Color, vec3 TorchColor, float Lightmap, vec3 Normal, vec3 p3){
|
||||
|
||||
float TorchLM = 10.0 - ( 1.0 / (pow(exp(-0.5*inversesqrt(Lightmap)),5.0)+0.1));
|
||||
TorchLM = pow(TorchLM/4,10) + pow(Lightmap,1.5)*0.5;
|
||||
vec3 TorchLight = TorchColor * TorchLM * 0.75;
|
||||
TorchLight *= TORCH_AMOUNT;
|
||||
|
||||
float NdotL = clamp(-dot(Normal,normalize(p3)),0.0,1.0);
|
||||
|
||||
float PlayerLight = exp( (1.0-clamp(1.0 - length(p3) / 32.0,0.0,1.0)) *-10.0);
|
||||
// vec3 AmbientLight = TorchColor * PlayerLight * NdotL;
|
||||
vec3 AmbientLight = vec3(0.5,0.3,1.0)*0.2 * (Normal.y*0.5+0.6);
|
||||
|
||||
|
||||
return TorchLight + AmbientLight;// + AmbientLight + FogTint;
|
||||
}
|
||||
#endif
|
54
shaders/lib/fallback_fog.glsl
Normal file
54
shaders/lib/fallback_fog.glsl
Normal file
@ -0,0 +1,54 @@
|
||||
vec4 GetVolumetricFog(
|
||||
vec3 viewPos,
|
||||
float dither,
|
||||
float dither2
|
||||
){
|
||||
int SAMPLES = 16;
|
||||
vec3 vL = vec3(0.0);
|
||||
float absorbance = 1.0;
|
||||
|
||||
//project pixel position into projected shadowmap space
|
||||
vec3 wpos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
vec3 fragposition = mat3(shadowModelView) * wpos + shadowModelView[3].xyz;
|
||||
fragposition = diagonal3(shadowProjection) * fragposition + shadowProjection[3].xyz;
|
||||
|
||||
//project view origin into projected shadowmap space
|
||||
vec3 start = toShadowSpaceProjected(vec3(0.));
|
||||
|
||||
//rayvector into projected shadow map space
|
||||
//we can use a projected vector because its orthographic projection
|
||||
//however we still have to send it to curved shadow map space every step
|
||||
vec3 dV = fragposition-start;
|
||||
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
||||
|
||||
float maxLength = min(length(dVWorld),far)/length(dVWorld);
|
||||
|
||||
dV *= maxLength;
|
||||
dVWorld *= maxLength;
|
||||
|
||||
float dL = length(dVWorld);
|
||||
float expFactor = 11.0;
|
||||
for (int i=0;i<SAMPLES;i++) {
|
||||
float d = (pow(expFactor, float(i+dither)/float(SAMPLES))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||
float dd = pow(expFactor, float(i+dither)/float(SAMPLES)) * log(expFactor) / float(SAMPLES)/(expFactor-1.0);
|
||||
vec3 progress = start.xyz + d*dV;
|
||||
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||
|
||||
// do main lighting
|
||||
float Density = 0.05;
|
||||
|
||||
|
||||
Density *= pow(normalize(-wpos).y*0.5+0.5,3.0);
|
||||
|
||||
|
||||
// vec3 vL0 = vec3(0.8,0.5,1) * 0.05 * pow(normalize(wpos).y*0.5+0.5,2.0)*2.0;
|
||||
vec3 vL0 = vec3(0.8,1.0,0.5) * 0.05 ;
|
||||
|
||||
vL += (vL0 - vL0*exp(-Density*dd*dL)) * absorbance;
|
||||
|
||||
absorbance *= exp(-(Density)*dd*dL);
|
||||
|
||||
if (absorbance < 1e-5) break;
|
||||
}
|
||||
return vec4(vL, absorbance);
|
||||
}
|
@ -4,37 +4,29 @@ vec2 R2_samples(int n){
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
///////////////////////////// SSAO ////////////////////////
|
||||
////////////////////////////////////////////////////////////////
|
||||
const float PI = 3.141592653589793238462643383279502884197169;
|
||||
|
||||
vec2 tapLocation_alternate(
|
||||
int sampleNumber, float spinAngle, int nb, float nbRot, float r0
|
||||
int samples, int totalSamples, float rotation, float rng
|
||||
){
|
||||
float alpha = (float(sampleNumber*1.0f + r0) * (1.0 / (nb)));
|
||||
float angle = alpha * (nbRot * 3.14) ;
|
||||
float alpha = float(samples + rng) * (1.0 / float(totalSamples));
|
||||
float angle = alpha * (rotation * PI);
|
||||
|
||||
float ssR = alpha + spinAngle*3.14;
|
||||
float sin_v, cos_v;
|
||||
float sin_v = sin(angle);
|
||||
float cos_v = cos(angle);
|
||||
|
||||
sin_v = sin(angle);
|
||||
cos_v = cos(angle);
|
||||
|
||||
return vec2(cos_v, sin_v)*ssR;
|
||||
return vec2(cos_v, sin_v) * alpha;
|
||||
}
|
||||
|
||||
vec2 SSAO(
|
||||
vec3 viewPos, vec3 normal, bool hand, bool leaves
|
||||
){
|
||||
if(hand) return vec2(1,0);
|
||||
|
||||
// float radius[7] = float[](
|
||||
// 0.15,
|
||||
// 0.15,
|
||||
// 0.15,
|
||||
// 0.15,
|
||||
// 0.15,
|
||||
// 0.15,
|
||||
// 0.15
|
||||
// );
|
||||
|
||||
float dist = 1.0 + clamp(viewPos.z*viewPos.z/50.0,0,5); // shrink sample size as distance increases
|
||||
float mulfov2 = gbufferProjection[1][1]/(3 * dist);
|
||||
@ -49,16 +41,20 @@ vec2 SSAO(
|
||||
|
||||
vec2 acc = -(TAA_Offset*(texelSize/2))*RENDER_SCALE ;
|
||||
|
||||
int seed = (frameCounter%40000) * 2 + (1+frameCounter);
|
||||
float samplePos = fract(R2_samples(seed).x + blueNoise(gl_FragCoord.xy).x) * 1.61803398874;
|
||||
|
||||
// int seed = (frameCounter%40000)*2 + (1+frameCounter);
|
||||
// vec2 samplePos = fract(R2_samples(seed).xy + blueNoise(gl_FragCoord.xy).xy);
|
||||
|
||||
int samples = 7;
|
||||
|
||||
int seed = (frameCounter%40000) + frameCounter*2;
|
||||
float samplePos = fract(R2_samples(seed).y + blueNoise(gl_FragCoord.xy).y);
|
||||
|
||||
float occlusion = 0.0; float sss = 0.0;
|
||||
int n = 0;
|
||||
for (int i = 0; i < samples; i++) {
|
||||
|
||||
vec2 sp = tapLocation_alternate(i, 0.0, samples, 20, samplePos)* 0.2;
|
||||
vec2 sp = tapLocation_alternate(i, samples, 20, samplePos) * 0.2;
|
||||
|
||||
float rd = mulfov2 ;
|
||||
|
||||
vec2 sampleOffset = sp * rd;
|
||||
@ -122,7 +118,7 @@ float ScreenSpace_SSS(
|
||||
int n = 0;
|
||||
for (int i = 0; i < samples; i++) {
|
||||
|
||||
vec2 sp = tapLocation_alternate(i, 0.0, samples, 20, samplePos)* 0.2;
|
||||
vec2 sp = tapLocation_alternate(i, samples, 20, samplePos)* 0.2;
|
||||
float rd = mulfov2 ;
|
||||
|
||||
vec2 sampleOffset = sp * rd;
|
||||
|
@ -162,7 +162,7 @@ const float sunPathRotation = -35; //[-90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -8
|
||||
#define fog_coefficientMieG 3.0 // [0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0]
|
||||
#define fog_coefficientMieB 3.0 // [0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0]
|
||||
|
||||
#define RainFog_amount 1 // [0 1 2 3 4 5 6 7 8 9 10 15 20 25]
|
||||
#define RainFog_amount 3 // [0 1 2 3 4 5 6 7 8 9 10 15 20 25]
|
||||
|
||||
#define BLOOMY_FOG 2.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 6.0 10.0 15.0 20.0]
|
||||
#define BLOOM_STRENGTH 4.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0]
|
||||
@ -490,8 +490,15 @@ uniform int moonPhase;
|
||||
|
||||
#define LIGHTNING_FLASH // FOR OPTIFINE USERS. some mods change the sky color, which can trigger the lightning flash detection.
|
||||
|
||||
#define RESOURCEPACK_SKY 0 // [0 1 2]
|
||||
|
||||
// fix settings
|
||||
#if RESOURCEPACK_SKY == 0
|
||||
#endif
|
||||
#ifdef VANILLA_SUN_AND_MOON
|
||||
#endif
|
||||
#ifdef LIGHTNING_FLASH
|
||||
#endif
|
||||
#if BLISS_SHADERS == 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user