mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-01-03 16:13:30 +08:00
add DISTANT HORIZONS SHADER PROGRAMS, and then make them work.
This commit is contained in:
parent
4b7ef65541
commit
1b15799911
@ -4,7 +4,7 @@
|
||||
block.10001 = minecraft:sunflower:half=upper minecraft:beetroots minecraft:potatoes minecraft:carrots minecraft:wheat minecraft:nether_wart minecraft:kelp minecraft:large_fern:half=upper minecraft:peony:half=upper minecraft:rose_bush:half=upper minecraft:lilac:half=upper minecraft:crimson_roots minecraft:nether_sprouts minecraft:warped_roots minecraft:seagrass minecraft:tall_seagrass:half=upper minecraft:tall_grass:half=upper minecraft:wither_rose minecraft:lily_of_the_valley minecraft:cornflower minecraft:sweet_berry_bush minecraft:oxeye_daisy minecraft:pink_tulip minecraft:white_tulip minecraft:orange_tulip minecraft:red_tulip minecraft:azure_bluet minecraft:allium minecraft:blue_orchid minecraft:poppy minecraft:dandelion minecraft:dead_bush minecraft:oak_sapling minecraft:spruce_sapling minecraft:birch_sapling minecraft:jungle_sapling minecraft:acacia_sapling minecraft:dark_oak_sapling \
|
||||
|
||||
# ground waving vertical models. this exists to brighten up the sides of grass and stuff in shaded places they blend in better with the world.
|
||||
block.10009 = minecraft:grass minecraft:fern \
|
||||
block.10009 = minecraft:short_grass minecraft:grass minecraft:fern \
|
||||
\
|
||||
conquest:acacia_sapling conquest:alder_tree_sapling conquest:apple_tree_sapling conquest:aspen_tree_sapling conquest:birch_sapling conquest:cherry_tree_sapling conquest:dark_oak_sapling conquest:downy_willow_tree_sapling conquest:gorse_tree_sapling conquest:grape_vine_sapling conquest:horse_chestnut_tree_sapling conquest:jungle_sapling conquest:larch_tree_sapling conquest:mallorn_tree_sapling conquest:oak_sapling conquest:orange_tree_sapling conquest:pear_tree_sapling conquest:pine_tree_sapling conquest:plum_tree_sapling conquest:rowan_tree_sapling conquest:spruce_sapling conquest:willow_tree_sapling conquest:angelica conquest:black_knapweed conquest:buttercups conquest:cornflower conquest:dandelion conquest:elanor conquest:goldenrod conquest:harebell conquest:lily_of_the_valley conquest:lobelia_flowers conquest:marsh_ragwort conquest:meadow_saffron conquest:mediterranean_wild_tulip conquest:moorland_spotted_orchid conquest:niphredil conquest:orange_tulip conquest:orpine conquest:oxeye_daisy conquest:pasque_flower conquest:pink_tulip conquest:poppy conquest:red_tulip conquest:rock_rose conquest:sea_lavender conquest:simbelmyne conquest:white_clematis conquest:white_tulip conquest:wild_dagga conquest:allium conquest:barley conquest:bean_pole conquest:beetroots conquest:cabbage conquest:carrots conquest:common_beans conquest:corn conquest:flax conquest:heirloom_wheat_crops conquest:hemp conquest:lavender conquest:peas conquest:potatoes conquest:rice conquest:thyme conquest:tobacco conquest:turnips conquest:water_mint conquest:wheat conquest:wild_basil conquest:wild_parsley conquest:wild_wheat conquest:common_meadow_grass conquest:cotton_grass conquest:dead_grass conquest:deergrass conquest:grass conquest:kentucky_bluegrass conquest:lush_grass conquest:purple_moor_grass conquest:sea_arrowgrass conquest:seagrass conquest:sweet_grass conquest:timothy_grass conquest:wavy_hair_grass conquest:pine_cones conquest:spruce_cones conquest:beautyberry_bush conquest:bilberry_bush conquest:blackberry_bush conquest:bog_blueberry_bush conquest:broom_bush conquest:dead_bush conquest:hawthorn_bush conquest:lingonberry_bush conquest:raspberry_bush conquest:alpine_sow_thristle conquest:athelas conquest:autumnal_dwarf_birch conquest:birdsfoot_trefoil conquest:bog_asphodel conquest:bottle_sedge conquest:cattails conquest:common_cow_wheat conquest:cow_parsley conquest:cross leaved heath conquest:dead_reeds conquest:dead_shrubs conquest:desert_shrub conquest:dogs_mercury conquest:dooryard_dock conquest:dry_reeds conquest:greater_fen_sedge conquest:greater_wood_rush conquest:green_meadow_fescue conquest:green_spurge conquest:heather conquest:meadow_fescue conquest:melancholy_thristle conquest:nettles conquest:nightshade conquest:papyrus conquest:purple_wolfs_bane conquest:red_common_cow_wheat conquest:rosebay_willowherb conquest:rushes conquest:wild_shrub conquest:sedge conquest:small_fescue conquest:small_scabious conquest:sweet_woodruff conquest:wild_overgrown_nettles conquest:wild_shrub conquest:wood_horsetail conquest:woodland_sedge conquest:wormwood conquest:yellow_wolfs_bane conquest:autumnal_bracken conquest:bracken conquest:dark_autumnal_bracken conquest:dead_bracken conquest:fern conquest:fern_1 conquest:fern_2 conquest:harts_tongue_fern conquest:large_fern_1 conquest:large_fern_2 conquest:large_fern_3 conquest:thick_fern conquest:tall_grass conquest:large_fern conquest:sunflower conquest:tall_lilac conquest:peony conquest:rose_bush conquest:tall_seagrass conquest:cypress conquest:young_tree conquest:young_frozen_tree conquest:cross_leaved_heath conquest:jungle_ground_cover conquest:alpine_sow_thistle conquest:duckweed conquest:red_mushroom conquest:brown_mushroom
|
||||
|
||||
|
97
shaders/dimensions/DH_solid.fsh
Normal file
97
shaders/dimensions/DH_solid.fsh
Normal file
@ -0,0 +1,97 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
|
||||
varying vec4 pos;
|
||||
varying vec4 gcolor;
|
||||
varying vec2 lightmapCoords;
|
||||
varying vec4 normals_and_materials;
|
||||
flat varying float SSSAMOUNT;
|
||||
flat varying float EMISSIVE;
|
||||
|
||||
uniform float far;
|
||||
// uniform int hideGUI;
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
|
||||
vec3 viewToWorld(vec3 viewPosition) {
|
||||
vec4 pos;
|
||||
pos.xyz = viewPosition;
|
||||
pos.w = 0.0;
|
||||
pos = gbufferModelViewInverse * pos;
|
||||
return pos.xyz;
|
||||
}
|
||||
vec3 worldToView(vec3 worldPos) {
|
||||
vec4 pos = vec4(worldPos, 0.0);
|
||||
pos = gbufferModelView * pos;
|
||||
return pos.xyz;
|
||||
}
|
||||
vec4 encode (vec3 n, vec2 lightmaps){
|
||||
n.xy = n.xy / dot(abs(n), vec3(1.0));
|
||||
n.xy = n.z <= 0.0 ? (1.0 - abs(n.yx)) * sign(n.xy) : n.xy;
|
||||
vec2 encn = clamp(n.xy * 0.5 + 0.5,-1.0,1.0);
|
||||
|
||||
return vec4(encn,vec2(lightmaps.x,lightmaps.y));
|
||||
}
|
||||
|
||||
//encoding by jodie
|
||||
float encodeVec2(vec2 a){
|
||||
const vec2 constant1 = vec2( 1., 256.) / 65535.;
|
||||
vec2 temp = floor( a * 255. );
|
||||
return temp.x*constant1.x+temp.y*constant1.y;
|
||||
}
|
||||
float encodeVec2(float x,float y){
|
||||
return encodeVec2(vec2(x,y));
|
||||
}
|
||||
|
||||
// uniform sampler2D depthtex0;
|
||||
// uniform vec2 texelSize;
|
||||
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
uniform mat4 gbufferProjection;
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
|
||||
vec3 toScreenSpace(vec3 p) {
|
||||
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
|
||||
vec3 feetPlayerPos = p * 2. - 1.;
|
||||
vec4 viewPos = iProjDiag * feetPlayerPos.xyzz + gbufferProjectionInverse[3];
|
||||
return viewPos.xyz / viewPos.w;
|
||||
}
|
||||
|
||||
|
||||
/* RENDERTARGETS:1,7,8 */
|
||||
void main() {
|
||||
// overdraw prevention
|
||||
// if(clamp(1.0-length(pos.xyz)/max(far-16,0.0),0,1) > 0 ) discard;
|
||||
|
||||
vec3 normals = viewToWorld(normals_and_materials.xyz);
|
||||
float materials = normals_and_materials.a;
|
||||
|
||||
vec4 data1 = clamp( encode(normals.xyz, vec2(lightmapCoords)), 0.0, 1.0);
|
||||
|
||||
// alpha is material masks, set it to 0.65 to make a DH LODs mask.
|
||||
vec4 Albedo = vec4(gcolor.rgb, 1.0);
|
||||
|
||||
#ifdef WhiteWorld
|
||||
Albedo.rgb = vec3(0.5);
|
||||
#endif
|
||||
|
||||
gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w, materials));
|
||||
|
||||
gl_FragData[1].a = 0.0;
|
||||
|
||||
#if EMISSIVE_TYPE == 0
|
||||
gl_FragData[2].a = 0.0;
|
||||
#else
|
||||
gl_FragData[2].a = EMISSIVE;
|
||||
#endif
|
||||
|
||||
#if SSS_TYPE == 0
|
||||
gl_FragData[2].b = 0.0;
|
||||
#else
|
||||
gl_FragData[2].b = SSSAMOUNT;
|
||||
#endif
|
||||
|
||||
}
|
49
shaders/dimensions/DH_solid.vsh
Normal file
49
shaders/dimensions/DH_solid.vsh
Normal file
@ -0,0 +1,49 @@
|
||||
#include "/lib/settings.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
varying vec4 pos;
|
||||
varying vec4 gcolor;
|
||||
varying vec2 lightmapCoords;
|
||||
varying vec4 normals_and_materials;
|
||||
flat varying float SSSAMOUNT;
|
||||
flat varying float EMISSIVE;
|
||||
|
||||
uniform vec2 texelSize;
|
||||
uniform int framemod8;
|
||||
|
||||
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(-1.,3.)/8.,
|
||||
vec2(5.0,1.)/8.,
|
||||
vec2(-3,-5.)/8.,
|
||||
vec2(-5.,5.)/8.,
|
||||
vec2(-7.,-1.)/8.,
|
||||
vec2(3,7.)/8.,
|
||||
vec2(7.,-7.)/8.);
|
||||
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
#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
|
||||
|
||||
lightmapCoords = gl_MultiTexCoord1.xy * 0.975; // is this even correct? lol'
|
||||
|
||||
gcolor = gl_Color;
|
||||
pos = gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
EMISSIVE = 0.0;
|
||||
if(dhMaterialId == DH_BLOCK_ILLUMINATED || gl_MultiTexCoord1.x >= 0.95) EMISSIVE = 0.5;
|
||||
|
||||
SSSAMOUNT = 0.0;
|
||||
if (dhMaterialId == DH_BLOCK_LEAVES ) SSSAMOUNT = 1.0;
|
||||
if (dhMaterialId == DH_BLOCK_SNOW) SSSAMOUNT = 0.5;
|
||||
|
||||
// a mask for DH terrain in general.
|
||||
float MATERIALS = 0.65;
|
||||
|
||||
normals_and_materials = vec4(normalize(gl_NormalMatrix * gl_Normal), MATERIALS);
|
||||
}
|
360
shaders/dimensions/DH_translucent.fsh
Normal file
360
shaders/dimensions/DH_translucent.fsh
Normal file
@ -0,0 +1,360 @@
|
||||
#include "/lib/settings.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
#include "/lib/color_transforms.glsl"
|
||||
#include "/lib/projections.glsl"
|
||||
|
||||
uniform vec2 texelSize;
|
||||
// uniform int moonPhase;
|
||||
uniform float frameTimeCounter;
|
||||
uniform sampler2D noisetex;
|
||||
|
||||
const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
|
||||
uniform sampler2D dhDepthTex;
|
||||
// uniform sampler2D dhDepthTex0;
|
||||
uniform sampler2D dhDepthTex1;
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D depthtex1;
|
||||
|
||||
uniform sampler2D colortex12;
|
||||
// uniform sampler2D colortex7;
|
||||
uniform sampler2D colortex5;
|
||||
|
||||
|
||||
#include "/lib/sky_gradient.glsl"
|
||||
#include "/lib/waterBump.glsl"
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
|
||||
varying vec4 pos;
|
||||
varying vec4 gcolor;
|
||||
|
||||
varying vec4 normals_and_materials;
|
||||
|
||||
varying vec2 lightmapCoords;
|
||||
|
||||
flat varying int isWater;
|
||||
|
||||
// uniform float far;
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
|
||||
uniform vec3 previousCameraPosition;
|
||||
// uniform vec3 cameraPosition;
|
||||
|
||||
// uniform mat4 gbufferModelView;
|
||||
uniform mat4 gbufferPreviousModelView;
|
||||
|
||||
// uniform mat4 shadowModelView;
|
||||
// uniform mat4 shadowModelViewInverse;
|
||||
// uniform mat4 shadowProjection;
|
||||
// uniform mat4 shadowProjectionInverse;
|
||||
|
||||
|
||||
|
||||
uniform int frameCounter;
|
||||
|
||||
|
||||
// uniform sampler2D colortex4;
|
||||
flat varying vec3 averageSkyCol_Clouds;
|
||||
flat varying vec4 lightCol;
|
||||
flat varying vec3 WsunVec;
|
||||
flat varying vec3 WsunVec2;
|
||||
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
// uniform mat4 dhPreviousProjection;
|
||||
// uniform mat4 dhProjectionInverse;
|
||||
// uniform mat4 dhProjection;
|
||||
|
||||
|
||||
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
vec3 DH_toScreenSpace(vec3 p) {
|
||||
vec4 iProjDiag = vec4(dhProjectionInverse[0].x, dhProjectionInverse[1].y, dhProjectionInverse[2].zw);
|
||||
vec3 feetPlayerPos = p * 2. - 1.;
|
||||
vec4 viewPos = iProjDiag * feetPlayerPos.xyzz + dhProjectionInverse[3];
|
||||
return viewPos.xyz / viewPos.w;
|
||||
}
|
||||
|
||||
vec3 DH_toClipSpace3(vec3 viewSpacePosition) {
|
||||
return projMAD(dhProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
// float DH_ld(float dist) {
|
||||
// return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
// }
|
||||
// float DH_invLinZ (float lindepth){
|
||||
// return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
// }
|
||||
|
||||
float DH_ld(float dist) {
|
||||
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
}
|
||||
float DH_inv_ld (float lindepth){
|
||||
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
}
|
||||
|
||||
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
uniform int isEyeInWater;
|
||||
|
||||
uniform float rainStrength;
|
||||
#include "/lib/volumetricClouds.glsl"
|
||||
|
||||
|
||||
vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) {
|
||||
r = pow(r,2.5);
|
||||
// r*=r;
|
||||
|
||||
vec3 h = l + v;
|
||||
float hn = inversesqrt(dot(h, h));
|
||||
|
||||
float dotLH = clamp(dot(h,l)*hn,0.,1.);
|
||||
float dotNH = clamp(dot(h,n)*hn,0.,1.) ;
|
||||
float dotNL = clamp(dot(n,l),0.,1.);
|
||||
float dotNHsq = dotNH*dotNH;
|
||||
|
||||
float denom = dotNHsq * r - dotNHsq + 1.;
|
||||
float D = r / (3.141592653589793 * denom * denom);
|
||||
vec3 F = 0.2 + (1. - F0) * exp2((-5.55473*dotLH-6.98316)*dotLH);
|
||||
float k2 = .25 * r;
|
||||
|
||||
return dotNL * D * F / (dotLH*dotLH*(1.0-k2)+k2);
|
||||
}
|
||||
uniform int framemod8;
|
||||
|
||||
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(-1.,3.)/8.,
|
||||
vec2(5.0,1.)/8.,
|
||||
vec2(-3,-5.)/8.,
|
||||
vec2(-5.,5.)/8.,
|
||||
vec2(-7.,-1.)/8.,
|
||||
vec2(3,7.)/8.,
|
||||
vec2(7.,-7.)/8.);
|
||||
|
||||
vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater){
|
||||
|
||||
float quality = mix(15,SSR_STEPS,fresnel);
|
||||
vec3 clipPosition = DH_toClipSpace3(position);
|
||||
float rayLength = ((position.z + dir.z * dhFarPlane*sqrt(3.)) > -dhNearPlane) ?
|
||||
(-dhNearPlane -position.z) / dir.z : dhFarPlane*sqrt(3.);
|
||||
vec3 direction = normalize(DH_toClipSpace3(position+dir*rayLength)-clipPosition); //convert to clip space
|
||||
direction.xy = normalize(direction.xy);
|
||||
|
||||
//get at which length the ray intersects with the edge of the screen
|
||||
vec3 maxLengths = (step(0.,direction)-clipPosition) / direction;
|
||||
float mult = min(min(maxLengths.x,maxLengths.y),maxLengths.z);
|
||||
|
||||
|
||||
vec3 stepv = direction * mult / quality * vec3(RENDER_SCALE,1.0);
|
||||
|
||||
|
||||
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) + stepv;
|
||||
float minZ = clipPosition.z;
|
||||
float maxZ = spos.z+stepv.z*0.5;
|
||||
|
||||
spos.xy += offsets[framemod8]*texelSize*0.5/RENDER_SCALE;
|
||||
|
||||
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++) {
|
||||
|
||||
|
||||
float sp = sqrt(texelFetch2D(colortex12,ivec2(spos.xy/texelSize/4),0).a/65000.0);
|
||||
sp = DH_inv_ld(sp);
|
||||
|
||||
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy/RENDER_SCALE,sp);
|
||||
|
||||
|
||||
spos += stepv;
|
||||
//small bias
|
||||
minZ = maxZ-0.00035/DH_ld(spos.z);
|
||||
maxZ += stepv.z;
|
||||
}
|
||||
|
||||
return vec3(1.1);
|
||||
}
|
||||
float R2_dither(){
|
||||
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
|
||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
||||
}
|
||||
float interleaved_gradientNoise(){
|
||||
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
|
||||
float noise = fract( 52.9829189 * fract( (coord.x * 0.06711056) + (coord.y * 0.00583715) ) );
|
||||
return noise ;
|
||||
}
|
||||
vec3 viewToWorld(vec3 viewPos) {
|
||||
vec4 pos;
|
||||
pos.xyz = viewPos;
|
||||
pos.w = 0.0;
|
||||
pos = gbufferModelViewInverse * pos;
|
||||
return pos.xyz;
|
||||
}
|
||||
vec3 worldToView(vec3 worldPos) {
|
||||
vec4 pos = vec4(worldPos, 0.0);
|
||||
pos = gbufferModelView * pos;
|
||||
return pos.xyz;
|
||||
}
|
||||
vec4 encode (vec3 n, vec2 lightmaps){
|
||||
n.xy = n.xy / dot(abs(n), vec3(1.0));
|
||||
n.xy = n.z <= 0.0 ? (1.0 - abs(n.yx)) * sign(n.xy) : n.xy;
|
||||
vec2 encn = clamp(n.xy * 0.5 + 0.5,-1.0,1.0);
|
||||
|
||||
return vec4(encn,vec2(lightmaps.x,lightmaps.y));
|
||||
}
|
||||
|
||||
//encoding by jodie
|
||||
float encodeVec2(vec2 a){
|
||||
const vec2 constant1 = vec2( 1., 256.) / 65535.;
|
||||
vec2 temp = floor( a * 255. );
|
||||
return temp.x*constant1.x+temp.y*constant1.y;
|
||||
}
|
||||
float encodeVec2(float x,float y){
|
||||
return encodeVec2(vec2(x,y));
|
||||
}
|
||||
uniform float near;
|
||||
// uniform float far;
|
||||
|
||||
float ld(float dist) {
|
||||
return (2.0 * near) / (far + near - dist * (far - near));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* RENDERTARGETS:2,7 */
|
||||
void main() {
|
||||
|
||||
bool iswater = isWater > 0;
|
||||
|
||||
vec3 normals = normals_and_materials.xyz;
|
||||
|
||||
vec3 playerPos = mat3(gbufferModelViewInverse) * pos.xyz;
|
||||
float transition = exp(-25* pow(clamp(1.0 - length(playerPos)/(far-8),0.0,1.0),2));
|
||||
|
||||
if(iswater){
|
||||
vec3 posxz = playerPos+cameraPosition;
|
||||
posxz.xz -= posxz.y;
|
||||
|
||||
vec3 waterHeightmap = normalize(getWaveHeight(posxz.xz,1.0));
|
||||
|
||||
float bumpmult = WATER_WAVE_STRENGTH;
|
||||
waterHeightmap = waterHeightmap * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult);
|
||||
waterHeightmap = normalize(waterHeightmap);
|
||||
vec2 TangentNormal = waterHeightmap.xy*0.5+0.5;
|
||||
|
||||
|
||||
// gl_FragData[2] = vec4(encodeVec2(TangentNormal), encodeVec2(vec2(1.0)), encodeVec2(vec2(1.0)), 1.0);
|
||||
|
||||
if(normals.y > 0.0) normals = vec3(waterHeightmap.x,normals.y,waterHeightmap.y);
|
||||
}
|
||||
|
||||
normals = worldToView(normals);
|
||||
vec3 Albedo = toLinear(gcolor.rgb);
|
||||
gl_FragData[0] = vec4(Albedo, gcolor.a);
|
||||
|
||||
vec4 COLORTEST = gl_FragData[0];
|
||||
|
||||
if(iswater){
|
||||
Albedo = vec3(0.0);
|
||||
gl_FragData[0].a = 1.0/255.0;
|
||||
}
|
||||
|
||||
// diffuse
|
||||
vec3 Direct_lighting = lightCol.rgb/80.0;
|
||||
|
||||
float NdotL = max(dot(normals, WsunVec2), 0.0f);
|
||||
Direct_lighting *= NdotL;
|
||||
|
||||
#ifdef CLOUDS_SHADOWS
|
||||
Direct_lighting *= GetCloudShadow(playerPos);
|
||||
#endif
|
||||
|
||||
#ifdef DISTANT_HORIZONS_SHADOWMAP
|
||||
float Shadows = 1.0;
|
||||
|
||||
mat4 DH_shadowProjection = DH_shadowProjectionTweak(shadowProjection);
|
||||
vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * pos.xyz + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz;
|
||||
projectedShadowPosition = diagonal3(DH_shadowProjection) * projectedShadowPosition + DH_shadowProjection[3].xyz;
|
||||
|
||||
//apply distortion
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
projectedShadowPosition.xy *= distortFactor;
|
||||
#else
|
||||
float distortFactor = 1.0;
|
||||
#endif
|
||||
|
||||
float smallbias = -0.0035;
|
||||
|
||||
bool ShadowBounds = abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0;
|
||||
|
||||
if(ShadowBounds){
|
||||
Shadows = 0.0;
|
||||
projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5);
|
||||
|
||||
Shadows = shadow2D(shadow, projectedShadowPosition + vec3(0.0,0.0, smallbias)).x;
|
||||
}
|
||||
|
||||
Direct_lighting *= Shadows;
|
||||
#endif
|
||||
|
||||
|
||||
vec3 Indirect_lighting = averageSkyCol_Clouds/30.0;
|
||||
|
||||
gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * Albedo;
|
||||
// specular
|
||||
vec3 reflectedVector = reflect(normalize(pos.xyz), normals);
|
||||
float fresnel = pow(clamp(1.0 + dot(normals, normalize(pos.xyz)), 0.0, 1.0),5.0);
|
||||
fresnel = mix(0.02, 1.0, fresnel);
|
||||
|
||||
#ifdef WATER_REFLECTIONS
|
||||
|
||||
vec4 ssReflections = vec4(0);
|
||||
#ifdef SCREENSPACE_REFLECTIONS
|
||||
vec3 rtPos = rayTrace(reflectedVector, pos.xyz, interleaved_gradientNoise(), fresnel, false);
|
||||
|
||||
if (rtPos.z < 1.){
|
||||
vec3 previousPosition = mat3(gbufferModelViewInverse) * DH_toScreenSpace(rtPos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition;
|
||||
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
|
||||
previousPosition.xy = projMAD(dhPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5;
|
||||
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) {
|
||||
ssReflections.a = 1.0;
|
||||
ssReflections.rgb = texture2D(colortex5, previousPosition.xy).rgb;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
vec3 skyReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0 ;
|
||||
skyReflection = mix(skyReflection, ssReflections.rgb, ssReflections.a);
|
||||
|
||||
vec3 sunReflection = Direct_lighting * GGX(normals, -normalize(pos.xyz), WsunVec2, 0.05, vec3(0.02));
|
||||
|
||||
gl_FragData[0].rgb = mix(gl_FragData[0].rgb, skyReflection, fresnel) + sunReflection ;
|
||||
gl_FragData[0].a = mix(gl_FragData[0].a, 1.0, fresnel);
|
||||
#endif
|
||||
|
||||
gl_FragData[0].a = mix(gl_FragData[0].a, 0.0, min(max(1.0 - length(pos.xz)/far,0.0)*2.0,1.0) );
|
||||
|
||||
float material = 1.0;
|
||||
|
||||
if(texture2D(depthtex1, gl_FragCoord.xy*texelSize).x < 1.0){
|
||||
gl_FragData[0].a = 0.0;
|
||||
material = 0.0;
|
||||
}
|
||||
|
||||
// gl_FragData[0] = vec4(ld(texture2D(depthtex0, gl_FragCoord.xy*texelSize).x) * vec3(1.0), 1.0);
|
||||
// if(gl_FragCoord.x*texelSize.x > 0.53) gl_FragData[0] = vec4(0.0);
|
||||
|
||||
gl_FragData[1] = vec4(Albedo, material);
|
||||
}
|
76
shaders/dimensions/DH_translucent.vsh
Normal file
76
shaders/dimensions/DH_translucent.vsh
Normal file
@ -0,0 +1,76 @@
|
||||
#include "/lib/settings.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
varying vec4 pos;
|
||||
varying vec4 gcolor;
|
||||
|
||||
varying vec4 normals_and_materials;
|
||||
varying vec2 lightmapCoords;
|
||||
flat varying int isWater;
|
||||
|
||||
|
||||
uniform sampler2D colortex4;
|
||||
flat varying vec3 averageSkyCol_Clouds;
|
||||
flat varying vec4 lightCol;
|
||||
|
||||
varying mat4 normalmatrix;
|
||||
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
|
||||
flat varying vec3 WsunVec;
|
||||
flat varying vec3 WsunVec2;
|
||||
|
||||
uniform vec3 sunPosition;
|
||||
uniform float sunElevation;
|
||||
|
||||
uniform vec2 texelSize;
|
||||
uniform int framemod8;
|
||||
|
||||
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(-1.,3.)/8.,
|
||||
vec2(5.0,1.)/8.,
|
||||
vec2(-3,-5.)/8.,
|
||||
vec2(-5.,5.)/8.,
|
||||
vec2(-7.,-1.)/8.,
|
||||
vec2(3,7.)/8.,
|
||||
vec2(7.,-7.)/8.);
|
||||
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
isWater = 0;
|
||||
if (dhMaterialId == DH_BLOCK_WATER){
|
||||
isWater = 1;
|
||||
// gl_Position.y -= 6.0/16.0;
|
||||
}
|
||||
|
||||
normals_and_materials = vec4(normalize(gl_Normal), 1.0);
|
||||
|
||||
gcolor = gl_Color;
|
||||
lightmapCoords = gl_MultiTexCoord1.xy;
|
||||
|
||||
|
||||
|
||||
|
||||
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
|
||||
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
|
||||
|
||||
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||
|
||||
WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||
WsunVec2 = lightCol.a * normalize(sunPosition);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#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
|
||||
|
||||
pos = gl_ModelViewMatrix * gl_Vertex;
|
||||
}
|
@ -4,6 +4,10 @@
|
||||
varying vec4 lmtexcoord;
|
||||
varying vec4 color;
|
||||
|
||||
#ifdef LINES
|
||||
flat varying int SELECTION_BOX;
|
||||
#endif
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
@ -86,6 +90,13 @@ float phaseg(float x, float g){
|
||||
/* DRAWBUFFERS:29 */
|
||||
|
||||
void main() {
|
||||
|
||||
#ifdef LINES
|
||||
#ifndef SELECT_BOX
|
||||
if(SELECTION_BOX > 0) discard;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec2 tempOffset = offsets[framemod8];
|
||||
vec3 viewPos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
|
||||
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos;
|
||||
@ -137,8 +148,12 @@ void main() {
|
||||
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
||||
|
||||
//apply distortion
|
||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
projectedShadowPosition.xy *= distortFactor;
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
projectedShadowPosition.xy *= distortFactor;
|
||||
#else
|
||||
float distortFactor = 1.0;
|
||||
#endif
|
||||
|
||||
//do shadows only if on shadow map
|
||||
if (abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution){
|
||||
|
@ -11,6 +11,10 @@ Read the terms of modification and sharing before changing something below pleas
|
||||
varying vec4 lmtexcoord;
|
||||
varying vec4 color;
|
||||
|
||||
#ifdef LINES
|
||||
flat varying int SELECTION_BOX;
|
||||
#endif
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
flat varying vec3 averageSkyCol_Clouds;
|
||||
flat varying vec4 lightCol;
|
||||
@ -18,6 +22,8 @@ varying vec4 color;
|
||||
uniform sampler2D colortex4;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
uniform vec3 sunPosition;
|
||||
uniform float sunElevation;
|
||||
|
||||
@ -89,9 +95,12 @@ void main() {
|
||||
|
||||
color = gl_Color;
|
||||
// color.rgb = worldpos;
|
||||
|
||||
#ifdef LINES
|
||||
color.a = 1.0;
|
||||
SELECTION_BOX = 0;
|
||||
if(dot(color.rgb,vec3(0.33333)) < 0.00001) SELECTION_BOX = 1;
|
||||
#endif
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
|
||||
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
|
||||
|
@ -29,6 +29,7 @@ flat varying float HELD_ITEM_BRIGHTNESS;
|
||||
const bool colortex4MipmapEnabled = true;
|
||||
uniform sampler2D noisetex;
|
||||
uniform sampler2D depthtex1;
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D colortex5;
|
||||
|
||||
uniform sampler2D texture;
|
||||
@ -246,7 +247,7 @@ vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater)
|
||||
#else
|
||||
vec2 testthing = spos.xy/texelSize/4.0;
|
||||
#endif
|
||||
float sp = sqrt((texelFetch2D(colortex4,ivec2(testthing),0).a+0.1)/65000.0);
|
||||
float sp = sqrt((texelFetch2D(colortex4,ivec2(testthing),0).a)/65000.0);
|
||||
sp = invLinZ(sp);
|
||||
|
||||
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy/RENDER_SCALE,sp);
|
||||
@ -276,12 +277,15 @@ vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) {
|
||||
|
||||
float denom = dotNHsq * r - dotNHsq + 1.;
|
||||
float D = r / (3.141592653589793 * denom * denom);
|
||||
vec3 F = F0 + (1. - F0) * exp2((-5.55473*dotLH-6.98316)*dotLH);
|
||||
vec3 F = 0.2 + (1. - F0) * exp2((-5.55473*dotLH-6.98316)*dotLH);
|
||||
float k2 = .25 * r;
|
||||
|
||||
return dotNL * D * F / (dotLH*dotLH*(1.0-k2)+k2);
|
||||
}
|
||||
|
||||
uniform float dhFarPlane;
|
||||
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
@ -293,7 +297,9 @@ void main() {
|
||||
if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) {
|
||||
|
||||
vec2 tempOffset = offsets[framemod8];
|
||||
|
||||
vec3 viewPos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
|
||||
|
||||
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
|
||||
@ -399,14 +405,20 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
mat4 DH_shadowProjection = DH_shadowProjectionTweak(shadowProjection);
|
||||
|
||||
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
|
||||
// vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos_shadow + Custom_ViewMatrix[3].xyz;
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz;
|
||||
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
||||
projectedShadowPosition = diagonal3(DH_shadowProjection) * projectedShadowPosition + DH_shadowProjection[3].xyz;
|
||||
|
||||
//apply distortion
|
||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
projectedShadowPosition.xy *= distortFactor;
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
projectedShadowPosition.xy *= distortFactor;
|
||||
#else
|
||||
float distortFactor = 1.0;
|
||||
#endif
|
||||
|
||||
bool ShadowBounds = false;
|
||||
if(shadowDistanceRenderMul > 0.0) ShadowBounds = length(feetPlayerPos_shadow) < max(shadowDistance - 20,0.0);
|
||||
@ -597,7 +609,9 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
gl_FragData[0].a = mix(gl_FragData[0].a, 1.0, fresnel);
|
||||
#endif
|
||||
|
||||
if (gl_FragData[0].r > 65000.) gl_FragData[0].rgba = vec4(0.);
|
||||
#ifdef DISTANT_HORIZONS
|
||||
gl_FragData[0].a = mix(gl_FragData[0].a, 0.0, 1.0-min(max(1.0 - length(feetPlayerPos.xz)/far,0.0)*2.0,1.0) );
|
||||
#endif
|
||||
|
||||
} else {
|
||||
gl_FragData[0].rgb = FinalColor;
|
||||
@ -611,6 +625,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
gl_FragData[1] = vec4(Albedo, iswater);
|
||||
#endif
|
||||
|
||||
// if(gl_FragCoord.x*texelSize.x < 0.47) gl_FragData[0] = vec4(0.0);
|
||||
|
||||
gl_FragData[3].a = max(lmtexcoord.w*blueNoise()*0.05 + lmtexcoord.w,0.0);
|
||||
}
|
||||
}
|
@ -72,6 +72,7 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),-viewSpacePosition.z);
|
||||
}
|
||||
|
||||
varying vec4 pos;
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
@ -87,6 +88,8 @@ void main() {
|
||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||
gl_Position = toClipSpace3(position);
|
||||
|
||||
pos = vec4(position,1);
|
||||
|
||||
HELD_ITEM_BRIGHTNESS = 0.0;
|
||||
|
||||
#ifdef Hand_Held_lights
|
||||
|
@ -7,6 +7,9 @@ flat varying vec2 TAA_Offset;
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
uniform sampler2D depthtex1;
|
||||
uniform sampler2D dhDepthTex;
|
||||
uniform sampler2D dhDepthTex1;
|
||||
|
||||
uniform sampler2D colortex1;
|
||||
uniform sampler2D colortex6; // Noise
|
||||
uniform sampler2D colortex8; // Noise
|
||||
@ -29,8 +32,11 @@ uniform vec3 cameraPosition;
|
||||
uniform float viewWidth;
|
||||
uniform float aspectRatio;
|
||||
uniform float viewHeight;
|
||||
|
||||
// uniform float far;
|
||||
uniform float near;
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
|
||||
#define ffstep(x,y) clamp((y - x) * 1e35,0.0,1.0)
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
@ -41,6 +47,8 @@ vec3 toScreenSpace(vec3 p) {
|
||||
vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
|
||||
return fragposition.xyz / fragposition.w;
|
||||
}
|
||||
|
||||
|
||||
vec3 worldToView(vec3 worldPos) {
|
||||
vec4 pos = vec4(worldPos, 0.0);
|
||||
pos = gbufferModelView * pos;
|
||||
@ -142,11 +150,29 @@ vec2 SpiralSample(
|
||||
return vec2(x, y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
float DH_ld(float dist) {
|
||||
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
}
|
||||
float DH_inv_ld (float lindepth){
|
||||
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
}
|
||||
|
||||
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main() {
|
||||
/* DRAWBUFFERS:3 */
|
||||
vec2 texcoord = gl_FragCoord.xy*texelSize;
|
||||
|
||||
float z = texture2D(depthtex1,texcoord).x;
|
||||
float DH_depth1 = texture2D(depthtex1,texcoord).x;
|
||||
|
||||
vec2 tempOffset=TAA_Offset;
|
||||
|
||||
@ -195,27 +221,31 @@ void main() {
|
||||
gl_FragData[0] = vec4(minshadowfilt, 0.1, 0.0, 0.0);
|
||||
gl_FragData[0].y = 0;
|
||||
|
||||
vec3 viewPos = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z));
|
||||
// vec3 viewPos = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z));
|
||||
|
||||
vec3 viewPos = toScreenSpace_DH(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5, z, DH_depth1);
|
||||
|
||||
#ifdef Variable_Penumbra_Shadows
|
||||
|
||||
if (NdotL > 0.001 || LabSSS > 0.0) {
|
||||
if (LabSSS > 0.0) {
|
||||
|
||||
mat4 DH_shadowProjection = DH_shadowProjectionTweak(shadowProjection);
|
||||
|
||||
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
// GriAndEminShadowFix(p3, viewToWorld(FlatNormals), vanillAO, lightmap.y, entities);
|
||||
|
||||
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
|
||||
// vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos + Custom_ViewMatrix[3].xyz;
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos + shadowModelView[3].xyz;
|
||||
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
||||
projectedShadowPosition = diagonal3(DH_shadowProjection) * projectedShadowPosition + DH_shadowProjection[3].xyz;
|
||||
|
||||
//apply distortion
|
||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
projectedShadowPosition.xy *= distortFactor;
|
||||
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
projectedShadowPosition.xy *= distortFactor;
|
||||
#else
|
||||
float distortFactor = 1.0;
|
||||
#endif
|
||||
//do shadows only if on shadow map
|
||||
if (abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0){
|
||||
if (abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0 || length(feetPlayerPos) < far){
|
||||
const float threshMul = max(2048.0/shadowMapResolution*shadowDistance/128.0,0.95);
|
||||
float distortThresh = (sqrt(1.0-NdotL*NdotL)/NdotL+0.7)/distortFactor;
|
||||
float diffthresh = distortThresh/6000.0*threshMul;
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "/lib/settings.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
|
||||
|
||||
|
||||
const bool colortex5MipmapEnabled = true;
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
@ -38,9 +41,12 @@ const bool colortex5MipmapEnabled = true;
|
||||
|
||||
uniform int hideGUI;
|
||||
uniform sampler2D noisetex; //noise
|
||||
uniform sampler2D depthtex0; //depth
|
||||
uniform sampler2D depthtex1; //depth
|
||||
uniform sampler2D depthtex2; //depth
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D depthtex1;
|
||||
uniform sampler2D depthtex2;
|
||||
|
||||
uniform sampler2D dhDepthTex;
|
||||
uniform sampler2D dhDepthTex1;
|
||||
|
||||
uniform sampler2D colortex0; //clouds
|
||||
uniform sampler2D colortex1; //albedo(rgb),material(alpha) RGBA16
|
||||
@ -75,6 +81,8 @@ uniform vec3 previousCameraPosition;
|
||||
|
||||
// uniform float far;
|
||||
uniform float near;
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
|
||||
uniform vec2 texelSize;
|
||||
uniform float viewWidth;
|
||||
@ -104,6 +112,9 @@ vec3 toScreenSpace(vec3 p) {
|
||||
return viewPos.xyz / viewPos.w;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "/lib/color_transforms.glsl"
|
||||
#include "/lib/waterBump.glsl"
|
||||
#include "/lib/sky_gradient.glsl"
|
||||
@ -127,6 +138,24 @@ float ld(float dist) {
|
||||
#include "/lib/specular.glsl"
|
||||
|
||||
|
||||
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
float DH_ld(float dist) {
|
||||
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
}
|
||||
float DH_inv_ld (float lindepth){
|
||||
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
}
|
||||
|
||||
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
}
|
||||
float invertlinearDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return ((2.0*near/depth)-far-near)/(far-near);
|
||||
}
|
||||
|
||||
|
||||
vec3 normVec (vec3 vec){
|
||||
return vec*inversesqrt(dot(vec,vec));
|
||||
}
|
||||
@ -206,9 +235,12 @@ vec4 blueNoise(vec2 coord){
|
||||
}
|
||||
|
||||
vec3 toShadowSpaceProjected(vec3 feetPlayerPos){
|
||||
|
||||
mat4 DH_shadowProjection = DH_shadowProjectionTweak(shadowProjection);
|
||||
|
||||
feetPlayerPos = mat3(gbufferModelViewInverse) * feetPlayerPos + gbufferModelViewInverse[3].xyz;
|
||||
feetPlayerPos = mat3(shadowModelView) * feetPlayerPos + shadowModelView[3].xyz;
|
||||
feetPlayerPos = diagonal3(shadowProjection) * feetPlayerPos + shadowProjection[3].xyz;
|
||||
feetPlayerPos = diagonal3(DH_shadowProjection) * feetPlayerPos + DH_shadowProjection[3].xyz;
|
||||
|
||||
return feetPlayerPos;
|
||||
}
|
||||
@ -372,7 +404,12 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
||||
vec3 progressW = start.xyz+cameraPosition+dVWorld;
|
||||
|
||||
//project into biased shadowmap space
|
||||
float distortFactor = calcDistort(spPos.xy);
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
float distortFactor = calcDistort(spPos.xy);
|
||||
#else
|
||||
float distortFactor = 1.0;
|
||||
#endif
|
||||
|
||||
vec3 pos = vec3(spPos.xy*distortFactor, spPos.z);
|
||||
float sh = 1.0;
|
||||
if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){
|
||||
@ -408,18 +445,30 @@ void Emission(
|
||||
if( Emission < 255.0/255.0 ) Lighting += (Albedo * Emissive_Brightness) * pow(Emission, Emissive_Curve);
|
||||
}
|
||||
|
||||
void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool inshadowmap, inout float Shadow, inout float SSS){
|
||||
vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, bool isSSS){
|
||||
float steps = 16.0;
|
||||
vec3 clipPosition = toClipSpace3(viewPos);
|
||||
|
||||
float Shadow = 1.0;
|
||||
float SSS = 0.0;
|
||||
|
||||
float _near = near; float _far = far*4.0;
|
||||
|
||||
if (depthCheck) {
|
||||
_near = dhNearPlane;
|
||||
_far = dhFarPlane;
|
||||
}
|
||||
|
||||
vec3 clipPosition = toClipSpace3_DH(viewPos, depthCheck);
|
||||
|
||||
//prevents the ray from going behind the camera
|
||||
float rayLength = ((viewPos.z + lightDir.z * far*sqrt(3.)) > -near) ?
|
||||
(-near -viewPos.z) / lightDir.z : far*sqrt(3.);
|
||||
float rayLength = ((viewPos.z + lightDir.z * _far*sqrt(3.)) > -_near) ?
|
||||
(-_near -viewPos.z) / lightDir.z : _far*sqrt(3.);
|
||||
|
||||
vec3 direction = toClipSpace3(viewPos + lightDir*rayLength) - clipPosition; //convert to clip space
|
||||
vec3 direction = toClipSpace3_DH(viewPos + lightDir*rayLength, depthCheck) - clipPosition; //convert to clip space
|
||||
direction.xyz = direction.xyz / max(abs(direction.x)/texelSize.x, abs(direction.y)/texelSize.y); //fixed step size
|
||||
|
||||
vec3 rayDir = direction * (isSSS ? 1.5 : 3.0) * vec3(RENDER_SCALE,1.0);
|
||||
|
||||
vec3 rayDir = direction * (isSSS ? 1.5 : (depthCheck ? 6.0 : 3.0)) * vec3(RENDER_SCALE,1.0);
|
||||
|
||||
vec3 screenPos = clipPosition * vec3(RENDER_SCALE,1.0) + rayDir*noise;
|
||||
if(isSSS) screenPos -= rayDir*0.9;
|
||||
@ -428,9 +477,14 @@ void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool ins
|
||||
|
||||
screenPos += rayDir;
|
||||
|
||||
float samplePos = texture2D(depthtex2, screenPos.xy).x;
|
||||
float samplePos = texture2D(depthtex1, screenPos.xy).x;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
if(depthCheck) samplePos = texture2D(dhDepthTex1, screenPos.xy).x;
|
||||
#endif
|
||||
|
||||
if(samplePos <= screenPos.z) {
|
||||
vec2 linearZ = vec2(linZ(screenPos.z), linZ(samplePos));
|
||||
vec2 linearZ = vec2(linearizeDepthFast(screenPos.z, _near, _far), linearizeDepthFast(samplePos, _near, _far));
|
||||
float calcthreshold = abs(linearZ.x - linearZ.y) / linearZ.x;
|
||||
|
||||
bool depthThreshold1 = calcthreshold < 0.015;
|
||||
@ -442,6 +496,8 @@ void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool ins
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return vec2(Shadow, SSS);
|
||||
}
|
||||
|
||||
float CustomPhase(float LightPos){
|
||||
@ -491,7 +547,6 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
|
||||
return scatter ;
|
||||
}
|
||||
|
||||
|
||||
#include "/lib/indirect_lighting_effects.glsl"
|
||||
#include "/lib/PhotonGTAO.glsl"
|
||||
vec4 renderInfiniteWaterPlane(
|
||||
@ -525,28 +580,103 @@ vec4 renderInfiniteWaterPlane(
|
||||
return vec4(color, total_extinction);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// uniform float viewWidth;
|
||||
// uniform float viewHeight;
|
||||
|
||||
// uniform sampler2D depthtex0;
|
||||
// uniform sampler2D dhDepthTex;
|
||||
|
||||
// uniform mat4 gbufferProjectionInverse;
|
||||
// uniform mat4 dhProjectionInverse;
|
||||
|
||||
vec3 getViewPos() {
|
||||
ivec2 uv = ivec2(gl_FragCoord.xy);
|
||||
vec2 viewSize = vec2(viewWidth, viewHeight);
|
||||
vec2 texcoord = gl_FragCoord.xy / viewSize;
|
||||
|
||||
vec4 viewPos = vec4(0.0);
|
||||
|
||||
float depth = texelFetch(depthtex0, uv, 0).r;
|
||||
|
||||
if (depth < 1.0) {
|
||||
vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0;
|
||||
viewPos = gbufferProjectionInverse * ndcPos;
|
||||
viewPos.xyz /= viewPos.w;
|
||||
}
|
||||
else {
|
||||
depth = texelFetch(dhDepthTex, ivec2(gl_FragCoord.xy), 0).r;
|
||||
|
||||
vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0;
|
||||
viewPos = dhProjectionInverse * ndcPos;
|
||||
viewPos.xyz /= viewPos.w;
|
||||
}
|
||||
|
||||
return viewPos.xyz;
|
||||
}
|
||||
vec3 DH_viewSpacePos(vec2 texcoord, float depth) {
|
||||
|
||||
vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0;
|
||||
vec4 viewPos = dhProjectionInverse * ndcPos;
|
||||
return viewPos.xyz /= viewPos.w;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
vec3 DEBUG = vec3( 1.0);
|
||||
vec3 DEBUG = vec3(1.0);
|
||||
|
||||
////// --------------- SETUP STUFF --------------- //////
|
||||
vec2 texcoord = gl_FragCoord.xy*texelSize;
|
||||
|
||||
float z0 = texture2D(depthtex0,texcoord).x;
|
||||
float z = texture2D(depthtex1,texcoord).x;
|
||||
|
||||
vec2 bnoise = blueNoise(gl_FragCoord.xy).rg;
|
||||
int seed = (frameCounter%40000) + frameCounter*2;
|
||||
float noise = fract(R2_samples(seed).y + bnoise.y);
|
||||
float noise_2 = R2_dither();
|
||||
|
||||
vec2 tempOffset = TAA_Offset;
|
||||
vec3 viewPos = toScreenSpace(vec3(texcoord/RENDER_SCALE - TAA_Offset*texelSize*0.5,z));
|
||||
float z0 = texture2D(depthtex0,texcoord).x;
|
||||
float z = texture2D(depthtex1,texcoord).x;
|
||||
float swappedDepth = z;
|
||||
bool isDHrange = z >= 1.0;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float DH_depth0 = texture2D(dhDepthTex,texcoord).x;
|
||||
float DH_depth1 = texture2D(dhDepthTex1,texcoord).x;
|
||||
|
||||
float mixedDepth = z;
|
||||
|
||||
float _near = near;
|
||||
float _far = far*4.0;
|
||||
|
||||
if (mixedDepth >= 1.0) {
|
||||
mixedDepth = DH_depth1;
|
||||
_near = dhNearPlane;
|
||||
_far = dhFarPlane;
|
||||
}
|
||||
mixedDepth = linearizeDepthFast(mixedDepth, _near, _far);
|
||||
mixedDepth = mixedDepth / dhFarPlane;
|
||||
|
||||
swappedDepth = DH_inv_ld(mixedDepth);
|
||||
if(swappedDepth >= 0.999999) swappedDepth = 1.0;
|
||||
#else
|
||||
float DH_depth0 = 0.0;
|
||||
float DH_depth1 = 0.0;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
vec3 viewPos = toScreenSpace_DH(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5, z, DH_depth1);
|
||||
#else
|
||||
vec3 viewPos = toScreenSpace(vec3(texcoord/RENDER_SCALE - TAA_Offset*texelSize*0.5,z));
|
||||
#endif
|
||||
|
||||
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos;
|
||||
vec3 feetPlayerPos_normalized = normVec(feetPlayerPos);
|
||||
|
||||
|
||||
|
||||
////// --------------- UNPACK OPAQUE GBUFFERS --------------- //////
|
||||
|
||||
vec4 data = texture2D(colortex1,texcoord);
|
||||
@ -580,9 +710,15 @@ void main() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
float vanilla_AO = clamp(normalAndAO.a,0,1);
|
||||
float vanilla_AO = z < 1.0 ? clamp(normalAndAO.a,0,1) : 0.0;
|
||||
normalAndAO.a = clamp(pow(normalAndAO.a*5,4),0,1);
|
||||
|
||||
if(isDHrange){
|
||||
slopednormal = normal;
|
||||
FlatNormals = worldToView(normal);
|
||||
}
|
||||
|
||||
|
||||
////// --------------- MASKS/BOOLEANS --------------- //////
|
||||
|
||||
bool iswater = texture2D(colortex7,texcoord).a > 0.99;
|
||||
@ -616,8 +752,6 @@ void main() {
|
||||
vec3 AmbientLightColor = vec3(0.0);
|
||||
vec3 Indirect_SSS = vec3(0.0);
|
||||
|
||||
vec3 ambientCoefs = slopednormal/dot(abs(slopednormal),vec3(1.));
|
||||
|
||||
vec3 Direct_lighting = vec3(0.0);
|
||||
vec3 DirectLightColor = vec3(0.0);
|
||||
vec3 Direct_SSS = vec3(0.0);
|
||||
@ -625,6 +759,16 @@ void main() {
|
||||
float Shadows = 1.0;
|
||||
float NdotL = 1.0;
|
||||
|
||||
|
||||
|
||||
float shadowMap = 1.0;
|
||||
#ifdef DISTANT_HORIZONS_SHADOWMAP
|
||||
float shadowMapFalloff = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance, dhFarPlane),0.0)*5.0,1.0),2.0),2.0);
|
||||
#else
|
||||
float shadowMapFalloff = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance, far),0.0)*5.0,1.0),2.0),2.0);
|
||||
#endif
|
||||
float LM_shadowMapFallback = min(max(lightmap.y-0.8, 0.0) * 25,1.0);
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
DirectLightColor = lightCol.rgb/80.0;
|
||||
|
||||
@ -637,12 +781,19 @@ void main() {
|
||||
vec3 filteredShadow = vec3(1.412,1.0,0.0);
|
||||
if (!hand) filteredShadow = texture2D(colortex3,texcoord).rgb;
|
||||
float ShadowBlockerDepth = filteredShadow.y;
|
||||
|
||||
Shadows = clamp(1.0 - filteredShadow.b,0.0,1.0);
|
||||
shadowMap = Shadows;
|
||||
bool inShadowmapBounds = false;
|
||||
#endif
|
||||
///////////////////////////// start drawin :D
|
||||
if (z >= 1.0) {
|
||||
|
||||
#ifdef CLOUDS_INFRONT_OF_WORLD
|
||||
float heightRelativeToClouds = clamp(cameraPosition.y - LAYER0_minHEIGHT,0.0,1.0);
|
||||
vec4 Clouds = texture2D_bicubic_offset(colortex0, texcoord*CLOUDS_QUALITY, noise, RENDER_SCALE.x);
|
||||
#endif
|
||||
|
||||
///////////////////////////// start drawin :D
|
||||
if (swappedDepth >= 1.0) {
|
||||
#ifdef OVERWORLD_SHADER
|
||||
vec3 Background = vec3(0.0);
|
||||
|
||||
@ -670,8 +821,12 @@ void main() {
|
||||
Background += Sky;
|
||||
|
||||
#ifdef VOLUMETRIC_CLOUDS
|
||||
vec4 Clouds = texture2D_bicubic_offset(colortex0, texcoord*CLOUDS_QUALITY, noise, RENDER_SCALE.x);
|
||||
Background = Background * Clouds.a + Clouds.rgb;
|
||||
#ifdef CLOUDS_INFRONT_OF_WORLD
|
||||
if(heightRelativeToClouds < 1.0) Background = Background * Clouds.a + Clouds.rgb;
|
||||
#else
|
||||
vec4 Clouds = texture2D_bicubic_offset(colortex0, texcoord*CLOUDS_QUALITY, noise, RENDER_SCALE.x);
|
||||
Background = Background * Clouds.a + Clouds.rgb;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gl_FragData[0].rgb = clamp(fp10Dither(Background, triangularize(noise_2)), 0.0, 65000.);
|
||||
@ -697,100 +852,77 @@ void main() {
|
||||
#ifdef OVERWORLD_SHADER
|
||||
|
||||
NdotL = clamp((-15 + dot(slopednormal, WsunVec)*255.0) / 240.0 ,0.0,1.0);
|
||||
// float shadowNDOTL = NdotL;
|
||||
// #ifndef Variable_Penumbra_Shadows
|
||||
// shadowNDOTL += LabSSS;
|
||||
// #endif
|
||||
|
||||
|
||||
float shadowNDOTL = NdotL;
|
||||
#ifndef Variable_Penumbra_Shadows
|
||||
shadowNDOTL += LabSSS;
|
||||
#endif
|
||||
// if(shadowNDOTL > 0.001){
|
||||
|
||||
vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
mat4 DH_shadowProjection = DH_shadowProjectionTweak(shadowProjection);
|
||||
|
||||
if(!entities){
|
||||
if(!hand) GriAndEminShadowFix(feetPlayerPos_shadow, viewToWorld(FlatNormals), vanilla_AO, lightmap.y, entities);
|
||||
}
|
||||
vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
|
||||
// vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos_shadow + Custom_ViewMatrix[3].xyz;
|
||||
if(!hand || !entities) GriAndEminShadowFix(shadowPlayerPos, viewToWorld(FlatNormals), vanilla_AO, lightmap.y, entities);
|
||||
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz;
|
||||
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * shadowPlayerPos + shadowModelView[3].xyz;
|
||||
projectedShadowPosition = diagonal3(DH_shadowProjection) * projectedShadowPosition + DH_shadowProjection[3].xyz;
|
||||
|
||||
//apply distortion
|
||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
projectedShadowPosition.xy *= distortFactor;
|
||||
//apply distortion
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
projectedShadowPosition.xy *= distortFactor;
|
||||
#else
|
||||
float distortFactor = 1.0;
|
||||
#endif
|
||||
|
||||
bool ShadowBounds = false;
|
||||
if(shadowDistanceRenderMul > 0.0) ShadowBounds = length(feetPlayerPos_shadow) < max(shadowDistance - 20,0.0);
|
||||
|
||||
if(shadowDistanceRenderMul < 0.0) ShadowBounds = abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0;
|
||||
|
||||
//do shadows only if on shadow map
|
||||
if(ShadowBounds){
|
||||
if (shadowNDOTL >= -0.001){
|
||||
Shadows = 0.0;
|
||||
int samples = SHADOW_FILTER_SAMPLE_COUNT;
|
||||
float smallbias = 0.0;
|
||||
|
||||
if(hand){
|
||||
samples = 1;
|
||||
noise = 0.5;
|
||||
smallbias = -0.0004;
|
||||
}
|
||||
|
||||
if(entities) smallbias = -0.0001;
|
||||
if(shadowDistanceRenderMul < 0.0) shadowMapFalloff = abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0 ? 1.0 : 0.0;
|
||||
|
||||
if(shadowMapFalloff > 0.0){
|
||||
shadowMap = 0.0;
|
||||
|
||||
projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5);
|
||||
|
||||
float biasOffset = 0.0;
|
||||
#ifdef BASIC_SHADOW_FILTER
|
||||
#ifndef Variable_Penumbra_Shadows
|
||||
if(LabSSS > 0) smallbias = -0.0002;
|
||||
#endif
|
||||
float rdMul = filteredShadow.x*distortFactor*d0*k/shadowMapResolution;
|
||||
|
||||
|
||||
for(int i = 0; i < samples; i++){
|
||||
for(int i = 0; i < SHADOW_FILTER_SAMPLE_COUNT; i++){
|
||||
vec2 offsetS = tapLocation_simple(i, 7, 9, noise_2) * 0.5;
|
||||
|
||||
float isShadow = shadow2D(shadow, projectedShadowPosition + vec3(rdMul*offsetS, smallbias) ).x;
|
||||
Shadows += isShadow/samples;
|
||||
shadowMap += shadow2D(shadow, projectedShadowPosition + vec3(rdMul*offsetS, biasOffset) ).x/SHADOW_FILTER_SAMPLE_COUNT;
|
||||
}
|
||||
#else
|
||||
Shadows = shadow2D(shadow, projectedShadowPosition + vec3(0.0,0.0, smallbias)).x;
|
||||
shadowMap = shadow2D(shadow, projectedShadowPosition + vec3(0.0,0.0, biasOffset)).x;
|
||||
#endif
|
||||
|
||||
Shadows = shadowMap;
|
||||
}
|
||||
inShadowmapBounds = true;
|
||||
}
|
||||
|
||||
float lightmapAsShadows = 1.0;
|
||||
if(!inShadowmapBounds && !iswater){
|
||||
lightmapAsShadows = min(max(lightmap.y-0.8, 0.0) * 25,1.0);
|
||||
|
||||
Shadows = lightmapAsShadows;
|
||||
}
|
||||
|
||||
#ifdef OLD_LIGHTLEAK_FIX
|
||||
if (isEyeInWater == 0) Shadows *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix
|
||||
#endif
|
||||
|
||||
Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff);
|
||||
|
||||
#ifdef OLD_LIGHTLEAK_FIX
|
||||
if (isEyeInWater == 0) Shadows *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix
|
||||
#endif
|
||||
// }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////// SUN SSS ////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if SSS_TYPE != 0
|
||||
#ifndef Variable_Penumbra_Shadows
|
||||
if(LabSSS > 0 ) {
|
||||
ShadowBlockerDepth = pow(1.0 - Shadows,2);
|
||||
}
|
||||
#if defined DISTANT_HORIZONS_SHADOWMAP && defined Variable_Penumbra_Shadows
|
||||
float DH_SSS_DISTANCE = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance, far),0.0)*5.0,1.0),2.0),2.0);
|
||||
ShadowBlockerDepth = mix(pow(1.0 - Shadows,2.0), ShadowBlockerDepth, DH_SSS_DISTANCE);
|
||||
#endif
|
||||
|
||||
#if !defined Variable_Penumbra_Shadows
|
||||
ShadowBlockerDepth = pow(1.0 - Shadows,2.0);
|
||||
#endif
|
||||
|
||||
if (!inShadowmapBounds) ShadowBlockerDepth = 0.0;
|
||||
|
||||
float sunSSS_density = LabSSS;
|
||||
|
||||
#ifndef RENDER_ENTITY_SHADOWS
|
||||
if(entities) sunSSS_density = 0.0;
|
||||
#endif
|
||||
@ -798,29 +930,22 @@ void main() {
|
||||
if (!hand){
|
||||
#ifdef SCREENSPACE_CONTACT_SHADOWS
|
||||
|
||||
float SS_shadow = 1.0; float SS_shadowSSS = 0.0;
|
||||
SSRT_Shadows(toScreenSpace(vec3(texcoord/RENDER_SCALE, z)), normalize(WsunVec*mat3(gbufferModelViewInverse)), interleaved_gradientNoise(), !inShadowmapBounds && LabSSS > 0.0, inShadowmapBounds, SS_shadow, SS_shadowSSS);
|
||||
vec2 SS_directLight = SSRT_Shadows(toScreenSpace_DH(texcoord/RENDER_SCALE, z, DH_depth1), isDHrange, normalize(WsunVec*mat3(gbufferModelViewInverse)), interleaved_gradientNoise(), sunSSS_density > 0.0);
|
||||
|
||||
Shadows = min(Shadows, SS_shadow);
|
||||
|
||||
if (!inShadowmapBounds) ShadowBlockerDepth = max(ShadowBlockerDepth, clamp(SS_shadowSSS,0.0,1.0));
|
||||
Shadows = min(Shadows, SS_directLight.r);
|
||||
ShadowBlockerDepth = mix(SS_directLight.g, ShadowBlockerDepth, shadowMapFalloff);
|
||||
|
||||
#else
|
||||
|
||||
if (!inShadowmapBounds) ShadowBlockerDepth = 1.0-min(max(lightmap.y-0.85,0.0)*10.0,1.0);
|
||||
|
||||
ShadowBlockerDepth = mix(1.0, ShadowBlockerDepth, shadowMapFalloff);
|
||||
#endif
|
||||
|
||||
Direct_SSS = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), inShadowmapBounds) ;
|
||||
Direct_SSS = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), inShadowmapBounds);
|
||||
|
||||
Direct_SSS *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff);
|
||||
if (isEyeInWater == 0) Direct_SSS *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix
|
||||
}
|
||||
|
||||
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;
|
||||
// Direct_SSS *= 1.0-NdotL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CLOUDS_SHADOWS
|
||||
@ -853,6 +978,10 @@ void main() {
|
||||
///////////////////////////// INDIRECT LIGHTING /////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if indirect_effect == 1
|
||||
vec2 SSAO_SSS = SSAO(viewPos, FlatNormals, hand, isLeaf, noise);
|
||||
#endif
|
||||
|
||||
#if defined OVERWORLD_SHADER && (indirect_effect == 0 || indirect_effect == 1)
|
||||
|
||||
vec3 ambientcoefs = slopednormal / dot(abs(slopednormal), vec3(1));
|
||||
@ -860,9 +989,11 @@ void main() {
|
||||
float SkylightDir = ambientcoefs.y*1.5;
|
||||
if(isGrass) SkylightDir = 1.25;
|
||||
|
||||
|
||||
float skylight = max(pow(viewToWorld(FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.25 + (1.0-lightmap.y) * 0.75) ;
|
||||
// skylight = 0.0;
|
||||
|
||||
#if indirect_effect == 1
|
||||
skylight = min(skylight, (SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x) * 2.5);
|
||||
#endif
|
||||
|
||||
AmbientLightColor *= skylight;
|
||||
#endif
|
||||
@ -894,35 +1025,31 @@ void main() {
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef OVERWORLD_SHADER
|
||||
if ((isEyeInWater == 0 && iswater) || (isEyeInWater == 1 && !iswater)){
|
||||
#ifdef DISTANT_HORIZONS
|
||||
vec3 viewPos0 = toScreenSpace_DH(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5, z0, DH_depth0);
|
||||
#else
|
||||
vec3 viewPos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z0));
|
||||
#endif
|
||||
|
||||
vec3 viewPos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z0));
|
||||
float Vdiff = distance(viewPos, viewPos0);
|
||||
float VdotU = feetPlayerPos_normalized.y;
|
||||
float estimatedDepth = Vdiff * abs(VdotU); //assuming water plane
|
||||
estimatedDepth = estimatedDepth;
|
||||
// make it such that the estimated depth flips to be correct when entering water.
|
||||
|
||||
// make it such that the estimated depth flips to be correct when entering water.
|
||||
if (isEyeInWater == 1) estimatedDepth = (1.0-lightmap.y)*16.0;
|
||||
|
||||
float estimatedSunDepth = Vdiff; //assuming water plane
|
||||
vec3 Absorbtion = exp2(-totEpsilon*estimatedDepth);
|
||||
|
||||
// caustics...
|
||||
float Direct_caustics = waterCaustics(feetPlayerPos + cameraPosition, WsunVec) * cloudShadow;
|
||||
// float Ambient_Caustics = waterCaustics(p3 + cameraPosition, vec3(0.5, 1, 0.5));
|
||||
|
||||
// apply caustics to the lighting
|
||||
DirectLightColor *= 1.0 + max(pow(Direct_caustics * 3.0, 2.0),0.0);
|
||||
// Indirect_lighting *= 0.5 + max(pow(Ambient_Caustics, 2.0),0.0);
|
||||
|
||||
DirectLightColor *= Absorbtion;
|
||||
if(isEyeInWater == 1 ) Indirect_lighting = (Indirect_lighting/exp2(-estimatedDepth*0.5)) * Absorbtion;
|
||||
|
||||
if(isEyeInWater == 0) DirectLightColor *= max(eyeBrightnessSmooth.y/240., 0.0);
|
||||
DirectLightColor *= cloudShadow;
|
||||
// apply caustics to the lighting
|
||||
float Direct_caustics = waterCaustics(feetPlayerPos + cameraPosition, WsunVec);
|
||||
DirectLightColor *= 1.0 + max(pow(Direct_caustics * 3.0, 2.0),0.0);
|
||||
|
||||
// if(isEyeInWater == 0) DirectLightColor *= max(eyeBrightnessSmooth.y/240., 0.0);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////// EFFECTS FOR INDIRECT /////////////////////////////
|
||||
@ -933,17 +1060,16 @@ void main() {
|
||||
#if indirect_effect == 0
|
||||
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ;
|
||||
Indirect_lighting *= AO;
|
||||
Direct_lighting *= AO;
|
||||
#endif
|
||||
|
||||
#if indirect_effect == 1
|
||||
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) );
|
||||
|
||||
vec2 SSAO_SSS = SSAO(viewPos, FlatNormals, hand, isLeaf, noise);
|
||||
// AO *= exp((1.0-SSAO_SSS.x) * -5.0);
|
||||
AO *= SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x;
|
||||
AO *= SSAO_SSS.x*SSAO_SSS.x;
|
||||
SkySSS = SSAO_SSS.y;
|
||||
|
||||
Indirect_lighting *= AO;
|
||||
Direct_lighting *= AO;
|
||||
#endif
|
||||
|
||||
// GTAO
|
||||
@ -954,6 +1080,7 @@ void main() {
|
||||
if (!hand) AO = ambient_occlusion(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z), viewPos, worldToView(slopednormal), r2) * vec3(1.0);
|
||||
|
||||
Indirect_lighting *= AO;
|
||||
Direct_lighting *= AO;
|
||||
#endif
|
||||
|
||||
// RTAO and/or SSGI
|
||||
@ -1007,7 +1134,8 @@ void main() {
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
// do these here so it gets underwater absorbtion.
|
||||
Direct_lighting = max(DirectLightColor * (NdotL * Shadows), DirectLightColor * Direct_SSS);
|
||||
// Direct_lighting = max(DirectLightColor * NdotL * Shadows, DirectLightColor * LabSSS*0);
|
||||
Direct_lighting = max(DirectLightColor * NdotL * Shadows, DirectLightColor * Direct_SSS);
|
||||
#endif
|
||||
|
||||
gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * albedo;
|
||||
@ -1024,27 +1152,36 @@ void main() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
if (iswater && isEyeInWater == 0){
|
||||
vec3 viewPos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z0));
|
||||
float Vdiff = distance(viewPos,viewPos0);
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
vec3 viewPos0 = toScreenSpace_DH(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5, z0, DH_depth0);
|
||||
#else
|
||||
vec3 viewPos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z0));
|
||||
#endif
|
||||
|
||||
float Vdiff = distance(viewPos, viewPos0);
|
||||
float VdotU = feetPlayerPos_normalized.y;
|
||||
float estimatedDepth = Vdiff * abs(VdotU) ; //assuming water plane
|
||||
float estimatedSunDepth = estimatedDepth/abs(WsunVec.y); //assuming water plane
|
||||
|
||||
float custom_lightmap_T = clamp(pow(texture2D(colortex14, texcoord).a,3.0),0.0,1.0);
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
if(isDHrange) custom_lightmap_T = 0.85;
|
||||
#endif
|
||||
|
||||
vec3 lightColVol = lightCol.rgb / 80.;
|
||||
// if(shadowmapindicator < 1) lightColVol *= clamp((custom_lightmap_T-0.8) * 15,0,1)
|
||||
|
||||
|
||||
vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.);
|
||||
vec3 ambientColVol = max((averageSkyCol_Clouds / 30.0) * custom_lightmap_T, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision)) ;
|
||||
|
||||
|
||||
waterVolumetrics(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth , estimatedSunDepth, Vdiff, noise_2, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(feetPlayerPos_normalized, WsunVec));
|
||||
|
||||
vec3 ambientColVol = max((averageSkyCol_Clouds / 30.0) * custom_lightmap_T, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision)) ;
|
||||
|
||||
waterVolumetrics(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth, estimatedSunDepth, Vdiff, noise_2, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(feetPlayerPos_normalized, WsunVec));
|
||||
}
|
||||
#else
|
||||
if (iswater && isEyeInWater == 0){
|
||||
@ -1059,5 +1196,42 @@ void main() {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
//////// DEBUG VIEW STUFF
|
||||
#if DEBUG_VIEW == debug_SHADOWMAP
|
||||
gl_FragData[0].rgb = (shadowMapFalloff > 0.0 ? vec3(1.0,1.0,1.0) : vec3(1.0,0.25,0.25)) * shadowMap ;
|
||||
#endif
|
||||
#if DEBUG_VIEW == debug_NORMALS
|
||||
gl_FragData[0].rgb = normal;
|
||||
#endif
|
||||
#if DEBUG_VIEW == debug_SPECULAR
|
||||
gl_FragData[0].rgb = SpecularTex.rgb;
|
||||
#endif
|
||||
#if DEBUG_VIEW == debug_INDIRECT
|
||||
gl_FragData[0].rgb = Indirect_lighting;
|
||||
#endif
|
||||
#if DEBUG_VIEW == debug_DIRECT
|
||||
gl_FragData[0].rgb = Direct_lighting;
|
||||
#endif
|
||||
#if DEBUG_VIEW == debug_VIEW_POSITION
|
||||
gl_FragData[0].rgb = viewPos;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CLOUDS_INFRONT_OF_WORLD
|
||||
gl_FragData[1] = texture2D(colortex2, texcoord);
|
||||
if(heightRelativeToClouds > 0.0){
|
||||
gl_FragData[0].rgb = gl_FragData[0].rgb * Clouds.a + Clouds.rgb;
|
||||
gl_FragData[1].a = gl_FragData[1].a*Clouds.a*Clouds.a*Clouds.a;
|
||||
}
|
||||
|
||||
/* DRAWBUFFERS:32 */
|
||||
|
||||
#else
|
||||
|
||||
/* DRAWBUFFERS:3 */
|
||||
|
||||
#endif
|
||||
}
|
@ -62,6 +62,40 @@ float ld(float depth) {
|
||||
return (2.0 * near) / (far + near - depth * (far - near)); // (-depth * (far - near)) = (2.0 * near)/ld - far - near
|
||||
}
|
||||
|
||||
// uniform float viewWidth;
|
||||
// uniform float viewHeight;
|
||||
|
||||
// uniform sampler2D depthtex0;
|
||||
uniform sampler2D dhDepthTex;
|
||||
|
||||
// uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 dhProjectionInverse;
|
||||
|
||||
vec3 getViewPos() {
|
||||
ivec2 uv = ivec2(gl_FragCoord.xy);
|
||||
vec2 viewSize = vec2(viewWidth, viewHeight);
|
||||
vec2 texcoord = gl_FragCoord.xy / viewSize;
|
||||
|
||||
vec4 viewPos = vec4(0.0);
|
||||
|
||||
float depth = texelFetch(depthtex0, uv, 0).r;
|
||||
|
||||
if (depth < 1.0) {
|
||||
vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0;
|
||||
viewPos = gbufferProjectionInverse * ndcPos;
|
||||
viewPos.xyz /= viewPos.w;
|
||||
} else {
|
||||
depth = texelFetch(dhDepthTex, ivec2(gl_FragCoord.xy), 0).r;
|
||||
|
||||
vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0;
|
||||
viewPos = dhProjectionInverse * ndcPos;
|
||||
viewPos.xyz /= viewPos.w;
|
||||
}
|
||||
|
||||
return viewPos.xyz;
|
||||
}
|
||||
|
||||
#define linear_to_srgb(x) (pow(x, vec3(1.0/2.2)))
|
||||
void main() {
|
||||
/* DRAWBUFFERS:7 */
|
||||
float vignette = (1.5-dot(texcoord-0.5,texcoord-0.5)*2.);
|
||||
@ -126,6 +160,12 @@ void main() {
|
||||
|
||||
col = mix(lum * vec3(Purkinje_R, Purkinje_G, Purkinje_B) * Purkinje_Multiplier, col, rodCurve);
|
||||
|
||||
|
||||
|
||||
// gl_FragColor = vec4(getViewPos() * 0.001,1.0);
|
||||
// gl_FragColor.rgb = linear_to_srgb(gl_FragColor.rgb);
|
||||
|
||||
|
||||
#ifndef USE_ACES_COLORSPACE_APPROXIMATION
|
||||
col = LinearTosRGB(TONEMAP(col));
|
||||
#else
|
||||
|
@ -6,6 +6,7 @@ flat varying vec3 averageSkyCol;
|
||||
|
||||
uniform sampler2D noisetex;
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D dhDepthTex;
|
||||
|
||||
uniform sampler2D colortex2;
|
||||
uniform sampler2D colortex3;
|
||||
@ -15,7 +16,10 @@ uniform sampler2D colortex6;
|
||||
flat varying vec3 WsunVec;
|
||||
uniform vec3 sunVec;
|
||||
uniform float sunElevation;
|
||||
|
||||
// uniform float far;
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
|
||||
uniform int frameCounter;
|
||||
uniform float frameTimeCounter;
|
||||
@ -27,8 +31,12 @@ uniform vec2 texelSize;
|
||||
uniform int isEyeInWater;
|
||||
uniform float rainStrength;
|
||||
uniform ivec2 eyeBrightnessSmooth;
|
||||
|
||||
uniform float eyeAltitude;
|
||||
|
||||
#define DHVLFOG
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
#include "/lib/color_transforms.glsl"
|
||||
#include "/lib/color_dither.glsl"
|
||||
#include "/lib/projections.glsl"
|
||||
@ -36,8 +44,21 @@ uniform float eyeAltitude;
|
||||
#include "/lib/sky_gradient.glsl"
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
float DH_ld(float dist) {
|
||||
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
}
|
||||
float DH_inv_ld (float lindepth){
|
||||
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
}
|
||||
|
||||
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
}
|
||||
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
|
||||
@ -186,7 +207,11 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
||||
vec3 spPos = start.xyz + dV*d;
|
||||
progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||
//project into biased shadowmap space
|
||||
float distortFactor = calcDistort(spPos.xy);
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
float distortFactor = calcDistort(spPos.xy);
|
||||
#else
|
||||
float distortFactor = 1.0;
|
||||
#endif
|
||||
vec3 pos = vec3(spPos.xy*distortFactor, spPos.z);
|
||||
|
||||
float sh = 1.0;
|
||||
@ -222,11 +247,7 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
||||
inColor += vL;
|
||||
}
|
||||
#endif
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
vec4 blueNoise(vec2 coord){
|
||||
return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ;
|
||||
}
|
||||
@ -234,18 +255,31 @@ vec2 R2_samples(int n){
|
||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||
return fract(alpha * n);
|
||||
}
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
|
||||
void main() {
|
||||
/* DRAWBUFFERS:0 */
|
||||
|
||||
// vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize+0.5*texelSize;
|
||||
vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize+0.5*texelSize;
|
||||
float z = texture2D(depthtex0,tc).x;
|
||||
vec3 viewPos = toScreenSpace(vec3(tc/RENDER_SCALE,z));
|
||||
|
||||
float noise_1 = R2_dither();
|
||||
float noise_2 = blueNoise();
|
||||
|
||||
vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize+0.5*texelSize;
|
||||
|
||||
float z = texture2D(depthtex0,tc).x;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float DH_z = texture2D(dhDepthTex,tc).x;
|
||||
#else
|
||||
float DH_z = 0.0;
|
||||
#endif
|
||||
|
||||
vec3 viewPos = toScreenSpace_DH(tc/RENDER_SCALE, z, DH_z);
|
||||
// vec3 viewPos = toScreenSpace(vec3(tc/RENDER_SCALE,z));
|
||||
|
||||
if (isEyeInWater == 0){
|
||||
|
||||
@ -257,8 +291,6 @@ void main() {
|
||||
vec4 VolumetricFog = GetVolumetricFog(viewPos, noise_1, noise_2);
|
||||
#endif
|
||||
|
||||
// VolumetricFog = vec4(0,0,0,1);
|
||||
|
||||
gl_FragData[0] = clamp(VolumetricFog, 0.0, 65000.0);
|
||||
}
|
||||
|
||||
@ -282,6 +314,7 @@ void main() {
|
||||
|
||||
vec3 vl = vec3(0.0);
|
||||
waterVolumetrics(vl, vec3(0.0), viewPos, estEyeDepth, estEyeDepth, length(viewPos), noise_1, totEpsilon, scatterCoef, ambientColVol, lightColVol*(1.0-pow(1.0-sunElevation*lightCol.a,5.0)) , dot(normalize(viewPos), normalize(sunVec* lightCol.a ) ));
|
||||
|
||||
gl_FragData[0] = clamp(vec4(vl,1.0),0.000001,65000.);
|
||||
#else
|
||||
vec3 fragpos0 = toScreenSpace(vec3(tc,z));
|
||||
@ -289,5 +322,6 @@ void main() {
|
||||
gl_FragData[0].a = 1;
|
||||
waterVolumetrics_notoverworld(gl_FragData[0].rgb, fragpos0, viewPos, 1.0, 1.0, 1.0, blueNoise(), totEpsilon, scatterCoef, ambientColVol);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
@ -1,14 +1,16 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
flat varying vec3 zMults;
|
||||
flat varying vec2 TAA_Offset;
|
||||
|
||||
flat varying vec2 TAA_Offset;
|
||||
flat varying vec3 skyGroundColor;
|
||||
|
||||
uniform sampler2D noisetex;
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D depthtex1;
|
||||
uniform sampler2D depthtex2;
|
||||
uniform sampler2D dhDepthTex;
|
||||
|
||||
|
||||
uniform sampler2D colortex0;
|
||||
uniform sampler2D colortex1;
|
||||
uniform sampler2D colortex2;
|
||||
@ -37,6 +39,9 @@ uniform float frameTimeCounter;
|
||||
uniform int frameCounter;
|
||||
uniform float far;
|
||||
uniform float near;
|
||||
uniform float dhNearPlane;
|
||||
uniform float dhFarPlane;
|
||||
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform mat4 gbufferPreviousModelView;
|
||||
@ -87,8 +92,18 @@ vec3 toScreenSpace(vec3 p) {
|
||||
return fragposition.xyz / fragposition.w;
|
||||
}
|
||||
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
float DH_ld(float dist) {
|
||||
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
}
|
||||
float DH_inv_ld (float lindepth){
|
||||
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
}
|
||||
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
}
|
||||
|
||||
// #include "/lib/specular.glsl"
|
||||
|
||||
|
||||
|
||||
@ -192,6 +207,7 @@ void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, vec2 depths, bool
|
||||
if(DistortedAlpha <= 0.001) Texcoord = UnalteredTexcoord; // remove distortion on non-translucents
|
||||
}
|
||||
|
||||
uniform float dhRenderDistance;
|
||||
uniform float eyeAltitude;
|
||||
|
||||
void main() {
|
||||
@ -204,10 +220,33 @@ void main() {
|
||||
float z2 = texture2D(depthtex1,texcoord).x;
|
||||
float frDepth = ld(z2);
|
||||
|
||||
vec2 tempOffset = TAA_Offset;
|
||||
vec3 fragpos = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z));
|
||||
vec3 fragpos2 = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z2));
|
||||
float swappedDepth = z;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float DH_depth0 = texture2D(dhDepthTex,texcoord).x;
|
||||
#else
|
||||
float DH_depth0 = 0.0;
|
||||
#endif
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float mixedDepth = z;
|
||||
float _near = near;
|
||||
float _far = far*4.0;
|
||||
if (mixedDepth >= 1.0) {
|
||||
mixedDepth = DH_depth0;
|
||||
_near = dhNearPlane;
|
||||
_far = dhFarPlane;
|
||||
}
|
||||
mixedDepth = linearizeDepthFast(mixedDepth, _near, _far);
|
||||
mixedDepth = mixedDepth / dhFarPlane;
|
||||
|
||||
swappedDepth = DH_inv_ld(mixedDepth);
|
||||
if(swappedDepth >= 0.999999) swappedDepth = 1.0;
|
||||
#endif
|
||||
|
||||
vec3 fragpos = toScreenSpace_DH(texcoord/RENDER_SCALE-vec2(TAA_Offset)*texelSize*0.5, z, DH_depth0);
|
||||
|
||||
// vec3 fragpos = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(TAA_Offset)*texelSize*0.5,z));
|
||||
vec3 p3 = mat3(gbufferModelViewInverse) * fragpos;
|
||||
vec3 np3 = normVec(p3);
|
||||
|
||||
@ -223,7 +262,9 @@ void main() {
|
||||
|
||||
vec4 albedo = vec4(unpack0.ba,unpack1.rg);
|
||||
vec2 tangentNormals = unpack0.xy*2.0-1.0;
|
||||
|
||||
if(albedo.a < 0.01) tangentNormals = vec2(0.0);
|
||||
|
||||
vec4 TranslucentShader = texture2D(colortex2, texcoord);
|
||||
|
||||
////// --------------- UNPACK MISC --------------- //////
|
||||
@ -252,9 +293,15 @@ void main() {
|
||||
//////////// and do border fog on opaque and translucents
|
||||
|
||||
#if defined BorderFog
|
||||
float fog = exp(-50.0 * pow(clamp(1.0-linearDistance/far,0.0,1.0),2.0));
|
||||
fog *= exp(-10.0 * pow(clamp(np3.y,0.0,1.0)*4.0,2.0));
|
||||
if(z >= 1.0 || isEyeInWater != 0) fog = 0.0;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float fog = exp(-25.0 * pow(clamp(1.0-linearDistance/max(dhFarPlane-1000,0.0),0.0,1.0),2.0));
|
||||
#else
|
||||
float fog = exp(-50.0 * pow(clamp(1.0-linearDistance/far,0.0,1.0),2.0));
|
||||
#endif
|
||||
|
||||
fog *= exp(-10.0 * pow(clamp(np3.y,0.0,1.0)*4.0,2.0));
|
||||
if(swappedDepth >= 1.0 || isEyeInWater != 0) fog = 0.0;
|
||||
|
||||
if(lightleakfixfast < 1.0) fog *= lightleakfix;
|
||||
|
||||
@ -354,7 +401,7 @@ void main() {
|
||||
color.rgb *= mix(1.0,clamp( exp(pow(linearDistance*(blindness*0.2),2) * -5),0.,1.) , blindness);
|
||||
|
||||
//////// --------------- darkness effect
|
||||
color.rgb *= mix(1.0, (1.0-darknessLightFactor*2.0) * clamp(1.0-pow(length(fragpos2)*(darknessFactor*0.07),2.0),0.0,1.0), darknessFactor);
|
||||
color.rgb *= mix(1.0, (1.0-darknessLightFactor*2.0) * clamp(1.0-pow(length(fragpos)*(darknessFactor*0.07),2.0),0.0,1.0), darknessFactor);
|
||||
|
||||
////// --------------- FINALIZE
|
||||
#ifdef display_LUT
|
||||
|
@ -14,6 +14,8 @@ const int colortex9Format = RGBA8; // rain in alpha
|
||||
const int colortex10Format = RGBA16; // resourcepack Skies
|
||||
const int colortex11Format = RGBA16; // unchanged translucents albedo, alpha and tangent normals
|
||||
|
||||
const int colortex12Format = RGBA16F; // DISTANT HORIZONS + VANILLA MIXED DEPTHs
|
||||
|
||||
const int colortex14Format = RGBA8; // a = skylightmap for translucents.
|
||||
const int colortex15Format = RGBA8; // flat normals and vanilla AO
|
||||
*/
|
||||
@ -36,6 +38,7 @@ const bool colortex13Clear = false;
|
||||
const bool colortex14Clear = true;
|
||||
const bool colortex15Clear = false;
|
||||
|
||||
|
||||
#ifdef SCREENSHOT_MODE
|
||||
/*
|
||||
const int colortex5Format = RGBA32F; //TAA buffer (everything)
|
||||
@ -54,6 +57,7 @@ uniform sampler2D colortex3;
|
||||
uniform sampler2D colortex5;
|
||||
uniform sampler2D colortex6;
|
||||
uniform sampler2D colortex10;
|
||||
uniform sampler2D colortex12;
|
||||
uniform sampler2D depthtex0;
|
||||
|
||||
uniform vec2 texelSize;
|
||||
@ -189,6 +193,30 @@ vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth)
|
||||
|
||||
return dmin;
|
||||
}
|
||||
|
||||
uniform sampler2D dhDepthTex;
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
float DH_ld(float dist) {
|
||||
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
}
|
||||
float DH_inv_ld (float lindepth){
|
||||
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
}
|
||||
uniform mat4 dhProjectionInverse;
|
||||
uniform mat4 dhProjection;
|
||||
vec3 DH_toScreenSpace(vec3 p) {
|
||||
vec4 iProjDiag = vec4(dhProjectionInverse[0].x, dhProjectionInverse[1].y, dhProjectionInverse[2].zw);
|
||||
vec3 feetPlayerPos = p * 2. - 1.;
|
||||
vec4 viewPos = iProjDiag * feetPlayerPos.xyzz + dhProjectionInverse[3];
|
||||
return viewPos.xyz / viewPos.w;
|
||||
}
|
||||
vec3 DH_toClipSpace3(vec3 viewSpacePosition) {
|
||||
return projMAD(dhProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(-1.,3.)/8.,
|
||||
vec2(5.0,1.)/8.,
|
||||
@ -208,7 +236,11 @@ vec4 TAA_hq(){
|
||||
|
||||
//use velocity from the nearest texel from camera in a 3x3 box in order to improve edge quality in motion
|
||||
#ifdef CLOSEST_VELOCITY
|
||||
vec3 closestToCamera = closestToCamera5taps(adjTC, depthtex0);
|
||||
#ifdef DISTANT_HORIZONS
|
||||
vec3 closestToCamera = closestToCamera5taps(adjTC, texture2D(depthtex0,adjTC).x < 1.0 ? depthtex0 : dhDepthTex);
|
||||
#else
|
||||
vec3 closestToCamera = closestToCamera5taps(adjTC, depthtex0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CLOSEST_VELOCITY
|
||||
@ -216,7 +248,12 @@ vec4 TAA_hq(){
|
||||
#endif
|
||||
|
||||
//reproject previous frame
|
||||
vec3 viewPos = toScreenSpace(closestToCamera);
|
||||
#ifdef DISTANT_HORIZONS
|
||||
vec3 viewPos = DH_toScreenSpace(closestToCamera);
|
||||
#else
|
||||
vec3 viewPos = toScreenSpace(closestToCamera);
|
||||
#endif
|
||||
|
||||
viewPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz + (cameraPosition - previousCameraPosition);
|
||||
|
||||
vec3 previousPosition = mat3(gbufferPreviousModelView) * viewPos + gbufferPreviousModelView[3].xyz;
|
||||
|
@ -68,8 +68,53 @@ float blueNoise(){
|
||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||
}
|
||||
|
||||
#define DHVLFOG
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
vec3 toScreenSpace(vec3 p) {
|
||||
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
|
||||
vec3 feetPlayerPos = p * 2. - 1.;
|
||||
vec4 viewPos = iProjDiag * feetPlayerPos.xyzz + gbufferProjectionInverse[3];
|
||||
return viewPos.xyz / viewPos.w;
|
||||
}
|
||||
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
vec3 DH_toScreenSpace(vec3 p) {
|
||||
vec4 iProjDiag = vec4(dhProjectionInverse[0].x, dhProjectionInverse[1].y, dhProjectionInverse[2].zw);
|
||||
vec3 feetPlayerPos = p * 2. - 1.;
|
||||
vec4 viewPos = iProjDiag * feetPlayerPos.xyzz + dhProjectionInverse[3];
|
||||
return viewPos.xyz / viewPos.w;
|
||||
}
|
||||
|
||||
vec3 DH_toClipSpace3(vec3 viewSpacePosition) {
|
||||
return projMAD(dhProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
// float DH_ld(float dist) {
|
||||
// return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
// }
|
||||
// float DH_invLinZ (float lindepth){
|
||||
// return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
// }
|
||||
|
||||
float DH_ld(float dist) {
|
||||
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
}
|
||||
float DH_inv_ld (float lindepth){
|
||||
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
}
|
||||
|
||||
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
}
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
|
||||
// uniform sampler2D colortex12;
|
||||
// const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
@ -88,7 +133,18 @@ float blueNoise(){
|
||||
uniform sampler2D colortex4;
|
||||
#include "/lib/end_fog.glsl"
|
||||
#endif
|
||||
vec3 rodSample(vec2 Xi)
|
||||
{
|
||||
float r = sqrt(1.0f - Xi.x*Xi.y);
|
||||
float phi = 2 * 3.14159265359 * Xi.y;
|
||||
|
||||
return normalize(vec3(cos(phi) * r, sin(phi) * r, Xi.x)).xzy;
|
||||
}
|
||||
//Low discrepancy 2D sequence, integration error is as low as sobol but easier to compute : http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/
|
||||
vec2 R2_samples(float n){
|
||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||
return fract(alpha * n);
|
||||
}
|
||||
|
||||
void main() {
|
||||
/* DRAWBUFFERS:4 */
|
||||
@ -195,9 +251,14 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
||||
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*1.75, skyGroundCol/30.0);
|
||||
sky = sky*clouds.a + clouds.rgb / 5.0;
|
||||
|
||||
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), lightSourceColor*1.75, skyGroundCol/30.0);
|
||||
// vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), lightSourceColor*1.75, skyGroundCol/30.0);
|
||||
vec4 VL_Fog = DH_GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), lightSourceColor*1.75, skyGroundCol/30.0);
|
||||
|
||||
sky = sky * VL_Fog.a + VL_Fog.rgb / 5.0;
|
||||
|
||||
|
||||
// if(p.y < 0.05) sky = averageSkyCol_Clouds;
|
||||
|
||||
gl_FragData[0] = vec4(sky,1.0);
|
||||
}
|
||||
#endif
|
||||
|
@ -51,7 +51,13 @@ vec3 sunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||
float luma(vec3 color) {
|
||||
return dot(color,vec3(0.21, 0.72, 0.07));
|
||||
}
|
||||
vec3 rodSample(vec2 Xi)
|
||||
{
|
||||
float r = sqrt(1.0f - Xi.x*Xi.y);
|
||||
float phi = 2 * 3.14159265359 * Xi.y;
|
||||
|
||||
return normalize(vec3(cos(phi) * r, sin(phi) * r, Xi.x)).xzy;
|
||||
}
|
||||
//Low discrepancy 2D sequence, integration error is as low as sobol but easier to compute : http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/
|
||||
vec2 R2_samples(int n){
|
||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||
@ -98,20 +104,20 @@ void main() {
|
||||
);
|
||||
|
||||
// sample in a 3x3 pattern to get a good area for average color
|
||||
vec3 pos = normalize(vec3(0,1,0));
|
||||
|
||||
int maxIT = 9;
|
||||
// int maxIT = 20;
|
||||
for (int i = 0; i < maxIT; i++) {
|
||||
pos = normalize(vec3(0,1,0));
|
||||
pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.90);
|
||||
vec3 pos = vec3(0.0,1.0,0.0);
|
||||
pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.9000);
|
||||
|
||||
averageSkyCol_Clouds += 1.5*skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.;
|
||||
|
||||
averageSkyCol += 1.5*skyFromTex(pos,colortex4).rgb/maxIT/150.;
|
||||
averageSkyCol_Clouds += 1.5 * (skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.0);
|
||||
averageSkyCol += 1.5 * (skyFromTex(pos,colortex4).rgb/maxIT/150.0);
|
||||
}
|
||||
|
||||
// only need to sample one spot for this
|
||||
vec3 minimumlight = vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.003 + nightVision);
|
||||
averageSkyCol_Clouds = max(averageSkyCol_Clouds, minimumlight);
|
||||
averageSkyCol_Clouds = max(averageSkyCol_Clouds * (1.0/(luma(averageSkyCol_Clouds)*0.25+0.75)), minimumlight);
|
||||
averageSkyCol = max(averageSkyCol*PLANET_GROUND_BRIGHTNESS, minimumlight);
|
||||
|
||||
////////////////////////////////////////
|
||||
|
@ -1,8 +1,14 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
uniform sampler2D colortex4;
|
||||
uniform sampler2D colortex12;
|
||||
|
||||
uniform vec2 texelSize;
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D depthtex1;
|
||||
uniform sampler2D depthtex2;
|
||||
|
||||
uniform sampler2D dhDepthTex;
|
||||
uniform sampler2D dhDepthTex1;
|
||||
|
||||
uniform float near;
|
||||
uniform float far;
|
||||
@ -11,6 +17,18 @@ float linZ(float depth) {
|
||||
return (2.0 * near) / (far + near - depth * (far - near));
|
||||
}
|
||||
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
float DH_ld(float dist) {
|
||||
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
}
|
||||
float DH_invLinZ (float lindepth){
|
||||
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
}
|
||||
|
||||
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
}
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
@ -18,12 +36,44 @@ float linZ(float depth) {
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
void main() {
|
||||
/* DRAWBUFFERS:4 */
|
||||
/* RENDERTARGETS:4,12 */
|
||||
vec3 oldTex = texelFetch2D(colortex4, ivec2(gl_FragCoord.xy), 0).xyz;
|
||||
|
||||
float newTex = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x;
|
||||
|
||||
if (newTex < 1.0)
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float QuarterResDepth = texelFetch2D(dhDepthTex, ivec2(gl_FragCoord.xy*4), 0).x;
|
||||
if(newTex >= 1.0) newTex = QuarterResDepth;
|
||||
#endif
|
||||
|
||||
if (newTex < 1.0)
|
||||
gl_FragData[0] = vec4(oldTex, linZ(newTex)*linZ(newTex)*65000.0);
|
||||
else
|
||||
else
|
||||
gl_FragData[0] = vec4(oldTex, 2.0);
|
||||
|
||||
float depth = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float _near = near;
|
||||
float _far = far*4.0;
|
||||
if (depth >= 1.0) {
|
||||
depth = texelFetch2D(dhDepthTex1, ivec2(gl_FragCoord.xy*4), 0).x;
|
||||
_near = dhNearPlane;
|
||||
_far = dhFarPlane;
|
||||
}
|
||||
|
||||
depth = linearizeDepthFast(depth, _near, _far);
|
||||
depth = depth / dhFarPlane;
|
||||
#endif
|
||||
|
||||
if(depth < 1.0)
|
||||
gl_FragData[1] = vec4(vec3(0.0), depth * depth * 65000.0);
|
||||
else
|
||||
gl_FragData[1] = vec4(vec3(0.0), 65000.0);
|
||||
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
gl_FragData[1].a = DH_ld(QuarterResDepth)*DH_ld(QuarterResDepth)*65000.0;
|
||||
#endif
|
||||
}
|
@ -14,9 +14,12 @@ flat varying float tempOffsets;
|
||||
// uniform float far;
|
||||
uniform float near;
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D dhDepthTex;
|
||||
// uniform sampler2D colortex4;
|
||||
uniform sampler2D noisetex;
|
||||
|
||||
uniform sampler2D colortex12;
|
||||
|
||||
flat varying vec3 WsunVec;
|
||||
uniform vec3 sunVec;
|
||||
uniform vec2 texelSize;
|
||||
@ -71,12 +74,39 @@ vec3 normVec (vec3 vec){
|
||||
return vec*inversesqrt(dot(vec,vec));
|
||||
}
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
uniform mat4 dhPreviousProjection;
|
||||
uniform mat4 dhProjectionInverse;
|
||||
uniform mat4 dhProjection;
|
||||
|
||||
vec3 DH_toScreenSpace(vec3 p) {
|
||||
vec4 iProjDiag = vec4(dhProjectionInverse[0].x, dhProjectionInverse[1].y, dhProjectionInverse[2].zw);
|
||||
vec3 feetPlayerPos = p * 2. - 1.;
|
||||
vec4 viewPos = iProjDiag * feetPlayerPos.xyzz + dhProjectionInverse[3];
|
||||
return viewPos.xyz / viewPos.w;
|
||||
}
|
||||
|
||||
vec3 DH_toClipSpace3(vec3 viewSpacePosition) {
|
||||
return projMAD(dhProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
float DH_ld(float dist) {
|
||||
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
}
|
||||
float DH_inv_ld (float lindepth){
|
||||
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
}
|
||||
|
||||
#include "/lib/lightning_stuff.glsl"
|
||||
|
||||
#include "/lib/sky_gradient.glsl"
|
||||
#include "/lib/volumetricClouds.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
@ -91,7 +121,7 @@ void main() {
|
||||
#ifdef VOLUMETRIC_CLOUDS
|
||||
vec2 halfResTC = vec2(floor(gl_FragCoord.xy)/CLOUDS_QUALITY/RENDER_SCALE+0.5+offsets[framemod8]*CLOUDS_QUALITY*RENDER_SCALE*0.5);
|
||||
|
||||
vec3 viewPos = toScreenSpace(vec3(halfResTC*texelSize,1));
|
||||
vec3 viewPos = toScreenSpace(vec3(halfResTC*texelSize,1.0));
|
||||
|
||||
vec4 VolumetricClouds = renderClouds(viewPos, vec2(R2_dither(),blueNoise2()), sunColor/80.0, averageSkyCol/30.0);
|
||||
|
||||
|
@ -6,9 +6,10 @@ uniform sampler2D colortex7;
|
||||
uniform vec2 texelSize;
|
||||
uniform float frameTimeCounter;
|
||||
|
||||
// uniform sampler2D shadowcolor0;
|
||||
// uniform sampler2D shadowtex0;
|
||||
// uniform sampler2D shadowtex1;
|
||||
uniform sampler2D shadowcolor0;
|
||||
uniform sampler2D shadowcolor1;
|
||||
uniform sampler2D shadowtex0;
|
||||
uniform sampler2D shadowtex1;
|
||||
|
||||
#include "/lib/color_transforms.glsl"
|
||||
#include "/lib/color_dither.glsl"
|
||||
@ -162,4 +163,9 @@ void main() {
|
||||
applyContrast(FINAL_COLOR, CONTRAST); // for fun
|
||||
|
||||
gl_FragColor.rgb = FINAL_COLOR;
|
||||
|
||||
|
||||
// vec2 texrood = texcoord * vec2(2.0, 1.0) - vec2(1.0, 0.0);
|
||||
// if(texcoord.x > 0.5) gl_FragColor.rgb = texture2D(shadowcolor0, texrood).rgb;
|
||||
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ screen.Direct_Light = Direct Light
|
||||
option.shadowDistanceRenderMul = Max Shadow Bounds
|
||||
value.shadowDistanceRenderMul.-1.0 = Un-Optimized
|
||||
value.shadowDistanceRenderMul.1.0 = Optimized
|
||||
option.entityShadowDistanceMul = Entity Shadow Distance
|
||||
|
||||
screen.Filtering = Shadow Filtering Settings
|
||||
option.SHADOW_FILTER_SAMPLE_COUNT = Basic Shadow Filter Samples
|
||||
option.Min_Shadow_Filter_Radius = Minimum Shadow filter Radius
|
||||
@ -447,7 +449,7 @@ screen.Clouds.comment = Configure settings related to the raymarched volumetric
|
||||
|
||||
screen.World.comment = Configure settings for various things that happen in the world, from waving plants to water related settings.
|
||||
screen.Water.comment = Configure settings related to the water.
|
||||
option.WATER_REFLECTIONS.comments = Toggle all reflections for translucent things. This allows other settings to be enabled below. §aPERFORMANCE COST:§r low
|
||||
option.WATER_REFLECTIONS.comment = Toggle all reflections for translucent things. This allows other settings to be enabled below. §aPERFORMANCE COST:§r low-high
|
||||
option.SCREENSPACE_REFLECTIONS.comment = Toggle screen-space reflections on translucent things. §aPERFORMANCE COST:§r medium
|
||||
option.SSR_STEPS.comment = Configure the quality of the screen-space reflections on translucent things. §aPERFORMANCE COST:§r medium to high
|
||||
option.WATER_SUN_SPECULAR.comment = Toggle the sun and moon reflections on translucent things. §aPERFORMANCE COST:§r low
|
||||
@ -526,3 +528,4 @@ option.CloudLayer2_height.comment = Configure the height at which these clouds
|
||||
|
||||
option.SKY_GROUND.comment = §bWhat is this?§r This is the dark bottom half of the sky that WOULD be the ground, if minecraft had infinite render distance. §aPERFORMANCE COST:§r very very low. §cdisabling this is very slightly slower than having it on due to extra math.§r
|
||||
option.SNELLS_WINDOW.comment = §bWhat is this?§r this is the dark reflective circle you see when under-water. This is an approximation of a thing that happens in reality known as "total internal reflection". §aPERFORMANCE COST:§r very very very small.
|
||||
option.entityShadowDistanceMul.comment = §bWhat is this?§r Configure how far shadows should work for entities. This is good if you want to keep entity shadows and improved performance in high entity areas.
|
@ -1,8 +1,23 @@
|
||||
option.BLISS_SHADERS=Bliss
|
||||
value.BLISS_SHADERS.0=A Chocapic13 Edit
|
||||
value.BLISS_SHADERS.1=作者: Xonk
|
||||
value.BLISS_SHADERS.2=版本: GIT-HEAD
|
||||
|
||||
# if you're here to translate, this is a joke, these don't do what they say. # Translator: I don't care
|
||||
profile.QUALITY=质量
|
||||
profile.PERFORMANCE=性能
|
||||
|
||||
screen.Misc_Settings = 杂项
|
||||
screen.Sun_and_Moon_Colors = 日月颜色
|
||||
option.sunPathRotation = 太阳角度
|
||||
option.sun_illuminance = 阳光照度
|
||||
option.moon_illuminance = 月光照度
|
||||
option.MOONPHASE_BASED_MOONLIGHT = 月相亮度水平
|
||||
|
||||
option.RESOURCEPACK_SKY = 资源包天空
|
||||
value.RESOURCEPACK_SKY.0 = 别用这个
|
||||
value.RESOURCEPACK_SKY.1 = 天空 + 光影日月
|
||||
value.RESOURCEPACK_SKY.2 = 完整天空
|
||||
|
||||
screen.Waving_Stuff = 摇晃相关
|
||||
option.WAVY_PLANTS = 植物摇晃
|
||||
@ -11,8 +26,8 @@ screen.Waving_Stuff = 摇晃相关
|
||||
|
||||
screen.Direct_Light = 直接照明
|
||||
screen.Shadows = 阴影
|
||||
option.RENDER_ENTITY_SHADOWS = 实体阴影
|
||||
option.SCREENSPACE_CONTACT_SHADOWS = 屏幕空间接触阴影
|
||||
option.RENDER_ENTITY_SHADOWS = 实体阴影
|
||||
option.shadowMapResolution = 阴影分辨率
|
||||
option.shadowDistance = 阴影距离
|
||||
value.shadowDistance.64.0 = 4 区块
|
||||
@ -45,7 +60,7 @@ screen.Direct_Light = 直接照明
|
||||
value.shadowDistance.496.0 = 31 区块
|
||||
value.shadowDistance.512.0 = 32 区块
|
||||
option.shadowDistanceRenderMul = 最大阴影边界
|
||||
value.shadowDistanceRenderMul.-1.0 = 无 - 优化
|
||||
value.shadowDistanceRenderMul.-1.0 = 无优化
|
||||
value.shadowDistanceRenderMul.1.0 = 优化
|
||||
screen.Filtering = 阴影过滤设置
|
||||
option.SHADOW_FILTER_SAMPLE_COUNT = 阴影过滤采样数
|
||||
@ -55,6 +70,7 @@ screen.Direct_Light = 直接照明
|
||||
option.Max_Shadow_Filter_Radius = 最大阴影过滤半径
|
||||
option.Max_Filter_Depth = 最大过滤深度
|
||||
|
||||
|
||||
screen.Subsurface_Scattering = 次表面散射 (SSS)
|
||||
option.LabSSS_Curve = LabSSS 曲线
|
||||
option.MISC_BLOCK_SSS = 随机方块次表面散射
|
||||
@ -73,6 +89,7 @@ screen.Ambient_light = 环境光
|
||||
option.GI_Strength = 全局照明强度
|
||||
option.HQ_SSGI = 远距 SSGI
|
||||
option.Hand_Held_lights = 手持光源
|
||||
option.SKY_CONTRIBUTION_IN_SSRT = 高质量环境光
|
||||
option.ambientOcclusionLevel = 原版 AO 强度
|
||||
option.ambient_brightness = 环境光照明亮度
|
||||
option.MIN_LIGHT_AMOUNT = 最小照明强度
|
||||
@ -104,7 +121,7 @@ screen.Fog = 雾气设置
|
||||
option.BLOOMY_FOG = 雾气泛化值
|
||||
option.Haze_amount = 大气雾霾密度
|
||||
option.RainFog_amount = 雨雾密度
|
||||
option.RAYMARCH_CLOUDS_WITH_FOG = 云中雾
|
||||
option.RAYMARCH_CLOUDS_WITH_FOG = 将云作为雾气渲染
|
||||
option.BorderFog = 边界雾
|
||||
|
||||
screen.TOD_fog = 全天雾气
|
||||
@ -118,15 +135,18 @@ screen.Fog = 雾气设置
|
||||
option.Night_Uniform_Fog = 夜晚 - 雾气密度
|
||||
option.Night_Cloudy_Fog =夜 晚 - 云雾密度
|
||||
|
||||
option.PER_BIOME_ENVIRONMENT = 生物群系特定雾气
|
||||
option.PER_BIOME_ENVIRONMENT = 群系特色环境
|
||||
|
||||
screen.Cave_Fog = 洞穴雾气
|
||||
option.CAVE_FOG = 洞穴雾气
|
||||
option.Cave_fog = 洞穴雾气
|
||||
option.CaveFogFallOff = 洞穴雾气渐消曲线
|
||||
option.CaveFogColor_R = 洞穴雾气红色比重
|
||||
option.CaveFogColor_G = 洞穴雾气绿色比重
|
||||
option.CaveFogColor_B = 洞穴雾气蓝色比重
|
||||
|
||||
screen.END_AND_NETHER_FOG = 下界/末地雾气
|
||||
option.END_STORM_DENSTIY = 末地风暴强度
|
||||
option.NETHER_PLUME_DENSITY = 下界烟柱密度
|
||||
|
||||
screen.Clouds = 云层设置
|
||||
option.VOLUMETRIC_CLOUDS = 体积云
|
||||
@ -136,14 +156,20 @@ screen.Clouds = 云层设置
|
||||
option.Cloud_Speed = 云层速度
|
||||
option.Rain_coverage = 雨云覆盖率
|
||||
|
||||
option.Cumulus = 积云
|
||||
option.Cumulus_coverage = 积云覆盖率
|
||||
option.Cumulus_density = 积云密度
|
||||
option.Cumulus_height = 积云高度
|
||||
option.CloudLayer0 = 小积云
|
||||
option.CloudLayer0_coverage = 覆盖率
|
||||
option.CloudLayer0_density = 密度
|
||||
option.CloudLayer0_height = 高度
|
||||
|
||||
option.Altostratus = 高层云
|
||||
option.Alto_coverage = 高层云覆盖率
|
||||
option.Alto_density = 高层云密度
|
||||
option.CloudLayer1 = 大积云
|
||||
option.CloudLayer1_coverage = 覆盖率
|
||||
option.CloudLayer1_density = 密度
|
||||
option.CloudLayer1_height = 高度
|
||||
|
||||
option.CloudLayer2 = 高层云
|
||||
option.CloudLayer2_coverage = 覆盖率
|
||||
option.CloudLayer2_density = 密度
|
||||
option.CloudLayer2_height = 高度
|
||||
|
||||
|
||||
screen.Climate = 气候
|
||||
@ -187,6 +213,29 @@ screen.Climate = 气候
|
||||
option.Spring_Leaf_G = 树叶 - 绿
|
||||
option.Spring_Leaf_B = 树叶 - 蓝
|
||||
|
||||
screen.SWAMP = 沼泽
|
||||
option.SWAMP_ENV = 沼泽环境
|
||||
option.SWAMP_UNIFORM_DENSITY = 均匀雾气密度
|
||||
option.SWAMP_CLOUDY_DENSITY = 云雾密度
|
||||
option.SWAMP_R = 红色比重
|
||||
option.SWAMP_G = 绿色比重
|
||||
option.SWAMP_B = 蓝色比重
|
||||
|
||||
screen.JUNGLE = 丛林
|
||||
option.JUNGLE_ENV = 丛林环境
|
||||
option.JUNGLE_UNIFORM_DENSITY = 均匀雾气密度
|
||||
option.JUNGLE_CLOUDY_DENSITY = 云雾密度
|
||||
option.JUNGLE_R = 红色比重
|
||||
option.JUNGLE_G = 绿色比重
|
||||
option.JUNGLE_B = 蓝色比重
|
||||
|
||||
screen.DARKFOREST = 黑森林
|
||||
option.DARKFOREST_ENV = 黑森林环境
|
||||
option.DARKFOREST_UNIFORM_DENSITY = 均匀雾气密度
|
||||
option.DARKFOREST_CLOUDY_DENSITY = 均匀雾气密度
|
||||
option.DARKFOREST_R = 红色比重
|
||||
option.DARKFOREST_G = 绿色比重
|
||||
option.DARKFOREST_B = 蓝色比重
|
||||
|
||||
screen.World = 世界
|
||||
screen.Water = 水体设置
|
||||
@ -198,6 +247,8 @@ screen.World = 世界
|
||||
option.Refraction = 折射 (水体/玻璃)
|
||||
option.Dirt_Amount = 水体浑浊程度
|
||||
option.Water_Top_Layer = 海平面 Y 轴坐标
|
||||
option.WATER_WAVE_STRENGTH = 水波强度
|
||||
option.SNELLS_WINDOW = 斯涅尔窗 (Snell's Window)
|
||||
|
||||
screen.Water_fog_color = 水雾设置
|
||||
option.Dirt_Scatter_R = 红色扩散 (污物)
|
||||
@ -216,7 +267,7 @@ screen.Post_Processing = 后期处理
|
||||
screen.Exposure = 曝光
|
||||
screen.DepthOfField = 景深 (DOF)
|
||||
screen.Purkinje_effect = 柏金赫现象设置
|
||||
option.SHARPENING = 对比度自适应锐化强度
|
||||
option.SHARPENING = 锐化强度
|
||||
option.BLOOM_STRENGTH = 泛光强度
|
||||
screen.TAA_OPTIONS = 抗锯齿设置
|
||||
option.SCREENSHOT_MODE = 截图模式
|
||||
@ -248,6 +299,7 @@ screen.LabPBR = Lab PBR
|
||||
|
||||
|
||||
screen.POM = 视差遮蔽映射 (POM)
|
||||
option.HEIGTHMAP_DEPTH_OFFSET = 基于高度图的深度偏移
|
||||
option.POM = 视差 (POM)
|
||||
option.MAX_ITERATIONS = 视差质量
|
||||
option.POM_DEPTH = 视差深度
|
||||
@ -261,6 +313,7 @@ screen.Porosity = 孔隙率/水坑
|
||||
option.Puddles = 水坑
|
||||
option.Puddle_Size = 水坑大小
|
||||
|
||||
option.MATERIAL_AO = 材质环境光遮蔽
|
||||
|
||||
option.DOF_QUALITY=景深 (DOF)
|
||||
value.DOF_QUALITY.-1=关闭
|
||||
@ -281,7 +334,6 @@ option.DOF_QUALITY=景深 (DOF)
|
||||
value.FOCUS_LASER_COLOR.4=黄
|
||||
value.FOCUS_LASER_COLOR.5=白
|
||||
|
||||
|
||||
option.AEROCHROME_MODE=Aerochrome 模式
|
||||
option.AEROCHROME_PINKNESS=Aerochrome 模式 红色: 粉色 比例
|
||||
option.AEROCHROME_WOOL_ENABLED=Aerochrome 模式作用于羊毛
|
||||
@ -307,6 +359,7 @@ screen.Shadows.comment = 根据喜好配置阳光的阴影.
|
||||
option.RENDER_ENTITY_SHADOWS.comment = §b这啥?§r 所有类型实体的阴影, 例如怪物, 箱子, 旗帜, 或者告示牌. §a性能消耗水平:§r 低偏中; 在近处有特别多实体的时候消耗的性能会非常的恐怖.
|
||||
option.shadowMapResolution.comment = 在太阳照射下从世界上的事物投射出来阴影的质量. §a性能消耗水平:§r 中或更高; 阴影需要从太阳的角度进行第二次 3D 世界的渲染, 这就是为什么它会使性能减半.
|
||||
option.shadowDistance.comment = 阴影可渲染的最大距离 (这不是线性距离). 推荐保持默认, 因为接触阴影能解决远处阴影的渲染需求. §a性能消耗水平:§r 中或更高; 如果渲染距离非常大, 阴影的性能开销会很恐怖.
|
||||
option.shadowDistanceRenderMul.comment = 仅在围绕以玩家为中心的球体中渲染的阴影, 最大渲染区块由渲染距离进行限制. 无优化选项不会以球体渲染阴影, 且不会被区块限制; 这意味着同样的渲染距离下阴影能覆盖更大的区域. 同样的, 设置为 无优化 时阴影距离不受区块限制. §a性能消耗水平:§r 低偏中. 优化选项更快, 无优化选项更慢.
|
||||
screen.Filtering.comment = 配置作用于阴影的过滤效果.
|
||||
option.SHADOW_FILTER_SAMPLE_COUNT.comment = 基础阴影过滤器质量. 过滤器仅用于软化阴影. §a性能消耗水平:§r 低偏中; 拉高本选项数值可以减少阴影边缘的噪点.
|
||||
option.Min_Shadow_Filter_Radius.comment = 基础阴影过滤器的最大软化程度.
|
||||
@ -320,10 +373,12 @@ screen.Ambient_light.comment = 配置和遮蔽处的照明相关的设置.
|
||||
option.GI_Strength.comment = 配置由 SSGI 渲染的全局照明强度. §b这啥?§r 在该情况下, 全局照明是指光线从一个表面反弹到其他区域的现象.
|
||||
option.HQ_SSGI.comment = 远距屏幕空间全局照明开关. §a性能消耗水平:§r 非常高.
|
||||
option.Hand_Held_lights.comment = 动态手持光源 (光影实现) 开关. §a性能消耗水平:§r 非常低.
|
||||
option.SKY_CONTRIBUTION_IN_SSRT.comment = 允许 RTAO 或 SSGI 计算考虑整个天空和雾气来在遮蔽处创建高质量照明. 但会带来更多噪点. §a性能消耗水平:§r 中
|
||||
|
||||
option.ambientOcclusionLevel.comment = 配置原版 Minecraft 的环境光遮蔽强度. §b这啥?§r 原版下该环境光遮蔽默认开启, 无关光影是否开启.
|
||||
option.ambient_brightness.comment = 配置阴影区域的其他光源照明的亮度.
|
||||
option.MIN_LIGHT_AMOUNT.comment = 配置阴影区域的最小照明水平.
|
||||
option.indirect_effect.comment = 切换不同类型的间接照明效果使阴影区域渲染质量更好. §a性能消耗水平S:§r. 原版 AO: 非常低. SSAO: 低偏中. GTAO: 中偏高. RTAO or SSGI: 高或更高.
|
||||
option.indirect_effect.comment = 切换不同类型的间接照明效果使阴影区域渲染质量更好. §a性能消耗水平:§r. 原版 AO: 非常低. SSAO: 低偏中. GTAO: 中偏高. RTAO or SSGI: 高或更高.
|
||||
|
||||
screen.Ambient_Colors.comment = 配置阴影区域的照明颜色.
|
||||
screen.Torch_Colors.comment = 配置火把或其它可放置光源的颜色.
|
||||
@ -352,6 +407,7 @@ screen.Emissives.comment = §b这啥?§r 自发光亮度是指某方块发光量
|
||||
option.Emissive_Curve.comment = 调整自发光纹理达到最高亮度的容易程度/速度. 1.0 是线性.
|
||||
|
||||
screen.POM.comment = 配置由资源包提供信息的视差遮蔽映射的相关设置.
|
||||
option.HEIGTHMAP_DEPTH_OFFSET.comment = §b这啥?§r 使用资源包提供的 “高度图” 的偏移抵消许多效果所需的深度. 允许近处有更多细节, 同时作为 “POM 的性能预算” 而生效. §a性能消耗水平:§r 低偏中 - 如果设备负担不起了 POM 的性能消耗, 可使用本选项.
|
||||
option.POM.comment = §b这啥?§r 通过使用资源包中的特殊图像, 在实际没有的区域渲染出 3D 几何图形. 这种效果基本上只向内凹, 所以大角度观察时, 会存在一些伪影. §a性能消耗水平:§r 中偏高.
|
||||
option.MAX_ITERATIONS.comment = 配置视差效果的质量. 如果近距离仅看到了部分层, 则需要提高本项数值, 不然很难看到. §a性能消耗水平:§r 高.
|
||||
option.POM_DEPTH.comment = 视差效果表面凹陷程度. §a性能消耗水平:§r 非常低.
|
||||
@ -370,14 +426,12 @@ screen.Fog.comment = 配置和光线行进体积雾, 基于距离的雾气相关
|
||||
option.BLOOMY_FOG.comment = 配置作用于雾气的泛化强度. §b这啥?§r 本选项的效果使雾气看起来更柔和, 同时有助于隐藏部分噪点. 但可能会导致在细节边缘出现一些明显的闪烁. §a性能消耗水平:§r 非常低.
|
||||
option.Haze_amount.comment = 配置周遭的大气密度. §b这啥?§r 在远处看到的蓝色雾霾.
|
||||
option.RainFog_amount.comment = 配置雨天时的雾气密度.
|
||||
option.RAYMARCH_CLOUDS_WITH_FOG.comment = 进入云层内或靠近云层周围时, 更细致的雾气的开关. §a性能消耗水平:§r 低偏中.
|
||||
option.BorderFog.comment = 隐藏未加载区块的雾气开关.
|
||||
option.RAYMARCH_CLOUDS_WITH_FOG.comment = 进入云层内或靠近云层周围时, 更细致的雾气的开关. §a性能消耗水平:§r 中偏高.
|
||||
option.BorderFog.comment = §b这啥?§r 雾气开关, 目的是尝试隐藏区块边界. 但因为四周都是天空, 所以很难做好. §a性能消耗水平:§r 非常非常低.
|
||||
|
||||
screen.TOD_fog.comment = 配置一天中特定时间出现的雾气的密度.
|
||||
option.TOD_Fog_mult.comment = 配置一天中特定时间出现的总体雾气量. 本选项不影响大气雾霾密度.
|
||||
|
||||
option.PER_BIOME_ENVIRONMENT.comment = 特定群系的特殊雾气效果开关. §a性能消耗水平:§r 低.
|
||||
|
||||
screen.Cave_Fog.comment = 配置仅出现在黑暗区域的雾气设置, 例如洞穴.
|
||||
option.Cave_Fog.comment = 仅出现在黑暗区域的雾气. 因为光影不可能准确地判断出你是否在一个洞穴里, 所以这种雾气可能会出现在不是洞穴的地方. §a性能消耗水平:§r 低.
|
||||
option.CaveFogFallOff.comment = 配置雾化淡出梯度达到最亮部分的容易程度/速度.
|
||||
@ -390,18 +444,9 @@ screen.Clouds.comment = 配置和光线步进体积云相关的设置.
|
||||
option.Cloud_Speed.comment = 配置日常时间云层的移动速度.
|
||||
option.Rain_coverage.comment = 配置雨天时云层的覆盖率.
|
||||
|
||||
option.Cumulus.comment = 低层云开关. §a性能消耗水平:§r 中.
|
||||
option.Cumulus_coverage.comment = 配置低层云的天空覆盖率. 本选项在周期循环的天气启用时不生效.
|
||||
option.Cumulus_density.comment = 配置低层云的密度.
|
||||
option.Cumulus_height.comment = 配置低层云的高度.
|
||||
|
||||
option.Altostratus.comment = 高层云开关. §a性能消耗水平:§r 低.
|
||||
option.Alto_coverage.comment = 配置高层云的天空覆盖率. 本选项在周期循环的天气启用时不生效.
|
||||
option.Alto_density.comment = 配置高层云的密度.
|
||||
|
||||
screen.World.comment = 配置多种会在主世界发生的效果, 从摇摆植物到水体相关的设置等.
|
||||
screen.Water.comment = 配置和水体相关的设置.
|
||||
option.WATER_REFLECTIONS.comments = 所有半透明方块反射的开关. 本选项允许以下其它设置启用. §a性能消耗水平:§r 低.
|
||||
option.WATER_REFLECTIONS.comment = 所有半透明方块反射的开关. 本选项允许以下其它设置启用. §a性能消耗水平:§r 低.
|
||||
option.SCREENSPACE_REFLECTIONS.comment = 半透明方块的屏幕空间反射开关. §a性能消耗水平:§r 中.
|
||||
option.SSR_STEPS.comment = 配置半透明方块的屏幕空间反射质量. §a性能消耗水平:§r 中偏高.
|
||||
option.WATER_SUN_SPECULAR.comment = 半透明方块的日月反射开关. §a性能消耗水平:§r 低.
|
||||
@ -422,6 +467,18 @@ screen.Climate.comment = 配置和气候相关的设置, 例如四季颜色, 周
|
||||
screen.Winter_colors.comment = 配置冬季植被的颜色.
|
||||
screen.Spring_colors.comment = 配置春季植被的颜色.
|
||||
|
||||
option.PER_BIOME_ENVIRONMENT.comment = 开关仅出现在特定群系的所有特色环境效果. §a性能消耗水平:§r 低.
|
||||
|
||||
screen.SWAMP.comment = 配置此群系类型的环境效果.
|
||||
option.SWAMP_ENV.comment = 开关此群系类型的环境效果. 即使此项禁用, 其他群系的环境效果仍保持激活状态..
|
||||
|
||||
screen.JUNGLE.comment = 配置此群系类型的环境效果.
|
||||
option.JUNGLE_ENV.comment = 开关此群系类型的环境效果. 即使此项禁用, 其他群系的环境效果仍保持激活状态..
|
||||
|
||||
screen.DARKFOREST.comment = 配置此群系类型的环境效果.
|
||||
option.DARKFOREST_ENV.comment = 开关此群系类型的环境效果. 即使此项禁用, 其他群系的环境效果仍保持激活状态..
|
||||
|
||||
|
||||
screen.Waving_Stuff.comment = 配置和摇摆相关的设置.
|
||||
option.WAVY_PLANTS.comment = 植物摇摆开关. §a性能消耗水平:§r 非常低.
|
||||
option.WAVY_STRENGTH.comment = 配置摇摆效果强度.
|
||||
@ -441,6 +498,35 @@ screen.Post_Processing.comment = 配置所有后处理效果设置, 从抗锯齿
|
||||
option.TAA_UPSCALING.comment = 时间性升分辨率. 升分辨率时, 可以从低分辨率的图像中保留大多数质量. 因此与常规升分辨率相比, 可以开启一个看起来很高的分辨率的同时也能有更好的性能.
|
||||
option.SCALE_FACTOR.comment = 配置以原有分辨率的多大一部分来开始升分辨率. 不推荐低于0.5, 只把它作为一个选项, 因为它很有趣. :P
|
||||
|
||||
option.RESOURCEPACK_SKY.comment = 开关资源包天空支持. 配置设置来使用完整的资源包天空, 或保持光影的日月. §a性能消耗水平:§r 非常低.
|
||||
option.SKY_GROUND = 地天
|
||||
|
||||
option.MATERIAL_AO.comment = 开关基于资源包提供的内容应用环境光遮蔽的功能. §a性能消耗水平:§r 非常低.
|
||||
option.WATER_WAVE_STRENGTH.comment = 配置出现的水波强度.
|
||||
option.MOONPHASE_BASED_MOONLIGHT.comment = §b这啥?§r 每晚月亮有不同的照度. 此选项根据月相来调整发出的月光亮度. §a性能消耗水平:§r 近乎于无.
|
||||
|
||||
|
||||
option.END_STORM_DENSTIY.comment = §b这啥?§r 这是末地的一层暗色云雾. 配置末地风暴的密度.
|
||||
option.NETHER_PLUME_DENSITY.comment = §b这啥?§r 这是下界中那些浓密的发光烟柱. 配置下界烟柱的密度.
|
||||
|
||||
option.CloudLayer0.comment = 较小积云层的开关. §a性能消耗水平:§r 中.
|
||||
option.CloudLayer0_coverage.comment = 配置云覆盖天空的程度.
|
||||
option.CloudLayer0_density.comment = 配置云层的密度或者说厚度.
|
||||
option.CloudLayer0_height.comment = 配置云层飘浮处的高度.
|
||||
|
||||
option.CloudLayer1.comment = 较大积云层的开关. §a性能消耗水平:§r 中.
|
||||
option.CloudLayer1_coverage.comment = 配置云覆盖天空的程度.
|
||||
option.CloudLayer1_density.comment = 配置云层的密度或者说厚度.
|
||||
option.CloudLayer1_height.comment = 配置云层飘浮处的高度. §c不能低于小积云层§r
|
||||
|
||||
option.CloudLayer2.comment = 较高且薄的云层的开关. §a性能消耗水平:§r 低.
|
||||
option.CloudLayer2_coverage.comment = 配置云覆盖天空的程度.
|
||||
option.CloudLayer2_density.comment = 配置云层的密度或者说厚度.
|
||||
option.CloudLayer2_height.comment = 配置云层飘浮处的高度. §c不能低于大积云层§r
|
||||
|
||||
option.SKY_GROUND.comment = §b这啥?§r 天空的暗色下半部分, 若 Minecraft 有无限渲染距离, 则这是地面. §a性能消耗水平:§r 非常非常低. §c由于额外的函数计算, 禁用本选项会比启用消耗消耗更多性能.§r
|
||||
option.SNELLS_WINDOW.comment = §b这啥?§r 这是在水下看到的黑色反射圆圈. 这是对现实水下会发生的情况的模拟, 称为 "全内反射". §a性能消耗水平:§r 非常非常非常低.
|
||||
|
||||
|
||||
#Additional Options / 附加选项
|
||||
#Direct Light
|
||||
@ -471,9 +557,14 @@ screen.Post_Processing.comment = 配置所有后处理效果设置, 从抗锯齿
|
||||
option.Vanilla_like_water=原版水体样式
|
||||
|
||||
|
||||
#Ambient_light
|
||||
option.HANDHELD_LIGHT_RANGE=手持光源范围
|
||||
|
||||
|
||||
#Fog
|
||||
option.FOG_START_HEIGHT=雾气起始高度
|
||||
|
||||
option.CAVE_FOG=洞穴雾气
|
||||
|
||||
|
||||
#Post_Processing
|
||||
@ -493,11 +584,8 @@ screen.Post_Processing.comment = 配置所有后处理效果设置, 从抗锯齿
|
||||
option.Manual_exposure_value=手动曝光值
|
||||
|
||||
screen.JITTER_DOF=抖动景深
|
||||
option.DOF_JITTER=抖动景深
|
||||
option.DOF_JITTER_FOCUS=抖动景深对焦距离
|
||||
option.JITTER_STRENGTH=抖动强度
|
||||
option.JITTER_STRENGTH.comment=抱歉
|
||||
option.FOCUS_LASER_COLOR=聚焦颜色
|
||||
option.FOCUS_LASER_COLOR=聚焦激光颜色
|
||||
option.FOCUS_LASER_COLOR.comment=红, 绿, 蓝, 粉, 黄, 白.
|
||||
|
||||
option.AUTOFOCUS=自动对焦
|
||||
@ -533,6 +621,7 @@ screen.Post_Processing.comment = 配置所有后处理效果设置, 从抗锯齿
|
||||
option.B_UPPER_CURVE=上部曲线 - 蓝色
|
||||
|
||||
#Clouds
|
||||
option.CLOUD_SHADOW_STRENGTH=云影强度
|
||||
|
||||
|
||||
#Misc Settings
|
||||
@ -552,14 +641,21 @@ screen.Post_Processing.comment = 配置所有后处理效果设置, 从抗锯齿
|
||||
option.Lightning_G=闪电 - 绿色
|
||||
option.Lightning_B=闪电 - 蓝色
|
||||
|
||||
option.display_LUT=显示 LUT
|
||||
option.WhiteWorld=全白世界
|
||||
option.WhiteWorld.comment=用于调试的视图. 易于观察环境光遮蔽的效果. 易于观察模拟全局光照 (绿光) 的效果.
|
||||
option.SSS_view=次表面散射视图
|
||||
option.ambientLight_only=仅启用环境光
|
||||
option.ambientLight_only.comment=用于调试的视图. 关闭太阳光. 此选项不会影响性能,阴影依旧会在后台工作.
|
||||
option.Glass_Tint=玻璃色调
|
||||
option.Glass_Tint.comment=背景通过混合玻璃本身的颜色获得强烈的色调.
|
||||
option.display_LUT=显示 LUT
|
||||
option.SSS_view=天空光次表面散射视图
|
||||
option.LIGHTNING_FLASH=闪电闪烁
|
||||
option.HURT_AND_DEATH_EFFECT=死伤效果
|
||||
option.LIT_PARTICLE_BRIGHTNESS=提高粒子亮度
|
||||
option.PLANET_GROUND_BRIGHTNESS=行星地表亮度
|
||||
option.BLOOMY_PARTICLES=泛光粒子
|
||||
option.ORIGINAL_CHOCAPIC_SKY=原始 Chocapic 天空
|
||||
option.BIOME_TINT_WATER=群系色调水体
|
||||
|
||||
|
||||
#Climate
|
||||
|
59
shaders/lib/DistantHorizons_projections.glsl
Normal file
59
shaders/lib/DistantHorizons_projections.glsl
Normal file
@ -0,0 +1,59 @@
|
||||
/////// ALL OF THIS IS BASED OFF OF THE DISTANT HORIZONS EXAMPLE PACK BY NULL
|
||||
|
||||
uniform mat4 dhPreviousProjection;
|
||||
uniform mat4 dhProjectionInverse;
|
||||
uniform mat4 dhProjection;
|
||||
|
||||
vec3 toScreenSpace_DH( vec2 texcoord, float depth, float DHdepth ) {
|
||||
|
||||
vec4 viewPos = vec4(0.0);
|
||||
vec3 feetPlayerPos = vec3(0.0);
|
||||
vec4 iProjDiag = vec4(0.0);
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
if (depth < 1.0) {
|
||||
#endif
|
||||
iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
|
||||
|
||||
feetPlayerPos = vec3(texcoord, depth) * 2.0 - 1.0;
|
||||
viewPos = iProjDiag * feetPlayerPos.xyzz + gbufferProjectionInverse[3];
|
||||
viewPos.xyz /= viewPos.w;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
} else {
|
||||
iProjDiag = vec4(dhProjectionInverse[0].x, dhProjectionInverse[1].y, dhProjectionInverse[2].zw);
|
||||
|
||||
feetPlayerPos = vec3(texcoord, DHdepth) * 2.0 - 1.0;
|
||||
viewPos = iProjDiag * feetPlayerPos.xyzz + dhProjectionInverse[3];
|
||||
viewPos.xyz /= viewPos.w;
|
||||
}
|
||||
#endif
|
||||
|
||||
return viewPos.xyz;
|
||||
}
|
||||
vec3 toClipSpace3_DH( vec3 viewSpacePosition, bool depthCheck ) {
|
||||
|
||||
mat4 projectionMatrix = depthCheck ? dhProjection : gbufferProjection;
|
||||
|
||||
return projMAD(projectionMatrix, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
mat4 DH_shadowProjectionTweak( in mat4 projection){
|
||||
|
||||
#ifdef DH_SHADOWPROJECTIONTWEAK
|
||||
|
||||
float _far = (3.0 * far);
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
_far = 2.0 * dhFarPlane;
|
||||
#endif
|
||||
|
||||
mat4 newProjection = projection;
|
||||
newProjection[2][2] = -2.0 / _far;
|
||||
newProjection[3][2] = 0.0;
|
||||
|
||||
return newProjection;
|
||||
#else
|
||||
return projection;
|
||||
#endif
|
||||
}
|
@ -9,6 +9,7 @@ void GriAndEminShadowFix(
|
||||
bool Entities
|
||||
){
|
||||
|
||||
// float DistanceOffset = clamp(0.17 + length(WorldPos) / (shadowMapResolution*0.20), 0.0,1.0) ;
|
||||
float DistanceOffset = clamp(0.17 + length(WorldPos) / (shadowMapResolution*0.20), 0.0,1.0) ;
|
||||
vec3 Bias = FlatNormal * DistanceOffset; // adjust the bias thingy's strength as it gets farther away.
|
||||
|
||||
|
@ -289,6 +289,7 @@ vec4 GetVolumetricFog(
|
||||
color += (lighting - lighting*exp(-(density)*dd*dL)) * absorbance;
|
||||
absorbance *= exp(-max(density,hazeDensity)*dd*dL);
|
||||
}
|
||||
// return vec4(0.0,0.0,0.0,1.0);
|
||||
return vec4(color, absorbance);
|
||||
}
|
||||
|
||||
@ -297,10 +298,10 @@ float GetCloudShadow(vec3 WorldPos, vec3 LightPos){
|
||||
|
||||
for (int i=0; i < 3; i++){
|
||||
|
||||
vec3 shadowSamplePos = WorldPos - LightPos * (pow(i,0.75)*0.25);
|
||||
float Cast = fogShape(shadowSamplePos)*END_STORM_DENSTIY;
|
||||
Shadow += Cast;
|
||||
// vec3 shadowSamplePos = WorldPos - LightPos * (pow(i,0.75)*0.25);
|
||||
vec3 shadowSamplePos = WorldPos - LightPos * (0.01 + pow(i,0.75)*0.25);
|
||||
Shadow += fogShape(shadowSamplePos)*END_STORM_DENSTIY;
|
||||
}
|
||||
|
||||
return clamp(exp(Shadow * -10.0),0.0,1.0);
|
||||
return clamp(exp2(Shadow * -5.0),0.0,1.0);
|
||||
}
|
@ -69,7 +69,13 @@ vec2 SSAO(
|
||||
ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio)*RENDER_SCALE);
|
||||
|
||||
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) );
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float dhdepth = texelFetch2D(dhDepthTex1, offset,0).x;
|
||||
#else
|
||||
float dhdepth = 0.0;
|
||||
#endif
|
||||
|
||||
vec3 t0 = toScreenSpace_DH((offset*texelSize+acc+0.5*texelSize) * (1.0/RENDER_SCALE), texelFetch2D(depthtex1, offset,0).x, dhdepth);
|
||||
vec3 vec = (t0.xyz - viewPos);
|
||||
float dsquared = dot(vec, vec);
|
||||
|
||||
|
@ -97,5 +97,6 @@ vec4 GetVolumetricFog(
|
||||
|
||||
if (absorbance < 1e-5) break;
|
||||
}
|
||||
// return vec4(0.0,0.0,0.0,1.0);
|
||||
return vec4(vL, absorbance);
|
||||
}
|
@ -52,6 +52,9 @@ float cloudVol(in vec3 pos){
|
||||
// return testfogshapes;
|
||||
|
||||
return CloudyFog + UniformFog + RainFog;
|
||||
|
||||
// float groundFog = max(exp( max(pos.y - 90,0.0) / -1), 0.0) * 100;
|
||||
// return groundFog;
|
||||
}
|
||||
|
||||
float phaseRayleigh(float cosTheta) {
|
||||
@ -74,13 +77,15 @@ vec4 GetVolumetricFog(
|
||||
vec3 LightColor,
|
||||
vec3 AmbientColor
|
||||
){
|
||||
|
||||
int SAMPLECOUNT = VL_SAMPLES;
|
||||
/// ------------- RAYMARCHING STUFF ------------- \\\
|
||||
|
||||
//project pixel position into projected shadowmap space
|
||||
|
||||
mat4 DH_shadowProjection = DH_shadowProjectionTweak(shadowProjection);
|
||||
vec3 wpos = mat3(gbufferModelViewInverse) * viewPosition + gbufferModelViewInverse[3].xyz;
|
||||
vec3 fragposition = mat3(shadowModelView) * wpos + shadowModelView[3].xyz;
|
||||
fragposition = diagonal3(shadowProjection) * fragposition + shadowProjection[3].xyz;
|
||||
fragposition = diagonal3(DH_shadowProjection) * fragposition + DH_shadowProjection[3].xyz;
|
||||
|
||||
//project view origin into projected shadowmap space
|
||||
vec3 start = toShadowSpaceProjected(vec3(0.0));
|
||||
@ -91,9 +96,16 @@ vec4 GetVolumetricFog(
|
||||
vec3 dV = fragposition - start;
|
||||
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
||||
|
||||
float maxLength = min(length(dVWorld), far)/length(dVWorld);
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float maxLength = min(length(dVWorld), max(dhFarPlane-1000,0.0))/length(dVWorld);
|
||||
SAMPLECOUNT += SAMPLECOUNT;
|
||||
#else
|
||||
float maxLength = min(length(dVWorld), far)/length(dVWorld);
|
||||
#endif
|
||||
|
||||
dV *= maxLength;
|
||||
dVWorld *= maxLength;
|
||||
|
||||
float dL = length(dVWorld);
|
||||
float mult = length(dVWorld)/25;
|
||||
|
||||
@ -153,16 +165,23 @@ vec4 GetVolumetricFog(
|
||||
|
||||
vec3 sunIndirectScattering = LightSourceColor * phaseg(dot(mat3(gbufferModelView)*vec3(0,1,0),normalize(viewPosition)), 0.5) * 3.14;
|
||||
#endif
|
||||
|
||||
float RLmult = 3.0;
|
||||
#ifdef DISTANT_HORIZONS
|
||||
RLmult = 1.0;
|
||||
#endif
|
||||
float expFactor = 11.0;
|
||||
for (int i=0;i<VL_SAMPLES;i++) {
|
||||
float d = (pow(expFactor, float(i+dither.x)/float(VL_SAMPLES))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||
float dd = pow(expFactor, float(i+dither.x)/float(VL_SAMPLES)) * log(expFactor) / float(VL_SAMPLES)/(expFactor-1.0);
|
||||
for (int i=0;i<SAMPLECOUNT;i++) {
|
||||
float d = (pow(expFactor, float(i+dither.x)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||
float dd = pow(expFactor, float(i+dither.x)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0);
|
||||
progress = start.xyz + d*dV;
|
||||
progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||
|
||||
//project into biased shadowmap space
|
||||
float distortFactor = calcDistort(progress.xy);
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
float distortFactor = calcDistort(progress.xy);
|
||||
#else
|
||||
float distortFactor = 1.0;
|
||||
#endif
|
||||
vec3 pos = vec3(progress.xy*distortFactor, progress.z);
|
||||
|
||||
float sh = 1.0;
|
||||
@ -184,14 +203,14 @@ vec4 GetVolumetricFog(
|
||||
///// ----- main fog lighting
|
||||
|
||||
//Just air
|
||||
vec2 airCoef = exp(-max(progressW.y - SEA_LEVEL, 0.0) / vec2(8.0e3, 1.2e3) * vec2(6.,7.0)) * 24 * Haze_amount;
|
||||
vec2 airCoef = exp(-max(progressW.y - SEA_LEVEL, 0.0) / vec2(8.0e3, 1.2e3) * vec2(6.,7.0)) * 24.0 * Haze_amount;
|
||||
|
||||
//Pbr for air, yolo mix between mie and rayleigh for water droplets
|
||||
vec3 rL = rC*airCoef.x;
|
||||
vec3 m = (airCoef.y+density) * mC;
|
||||
|
||||
vec3 Atmosphere = skyLightPhased * (rL * 3.0 + m); // not pbr so just make the atmosphere also dense fog heh
|
||||
vec3 DirectLight = LightSourcePhased * sh * ((rL* 3.0)*rayL + m);
|
||||
vec3 Atmosphere = skyLightPhased * (rL*RLmult + m); // not pbr so just make the atmosphere also dense fog heh
|
||||
vec3 DirectLight = LightSourcePhased * sh * ((rL*RLmult)*rayL + m);
|
||||
vec3 Lightning = Iris_Lightningflash_VLfog(progressW-cameraPosition, lightningBoltPosition.xyz) * (rL + m);
|
||||
|
||||
vec3 foglighting = (Atmosphere + DirectLight + Lightning) * lightleakfix;
|
||||
@ -252,11 +271,34 @@ vec4 GetVolumetricFog(
|
||||
return vec4(color, min(dot(absorbance,vec3(0.335)),1.0));
|
||||
}
|
||||
|
||||
/*
|
||||
// uniform bool inSpecialBiome;
|
||||
vec4 GetVolumetricFog(
|
||||
#ifdef DHVLFOG
|
||||
float DH_cloudVol(in vec3 pos){
|
||||
|
||||
vec3 samplePos = pos*vec3(1.0,1./24.,1.0);
|
||||
vec3 samplePos2 = pos*vec3(1.0,1./48.,1.0);
|
||||
|
||||
|
||||
float noise = densityAtPosFog(samplePos2 * 6.0);
|
||||
float area_noise = 1-texture2D(noisetex, samplePos.xz/5000).b;
|
||||
|
||||
// noise += area_noise*area_noise*0.5;
|
||||
// float erosion = 1.0-densityAtPosFog(samplePos2 * (125 - (1-pow(1-noise,5))*25));
|
||||
|
||||
|
||||
// float clumpyFog = max(exp(noise * -5)*2 - (erosion*erosion), 0.0);
|
||||
|
||||
float groundFog = max(exp( max(pos.y - 70,0.0) / -40) - noise*noise * 2 , 0.0) * TOD_Fog_mult;
|
||||
|
||||
|
||||
// float rainfall = pos.y < CloudLayer0_height ? clamp(1.0-GetCloudShadow_VLFOG(pos, vec3(0,1,0))-0.95,0,1) * clamp(exp( sqrt((CloudLayer0_height)-pos.y) / -5.0 ),0.0,1.0) * 255: 0;
|
||||
|
||||
return groundFog;
|
||||
// return CloudyFog + UniformFog + RainFog;
|
||||
}
|
||||
|
||||
vec4 DH_GetVolumetricFog(
|
||||
vec3 viewPosition,
|
||||
float dither,
|
||||
vec2 dither,
|
||||
vec3 LightColor,
|
||||
vec3 AmbientColor
|
||||
){
|
||||
@ -277,51 +319,54 @@ vec4 GetVolumetricFog(
|
||||
vec3 dV = fragposition - start;
|
||||
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
||||
|
||||
float maxLength = min(length(dVWorld), far)/length(dVWorld);
|
||||
float maxLength = (min(length(dVWorld), max(dhFarPlane-1500,0.0) )/length(dVWorld));// * (1.0-min(max(1.0-length(dVWorld)/(far+32*2),0)*2,1.0));
|
||||
dV *= maxLength;
|
||||
dVWorld *= maxLength;
|
||||
|
||||
float dL = length(dVWorld);
|
||||
float mult = length(dVWorld)/25;
|
||||
|
||||
vec3 progress = start.xyz;
|
||||
|
||||
|
||||
// float maxLength = (min(length(dVWorld), max(dhFarPlane+3000,0.0)/4)/length(dVWorld));// * (1.0-min(max(1.0-length(dVWorld)/(far+32*2),0)*2,1.0));
|
||||
// dV *= maxLength;
|
||||
// dVWorld *= maxLength;
|
||||
// float dL = length(dVWorld);
|
||||
|
||||
vec3 progressW = gbufferModelViewInverse[3].xyz + cameraPosition;
|
||||
|
||||
vec3 WsunVec = mat3(gbufferModelViewInverse) * sunVec * lightCol.a;
|
||||
float SdotV = dot(sunVec,normalize(viewPosition))*lightCol.a;
|
||||
|
||||
|
||||
/// ------------- COLOR/LIGHTING STUFF ------------- \\\
|
||||
|
||||
vec3 color = vec3(0.0);
|
||||
vec3 absorbance = vec3(1.0);
|
||||
|
||||
///// ----- fog lighting
|
||||
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
|
||||
float mie = fogPhase(SdotV) * 5.0;
|
||||
float rayL = phaseRayleigh(SdotV);
|
||||
|
||||
vec3 rC = vec3(fog_coefficientRayleighR*1e-6, fog_coefficientRayleighG*1e-5, fog_coefficientRayleighB*1e-5);
|
||||
vec3 rC = vec3(sky_coefficientRayleighR*1e-6, sky_coefficientRayleighG*1e-5, sky_coefficientRayleighB*1e-5);
|
||||
vec3 mC = vec3(fog_coefficientMieR*1e-6, fog_coefficientMieG*1e-6, fog_coefficientMieB*1e-6);
|
||||
|
||||
vec3 LightSourceColor = LightColor;
|
||||
vec3 skyLightPhased = AmbientColor;
|
||||
vec3 LightSourcePhased = LightColor;
|
||||
|
||||
#ifdef ambientLight_only
|
||||
LightSourceColor = vec3(0.0);
|
||||
LightSourcePhased = vec3(0.0);
|
||||
#endif
|
||||
|
||||
vec3 skyCol0 = AmbientColor;
|
||||
#ifdef PER_BIOME_ENVIRONMENT
|
||||
BiomeFogColor(LightSourceColor);
|
||||
BiomeFogColor(skyCol0);
|
||||
#endif
|
||||
|
||||
skyCol0 = max(skyCol0 + skyCol0*(normalize(wpos).y*0.9+0.1),0.0);
|
||||
|
||||
|
||||
|
||||
float lightleakfix = clamp(pow(eyeBrightnessSmooth.y/240.,2) ,0.0,1.0);
|
||||
skyLightPhased = max(skyLightPhased + skyLightPhased*(normalize(wpos).y*0.9+0.1),0.0);
|
||||
LightSourcePhased *= mie;
|
||||
|
||||
float expFactor = 11.0;
|
||||
for (int i=0;i<VL_SAMPLES;i++) {
|
||||
float d = (pow(expFactor, float(i+dither)/float(VL_SAMPLES))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||
float dd = pow(expFactor, float(i+dither)/float(VL_SAMPLES)) * log(expFactor) / float(VL_SAMPLES)/(expFactor-1.0);
|
||||
int SAMPLE = 16;
|
||||
for (int i=0;i<SAMPLE;i++) {
|
||||
float d = (pow(expFactor, float(i+dither.x)/float(SAMPLE))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||
float dd = pow(expFactor, float(i+dither.x)/float(SAMPLE)) * log(expFactor) / float(SAMPLE)/(expFactor-1.0);
|
||||
progress = start.xyz + d*dV;
|
||||
progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||
|
||||
@ -330,6 +375,7 @@ vec4 GetVolumetricFog(
|
||||
vec3 pos = vec3(progress.xy*distortFactor, progress.z);
|
||||
|
||||
float sh = 1.0;
|
||||
|
||||
if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){
|
||||
pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5;
|
||||
sh = shadow2D(shadow, pos).x;
|
||||
@ -338,29 +384,27 @@ vec4 GetVolumetricFog(
|
||||
#ifdef VL_CLOUDS_SHADOWS
|
||||
sh *= GetCloudShadow_VLFOG(progressW, WsunVec);
|
||||
#endif
|
||||
|
||||
float densityVol = cloudVol(progressW) * lightleakfix;
|
||||
float densityVol = DH_cloudVol(progressW);
|
||||
//Water droplets(fog)
|
||||
float density = densityVol*300.;
|
||||
float density = densityVol*300.0;
|
||||
|
||||
///// ----- main fog lighting
|
||||
|
||||
//Just air
|
||||
vec2 airCoef = exp(-max(progressW.y - SEA_LEVEL, 0.0) / vec2(8.0e3, 1.2e3) * vec2(6.,7.0)) * 24 * Haze_amount;
|
||||
vec2 airCoef = exp(-max(progressW.y - SEA_LEVEL, 0.0) / vec2(8.0e3, 1.2e3) * vec2(6.,7.0)) * 6 * Haze_amount;
|
||||
|
||||
//Pbr for air, yolo mix between mie and rayleigh for water droplets
|
||||
vec3 rL = rC*airCoef.x;
|
||||
vec3 m = (airCoef.y+density) * mC;
|
||||
|
||||
vec3 AtmosphericFog = skyCol0 * (rL*3.0 + m);
|
||||
vec3 DirectLight = (LightSourceColor*sh) * (rayL*rL*3.0 + m*mie);
|
||||
vec3 AmbientLight = skyCol0 * m;
|
||||
vec3 Lightning = Iris_Lightningflash_VLfog(progressW-cameraPosition, lightningBoltPosition.xyz) * m;
|
||||
vec3 Atmosphere = skyLightPhased * (rL * 1.0 + m) ; // not pbr so just make the atmosphere also dense fog heh
|
||||
vec3 DirectLight = LightSourcePhased * sh * ((rL* 1.0)*rayL + m);
|
||||
|
||||
vec3 lighting = (AtmosphericFog + AmbientLight + DirectLight + Lightning) * lightleakfix;
|
||||
vec3 foglighting = (Atmosphere + DirectLight);// * max(exp(densityVol * -0.1),0.0) ;
|
||||
|
||||
|
||||
color += max(lighting - lighting * exp(-(rL+m)*dd*dL),0.0) / max(rL+m, 0.00000001)*absorbance;
|
||||
absorbance *= max(exp(-(rL+m)*dd*dL),0.0);
|
||||
color += (foglighting - foglighting * exp(-(rL+m)*dd*dL)) / ((rL+m)+0.00000001)*absorbance;
|
||||
absorbance *= clamp(exp(-(rL+m)*dd*dL),0.0,1.0);
|
||||
}
|
||||
return vec4(color, dot(absorbance,vec3(0.333333)));
|
||||
return vec4(color, min(dot(absorbance,vec3(0.335)),1.0));
|
||||
}
|
||||
*/
|
||||
#endif
|
@ -8,7 +8,6 @@ uniform mat4 shadowProjection;
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
|
@ -116,12 +116,10 @@ const float ambientOcclusionLevel = 1.0; // this controls vanilla minecrafts amb
|
||||
/////////////////////////////////////////
|
||||
|
||||
const int shadowMapResolution = 2048; // [512 768 1024 1536 2048 3172 4096 8192 16384]
|
||||
// const float shadowDistance = 69.0 * 12.0; // [32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 120.0 121.0 122.0 123.0 124.0 125.0 126.0 127.0 128.0 129.0 130.0 131.0 132.0 133.0 134.0 135.0 136.0 137.0 138.0 139.0 140.0 141.0 142.0 143.0 144.0 145.0 146.0 147.0 148.0 149.0 150.0 151.0 152.0 153.0 154.0 155.0 156.0 157.0 158.0 159.0 160.0 161.0 162.0 163.0 164.0 165.0 166.0 167.0 168.0 169.0 170.0 171.0 172.0 173.0 174.0 175.0 176.0 177.0 178.0 179.0 180.0 181.0 182.0 183.0 184.0 185.0 186.0 187.0 188.0 189.0 190.0 191.0 192.0 193.0 194.0 195.0 196.0 197.0 198.0 199.0 200.0 201.0 202.0 203.0 204.0 205.0 206.0 207.0 208.0 209.0 210.0 211.0 212.0 213.0 214.0 215.0 216.0 217.0 218.0 219.0 220.0 221.0 222.0 223.0 224.0 225.0 226.0 227.0 228.0 229.0 230.0 231.0 232.0 233.0 234.0 235.0 236.0 237.0 238.0 239.0 240.0 241.0 242.0 243.0 244.0 245.0 246.0 247.0 248.0 249.0 250.0 251.0 252.0 253.0 254.0 255.0 256.0]
|
||||
|
||||
const float shadowDistance = 128.0; // [64.0 80.0 96.0 112.0 128.0 144.0 160.0 176.0 192.0 208.0 224.0 240.0 256.0 272.0 288.0 304.0 320.0 336.0 352.0 384.0 400.0 416.0 432.0 448.0 464.0 480.0 496.0 512.0]
|
||||
const float shadowDistance = 128.0; // [64.0 80.0 96.0 112.0 128.0 144.0 160.0 176.0 192.0 208.0 224.0 240.0 256.0 272.0 288.0 304.0 320.0 336.0 352.0 384.0 400.0 416.0 432.0 448.0 464.0 480.0 496.0 512.0 800.0 1000.0 2000.0 3000.0]
|
||||
|
||||
const float shadowDistanceRenderMul = 1.0; // [-1.0 1.0]
|
||||
|
||||
const float entityShadowDistanceMul = 1.0; // [0.05 0.10 1.50 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.0]
|
||||
|
||||
#define RENDER_ENTITY_SHADOWS
|
||||
|
||||
@ -187,6 +185,11 @@ const float sunPathRotation = -35; //[-90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -8
|
||||
#undef BorderFog
|
||||
#endif
|
||||
|
||||
#define DISTANT_HORIZONS_SUPPORT
|
||||
#ifndef DISTANT_HORIZONS_SUPPORT
|
||||
#undef DISTANT_HORIZONS
|
||||
#endif
|
||||
|
||||
#define SEA_LEVEL 70 // [0 10 20 30 40 50 60 70 80 90 100 110 120 130 150 170 190]
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
@ -334,7 +337,7 @@ uniform int moonPhase;
|
||||
#define VOLUMETRIC_CLOUDS
|
||||
#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
|
||||
// #define Daily_Weather
|
||||
#define Cloud_Speed 1.0 // [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 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0]
|
||||
|
||||
#ifdef VOLUMETRIC_CLOUDS
|
||||
@ -364,7 +367,7 @@ uniform int moonPhase;
|
||||
#define CloudLayer2_height 2000 // [-300 -290 -280 -270 -260 -250 -240 -230 -220 -210 -200 -190 -180 -170 -160 -150 -140 -130 -120 -110 -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 500 510 520 530 540 550 560 570 580 590 600 700 800 900 1000]
|
||||
|
||||
#if (defined CloudLayer0 || defined CloudLayer1) && defined VOLUMETRIC_CLOUDS
|
||||
#define RAYMARCH_CLOUDS_WITH_FOG
|
||||
// #define RAYMARCH_CLOUDS_WITH_FOG
|
||||
#endif
|
||||
|
||||
#define Rain_coverage 1.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]
|
||||
@ -519,13 +522,34 @@ uniform int moonPhase;
|
||||
#define LIT_PARTICLE_BRIGHTNESS 2.0 // [1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 100.]
|
||||
|
||||
#define HURT_AND_DEATH_EFFECT
|
||||
#define SELECT_BOX
|
||||
|
||||
#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]
|
||||
|
||||
#define TRANSLUCENT_ENTITIES
|
||||
|
||||
#define DISTORT_SHADOWMAP
|
||||
// #define DISTANT_HORIZONS_SHADOWMAP
|
||||
#ifdef DISTANT_HORIZONS_SHADOWMAP
|
||||
#undef DISTORT_SHADOWMAP
|
||||
#endif
|
||||
|
||||
// #define DH_SHADOWPROJECTIONTWEAK
|
||||
|
||||
#define debug_OFF 0
|
||||
#define debug_SHADOWMAP 1
|
||||
#define debug_NORMALS 2
|
||||
#define debug_SPECULAR 3
|
||||
#define debug_INDIRECT 4
|
||||
#define debug_DIRECT 5
|
||||
#define debug_VIEW_POSITION 6
|
||||
#define DEBUG_VIEW debug_OFF // [debug_OFF debug_SHADOWMAP debug_NORMALS debug_SPECULAR debug_INDIRECT debug_DIRECT debug_VIEW_POSITION]
|
||||
|
||||
// #define BLOOMY_PARTICLES
|
||||
// #define ORIGINAL_CHOCAPIC_SKY
|
||||
// #define CLOUDS_INFRONT_OF_WORLD
|
||||
|
||||
// fix settings
|
||||
#if RESOURCEPACK_SKY == 0
|
||||
|
@ -191,6 +191,7 @@ float GetAltostratusDensity(vec3 pos){
|
||||
float small = texture2D(noisetex, (pos.xz - cloud_movement)/10000. - vec2(-large,1-large)/5).b;
|
||||
large = max(large + Coverage - 0.5, 0.0);
|
||||
// float shape = (small + pow((1.0-large),2.0))/2.0;
|
||||
|
||||
float weight = 0.7;
|
||||
float shape = max( large*weight - small*(1.0-weight) ,0.0);
|
||||
shape *= shape;
|
||||
@ -327,6 +328,11 @@ if(layer == 2){
|
||||
}else{
|
||||
|
||||
for(int i = 0; i < QUALITY; i++) {
|
||||
|
||||
// IntersecTerrain = length(rayProgress - cameraPosition) > lViewPosM;
|
||||
|
||||
// if(IntersecTerrain) break;
|
||||
|
||||
/// avoid overdraw
|
||||
if(notVisible) break;
|
||||
|
||||
@ -338,14 +344,14 @@ if(layer == 2){
|
||||
float muE = cumulus * fadedDensity;
|
||||
|
||||
float directLight = 0.0;
|
||||
for (int j=0; j < 3; j++){
|
||||
if(clamp(rayProgress.y - maxHeight,0.0,1.0) < 1.0 && clamp(rayProgress.y - minHeight,0.0,1.0) > 0.0){ // make sure no work is done on pixels with no densities
|
||||
for (int j=0; j < 3; j++){
|
||||
vec3 shadowSamplePos = rayProgress + dV_Sun * (0.1 + j * (0.1 + dither*0.05));
|
||||
float shadow = GetCumulusDensity(layer, shadowSamplePos, 0, minHeight, maxHeight) * cloudDensity;
|
||||
|
||||
vec3 shadowSamplePos = rayProgress + dV_Sun * (0.1 + j * (0.1 + dither*0.05));
|
||||
float shadow = GetCumulusDensity(layer, shadowSamplePos, 0, minHeight, maxHeight) * cloudDensity;
|
||||
|
||||
directLight += shadow;
|
||||
directLight += shadow;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined CloudLayer1 && defined CloudLayer0
|
||||
if(layer == 0) directLight += CloudLayer1_density * 2.0 * GetCumulusDensity(1, rayProgress + dV_Sun/abs(dV_Sun.y) * max((LAYER1_maxHEIGHT-70) - rayProgress.y,0.0), 0, LAYER1_minHEIGHT, LAYER1_maxHEIGHT);
|
||||
#endif
|
||||
@ -380,7 +386,6 @@ if(layer == 2){
|
||||
|
||||
rayProgress += dV_view;
|
||||
}
|
||||
|
||||
return vec4(COLOR, TOTAL_EXTINCTION);
|
||||
}
|
||||
}
|
||||
@ -392,6 +397,10 @@ vec4 renderClouds(
|
||||
vec3 SkyColor
|
||||
){
|
||||
|
||||
// float lViewPosM = length(FragPosition) < dhRenderDistance *1.5? length(FragPosition) - 1.0 : 1000000000.0;
|
||||
// bool IntersecTerrain = false;
|
||||
|
||||
|
||||
#ifndef VOLUMETRIC_CLOUDS
|
||||
return vec4(0.0,0.0,0.0,1.0);
|
||||
#endif
|
||||
@ -399,7 +408,6 @@ vec4 renderClouds(
|
||||
vec3 color = vec3(0.0);
|
||||
|
||||
float heightRelativeToClouds = clamp(1.0 - max(cameraPosition.y - LAYER0_minHEIGHT,0.0) / 100.0 ,0.0,1.0);
|
||||
// heightRelativeToClouds*=heightRelativeToClouds;
|
||||
|
||||
//////////////////////////////////////////
|
||||
////// Raymarching stuff
|
||||
@ -445,7 +453,7 @@ vec4 renderClouds(
|
||||
// use this to blend into the atmosphere's ground.
|
||||
vec3 approxdistance = normalize(dV_view);
|
||||
#ifdef SKY_GROUND
|
||||
float distantfog = mix(1.0, max(1.0 - clamp(exp2(pow(abs(approxdistance.y),1.5) * -35.0),0.0,1.0),0.0), heightRelativeToClouds);
|
||||
float distantfog = mix(1.0, max(1.0 - clamp(exp2(pow(abs(approxdistance.y),1.5) * -100.0),0.0,1.0),0.0), heightRelativeToClouds);
|
||||
#else
|
||||
float distantfog = 1.0;
|
||||
float distantfog2 = mix(1.0, max(1.0 - clamp(exp(pow(abs(approxdistance.y),1.5) * -35.0),0.0,1.0),0.0), heightRelativeToClouds);
|
||||
@ -575,15 +583,15 @@ float GetCloudShadow(vec3 feetPlayerPos){
|
||||
|
||||
// assume a flat layer of cloud, and stretch the sampled density along the sunvector, starting from some vertical layer in the cloud.
|
||||
#ifdef CloudLayer0
|
||||
vec3 lowShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.2)) * max((CloudLayer0_height + 30) - playerPos.y,0.0) ;
|
||||
vec3 lowShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.0)) * max((CloudLayer0_height + 20) - playerPos.y,0.0) ;
|
||||
shadow += GetCumulusDensity(0, lowShadowStart, 1, CloudLayer0_height, CloudLayer0_height+100)*CloudLayer0_density;
|
||||
#endif
|
||||
#ifdef CloudLayer1
|
||||
vec3 higherShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.2)) * max((CloudLayer1_height + 30) - playerPos.y,0.0) ;
|
||||
vec3 higherShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.0)) * max((CloudLayer1_height + 30) - playerPos.y,0.0) ;
|
||||
shadow += GetCumulusDensity(1, higherShadowStart, 0, CloudLayer1_height, CloudLayer1_height+100)*CloudLayer1_density;
|
||||
#endif
|
||||
#ifdef CloudLayer2
|
||||
vec3 highShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.2)) * max(CloudLayer2_height - playerPos.y,0.0);
|
||||
vec3 highShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.0)) * max(CloudLayer2_height - playerPos.y,0.0);
|
||||
shadow += GetAltostratusDensity(highShadowStart) * CloudLayer2_density;
|
||||
#endif
|
||||
|
||||
@ -605,15 +613,15 @@ float GetCloudShadow_VLFOG(vec3 WorldPos, vec3 WorldSpace_sunVec){
|
||||
float shadow = 0.0;
|
||||
|
||||
#ifdef CloudLayer0
|
||||
vec3 lowShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.2)) * max((CloudLayer0_height+ 30) - WorldPos.y,0.0) ;
|
||||
vec3 lowShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.0)) * max((CloudLayer0_height + 20) - WorldPos.y,0.0) ;
|
||||
shadow += GetCumulusDensity(0, lowShadowStart, 0, CloudLayer0_height,CloudLayer0_height+100)*CloudLayer0_density;
|
||||
#endif
|
||||
#ifdef CloudLayer1
|
||||
vec3 higherShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.2)) * max((CloudLayer1_height+ 30) - WorldPos.y,0.0) ;
|
||||
vec3 higherShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.0)) * max((CloudLayer1_height + 20) - WorldPos.y,0.0) ;
|
||||
shadow += GetCumulusDensity(1,higherShadowStart, 0, CloudLayer1_height,CloudLayer1_height+100)*CloudLayer1_density;
|
||||
#endif
|
||||
#ifdef CloudLayer2
|
||||
vec3 highShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.2)) * max(CloudLayer2_height - WorldPos.y,0.0);
|
||||
vec3 highShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.0)) * max(CloudLayer2_height - WorldPos.y,0.0);
|
||||
shadow += GetAltostratusDensity(highShadowStart)*CloudLayer2_density;
|
||||
#endif
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
#shaders/shaders.properties
|
||||
#Minecraft Settings
|
||||
frustum.culling=false
|
||||
shadow.culling =false
|
||||
|
||||
|
||||
#ifndef RENDER_ENTITY_SHADOWS
|
||||
shadowBlockEntities = false
|
||||
@ -29,19 +32,45 @@ beacon.beam.depth = true
|
||||
|
||||
program.composite4.enabled = TAA_UPSCALING
|
||||
|
||||
|
||||
|
||||
#if defined TRANSLUCENT_ENTITIES && defined IS_IRIS
|
||||
separateEntityDraws = true
|
||||
|
||||
program.gbuffers_entities_translucent.enabled = true
|
||||
program.gbuffers_block_translucent.enabled = true
|
||||
|
||||
blend.gbuffers_entities_translucent = off
|
||||
blend.gbuffers_block_translucent = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
#else
|
||||
separateEntityDraws = false
|
||||
program.gbuffers_entities_translucent.enabled = IS_IRIS
|
||||
program.gbuffers_block_translucent.enabled = IS_IRIS
|
||||
#endif
|
||||
|
||||
#if defined DISTANT_HORIZONS && defined IS_IRIS
|
||||
#if defined DISTANT_HORIZONS_SHADOWMAP
|
||||
dhShadow.enabled = true
|
||||
#else
|
||||
dhShadow.enabled = false
|
||||
#endif
|
||||
|
||||
program.dh_terrain.enabled = true
|
||||
program.dh_water.enabled = true
|
||||
|
||||
blend.dh_shadow = off
|
||||
blend.dh_terrain = off
|
||||
blend.dh_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
#else
|
||||
dhShadow.enabled = false
|
||||
program.dh_terrain.enabled = false
|
||||
program.dh_water.enabled = false
|
||||
#endif
|
||||
|
||||
|
||||
# SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE ZERO
|
||||
# SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
#Get the correct alpha value : S_A*(1-DST_A)+DST_A
|
||||
|
||||
program.gbuffers_entities_translucent.enabled = IS_IRIS
|
||||
program.gbuffers_block_translucent.enabled = IS_IRIS
|
||||
|
||||
#ifdef IS_IRIS
|
||||
separateEntityDraws=true
|
||||
blend.gbuffers_entities_translucent = off
|
||||
blend.gbuffers_block_translucent = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
#endif
|
||||
|
||||
blend.gbuffers_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
blend.gbuffers_hand_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
blend.gbuffers_textured = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
@ -54,6 +83,7 @@ blend.gbuffers_skytextured = ONE ONE ONE ZERO
|
||||
blend.gbuffers_damagedblock = ONE ONE ONE ZERO
|
||||
|
||||
# Disable blending
|
||||
blend.gbuffers_terrain = off
|
||||
blend.gbuffers_hand = off
|
||||
blend.gbuffers_block = off
|
||||
blend.gbuffers_entities = off
|
||||
@ -61,6 +91,7 @@ blend.gbuffers_beaconbeam = off
|
||||
blend.gbuffers_water.colortex11 = off
|
||||
blend.composite.colortex12 = off
|
||||
|
||||
|
||||
# Alpha test
|
||||
alphaTest.shadow = GREATER 0.1
|
||||
alphaTest.gbuffers_entities = GREATER 0.1
|
||||
@ -73,7 +104,7 @@ alphaTest.gbuffers_skybasic=false
|
||||
alphaTest.gbuffers_skytextured=false
|
||||
|
||||
|
||||
sliders = HANDHELD_LIGHT_RANGE CLOUD_SHADOW_STRENGTH CloudLayer0_coverage CloudLayer0_density CloudLayer0_height CloudLayer1_coverage CloudLayer1_density CloudLayer1_height CloudLayer2_coverage CloudLayer2_density CloudLayer2_height PLANET_GROUND_BRIGHTNESS FOG_START_HEIGHT WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B NETHER_PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS R_UPPER_CURVE R_LOWER_CURVE G_UPPER_CURVE G_LOWER_CURVE B_UPPER_CURVE B_LOWER_CURVE UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance FinalR FinalG FinalB Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH
|
||||
sliders = DEBUG_VIEW entityShadowDistanceMul HANDHELD_LIGHT_RANGE CLOUD_SHADOW_STRENGTH CloudLayer0_coverage CloudLayer0_density CloudLayer0_height CloudLayer1_coverage CloudLayer1_density CloudLayer1_height CloudLayer2_coverage CloudLayer2_density CloudLayer2_height PLANET_GROUND_BRIGHTNESS FOG_START_HEIGHT WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B NETHER_PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS R_UPPER_CURVE R_LOWER_CURVE G_UPPER_CURVE G_LOWER_CURVE B_UPPER_CURVE B_LOWER_CURVE UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance FinalR FinalG FinalB Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH
|
||||
|
||||
screen.columns=2
|
||||
screen = \
|
||||
@ -82,7 +113,7 @@ BLISS_SHADERS <empty> \
|
||||
[Direct_Light] [World] \
|
||||
[Ambient_light] [Fog] \
|
||||
[Post_Processing] [Clouds] \
|
||||
<empty> [Climate] \
|
||||
DISTANT_HORIZONS_SHADOWMAP [Climate] \
|
||||
<empty> <empty> \
|
||||
[Misc_Settings] [LabPBR]
|
||||
|
||||
@ -97,7 +128,7 @@ BLISS_SHADERS <empty> \
|
||||
screen.Direct_Light = [Shadows] [Subsurface_Scattering] [Sun_and_Moon_Colors] OLD_LIGHTLEAK_FIX sunPathRotation sun_illuminance MOONPHASE_BASED_MOONLIGHT moon_illuminance
|
||||
|
||||
screen.Shadows.columns=1
|
||||
screen.Shadows = SCREENSPACE_CONTACT_SHADOWS RENDER_ENTITY_SHADOWS <empty> [Filtering] shadowMapResolution shadowDistance shadowDistanceRenderMul
|
||||
screen.Shadows = SCREENSPACE_CONTACT_SHADOWS RENDER_ENTITY_SHADOWS entityShadowDistanceMul <empty> [Filtering] shadowMapResolution shadowDistance shadowDistanceRenderMul
|
||||
|
||||
screen.Subsurface_Scattering.columns=1
|
||||
screen.Subsurface_Scattering = SSS_TYPE LabSSS_Curve <empty> MISC_BLOCK_SSS MOB_SSS <empty> Ambient_SSS ambientsss_brightness
|
||||
@ -270,7 +301,7 @@ BLISS_SHADERS <empty> \
|
||||
|
||||
|
||||
######## MISC SETTINGS
|
||||
screen.Misc_Settings = [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER
|
||||
screen.Misc_Settings = DEBUG_VIEW [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER CLOUDS_INFRONT_OF_WORLD DH_SHADOWPROJECTIONTWEAK SELECT_BOX
|
||||
|
||||
screen.the_orb.columns = 1
|
||||
screen.the_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B
|
||||
|
5
shaders/world-1/dh_terrain.fsh
Normal file
5
shaders/world-1/dh_terrain.fsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define NETHER_SHADER
|
||||
|
||||
#include "/dimensions/DH_solid.fsh"
|
5
shaders/world-1/dh_terrain.vsh
Normal file
5
shaders/world-1/dh_terrain.vsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define NETHER_SHADER
|
||||
|
||||
#include "/dimensions/DH_solid.vsh"
|
5
shaders/world-1/dh_water.fsh
Normal file
5
shaders/world-1/dh_water.fsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define NETHER_SHADER
|
||||
|
||||
#include "/dimensions/DH_translucent.fsh"
|
5
shaders/world-1/dh_water.vsh
Normal file
5
shaders/world-1/dh_water.vsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define NETHER_SHADER
|
||||
|
||||
#include "/dimensions/DH_translucent.vsh"
|
@ -1,6 +1,5 @@
|
||||
#version 120
|
||||
|
||||
|
||||
#define LINES
|
||||
#define NETHER_SHADER
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#version 120
|
||||
|
||||
|
||||
#define LINES
|
||||
#define NETHER_SHADER
|
||||
|
||||
|
19
shaders/world0/dh_shadow.fsh
Normal file
19
shaders/world0/dh_shadow.fsh
Normal file
@ -0,0 +1,19 @@
|
||||
#version 120
|
||||
//#extension GL_ARB_shader_texture_lod : disable
|
||||
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
flat varying int water;
|
||||
varying vec2 texcoord;
|
||||
uniform sampler2D tex;
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
void main() {
|
||||
// if(water > 0) discard;
|
||||
|
||||
gl_FragData[0] = texture2D(tex, texcoord.xy);
|
||||
}
|
63
shaders/world0/dh_shadow.vsh
Normal file
63
shaders/world0/dh_shadow.vsh
Normal file
@ -0,0 +1,63 @@
|
||||
#version 120
|
||||
|
||||
/*
|
||||
!! DO NOT REMOVE !!
|
||||
This code is from Chocapic13' shaders
|
||||
Read the terms of modification and sharing before changing something below please !
|
||||
!! DO NOT REMOVE !!
|
||||
*/
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
#define SHADOW_MAP_BIAS 0.5
|
||||
const float PI = 3.1415927;
|
||||
varying vec2 texcoord;
|
||||
uniform mat4 shadowProjectionInverse;
|
||||
uniform mat4 shadowProjection;
|
||||
uniform mat4 shadowModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 gbufferProjection;
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
|
||||
flat varying int water;
|
||||
|
||||
|
||||
|
||||
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
// uniform float far;
|
||||
uniform float dhFarPlane;
|
||||
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
|
||||
mat4 projection = DH_shadowProjectionTweak(gl_ProjectionMatrix);
|
||||
|
||||
return vec4(projMAD(projection, viewSpacePosition),1.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// uniform int renderStage;
|
||||
|
||||
void main() {
|
||||
water = 0;
|
||||
|
||||
// if(gl_Color.a < 1.0) water = 1;
|
||||
|
||||
texcoord.xy = gl_MultiTexCoord0.xy;
|
||||
|
||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
gl_Position = BiasShadowProjection(toClipSpace3(position));
|
||||
#else
|
||||
gl_Position = toClipSpace3(position);
|
||||
#endif
|
||||
|
||||
gl_Position.z /= 6.0;
|
||||
}
|
5
shaders/world0/dh_terrain.fsh
Normal file
5
shaders/world0/dh_terrain.fsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
|
||||
#include "/dimensions/DH_solid.fsh"
|
5
shaders/world0/dh_terrain.vsh
Normal file
5
shaders/world0/dh_terrain.vsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
|
||||
#include "/dimensions/DH_solid.vsh"
|
5
shaders/world0/dh_water.fsh
Normal file
5
shaders/world0/dh_water.fsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
|
||||
#include "/dimensions/DH_translucent.fsh"
|
5
shaders/world0/dh_water.vsh
Normal file
5
shaders/world0/dh_water.vsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
|
||||
#include "/dimensions/DH_translucent.vsh"
|
@ -96,8 +96,19 @@ bool intersectCone(float coneHalfAngle, vec3 coneTip , vec3 coneAxis, vec3 rayOr
|
||||
}
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
|
||||
|
||||
// uniform float far;
|
||||
uniform float dhFarPlane;
|
||||
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),1.0);
|
||||
|
||||
mat4 projection = DH_shadowProjectionTweak(gl_ProjectionMatrix);
|
||||
|
||||
return vec4(projMAD(projection, viewSpacePosition),1.0);
|
||||
}
|
||||
|
||||
|
||||
@ -172,7 +183,11 @@ void main() {
|
||||
}
|
||||
#endif
|
||||
|
||||
gl_Position = BiasShadowProjection(toClipSpace3(position));
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
gl_Position = BiasShadowProjection(toClipSpace3(position));
|
||||
#else
|
||||
gl_Position = toClipSpace3(position);
|
||||
#endif
|
||||
|
||||
|
||||
if(mc_Entity.x == 8 || mc_Entity.x == 9) gl_Position.w = -1.0;
|
||||
|
5
shaders/world1/dh_terrain.fsh
Normal file
5
shaders/world1/dh_terrain.fsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define END_SHADER
|
||||
|
||||
#include "/dimensions/DH_solid.fsh"
|
5
shaders/world1/dh_terrain.vsh
Normal file
5
shaders/world1/dh_terrain.vsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define END_SHADER
|
||||
|
||||
#include "/dimensions/DH_solid.vsh"
|
5
shaders/world1/dh_water.fsh
Normal file
5
shaders/world1/dh_water.fsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define END_SHADER
|
||||
|
||||
#include "/dimensions/DH_translucent.fsh"
|
5
shaders/world1/dh_water.vsh
Normal file
5
shaders/world1/dh_water.vsh
Normal file
@ -0,0 +1,5 @@
|
||||
#version 330 compatibility
|
||||
|
||||
#define END_SHADER
|
||||
|
||||
#include "/dimensions/DH_translucent.vsh"
|
@ -1,9 +1,6 @@
|
||||
#version 120
|
||||
|
||||
// #define ENTITIES
|
||||
#define BLOCKENTITIES
|
||||
#define WORLD
|
||||
|
||||
#define LINES
|
||||
#define END_SHADER
|
||||
|
||||
#include "/dimensions/all_solid.fsh"
|
@ -1,10 +1,6 @@
|
||||
#version 120
|
||||
|
||||
// #define ENTITIES
|
||||
// #define LINE
|
||||
#define BLOCKENTITIES
|
||||
#define WORLD
|
||||
|
||||
#define LINES
|
||||
#define END_SHADER
|
||||
|
||||
#include "/dimensions/all_solid.vsh"
|
Loading…
x
Reference in New Issue
Block a user