mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-01-03 16:13:30 +08:00
made rain come down from an angle. tweaked SSS from the sun.
This commit is contained in:
parent
d47eedd987
commit
69e605b38b
@ -101,7 +101,6 @@ void main() {
|
||||
#endif
|
||||
|
||||
#ifdef WEATHER
|
||||
// lightmap.x = clamp(max(lightmap.x - 0.5, 0.0) * 2.5, 0.0, 1.0);
|
||||
gl_FragData[1].a = TEXTURE.a; // for bloomy rain and stuff
|
||||
#endif
|
||||
|
||||
|
@ -23,8 +23,12 @@ uniform float sunElevation;
|
||||
|
||||
uniform vec2 texelSize;
|
||||
uniform int framemod8;
|
||||
|
||||
uniform float frameTimeCounter;
|
||||
uniform vec3 cameraPosition;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform ivec2 eyeBrightnessSmooth;
|
||||
|
||||
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(-1.,3.)/8.,
|
||||
vec2(5.0,1.)/8.,
|
||||
@ -33,7 +37,12 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(-7.,-1.)/8.,
|
||||
vec2(3,7.)/8.,
|
||||
vec2(7.,-7.)/8.);
|
||||
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),-viewSpacePosition.z);
|
||||
}
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
@ -41,13 +50,33 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
|
||||
lmtexcoord.xy = (gl_MultiTexCoord0).xy;
|
||||
vec2 lmcoord = gl_MultiTexCoord1.xy / 255.0; // is this even correct? lol'
|
||||
lmtexcoord.zw = lmcoord;
|
||||
|
||||
#ifdef WEATHER
|
||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||
|
||||
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz + cameraPosition;
|
||||
bool istopv = worldpos.y > cameraPosition.y + 5.0 && lmtexcoord.w > 0.94;
|
||||
|
||||
if(!istopv){
|
||||
worldpos.xyz -= cameraPosition;
|
||||
}else{
|
||||
worldpos.xyz -= cameraPosition + vec3(2.0,0.0,2.0);
|
||||
}
|
||||
|
||||
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
||||
|
||||
gl_Position = toClipSpace3(position);
|
||||
#else
|
||||
gl_Position = ftransform();
|
||||
#endif
|
||||
|
||||
|
||||
color = gl_Color;
|
||||
// color.rgb = worldpos;
|
||||
#ifdef LINES
|
||||
color.a = 1.0;
|
||||
#endif
|
||||
|
@ -522,35 +522,33 @@ void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool ins
|
||||
}
|
||||
#endif
|
||||
|
||||
float CustomPhase(float LightPos, float S_1, float S_2){
|
||||
float SCALE = S_2 + 0.001; // remember the epislons 0.001 is fine.
|
||||
float N = S_1;
|
||||
float N2 = N / SCALE;
|
||||
float CustomPhase(float LightPos){
|
||||
|
||||
float R = 1;
|
||||
float A = pow(1.0 - pow(max(R-LightPos,0.0), N2 ),N);
|
||||
float PhaseCurve = 1.0 - LightPos;
|
||||
float Final = exp2(sqrt(PhaseCurve) * -25.0);
|
||||
Final += exp(PhaseCurve * -10.0)*0.5;
|
||||
|
||||
return A;
|
||||
return Final;
|
||||
}
|
||||
|
||||
vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, float lightPos, bool inShadowmapBounds){
|
||||
|
||||
float labcurve = pow(Density,LabSSS_Curve);
|
||||
// float density = sqrt(30 - labcurve*15);
|
||||
float labcurve = pow(Density, LabSSS_Curve);
|
||||
|
||||
float density = 15 - labcurve*10;
|
||||
|
||||
vec3 absorbed = max(1.0 - albedo,0.0);
|
||||
|
||||
vec3 scatter = vec3(0.0);
|
||||
// if(inShadowmapBounds) {
|
||||
scatter = exp(absorbed * Scattering * -5) * exp(Scattering * -density);
|
||||
// }else{
|
||||
// scatter = exp(absorbed * Scattering * -10) * exp(Scattering * -max(density,5));
|
||||
// }
|
||||
// vec3 scatter = vec3(1)* exp(Scattering * -density);
|
||||
vec3 scatter = exp(absorbed * Scattering * -5) * exp(Scattering * -density);
|
||||
|
||||
scatter *= labcurve;
|
||||
scatter *= 0.5 + CustomPhase(lightPos, 1.0,30.0)*20;
|
||||
|
||||
// PHASE TIME
|
||||
// scatter *= 0.5 + CustomPhase(lightPos) * 13.0; // ~20x brighter at the peak
|
||||
// scatter *= 1.0 + CustomPhase(lightPos) * 12.6; // ~20x brighter at the peak
|
||||
|
||||
// scatter *= 0.5 + CustomPhase(lightPos)*6.35; // ~10x brighter at the peak
|
||||
scatter *= 1.0 + CustomPhase(lightPos)*6.0; // ~10x brighter at the peak
|
||||
|
||||
return scatter;
|
||||
|
||||
@ -685,6 +683,11 @@ void main() {
|
||||
#ifndef ambientLight_only
|
||||
DirectLightColor = lightCol.rgb/80.0;
|
||||
#endif
|
||||
|
||||
#ifdef PER_BIOME_ENVIRONMENT
|
||||
BiomeSunlightColor(DirectLightColor);
|
||||
#endif
|
||||
|
||||
AmbientLightColor = averageSkyCol_Clouds;
|
||||
|
||||
vec3 filteredShadow = vec3(1.412,1.0,0.0);
|
||||
@ -846,7 +849,10 @@ void main() {
|
||||
|
||||
if (isEyeInWater == 0) Direct_SSS *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix
|
||||
|
||||
if (!inShadowmapBounds) Direct_SSS *= lightmapAsShadows;
|
||||
if (!inShadowmapBounds){
|
||||
Direct_SSS *= lightmapAsShadows;
|
||||
Direct_SSS *= 1.0-NdotL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -1053,7 +1059,11 @@ void main() {
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
Direct_lighting = DoDirectLighting(DirectLightColor, Shadows, NdotL, 0.0);
|
||||
Direct_lighting += Direct_SSS * DirectLightColor; // do this here so it gets underwater absorbtion.
|
||||
|
||||
// do this here so it gets underwater absorbtion.
|
||||
|
||||
// Direct_lighting += Direct_SSS * DirectLightColor;
|
||||
Direct_lighting = max(Direct_lighting, Direct_SSS * DirectLightColor);
|
||||
#endif
|
||||
|
||||
gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * albedo;
|
||||
@ -1103,7 +1113,7 @@ void main() {
|
||||
|
||||
// float phaseorigin = 1.0 - clamp(dot(feetPlayerPos_normalized, normalize(testPos) ),0.0,1.0);
|
||||
|
||||
// gl_FragData[0].rgb += lightningEffect * exp(sqrt(phaseorigin) * -10);
|
||||
// gl_FragData[0].rgb = vec3(1) * CustomPhase(clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0));
|
||||
|
||||
/* DRAWBUFFERS:3 */
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ const int colortex4Format = RGBA16F; //light values and skyboxes (everything)
|
||||
const int colortex6Format = R11F_G11F_B10F; //additionnal buffer for bloom (composite3->final)
|
||||
const int colortex7Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
||||
|
||||
const int colortex9Format = RGBA8; // flat normals and vanilla AO
|
||||
const int colortex11Format = RGBA16; // unchanged translucents albedo, alpha and tangent normals
|
||||
const int colortex15Format = RGBA8; // flat normals and vanilla AO
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user