Skip to content

Commit

Permalink
Reimagined r2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EminGT committed Feb 24, 2023
1 parent 0e495de commit 329f392
Show file tree
Hide file tree
Showing 100 changed files with 2,138 additions and 1,104 deletions.
8 changes: 1 addition & 7 deletions shaderFile_1/shaderFile_4.placebo
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
shaderFile_A_BSL.placebo
shaderFile_B_Compatibility.placebo
shaderFile_C_Extended.placebo
shaderFile_D_Improved.placebo
shaderFile_E_Utility.placebo
shaderFile_F_Versatile.placebo
shaderFile_G_Visibility.placebo
This is a placebo file so that some people stop thinking they should put the "shaders" folder to their shaderpacks folder.
8 changes: 1 addition & 7 deletions shaderFile_2/shaderFile_R.placebo
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
shaderFile_A_Reimagined.placebo
shaderFile_B_Harmony.placebo
shaderFile_C_Extended.placebo
shaderFile_D_Improved.placebo
shaderFile_E_Unseen.placebo
shaderFile_F_Tailored.placebo
shaderFile_G_Visibility.placebo
This is a placebo file so that some people stop thinking they should put the "shaders" folder to their shaderpacks folder.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion shaderFile_F_Tailored.placebo

This file was deleted.

146 changes: 90 additions & 56 deletions shaders/block.properties

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions shaders/entity.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

entity.50000=end_crystal
entity.50004=lightning_bolt
entity.50008=item_frame
entity.50012=glow_item_frame
entity.50008=item_frame glow_item_frame
entity.50012=
entity.50016=player
entity.50020=blaze
entity.50024=creeper
Expand Down
228 changes: 144 additions & 84 deletions shaders/lang/en_US.lang

Large diffs are not rendered by default.

45 changes: 36 additions & 9 deletions shaders/lib/antialiasing/taa.glsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#include "/lib/util/reprojection.glsl"
const float regularEdge = 20.0;
const float extraEdgeMult = 3.0;

// Previous frame reprojection from Chocapic13
vec2 Reprojection(vec3 pos, vec3 cameraOffset) {
pos = pos * 2.0 - 1.0;

vec4 viewPosPrev = gbufferProjectionInverse * vec4(pos, 1.0);
viewPosPrev /= viewPosPrev.w;
viewPosPrev = gbufferModelViewInverse * viewPosPrev;

vec4 previousPosition = viewPosPrev + vec4(cameraOffset, 0.0);
previousPosition = gbufferPreviousModelView * previousPosition;
previousPosition = gbufferPreviousProjection * previousPosition;
return previousPosition.xy / previousPosition.w * 0.5 + 0.5;
}

ivec2 neighbourhoodOffsets[8] = ivec2[8](
ivec2(-1, -1),
Expand All @@ -15,19 +30,28 @@ void NeighbourhoodClamping(vec3 color, inout vec3 tempColor, float depth, inout
vec3 minclr = color, maxclr = color;

for (int i = 0; i < 8; i++) {
float depthCheck = texelFetch(depthtex1, texelCoord + neighbourhoodOffsets[i], 0).r;
if (abs(GetLinearDepth(depthCheck) - GetLinearDepth(depth)) > 0.09) edge = 10.0;
vec3 clr = texelFetch(colortex3, texelCoord + neighbourhoodOffsets[i], 0).rgb;
ivec2 texelCoordM = texelCoord + neighbourhoodOffsets[i];

float depthCheck = texelFetch(depthtex1, texelCoordM, 0).r;
if (abs(GetLinearDepth(depthCheck) - GetLinearDepth(depth)) > 0.09) {
edge = regularEdge;

if (int(texelFetch(colortex1, texelCoordM, 0).g * 255.1) == 253) // Reduced Edge TAA
edge *= extraEdgeMult;
}

vec3 clr = texelFetch(colortex3, texelCoordM, 0).rgb;
minclr = min(minclr, clr); maxclr = max(maxclr, clr);
}

tempColor = clamp(tempColor, minclr, maxclr);
}

void DoTAA(inout vec3 color, inout vec3 temp) {
if (int(texelFetch(colortex1, texelCoord, 0).g * 255.1) == 4) { // No SSAO, No TAA
int materialMask = int(texelFetch(colortex1, texelCoord, 0).g * 255.1);

if (materialMask == 254) // No SSAO, No TAA
return;
}

float depth = texelFetch(depthtex1, texelCoord, 0).r;
vec3 coord = vec3(texCoord, depth);
Expand All @@ -43,9 +67,11 @@ void DoTAA(inout vec3 color, inout vec3 temp) {

float edge = 0.0;
NeighbourhoodClamping(color, tempColor, depth, edge);

if (materialMask == 253) // Reduced Edge TAA
edge *= extraEdgeMult;

vec2 velocity = (texCoord - prvCoord.xy) * view;

float blendFactor = float(prvCoord.x > 0.0 && prvCoord.x < 1.0 &&
prvCoord.y > 0.0 && prvCoord.y < 1.0);
//float blendMinimum = 0.6;
Expand All @@ -54,10 +80,11 @@ void DoTAA(inout vec3 color, inout vec3 temp) {
float blendMinimum = 0.3;
float blendVariable = 0.25;
float blendConstant = 0.65;
float lengthVelocity = length(velocity) * 100.0;
blendFactor *= max(exp(-lengthVelocity) * blendVariable + blendConstant - length(cameraOffset) * edge, blendMinimum);
float velocityFactor = dot(velocity, velocity) * 10.0;
blendFactor *= max(exp(-velocityFactor) * blendVariable + blendConstant - length(cameraOffset) * edge, blendMinimum);

color = mix(color, tempColor, blendFactor);
temp = color;

//if (edge > 0.05) color.rgb = vec3(1.0, 0.0, 1.0);
}
38 changes: 29 additions & 9 deletions shaders/lib/atmospherics/auroraBorealis.glsl
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
vec3 GetAuroraBorealis(vec3 viewPos, float VdotU, float dither) {
float visibility = sqrt1(clamp01(VdotU * 1.5 - 0.225)) - sunVisibility - rainFactor;
visibility *= 1.0 - VdotU * 0.75;
visibility *= 1.0 - VdotU * 0.9;

#if AURORA_CONDITION == 1 || AURORA_CONDITION == 3
visibility -= moonPhase;
#endif
#if AURORA_CONDITION == 2 || AURORA_CONDITION == 3
visibility *= isSnowy;
#endif
#if AURORA_CONDITION == 4
visibility = max(visibility * isSnowy, visibility - moonPhase);
#endif

if (visibility > 0.0) {
if (max(blindness, darknessFactor) > 0.1) return vec3(0.0);
Expand All @@ -22,22 +25,39 @@ vec3 GetAuroraBorealis(vec3 viewPos, float VdotU, float dither) {
int sampleCount = 25;
int sampleCountP = sampleCount + 5;
float ditherM = dither + 5.0;
float auroraAnimate = frameTimeCounter * 0.0015;
float auroraAnimate = frameTimeCounter * 0.001;
for (int i = 0; i < sampleCount; i++) {
float current = pow2((i + ditherM) / sampleCountP);

vec2 planePos = wpos.xz * (0.8 + current);
planePos = floor(planePos * 11.0 + cameraPositionM) * 0.0007;
vec2 planePos = wpos.xz * (0.8 + current) * 11.0 + cameraPositionM;
#if AURORA_STYLE == 1
planePos = floor(planePos) * 0.0007;

float noise = texture2D(noisetex, planePos).b;
noise = pow2(pow2(pow2(pow2(1.0 - 2.0 * abs(noise - 0.5)))));

noise *= pow1_5(texture2D(noisetex, planePos * 100.0 + auroraAnimate).b);
#else
planePos *= 0.0007;

float noise = texture2D(noisetex, planePos).r;
noise = pow2(pow2(pow2(pow2(1.0 - 2.0 * abs(noise - 0.5)))));

float noise = texture2D(noisetex, planePos).b;
noise = pow2(pow2(pow2(pow2(1.0 - 2.0 * abs(noise - 0.5)))));
noise *= pow1_5(texture2D(noisetex, planePos * 100.0 + auroraAnimate).b);
noise *= texture2D(noisetex, planePos * 3.0 + auroraAnimate).b;
noise *= texture2D(noisetex, planePos * 5.0 - auroraAnimate).b;
#endif

float currentM = 1.0 - current;
aurora += noise * currentM * mix(vec3(7.0, 2.2, 12.0), vec3(6.0, 16.0, 12.0), pow2(pow2(currentM)));
}

return aurora * 1.3 * visibility / sampleCount;

#if AURORA_STYLE == 1
aurora *= 1.3;
#else
aurora *= 1.8;
#endif

return aurora * visibility / sampleCount;
}

return vec3(0.0);
Expand Down
File renamed without changes.
49 changes: 49 additions & 0 deletions shaders/lib/atmospherics/clouds/mainClouds.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include "/lib/colors/lightAndAmbientColors.glsl"
#include "/lib/atmospherics/sky.glsl"

#ifdef CLOUDS_REIMAGINED
#include "/lib/atmospherics/clouds/reimaginedClouds.glsl"
#endif
#if CLOUD_STYLE == 3
#include "/lib/atmospherics/clouds/planarClouds.glsl"
#endif

vec4 GetClouds(inout float cloudLinearDepth, float skyFade, vec3 playerPos, vec3 viewPos, float lViewPos, float VdotS, float VdotU, float dither) {
vec4 clouds = vec4(0.0);

#ifdef CLOUDS_REIMAGINED
const float threshold1 = 1000.0;
const float threshold2 = 1000.0;

vec3 nPlayerPos = normalize(playerPos);
float lViewPosM = lViewPos < far * 1.5 ? lViewPos - 1.0 : 1000000000.0;
float skyMult0 = pow2(skyFade * 3.333333 - 2.333333);

#if CLOUD_STYLE == 1
clouds =
GetVolumetricClouds(CLOUD_ALT1, threshold1, cloudLinearDepth, skyFade, skyMult0, nPlayerPos, lViewPosM, VdotS, VdotU, dither);
#else
float maxCloudAlt = max(CLOUD_ALT1, CLOUD_ALT2);
float minCloudAlt = min(CLOUD_ALT1, CLOUD_ALT2);
if (maxCloudAlt - minCloudAlt < 10.0) maxCloudAlt = minCloudAlt + 12.0; // We can probably eliminate this check later

if (abs(cameraPosition.y - minCloudAlt) < abs(cameraPosition.y - maxCloudAlt)) {
clouds =
GetVolumetricClouds(minCloudAlt, threshold1, cloudLinearDepth, skyFade, skyMult0, nPlayerPos, lViewPosM, VdotS, VdotU, dither);
if (clouds.a == 0.0) clouds =
GetVolumetricClouds(maxCloudAlt, threshold2, cloudLinearDepth, skyFade, skyMult0, nPlayerPos, lViewPosM, VdotS, VdotU, dither);
} else {
clouds =
GetVolumetricClouds(maxCloudAlt, threshold2, cloudLinearDepth, skyFade, skyMult0, nPlayerPos, lViewPosM, VdotS, VdotU, dither);
if (clouds.a == 0.0) clouds =
GetVolumetricClouds(minCloudAlt, threshold1, cloudLinearDepth, skyFade, skyMult0, nPlayerPos, lViewPosM, VdotS, VdotU, dither);
}
#endif
#endif

#if CLOUD_STYLE == 3
if (skyFade > 0.00001) clouds = DrawCloud(viewPos, dither, VdotS, VdotU) * skyFade;
#endif

return clouds;
}
70 changes: 70 additions & 0 deletions shaders/lib/atmospherics/clouds/planarClouds.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
float CLOUD_AMOUNT = 10.5;
float CLOUD_THICKNESS = 0.5;
float stretchFactor = 2.5;
float coordFactor = 0.009375;

float CloudNoise(vec2 coord) {
float wind = syncedTime * 0.007;
float noise = texture2D(noisetex, coord*0.5 + vec2(wind * 0.25, 0)).r * 7.0;
noise+= texture2D(noisetex, coord*0.25 + vec2(wind * 0.15, 0)).r * 12.0;
noise+= texture2D(noisetex, coord*0.125 + vec2(wind * 0.05, 0)).r * 12.0;
noise+= texture2D(noisetex, coord*0.0625 + vec2(wind * 0.05, 0)).r * 24.0;
return noise * 0.34;
}

float CloudCoverage(float noise, float coverage, float VdotU, float VdotS) {
float sunMoonFactor = pow2(pow2(abs(VdotS)));
float noiseCoverage = pow2(coverage) + CLOUD_AMOUNT
* (1.0 + sunMoonFactor * 0.175)
* (1.0 + VdotU * 0.365 * (1.0 - rainFactor * 2.7))
- 2.5;
return max(noise - noiseCoverage, 0.0);
}

vec4 DrawCloud(vec3 viewPos, float dither, float VdotS, float VdotU) {
float cloudGradient = 0.0;
float gradientMix = dither * 0.1667;

float cloudHeight = 15.0 * pow2(max(1.11 - 0.0015 * cameraPosition.y, 0.0));

float scatter = max0(pow2(VdotS));
float dayNightFogBlend = pow(1.0 - nightFactor, 4.0 - VdotS - 3.0 * sunVisibility2);
vec3 cloudRainColor = mix(nightMiddleSkyColor, dayUpSkyColor * 3.5, sunFactor);
vec3 cloudClearAmbient = mix(nightClearAmbientColor * 0.3, 0.9 * dayAmbientColor, dayNightFogBlend);
vec3 cloudClearLight = mix(nightClearLightColor * 1.5, (1.3 + scatter) * dayLightColor, pow2(dayNightFogBlend));

vec3 cloudAmbientColor = mix(cloudClearAmbient, cloudRainColor * 0.3, rainFactor);
vec3 cloudLightColor = mix(cloudClearLight, cloudRainColor * (1.0 + scatter), rainFactor);

vec4 clouds = vec4(0.0);
if (VdotU > 0.025) {
vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos, 1.0)).xyz);
for(int i = 0; i < 5; i++) {
vec2 planeCoord = wpos.xz * ((cloudHeight + (i + dither) * stretchFactor) / wpos.y) * 0.0085;
vec2 coord = cameraPosition.xz * 0.00025 + planeCoord;

float ang1 = (i + syncedTime * 0.025) * 2.391;
float ang2 = ang1 + 2.391;
coord += mix(vec2(cos(ang1), sin(ang1)), vec2(cos(ang2), sin(ang2)), dither * 0.25 + 0.75) * coordFactor;

float coverage = float(i - 3.0 + dither) * 0.725;

float noise = CloudNoise(coord);
noise = CloudCoverage(noise, coverage, VdotU, VdotS) * CLOUD_THICKNESS;
noise = noise / sqrt(noise * noise + 1.0);

cloudGradient = mix(cloudGradient,
mix(gradientMix * gradientMix, 1.0 - noise, 0.25),
noise * (1.0 - clouds.a));

clouds.a += max(noise - clouds.a, 0.0);
gradientMix += 0.2;
}

clouds.rgb = cloudAmbientColor + cloudLightColor * cloudGradient;

clouds.a *= pow2(pow2(1.0 - exp(- 10.0 * VdotU)));
}

return clouds;
}
Loading

0 comments on commit 329f392

Please sign in to comment.