fog tweaks, fix TAAU breaking the nether

yar
This commit is contained in:
Xonk 2023-06-10 16:49:06 -04:00
parent 3cda692d97
commit 2e7d464b14
13 changed files with 135 additions and 73 deletions

View File

@ -822,7 +822,9 @@ void main() {
vec3 background = vec3(0.0);
background += stars(vec3(np3.x,abs(np3.y),np3.z)) * 5.0 ;
vec3 orbitstar = vec3(np3.x,abs(np3.y),np3.z);
orbitstar.x -= WsunVec.x*0.2;
background += stars(orbitstar) * 5.0 ;
#ifndef ambientLight_only
background += drawSun(dot(lightCol.a * WsunVec, np3),0, DirectLightColor,vec3(0.0)) ; // sun
@ -1115,7 +1117,7 @@ void main() {
}
// gl_FragData[0].rgb = TESTS; if(z >= 1) gl_FragData[0].rgb = vec3(0.5);
// gl_FragData[0].rgb = worldToView(normal); if(z >= 1) gl_FragData[0].rgb = vec3(0.5);
// if (abs(filtered.b-0.1) < 0.0004 ) gl_FragData[0].rgb = vec3(0,1,0);
/* DRAWBUFFERS:3 */

View File

@ -80,7 +80,9 @@ uniform int frameCounter;
uniform int framemod8;
uniform vec3 previousCameraPosition;
uniform mat4 gbufferPreviousModelView;
#define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.)
#include "lib/projections.glsl"
@ -120,9 +122,11 @@ vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth)
dmin = dmin.z > dtl.z? dtl : dmin;
dmin = dmin.z > dbl.z? dbl : dmin;
dmin = dmin.z > dbr.z? dbr : dmin;
#ifdef TAA_UPSCALING
dmin.xy = dmin.xy/RENDER_SCALE;
#endif
return dmin;
}

View File

@ -136,6 +136,21 @@ vec3 blackbody2(float Temp)
#include "/lib/climate_settings.glsl"
uniform sampler2D noisetex;//depth
float densityAtPos(in vec3 pos){
pos /= 18.;
pos.xz *= 0.5;
vec3 p = floor(pos);
vec3 f = fract(pos);
vec2 uv = p.xz + f.xz + p.y * vec2(0.0,193.0);
vec2 coord = uv / 512.0;
//The y channel has an offset to avoid using two textures fetches
vec2 xy = texture2D(noisetex, coord).yx;
return mix(xy.r,xy.g, f.y);
}
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@ -245,12 +260,23 @@ void main() {
#ifdef WAVY_PLANTS
bool istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t;
// #ifdef WORLD
// #ifndef HAND
// vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz + cameraPosition;
// // worldpos.xyz += (densityAtPos(worldpos*255 )*2) - cameraPosition;
// worldpos.xyz += sin(worldpos) - cameraPosition;
// position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
// #endif
// #endif
if ((mc_Entity.x == 10001 && istopv) && abs(position.z) < 64.0) {
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz + cameraPosition;
worldpos.xyz += calcMovePlants(worldpos.xyz)*lmtexcoord.w - cameraPosition;
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
}
if (mc_Entity.x == 10003 && abs(position.z) < 64.0) {
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz + cameraPosition;
worldpos.xyz += calcMoveLeaves(worldpos.xyz, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*lmtexcoord.w - cameraPosition;

View File

@ -2,4 +2,5 @@
#define WORLD
#define HAND
#include "gbuffers_all_solid.vsh"

View File

@ -71,7 +71,11 @@
// #define SCREENSHOT_MODE // go render mode and accumulate frames for as long as you want for max image quality.
// #define SPLIT_RENDER // AAAAAAAAAAAAAAAA
// --- FOG/VOLUMETRICS ---
//////////////////////////////////////
// ----- FOG RELATED SETTINGS ----- //
//////////////////////////////////////
#define Biome_specific_environment // makes the fog density and color look unique in certain biomes. (swamps, jungles, lush caves, giant pines, dark forests)
#define Cave_fog // cave fog....
@ -96,61 +100,80 @@
#define cloudray_amount 0.2 // rain boost this [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.75 0.8 0.85 0.9 0.95 1.0]
#define HQ_CLOUDS //Renders detailled clouds for viewport
#define CLOUDS_QUALITY 0.5 //[0.1 0.125 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.9 1.0]
#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]
// ----- MISC FOG ----- //
#define Haze_amount 1.0 // [0.0 0.2 0.4 0.6 0.8 1.0 1.25 1.5 1.75 2.0 3.0 4.0 5.0]
#define RainFog_amount 5 // [0 1 2 3 4 5 6 7 8 9 10 15 20 25]
#define CaveFog_amount 5 // [0 1 2 3 4 5 6 7 8 9 10 15 20 25]
#define Morning_Uniform_Fog 1.0 // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Noon_Uniform_Fog 0.0 // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Evening_Uniform_Fog 10.0 // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Night_Uniform_Fog 10.0 // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define RainFog_amount 1 // [0 1 2 3 4 5 6 7 8 9 10 15 20 25]
#define Morning_Cloudy_Fog 1.0 // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Noon_Cloudy_Fog 0.0 // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Evening_Cloudy_Fog 50.0 // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Night_Cloudy_Fog 5.0 // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define CaveFog_amount 1 // [0 1 2 3 4 5 6 7 8 9 10 15 20 25]
// ----- TIME OF DAY FOG ----- //
#define TOD_Fog_mult 1.0 // [0.0 0.25 0.5 0.75 1.0 2.0 3.0 4.0 5.0 10.0 15.0 20.0 25.0 50.0 75.0 100.0]
#define Morning_Uniform_Fog 1. // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Morning_Cloudy_Fog 10. // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Noon_Uniform_Fog 0. // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Noon_Cloudy_Fog 0. // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Evening_Uniform_Fog 3. // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Evening_Cloudy_Fog 1. // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Night_Uniform_Fog 5. // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
#define Night_Cloudy_Fog 5. // [0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 75. 100. 125. 150. 175. 200. 255.]
// ----- OTHER DIMENSION'S FOG ----- //
#define NetherFog_brightness 0.5 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.75 0.8 0.85 0.9 0.95 1.0]
// --- LABPBR ---
//#define SPECULARTEX
#define Sub_surface_scattering // (place the flashlight on your hand example here)
#define LabPBR_subsurface_scattering
#define SSS_TYPE 1 // [0 1 2 3]
#define Ambient_SSS // subsurface scattering from the sky's light. If SSAO is enabled, this costs very little performance.
#define ambientsss_brightness 1 // [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 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
#define LabSSS_Curve 1.0 // i just really like how it looks at 2.0, so i made it an option. [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 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
#define Strong_SSS_strength 45 // [ 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 2 3 4 5 6 7 8 9 10 15 20 30 35 40 45 50]
#define Medium_SSS_strength 30 // [ 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 2 3 4 5 6 7 8 9 10 15 20 30 35 40 45 50]
#define AO_Strength 0.8 // strength of shadowed areas [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 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
#define GI_Strength 1.0 // strength of bounced light areas [1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
// #define HQ_SSGI
///////////////////////////////////////////////////
// ----- LABPBR MATERIALS RELATED SETTINGS ----- //
///////////////////////////////////////////////////
//#define SPECULARTEX
// #define LabPBR_Emissives
#define Emissive_Brightness 10.0 // [1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15. 20. 25. 30. 35. 40. 45. 50. 100.]
#define Emissive_Curve 2.0 // yes i blatantly copied kappa here. [1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
//#define Horrible_slope_normals // really only good on low resoltution packs. alot of aliasing/flickering at high resoltions
#define LabPBR_subsurface_scattering
#define LabSSS_Curve 1.0 // i just really like how it looks at 2.0, so i made it an option. [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 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
//#define POM
#define mob_SSS
#define misc_block_SSS
#define POM_DEPTH 0.25 // [0.025 0.05 0.075 0.1 0.125 0.15 0.20 0.25 0.30 0.50 0.75 1.0] // IN METERS. Vanillaccurate: 0.15-0.25. VNR: 0.20. Patrix: 1.0
#define Adaptive_Step_length // make only used parts of the POM depth get samples, to increase overall quality. DOWNSIDE: at sheer angles, it looks kinda buggy.
//#define Horrible_slope_normals // really only good on low resoltution packs. alot of aliasing/flickering at high resoltions
#define POM_DEPTH 0.25 // [0.025 0.05 0.075 0.1 0.125 0.15 0.20 0.25 0.30 0.50 0.75 1.0] // IN METERS. Vanillaccurate: 0.15-0.25. VNR: 0.20. Patrix: 1.0
#define MAX_ITERATIONS 50 // [5 10 15 20 25 30 40 50 60 70 80 90 100 125 150 200 400] //Improves quality at grazing angles (reduces performance)
#define MAX_DIST 25.0 // [5.0 10.0 15.0 20.0 25.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0 125.0 150.0 200.0 400.0] //Increases distance at which POM is calculated
// #define DISABLE_ALPHA_MIPMAPS //Disables mipmaps on the transparency of alpha-tested things like foliage, may cost a few fps in some cases
// #define Porosity
#define Sub_surface_scattering // (place the flashlight on your hand example here)
#define SSS_TYPE 1 // [0 1 2 3]
#define Ambient_SSS // subsurface scattering from the sky's light. If SSAO is enabled, this costs very little performance.
#define ambientsss_brightness 1 // [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 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
#define Strong_SSS_strength 45 // [ 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 2 3 4 5 6 7 8 9 10 15 20 30 35 40 45 50]
#define Medium_SSS_strength 30 // [ 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 2 3 4 5 6 7 8 9 10 15 20 30 35 40 45 50]
#define AO_Strength 0.8 // strength of shadowed areas [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 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
#define GI_Strength 1.0 // strength of bounced light areas [1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
// #define HQ_SSGI
#define mob_SSS
#define misc_block_SSS
// #define DISABLE_ALPHA_MIPMAPS //Disables mipmaps on the transparency of alpha-tested things like foliage, may cost a few fps in some cases
// --- WEATHER/SKY ---
@ -266,10 +289,17 @@ const float shadowDistanceRenderMul = -1.0; //[-1.0 1.0] THIS WILL BREAK SUBSURF
#define Puddles // yes
#endif
// --- CLOUDS ---
////////////////////////////////////////
// ----- CLOUD RELATED SETTINGS ----- //
////////////////////////////////////////
#define VOLUMETRIC_CLOUDS // if you don't like the noise on the default cloud settings, turn up the cloud samples. if that hurts performance too much, turn down the clouds quality.
#define HQ_CLOUDS // Renders detailled clouds for viewport
#define CLOUDS_QUALITY 0.5 //[0.1 0.125 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.9 1.0]
// #define Daily_Weather // different skies for different days, and fog.
#ifdef VOLUMETRIC_CLOUDS
#define CLOUDS_SHADOWS // Casts shadows from clouds on the world
#ifdef CLOUDS_SHADOWS
@ -290,7 +320,6 @@ const float shadowDistanceRenderMul = -1.0; //[-1.0 1.0] THIS WILL BREAK SUBSURF
#define Rain_coverage 1.1 // how much the coverage of the clouds change during rain [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 Daily_Weather // different skies for different days, and fog.
#define WeatherDay -1 // [-1 0 1 2 3 4 5 6 7]
#define cloudCoverage 0.4 // Cloud coverage [ 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]

View File

@ -131,7 +131,8 @@ vec3 Cloud_lighting(
vec3 moonContribution,
float AmbientShadow,
int cloudType,
vec3 pos
vec3 pos,
float time
){
float coeeff = -30;
// float powder = 1.0 - exp((CloudShape*CloudShape) * -800);
@ -147,7 +148,7 @@ vec3 Cloud_lighting(
skyLighting += sunContributionMulti * exp(-SunShadowing) * clamp((1.0 - abs(pow(Density*4.0 - 1.1,4.0))) * Coverage,0,1) ;
#endif
skyLighting *= exp(SkyShadowing * AmbientShadow * coeeff/2 ) * lesspowder ;
skyLighting *= exp(SkyShadowing * AmbientShadow * coeeff/(2.0 - time) ) * lesspowder ;
if(cloudType == 1){
@ -158,7 +159,7 @@ vec3 Cloud_lighting(
vec3 sunLighting = exp(SunShadowing * coeeff + powder) * sunContribution;
sunLighting += exp(SunShadowing * coeeff/4 + powder*2) * sunContributionMulti;
vec3 moonLighting = exp(MoonShadowing * coeeff / 3) * moonContribution * powder;
vec3 moonLighting = exp(MoonShadowing * coeeff/4 + powder) * moonContribution;
return skyLighting + moonLighting + sunLighting ;
// return skyLighting;
@ -248,9 +249,10 @@ vec4 renderClouds(
vec3 sunContribution = SunColor * mieDay;
vec3 sunContributionMulti = SunColor * mieDayMulti ;
float mieNight = (phaseg(-SdotV,0.8) + phaseg(-SdotV, 0.35)*4) * 6.0;
float mieNight = (phaseg(-SdotV,0.8) + phaseg(-SdotV, 0.35)*4);
vec3 moonContribution = MoonColor * mieNight;
float timing = 1.0 - clamp(pow(abs(dV_Sun.y)/150.0,2.0),0.0,1.0);
#ifdef Cumulus
for(int i=0;i<maxIT_clouds;i++) {
@ -287,9 +289,9 @@ vec4 renderClouds(
float phase = PhaseHG(-SdotV, (1.0-cumulus));
float ambientlightshadow = 1.0 - clamp(exp((progress_view.y - (MaxCumulusHeight - 50)) / 100.0),0.0,1.0);
float ambientlightshadow = 1.0 - clamp(exp((progress_view.y - (MaxCumulusHeight - 50)) / 100.0),0.0,1.0) ;
vec3 S = Cloud_lighting(muE, cumulus*Cumulus_density, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, ambientlightshadow, 0, progress_view);
vec3 S = Cloud_lighting(muE, cumulus*Cumulus_density, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, ambientlightshadow, 0, progress_view, timing);
vec3 Sint = (S - S * exp(-mult*muE)) / muE;
color += max(muE*Sint*total_extinction,0.0);
@ -317,7 +319,7 @@ vec4 renderClouds(
float shadow = GetAltostratusDensity(shadowSamplePos_high);
Sunlight += shadow;
}
vec3 S = Cloud_lighting(altostratus, altostratus, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, 1, 1, progress_view_high);
vec3 S = Cloud_lighting(altostratus, altostratus, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, 1, 1, progress_view_high, timing);
vec3 Sint = (S - S * exp(-20*altostratus)) / altostratus;
color += max(altostratus*Sint*total_extinction,0.0);

View File

@ -254,7 +254,7 @@ void main() {
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 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition;

View File

@ -131,9 +131,9 @@ void main() {
#endif
#ifdef TAA_UPSCALING
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
#endif
// #ifdef TAA_UPSCALING
// gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
// #endif
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w * texelSize;
#endif

View File

@ -126,14 +126,14 @@ vec3 rayTrace(vec3 dir,vec3 position,float dither, float fresnel, bool inwater){
float mult = min(min(maxLengths.x,maxLengths.y),maxLengths.z);
vec3 stepv = direction * mult / quality*vec3(RENDER_SCALE,1.0);
vec3 stepv = direction * mult / quality;
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) + stepv*dither;
vec3 spos = clipPosition + stepv*dither;
float minZ = clipPosition.z;
float maxZ = spos.z+stepv.z*0.5;
spos.xy += offsets[framemod8]*texelSize*0.5/RENDER_SCALE;
spos.xy += offsets[framemod8]*texelSize*0.5;
float dist = 1.0 + clamp(position.z*position.z/50.0,0,2); // shrink sample size as distance increases
for (int i = 0; i <= int(quality); i++) {
@ -141,7 +141,7 @@ vec3 rayTrace(vec3 dir,vec3 position,float dither, float fresnel, bool inwater){
float sp = texelFetch2D(depthtex1,ivec2(spos.xy/texelSize),0).x;
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ) ) return vec3(spos.xy/RENDER_SCALE,sp);
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ) ) return vec3(spos.xy,sp);
spos += stepv;
@ -422,7 +422,7 @@ vec3 getWaveHeightmap_dimension(vec2 posxz, float iswater){
//////////////////////////////VOID MAIN//////////////////////////////
/* RENDERTARGETS:2,7,1,11,13,14 */
void main() {
if (gl_FragCoord.x * texelSize.x < RENDER_SCALE.x && gl_FragCoord.y * texelSize.y < RENDER_SCALE.y ) {
if (gl_FragCoord.x * texelSize.x < 1 && gl_FragCoord.y * texelSize.y < 1 ) {
gl_FragData[0] = texture2D(texture, lmtexcoord.xy,Texture_MipMap_Bias)*color;
vec3 Albedo = toLinear(gl_FragData[0].rgb);
@ -452,7 +452,7 @@ void main() {
vec2 tempOffset=offsets[framemod8];
vec3 fragC = gl_FragCoord.xyz*vec3(texelSize,1.0);
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
vec3 p3 = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz;
vec3 np3 = normVec(p3);

View File

@ -108,9 +108,9 @@ void main() {
#ifdef TAA_UPSCALING
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
#endif
// #ifdef TAA_UPSCALING
// gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
// #endif
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif

View File

@ -341,7 +341,7 @@ void ScreenSpace_SSS(inout float sss, vec3 fragpos, vec2 noise, vec3 normal){
float rd = mulfov2 * 0.1;
vec2 acc = -(TAA_Offset*(texelSize/2))*RENDER_SCALE ;
vec2 acc = -(TAA_Offset*(texelSize/2)) ;
// int seed = (frameCounter%40000)*2 + (1+frameCounter);
// float randomDir = fract(R2_samples(seed).y + noise.x ) * 1.61803398874 ;
@ -355,10 +355,10 @@ void ScreenSpace_SSS(inout float sss, vec3 fragpos, vec2 noise, vec3 normal){
// vec2 sp = tapLocation_alternate(j, 0.0, 7, 20, randomDir);
vec2 sampleOffset = sp*rd;
ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio)*RENDER_SCALE);
ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio));
if (offset.x >= 0 && offset.y >= 0 && offset.x < viewWidth*RENDER_SCALE.x && offset.y < viewHeight*RENDER_SCALE.y ) {
vec3 t0 = toScreenSpace(vec3(offset*texelSize+acc+0.5*texelSize,texelFetch2D(depthtex1,offset,0).x) * vec3(1.0/RENDER_SCALE, 1.0) );
if (offset.x >= 0 && offset.y >= 0 && offset.x < viewWidth && offset.y < viewHeight ) {
vec3 t0 = toScreenSpace(vec3(offset*texelSize+acc+0.5*texelSize,texelFetch2D(depthtex1,offset,0).x) );
vec3 vec = t0.xyz - fragpos;
float dsquared = dot(vec,vec);

View File

@ -3,6 +3,7 @@
#extension GL_EXT_gpu_shader4 : enable
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
const int noiseTextureResolution = 32;
@ -31,7 +32,9 @@ varying vec2 texcoord;
flat varying float exposureA;
flat varying float tempOffsets;
uniform sampler2D colortex3;
uniform sampler2D colortex0;
uniform sampler2D colortex5;
uniform sampler2D colortex6;
uniform sampler2D depthtex0;
uniform vec2 texelSize;
@ -247,9 +250,7 @@ vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth)
dmin = dmin.z > dtl.z? dtl : dmin;
dmin = dmin.z > dbl.z? dbl : dmin;
dmin = dmin.z > dbr.z? dbr : dmin;
#ifdef TAA_UPSCALING
dmin.xy = dmin.xy/RENDER_SCALE;
#endif
return dmin;
}
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
@ -287,12 +288,7 @@ vec3 TAA_hq(){
if (previousPosition.x < 0.0 || previousPosition.y < 0.0 || previousPosition.x > 1.0 || previousPosition.y > 1.0)
return smoothfilter(colortex3, adjTC + offsets[framemod8]*texelSize*0.5).xyz;
#ifdef TAA_UPSCALING
vec3 albedoCurrent0 = smoothfilter(colortex3, adjTC + offsets[framemod8]*texelSize*0.5).xyz;
// Interpolating neighboorhood clampling boundaries between pixels
vec3 cMax = texture2D(colortex0, adjTC).rgb;
vec3 cMin = texture2D(colortex6, adjTC).rgb;
#else
vec3 albedoCurrent0 = texture2D(colortex3, adjTC).rgb;
vec3 albedoCurrent1 = texture2D(colortex3, adjTC + vec2(texelSize.x,texelSize.y)).rgb;
vec3 albedoCurrent2 = texture2D(colortex3, adjTC + vec2(texelSize.x,-texelSize.y)).rgb;
@ -306,7 +302,7 @@ vec3 TAA_hq(){
vec3 cMax = max(max(max(albedoCurrent0,albedoCurrent1),albedoCurrent2),max(albedoCurrent3,max(albedoCurrent4,max(albedoCurrent5,max(albedoCurrent6,max(albedoCurrent7,albedoCurrent8))))));
vec3 cMin = min(min(min(albedoCurrent0,albedoCurrent1),albedoCurrent2),min(albedoCurrent3,min(albedoCurrent4,min(albedoCurrent5,min(albedoCurrent6,min(albedoCurrent7,albedoCurrent8))))));
albedoCurrent0 = smoothfilter(colortex3, adjTC + offsets[framemod8]*texelSize*0.5).rgb;
#endif
#ifndef NO_CLIP
vec3 albedoPrev = max(FastCatmulRom(colortex5, previousPosition.xy,vec4(texelSize, 1.0/texelSize), 0.75).xyz, 0.0);

View File

@ -54,9 +54,11 @@ void main() {
#endif
normalMat = vec4(normalize(gl_NormalMatrix *gl_Normal),1.0);
#ifdef TAA_UPSCALING
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
#endif
// #ifdef TAA_UPSCALING
// gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
// #endif
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif