mirror of
https://github.com/Merlin1809/Eclipse-Shader.git
synced 2026-10-10 04:53:07 +08:00
Add WIP Photonics compat
This commit is contained in:
@@ -16,7 +16,7 @@ Notable changes/additions compared to Bliss unstable:
|
||||
+ Better shader-side (hardcoded) emissives
|
||||
+ Lightsource with shadows on the main end island
|
||||
+ Better lightning strikes with clouds lighting up and shadows
|
||||
+ Colorwheel, Caelum (Arda Craft) support
|
||||
+ Photonics, Colorwheel, Caelum (Arda Craft) support
|
||||
+ 1.21.11 Chunk Fade In and Texture Filtering support
|
||||
+ Emissive Ores and Trims
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ uniform sampler2D colortex11;
|
||||
uniform sampler2D colortex12;
|
||||
uniform sampler2D colortex13;
|
||||
uniform sampler2D colortex14;
|
||||
uniform sampler2D colortex15;
|
||||
|
||||
in DATA {
|
||||
flat vec2 TAA_Offset;
|
||||
@@ -1535,6 +1536,12 @@ void main() {
|
||||
///////////////////////////// EFFECTS FOR INDIRECT /////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef PHOTONICS_ENABLED
|
||||
vec3 gi_color = texture(colortex15, texcoord).xyz;
|
||||
|
||||
Indirect_lighting += gi_color*2.5*PHOTONICS_INDIRECT_BRIGHTNESS;
|
||||
#endif
|
||||
|
||||
float SkySSS = SSAO_SSS.y;
|
||||
vec3 AO = vec3(1.0);
|
||||
|
||||
@@ -1764,7 +1771,7 @@ void main() {
|
||||
#endif
|
||||
|
||||
vec3 moonLightCol = moonColorBase2;
|
||||
Background += pow(moonTex, vec3(3.2)) * 17.0 * drawRealMoon(feetPlayerPos_normalized, WmoonVec, moonLightCol, Background, moonSize);
|
||||
Background += pow(moonTex, vec3(3.2)) * 12.0 * drawRealMoon(feetPlayerPos_normalized, WmoonVec, moonLightCol, Background, moonSize);
|
||||
#else
|
||||
vec3 moonLightCol = moonColorSSBO / 2400.0;
|
||||
Background += drawMoon(feetPlayerPos_normalized, WmoonVec, moonLightCol, Background);
|
||||
|
||||
@@ -21,7 +21,7 @@ const int colortex12Format = RGBA16F; // DISTANT HORIZONS + VANILLA MIXED DEP
|
||||
|
||||
const int colortex13Format = RGBA16F; // low res VL (composite5->composite15)
|
||||
const int colortex14Format = RGBA16; // rg = SSAO and SS-SSS. a = skylightmap for translucents.
|
||||
const int colortex15Format = RGBA8; // flat normals and vanilla AO
|
||||
const int colortex15Format = RGBA16F; // flat normals and vanilla AO
|
||||
|
||||
#ifdef VOXY
|
||||
const int colortex16Format = RGBA16F; // voxy translucent stuff...
|
||||
@@ -44,7 +44,7 @@ const bool colortex11Clear = true;
|
||||
const bool colortex12Clear = false;
|
||||
const bool colortex13Clear = false;
|
||||
const bool colortex14Clear = true;
|
||||
const bool colortex15Clear = false;
|
||||
const bool colortex15Clear = true;
|
||||
#ifdef VOXY
|
||||
const bool colortex16Clear = true;
|
||||
#endif
|
||||
|
||||
@@ -246,7 +246,8 @@ void main() {
|
||||
|
||||
#ifndef IS_IRIS
|
||||
gl_FragColor.rgb = vec3(0.0);
|
||||
beginText(ivec2(gl_FragCoord.xy), ivec2(0.05*viewWidth, 0.75*viewHeight));
|
||||
const float textSize = 4.0;
|
||||
beginText(ivec2(gl_FragCoord.xy/textSize), ivec2(0.05*viewWidth/textSize, 0.75*viewHeight/textSize));
|
||||
text.fgCol = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
printString((_O, _p, _t, _i, _F, _i, _n, _e, _space, _d, _o, _e, _s, _space, _n, _o, _t, _space, _s, _u, _p, _p, _o, _r, _t, _space, _E, _c, _l, _i, _p, _s, _e, _exclm));
|
||||
printLine();
|
||||
|
||||
@@ -0,0 +1,662 @@
|
||||
#extension GL_ARB_shader_texture_lod : enable
|
||||
|
||||
#include "/lib/settings.glsl"
|
||||
#include "/lib/blocks.glsl"
|
||||
#include "/lib/entities.glsl"
|
||||
#include "/lib/items.glsl"
|
||||
#include "/lib/hsv.glsl"
|
||||
|
||||
#ifdef IRIS_FEATURE_TEXTURE_FILTERING
|
||||
#include "/lib/texture_filtering.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef HAND
|
||||
#undef POM
|
||||
#endif
|
||||
|
||||
#ifndef USE_LUMINANCE_AS_HEIGHTMAP
|
||||
#ifndef MC_NORMAL_MAP
|
||||
#undef POM
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef POM
|
||||
#define MC_NORMAL_MAP
|
||||
#endif
|
||||
|
||||
|
||||
in DATA {
|
||||
vec4 color;
|
||||
|
||||
vec4 lmtexcoord;
|
||||
vec3 normalMat;
|
||||
|
||||
#ifdef MC_NORMAL_MAP
|
||||
vec4 tangent;
|
||||
#endif
|
||||
|
||||
vec3 block_normal;
|
||||
flat int blockID;
|
||||
} data_in;
|
||||
|
||||
const float mincoord = 1.0/4096.0;
|
||||
const float maxcoord = 1.0-mincoord;
|
||||
|
||||
const float MAX_OCCLUSION_DISTANCE = MAX_DIST;
|
||||
const float MIX_OCCLUSION_DISTANCE = MAX_DIST*0.9;
|
||||
const int MAX_OCCLUSION_POINTS = MAX_ITERATIONS;
|
||||
|
||||
uniform vec2 texelSize;
|
||||
uniform int framemod8;
|
||||
|
||||
|
||||
const vec2 dcdx = vec2(0.0);
|
||||
const vec2 dcdy = vec2(0.0);
|
||||
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
|
||||
uniform float far;
|
||||
|
||||
|
||||
#ifdef MC_NORMAL_MAP
|
||||
uniform sampler2D normals;
|
||||
#endif
|
||||
|
||||
|
||||
uniform sampler2D specular;
|
||||
uniform sampler2D gtexture;
|
||||
uniform sampler2D colortex1;//albedo(rgb),material(alpha) RGBA16
|
||||
uniform float frameTimeCounter;
|
||||
uniform int frameCounter;
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform mat4 gbufferProjection;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform vec3 cameraPosition;
|
||||
uniform float rainStrength;
|
||||
uniform sampler2D noisetex;//depth
|
||||
uniform sampler2D depthtex0;
|
||||
|
||||
#if defined VIVECRAFT
|
||||
uniform bool vivecraftIsVR;
|
||||
uniform vec3 vivecraftRelativeMainHandPos;
|
||||
uniform vec3 vivecraftRelativeOffHandPos;
|
||||
uniform mat4 vivecraftRelativeMainHandRot;
|
||||
uniform mat4 vivecraftRelativeOffHandRot;
|
||||
#endif
|
||||
|
||||
uniform vec4 entityColor;
|
||||
|
||||
// in vec3 velocity;
|
||||
|
||||
uniform int heldItemId;
|
||||
uniform int heldItemId2;
|
||||
|
||||
|
||||
uniform float noPuddleAreas;
|
||||
uniform float nightVision;
|
||||
uniform vec3 relativeEyePosition;
|
||||
|
||||
// float interleaved_gradientNoise(){
|
||||
// return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521);
|
||||
// }
|
||||
|
||||
float interleaved_gradientNoise_temporal(){
|
||||
#ifdef TAA
|
||||
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887 * frameCounter);
|
||||
#else
|
||||
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887);
|
||||
#endif
|
||||
}
|
||||
float interleaved_gradientNoise(){
|
||||
vec2 coord = gl_FragCoord.xy;
|
||||
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
||||
return noise;
|
||||
}
|
||||
float R2_dither(){
|
||||
vec2 coord = gl_FragCoord.xy ;
|
||||
|
||||
#ifdef TAA
|
||||
coord += + (frameCounter%40000) * 2.0;
|
||||
#endif
|
||||
|
||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
||||
}
|
||||
|
||||
#ifdef TAA
|
||||
float blueNoise() {
|
||||
return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||
}
|
||||
#else
|
||||
float blueNoise() {
|
||||
return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887);
|
||||
}
|
||||
#endif
|
||||
|
||||
uniform int currentRenderedItemId;
|
||||
|
||||
|
||||
mat3 inverseMatrix(mat3 m) {
|
||||
float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
|
||||
float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];
|
||||
float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];
|
||||
|
||||
float b01 = a22 * a11 - a12 * a21;
|
||||
float b11 = -a22 * a10 + a12 * a20;
|
||||
float b21 = a21 * a10 - a11 * a20;
|
||||
|
||||
float det = a00 * b01 + a01 * b11 + a02 * b21;
|
||||
|
||||
return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),
|
||||
b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),
|
||||
b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
vec2 encodeNormal(vec3 n){
|
||||
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 encn;
|
||||
}
|
||||
|
||||
//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));
|
||||
}
|
||||
|
||||
#ifdef MC_NORMAL_MAP
|
||||
vec3 applyBump(mat3 tbnMatrix, vec3 bump){
|
||||
float bumpmult = NORMAL_MAP_MULT;
|
||||
bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult);
|
||||
return normalize(bump*tbnMatrix);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#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 p3 = p * 2. - 1.;
|
||||
vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
|
||||
return fragposition.xyz / fragposition.w;
|
||||
}
|
||||
vec3 toClipSpace3(vec3 viewSpacePosition) {
|
||||
return projMAD(gbufferProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
float luma(vec3 color) {
|
||||
return dot(color,vec3(0.21, 0.72, 0.07));
|
||||
}
|
||||
|
||||
|
||||
vec3 toLinear(vec3 sRGB){
|
||||
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
|
||||
}
|
||||
|
||||
|
||||
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.);
|
||||
|
||||
|
||||
uniform float near;
|
||||
|
||||
|
||||
float ld(float dist) {
|
||||
return (2.0 * near) / (far + near - dist * (far - near));
|
||||
}
|
||||
|
||||
|
||||
// vec4 readNoise(in vec2 coord){
|
||||
// // return texture(noisetex,coord*texcoordam.pq+texcoord);
|
||||
// return textureGradARB(noisetex,coord*texcoordam.pq + texcoordam.st,dcdx,dcdy);
|
||||
// }
|
||||
// float EndPortalEffect(
|
||||
// inout vec4 ALBEDO,
|
||||
// vec3 FragPos,
|
||||
// vec3 WorldPos,
|
||||
// mat3 tbnMatrix
|
||||
// ){
|
||||
//
|
||||
// int maxdist = 25;
|
||||
// int quality = 35;
|
||||
//
|
||||
// vec3 viewVec = normalize(tbnMatrix*FragPos);
|
||||
// if ( viewVec.z < 0.0 && length(FragPos) < maxdist) {
|
||||
// float endportalGLow = 0.0;
|
||||
// float Depth = 0.3;
|
||||
// vec3 interval = (viewVec.xyz /-viewVec.z/quality*Depth) * (0.7 + (blueNoise-0.5)*0.1);
|
||||
//
|
||||
// vec3 coord = vec3(WorldPos.xz , 1.0);
|
||||
// coord += interval;
|
||||
//
|
||||
// for (int loopCount = 0; (loopCount < quality) && (1.0 - Depth + Depth * ( 1.0-readNoise(coord.st).r - readNoise(-coord.st*3).b*0.2 ) ) < coord.p && coord.p >= 0.0; ++loopCount) {
|
||||
// coord = coord+interval ;
|
||||
// endportalGLow += (0.3/quality);
|
||||
// }
|
||||
//
|
||||
// ALBEDO.rgb = vec3(0.5,0.75,1.0) * sqrt(endportalGLow);
|
||||
//
|
||||
// return clamp(pow(endportalGLow*3.5,3),0,1);
|
||||
// }
|
||||
// }
|
||||
|
||||
float bias(){
|
||||
// bias mipmapping as window resolution and / or render scale changes.
|
||||
#ifdef TAA_UPSCALING
|
||||
return (1.0 - texelSize.x * 2560.0) + (0.0 - (1.0-RENDER_SCALE.x) * 2.0);
|
||||
#else
|
||||
return 1.0 - texelSize.x * 2560.0;
|
||||
#endif
|
||||
}
|
||||
vec4 texture_POMSwitch(
|
||||
sampler2D sampler,
|
||||
vec2 lightmapCoord,
|
||||
vec4 dcdxdcdy,
|
||||
bool ifPOM,
|
||||
float LOD
|
||||
){
|
||||
{
|
||||
return texture(sampler, lightmapCoord, LOD);
|
||||
}
|
||||
}
|
||||
|
||||
void convertHandDepth(inout float depth) {
|
||||
float ndcDepth = depth * 2.0 - 1.0;
|
||||
ndcDepth /= MC_HAND_DEPTH;
|
||||
depth = ndcDepth * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
float getEmission(vec3 Albedo) {
|
||||
vec3 hsv = RgbToHsv(Albedo);
|
||||
float emissive = smoothstep(0.05, 0.15, hsv.y) * pow(hsv.z, 3.5);
|
||||
return emissive * 0.5;
|
||||
}
|
||||
|
||||
float getTrimEmission(vec3 Albedo) {
|
||||
vec3 hsv = RgbToHsv(Albedo);
|
||||
return sqrt(hsv.z);
|
||||
}
|
||||
|
||||
uniform float alphaTestRef;
|
||||
|
||||
#include "/photonics/photonics.glsl"
|
||||
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
layout(location = 0) out vec4 OutAlbedo;
|
||||
layout(location = 1) out vec4 OutSpecular;
|
||||
|
||||
/* RENDERTARGETS:1,8 */
|
||||
|
||||
void main() {
|
||||
vec3 FragCoord = gl_FragCoord.xyz;
|
||||
|
||||
bool ifPOM = false;
|
||||
|
||||
bool ShaderGrass = false;
|
||||
|
||||
bool SIGN = false;
|
||||
|
||||
|
||||
if(SIGN) ifPOM = false;
|
||||
|
||||
vec3 normal = data_in.normalMat;
|
||||
|
||||
#ifdef MC_NORMAL_MAP
|
||||
vec3 binormal = normalize(cross(data_in.tangent.rgb,normal)*data_in.tangent.w);
|
||||
mat3 tbnMatrix = mat3(data_in.tangent.x, binormal.x, normal.x,
|
||||
data_in.tangent.y, binormal.y, normal.y,
|
||||
data_in.tangent.z, binormal.z, normal.z);
|
||||
#endif
|
||||
|
||||
float BN = blueNoise();
|
||||
float R2 = R2_dither();
|
||||
|
||||
vec2 tempOffset = offsets[framemod8];
|
||||
|
||||
vec3 fragpos = toScreenSpace(FragCoord*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5, 0.0));
|
||||
vec3 playerpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz;
|
||||
vec3 worldpos = playerpos + cameraPosition;
|
||||
|
||||
vec2 adjustedTexCoord = data_in.lmtexcoord.xy;
|
||||
|
||||
float saveDepth = 0.0;
|
||||
|
||||
if(!ifPOM) adjustedTexCoord = data_in.lmtexcoord.xy;
|
||||
|
||||
float opaqueMasks = 1.0;
|
||||
|
||||
if(data_in.blockID == BLOCK_GROUND_WAVING_VERTICAL || data_in.blockID == BLOCK_GRASS_SHORT || data_in.blockID == BLOCK_GRASS_TALL_LOWER || data_in.blockID == BLOCK_GRASS_TALL_UPPER ) opaqueMasks = 0.60;
|
||||
else if(data_in.blockID == BLOCK_AIR_WAVING) opaqueMasks = 0.55;
|
||||
|
||||
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
//////////////////////////////// ALBEDO ////////////////////////////////
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
|
||||
float textureLOD = bias();
|
||||
|
||||
vec2 lmcoord = data_in.lmtexcoord.zw;
|
||||
|
||||
vec4 Color = data_in.color;
|
||||
|
||||
float vanillaAO = 1.0 - clamp(Color.a,0,1);
|
||||
|
||||
// don't fix vanilla ao on some custom block models.
|
||||
// if (Color.a < 0.3) Color.a = 1.0; // fix vanilla ao on some custom block models.
|
||||
|
||||
RayJob ray = RayJob(vec3(0), vec3(0), vec3(0), vec3(0), vec3(0), false);
|
||||
ray.origin = worldpos + cameraPosition - world_offset - 0.001f * data_in.block_normal;
|
||||
ray.direction = worldpos - gbufferModelViewInverse[3].xyz;
|
||||
ray_constraint = ivec3(ray.origin);
|
||||
trace_ray(ray);
|
||||
|
||||
if (!ray.result_hit) discard;
|
||||
if (ray.result_normal == vec3(0.0)) ray.result_normal = data_in.block_normal;
|
||||
|
||||
playerpos = ray.result_position + world_offset - cameraPosition;
|
||||
vec3 viewPos = (gbufferModelView * vec4(playerpos, 1.0f)).xyz;
|
||||
vec4 ndc4 = gbufferProjection * vec4(viewPos, 1.0f);
|
||||
vec3 screenPos = ndc4.xyz / ndc4.w * 0.5f + 0.5f;
|
||||
gl_FragDepth = screenPos.z;
|
||||
|
||||
normal = normalize(gl_NormalMatrix * ray.result_normal);
|
||||
|
||||
vec4 Albedo = vec4(ray.result_color, 1.0f);
|
||||
|
||||
|
||||
vec3 flatNormals = viewToWorld(normal);
|
||||
|
||||
float torchlightmap = lmcoord.x;
|
||||
|
||||
#ifdef WhiteWorld
|
||||
Albedo.rgb = vec3(0.5);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef AEROCHROME_MODE
|
||||
float gray = dot(Albedo.rgb, vec3(0.2, 1.0, 0.07));
|
||||
if (
|
||||
data_in.blockID == BLOCK_AMETHYST_BUD_MEDIUM || data_in.blockID == BLOCK_AMETHYST_BUD_LARGE || data_in.blockID == BLOCK_AMETHYST_CLUSTER
|
||||
|| data_in.blockID == BLOCK_SSS_STRONG || data_in.blockID == BLOCK_SSS_STRONG3 || data_in.blockID == BLOCK_SSS_WEAK || data_in.blockID == BLOCK_CACTUS
|
||||
|| data_in.blockID == BLOCK_CELESTIUM || data_in.blockID == BLOCK_SNOW_LAYERS
|
||||
|| data_in.blockID >= 10 && data_in.blockID < 80
|
||||
) {
|
||||
// IR Reflective (Pink-red)
|
||||
Albedo.rgb = mix(vec3(gray), aerochrome_color, 0.7);
|
||||
}
|
||||
else if(data_in.blockID == BLOCK_GRASS) {
|
||||
// Special handling for grass block
|
||||
float strength = 1.0 - Color.b;
|
||||
Albedo.rgb = mix(Albedo.rgb, aerochrome_color, strength);
|
||||
}
|
||||
#ifdef AEROCHROME_WOOL_ENABLED
|
||||
else if (data_in.blockID == BLOCK_SSS_WEAK_2 || data_in.blockID == BLOCK_CARPET) {
|
||||
// Wool
|
||||
Albedo.rgb = mix(Albedo.rgb, aerochrome_color, 0.3);
|
||||
}
|
||||
#endif
|
||||
else if(data_in.blockID == BLOCK_WATER || (data_in.blockID >= 300 && data_in.blockID < 400))
|
||||
{
|
||||
// IR Absorbsive? Dark.
|
||||
Albedo.rgb = mix(Albedo.rgb, vec3(0.01, 0.08, 0.15), 0.5);
|
||||
}
|
||||
#endif
|
||||
|
||||
Albedo.a = opaqueMasks;
|
||||
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
//////////////////////////////// SPECULAR ////////////////////////////////
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
|
||||
normal = viewToWorld(normal);
|
||||
|
||||
float SSSAMOUNT = 0.0;
|
||||
#if (SSS_TYPE == 1 || SSS_TYPE == 2) && !defined HAND
|
||||
#ifdef ENTITIES
|
||||
#ifdef MOB_SSS
|
||||
/////// ----- SSS ON MOBS----- ///////
|
||||
// strong
|
||||
if(data_in.blockID == ENTITY_SSS_MEDIUM) SSSAMOUNT = 0.75;
|
||||
|
||||
// medium
|
||||
|
||||
// low
|
||||
else if(data_in.blockID == ENTITY_SSS_WEAK || data_in.blockID == ENTITY_PLAYER || data_in.blockID == ENTITY_CURRENT_PLAYER) SSSAMOUNT = 0.4;
|
||||
#endif
|
||||
#else
|
||||
#if defined SHADER_GRASS && !defined CUTOUT
|
||||
if (ShaderGrass) SSSAMOUNT = 0.65;
|
||||
else
|
||||
#endif
|
||||
|
||||
/////// ----- SSS ON BLOCKS ----- ///////
|
||||
// strong
|
||||
if (
|
||||
data_in.blockID == BLOCK_SSS_STRONG || data_in.blockID == BLOCK_SSS_STRONG3 || data_in.blockID == BLOCK_AIR_WAVING || data_in.blockID == BLOCK_SSS_STRONG_2
|
||||
) {
|
||||
SSSAMOUNT = 1.0;
|
||||
}
|
||||
// medium
|
||||
else if (
|
||||
data_in.blockID == BLOCK_GROUND_WAVING || data_in.blockID == BLOCK_GROUND_WAVING_VERTICAL ||
|
||||
data_in.blockID == BLOCK_GRASS_SHORT || data_in.blockID == BLOCK_GRASS_TALL_UPPER || data_in.blockID == BLOCK_GRASS_TALL_LOWER ||
|
||||
data_in.blockID == BLOCK_SSS_WEAK || data_in.blockID == BLOCK_CACTUS || data_in.blockID == BLOCK_SSS_WEAK_2 ||
|
||||
data_in.blockID == BLOCK_CELESTIUM || (data_in.blockID >= 269 && data_in.blockID <= 274) || data_in.blockID == BLOCK_SNOW_LAYERS || data_in.blockID == BLOCK_CARPET ||
|
||||
data_in.blockID == BLOCK_AMETHYST_BUD_MEDIUM || data_in.blockID == BLOCK_AMETHYST_BUD_LARGE || data_in.blockID == BLOCK_AMETHYST_CLUSTER ||
|
||||
data_in.blockID == BLOCK_BAMBOO || data_in.blockID == BLOCK_SAPLING || (data_in.blockID >= BLOCK_VINE_NORTH && data_in.blockID <= BLOCK_VINE_UP) || data_in.blockID == BLOCK_VINE_OTHER
|
||||
#ifdef MISC_BLOCK_SSS
|
||||
|| data_in.blockID == BLOCK_SSS_WEIRD || data_in.blockID == BLOCK_GRASS
|
||||
#endif
|
||||
) {
|
||||
SSSAMOUNT = 0.5;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BLOCKENTITIES
|
||||
/////// ----- SSS ON BLOCK ENTITIES----- ///////
|
||||
// strong
|
||||
|
||||
// medium
|
||||
if(data_in.blockID == BLOCK_SSS_WEAK_3) SSSAMOUNT = 0.4;
|
||||
|
||||
// low
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if EMISSIVE_TRIMS > 0
|
||||
bool isBrightTrim = currentRenderedItemId == 1026;
|
||||
bool isTrim = isBrightTrim || currentRenderedItemId == 1027;
|
||||
#endif
|
||||
|
||||
#if EMISSIVE_TYPE == 1 || EMISSIVE_TYPE == 2
|
||||
/////// ----- EMISSIVE STUFF ----- ///////
|
||||
float EMISSIVE = 0.0;
|
||||
|
||||
// if(vNameTags > 0) EMISSIVE = 0.9;
|
||||
|
||||
// normal block lightsources
|
||||
if(data_in.blockID >= 100 && data_in.blockID < 282) {
|
||||
EMISSIVE = 0.5;
|
||||
|
||||
if(data_in.blockID == 266 || (data_in.blockID >= 276 && data_in.blockID <= 281)) EMISSIVE = 0.2; // sculk stuff
|
||||
|
||||
else if(data_in.blockID == 195) EMISSIVE = 2.3; // glow lichen
|
||||
|
||||
else if(data_in.blockID == 185) EMISSIVE = 1.5; // crying obsidian
|
||||
|
||||
else if(data_in.blockID == 105) EMISSIVE = 2.0; // brewing stand
|
||||
|
||||
else if(data_in.blockID == 236) EMISSIVE = 1.0; // respawn anchor
|
||||
|
||||
else if(data_in.blockID == 101) EMISSIVE = 0.7; // large amethyst bud
|
||||
|
||||
else if(data_in.blockID == 103) EMISSIVE = 1.0; // amethyst cluster
|
||||
|
||||
else if(data_in.blockID == 244) EMISSIVE = 1.5; // soul fire
|
||||
}
|
||||
|
||||
#if EMISSIVE_ORES > 0
|
||||
if(data_in.blockID == 502) {
|
||||
EMISSIVE = EMISSIVE_ORES_STRENGTH;
|
||||
|
||||
#ifndef HARDCODED_EMISSIVES_APPROX
|
||||
EMISSIVE *= getEmission(Albedo.rgb);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if EMISSIVE_TRIMS > 0
|
||||
if(isTrim) EMISSIVE = EMISSIVE_TRIMS_STRENGTH*getTrimEmission(Albedo.rgb);
|
||||
|
||||
if(isBrightTrim) EMISSIVE *= 0.4;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
vec4 SpecularTex = vec4(0.0);
|
||||
// SpecularTex.r = max(SpecularTex.r, rainfall);
|
||||
// SpecularTex.g = max(SpecularTex.g, max(Puddle_shape*0.02,0.02));
|
||||
|
||||
OutSpecular = vec4(0.0,0.0,0.0,0.0);
|
||||
OutSpecular.rg = SpecularTex.rg;
|
||||
|
||||
#if EMISSIVE_ORES > 1 && EMISSIVE_TYPE > 1
|
||||
if(data_in.blockID == 502) {
|
||||
SpecularTex.a = EMISSIVE_ORES_STRENGTH;
|
||||
|
||||
SpecularTex.a *= getEmission(Albedo.rgb);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if EMISSIVE_TRIMS > 1 && EMISSIVE_TYPE > 1
|
||||
if(isTrim) SpecularTex.a = EMISSIVE_TRIMS_STRENGTH*getTrimEmission(Albedo.rgb);
|
||||
|
||||
if(isBrightTrim) SpecularTex.a *= 0.4;
|
||||
#endif
|
||||
|
||||
#if EMISSIVE_TYPE == 2
|
||||
bool emissionCheck = SpecularTex.a <= 0.0;
|
||||
#endif
|
||||
|
||||
#ifdef MIRROR_IRON
|
||||
if(data_in.blockID == 504 || currentRenderedItemId == 504) {
|
||||
OutSpecular.rg = vec2(1.0, 1.0);
|
||||
Albedo.rgb = vec3(1.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined HARDCODED_EMISSIVES_APPROX && (EMISSIVE_TYPE == 1 || EMISSIVE_TYPE == 2)
|
||||
#if EMISSIVE_TYPE == 2 && EMISSIVE_TRIMS > 0
|
||||
if(emissionCheck && !isTrim)
|
||||
#elif EMISSIVE_TRIMS > 0
|
||||
if(!isTrim)
|
||||
#elif EMISSIVE_TYPE == 2
|
||||
if(emissionCheck)
|
||||
#endif
|
||||
{
|
||||
EMISSIVE *= getEmission(Albedo.rgb);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if EMISSIVE_TYPE == 0
|
||||
OutSpecular.a = 0.0;
|
||||
#endif
|
||||
|
||||
#if EMISSIVE_TYPE == 1
|
||||
EMISSIVE = clamp(EMISSIVE, 0.0, 0.99);
|
||||
OutSpecular.a = EMISSIVE;
|
||||
#endif
|
||||
|
||||
#if EMISSIVE_TYPE == 2
|
||||
OutSpecular.a = SpecularTex.a;
|
||||
EMISSIVE = clamp(EMISSIVE, 0.0, 0.99);
|
||||
if(emissionCheck) OutSpecular.a = EMISSIVE;
|
||||
#endif
|
||||
|
||||
#if EMISSIVE_TYPE == 3
|
||||
OutSpecular.a = SpecularTex.a;
|
||||
#endif
|
||||
|
||||
|
||||
#if SSS_TYPE == 0
|
||||
OutSpecular.b = 0.0;
|
||||
#endif
|
||||
|
||||
#if SSS_TYPE == 1
|
||||
OutSpecular.b = SSSAMOUNT;
|
||||
#endif
|
||||
|
||||
#if SSS_TYPE == 2
|
||||
OutSpecular.b = SpecularTex.b;
|
||||
if(SpecularTex.b < 65.0/255.0) OutSpecular.b = SSSAMOUNT;
|
||||
#endif
|
||||
|
||||
#if SSS_TYPE == 3
|
||||
OutSpecular.b = SpecularTex.b;
|
||||
#endif
|
||||
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
//////////////////////////////// FINALIZE ////////////////////////////////
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
|
||||
// apply noise to lightmaps to reduce banding.
|
||||
vec2 PackLightmaps = vec2(torchlightmap, lmcoord.y);
|
||||
|
||||
// special curve to give more precision on high/low values of the gradient. this curve will be inverted after sampling and decoding.
|
||||
// PackLightmaps = pow(1.0-pow(1.0-PackLightmaps,vec2(0.5)),vec2(0.5));
|
||||
|
||||
// some dither to lightmaps to reduce banding.
|
||||
PackLightmaps = clamp( PackLightmaps + PackLightmaps * (BN-0.5)*0.005,0,1);
|
||||
|
||||
|
||||
vec4 data1 = clamp(vec4(encodeNormal(normal), PackLightmaps), 0.0, 1.0);
|
||||
|
||||
Albedo = clamp(Albedo, 0.0, 1.0);
|
||||
|
||||
OutAlbedo = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w,Albedo.w));
|
||||
|
||||
vec4 otherData = clamp(vec4(flatNormals * 0.5 + 0.5, vanillaAO), 0.0, 1.0);
|
||||
OutSpecular = clamp(OutSpecular, 0.0, 1.0);
|
||||
|
||||
OutSpecular = vec4(
|
||||
encodeVec2(OutSpecular.x, otherData.x),
|
||||
encodeVec2(OutSpecular.y, otherData.y),
|
||||
encodeVec2(OutSpecular.z, otherData.z),
|
||||
encodeVec2(OutSpecular.w, otherData.w)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
#include "/lib/settings.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
#include "/lib/bokeh.glsl"
|
||||
#include "/lib/blocks.glsl"
|
||||
#include "/lib/entities.glsl"
|
||||
#include "/lib/items.glsl"
|
||||
|
||||
#include "/lib/SSBOs.glsl"
|
||||
|
||||
#ifdef HAND
|
||||
#undef POM
|
||||
#endif
|
||||
|
||||
#ifndef USE_LUMINANCE_AS_HEIGHTMAP
|
||||
#ifndef MC_NORMAL_MAP
|
||||
#undef POM
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef POM
|
||||
#define MC_NORMAL_MAP
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
out DATA {
|
||||
vec4 color;
|
||||
|
||||
vec4 lmtexcoord;
|
||||
vec3 normalMat;
|
||||
|
||||
#ifdef MC_NORMAL_MAP
|
||||
vec4 tangent;
|
||||
#endif
|
||||
|
||||
vec3 block_normal;
|
||||
flat int blockID;
|
||||
} data_out;
|
||||
|
||||
#ifdef MC_NORMAL_MAP
|
||||
in vec4 at_tangent;
|
||||
#endif
|
||||
|
||||
uniform float frameTimeCounter;
|
||||
const float PI48 = 150.796447372*WAVY_SPEED;
|
||||
float pi2wt = PI48*frameTimeCounter;
|
||||
|
||||
in vec4 mc_Entity;
|
||||
in vec4 mc_midTexCoord;
|
||||
|
||||
uniform int blockEntityId;
|
||||
uniform int entityId;
|
||||
|
||||
|
||||
uniform int heldItemId;
|
||||
uniform int heldItemId2;
|
||||
|
||||
#ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE
|
||||
in vec4 at_midBlock;
|
||||
#else
|
||||
in vec3 at_midBlock;
|
||||
#endif
|
||||
|
||||
uniform int frameCounter;
|
||||
uniform float far;
|
||||
uniform float aspectRatio;
|
||||
uniform float viewHeight;
|
||||
uniform float viewWidth;
|
||||
uniform int hideGUI;
|
||||
uniform float screenBrightness;
|
||||
uniform int isEyeInWater;
|
||||
|
||||
// in vec3 at_velocity;
|
||||
// out vec3 velocity;
|
||||
|
||||
uniform float nightVision;
|
||||
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform vec3 cameraPosition;
|
||||
uniform vec2 texelSize;
|
||||
|
||||
#if defined HAND
|
||||
uniform mat4 gbufferPreviousModelView;
|
||||
uniform vec3 previousCameraPosition;
|
||||
|
||||
float detectCameraMovement(){
|
||||
// simply get the difference of modelview matrices and cameraPosition across a frame.
|
||||
vec3 fakePos = vec3(0.5,0.5,0.0);
|
||||
vec3 hand_playerPos = mat3(gbufferModelViewInverse) * fakePos + (cameraPosition - previousCameraPosition);
|
||||
vec3 previousPosition = mat3(gbufferPreviousModelView) * hand_playerPos;
|
||||
float detectMovement = 1.0 - clamp(distance(previousPosition, fakePos)/texelSize.x,0.0,1.0);
|
||||
|
||||
return detectMovement;
|
||||
}
|
||||
#endif
|
||||
|
||||
//#ifndef IS_LPV_ENABLED
|
||||
uniform vec3 relativeEyePosition;
|
||||
//#endif
|
||||
|
||||
#if !defined ENTITIES && !defined HAND && defined SHADER_GRASS && (defined GRASS_DETECT_FALLOFF || defined GRASS_DETECT_INV_FALLOFF || REPLACE_SHORT_GRASS > 0)
|
||||
uniform usampler1D texBlockData;
|
||||
uniform vec3 cameraPositionFract;
|
||||
|
||||
#include "/lib/lpv_common.glsl"
|
||||
#include "/lib/lpv_blocks.glsl"
|
||||
#include "/lib/lpv_buffer.glsl"
|
||||
#include "/lib/voxel_common.glsl"
|
||||
|
||||
uint GetVoxelBlock(const in ivec3 voxelPos) {
|
||||
if (clamp(voxelPos, ivec3(0), ivec3(VoxelSize3-1u)) != voxelPos)
|
||||
return BLOCK_EMPTY;
|
||||
|
||||
return imageLoad(imgVoxelMask, voxelPos).r;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),-viewSpacePosition.z);
|
||||
}
|
||||
|
||||
vec2 calcWave(in vec3 pos) {
|
||||
|
||||
float magnitude = abs(sin(dot(vec4(frameTimeCounter, pos),vec4(1.0,0.005,0.005,0.005)))*0.5+0.72)*0.013;
|
||||
vec2 ret = (sin(pi2wt*vec2(0.0063,0.0015)*4. - pos.xz + pos.y*0.05)+0.1)*magnitude;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec3 calcMovePlants(in vec3 pos) {
|
||||
vec2 move1 = calcWave(pos );
|
||||
float move1y = -length(move1);
|
||||
return vec3(move1.x,move1y,move1.y)*5.*WAVY_STRENGTH;
|
||||
}
|
||||
|
||||
vec3 calcWaveLeaves(in vec3 pos) {
|
||||
|
||||
float magnitude = abs(sin(dot(vec4(frameTimeCounter, pos),vec4(1.0,0.005,0.005,0.005)))*0.5+0.72)*0.013;
|
||||
vec3 ret = (sin(pi2wt*vec3(0.0063,0.0224,0.0015)*1.5 - pos))*magnitude;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec3 calcMoveLeaves(in vec3 pos, in vec3 amp1) {
|
||||
vec3 move1 = calcWaveLeaves(pos) * amp1;
|
||||
return move1*5.*WAVY_STRENGTH;
|
||||
}
|
||||
|
||||
vec3 srgbToLinear2(vec3 srgb){
|
||||
return mix(
|
||||
srgb / 12.92,
|
||||
pow(.947867 * srgb + .0521327, vec3(2.4) ),
|
||||
step( .04045, srgb )
|
||||
);
|
||||
}
|
||||
vec3 blackbody2(float Temp)
|
||||
{
|
||||
float t = pow(Temp, -1.5);
|
||||
float lt = log(Temp);
|
||||
|
||||
vec3 col = vec3(0.0);
|
||||
col.x = 220000.0 * t + 0.58039215686;
|
||||
col.y = 0.39231372549 * lt - 2.44549019608;
|
||||
col.y = Temp > 6500. ? 138039.215686 * t + 0.72156862745 : col.y;
|
||||
col.z = 0.76078431372 * lt - 5.68078431373;
|
||||
col = clamp(col,0.0,1.0);
|
||||
col = Temp < 1000. ? col * Temp * 0.001 : col;
|
||||
|
||||
return srgbToLinear2(col);
|
||||
}
|
||||
// float luma(vec3 color) {
|
||||
// return dot(color,vec3(0.21, 0.72, 0.07));
|
||||
// }
|
||||
|
||||
#define SEASONS_VSH
|
||||
#include "/lib/climate_settings.glsl"
|
||||
|
||||
uniform int framemod8;
|
||||
|
||||
|
||||
#include "/lib/TAA_jitter.glsl"
|
||||
|
||||
|
||||
uniform sampler2D noisetex;//depth
|
||||
float densityAtPos(in vec3 pos){
|
||||
pos /= 18.;
|
||||
pos.xz *= 0.5;
|
||||
vec3 p = floor(pos);
|
||||
vec3 f = fract(pos);
|
||||
vec2 uv = p.xz + f.xz + p.y * vec2(0.0,193.0);
|
||||
vec2 coord = uv / 512.0;
|
||||
|
||||
//The y channel has an offset to avoid using two textures fetches
|
||||
vec2 xy = texture(noisetex, coord).yx;
|
||||
|
||||
return mix(xy.r,xy.g, f.y);
|
||||
}
|
||||
float luma(vec3 color) {
|
||||
return dot(color,vec3(0.21, 0.72, 0.07));
|
||||
}
|
||||
vec3 viewToWorld(vec3 viewPos) {
|
||||
vec4 pos;
|
||||
pos.xyz = viewPos;
|
||||
pos.w = 0.0;
|
||||
pos = gbufferModelViewInverse * pos;
|
||||
return pos.xyz;
|
||||
}
|
||||
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 1 && !defined HAND
|
||||
uniform float caveDetection;
|
||||
#endif
|
||||
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
void main() {
|
||||
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||
data_out.blockID = int(mc_Entity.x);
|
||||
|
||||
/////// ----- COLOR STUFF ----- ///////
|
||||
data_out.color = gl_Color;
|
||||
data_out.block_normal = gl_Normal;
|
||||
|
||||
/////// ----- RANDOM STUFF ----- ///////
|
||||
// gl_TextureMatrix[0] for animated things like charged creepers
|
||||
data_out.lmtexcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
data_out.lmtexcoord.zw = gl_MultiTexCoord1.xy / 240.0;
|
||||
|
||||
#ifdef MC_NORMAL_MAP
|
||||
data_out.tangent = vec4(normalize(gl_NormalMatrix * at_tangent.rgb), at_tangent.w);
|
||||
#endif
|
||||
|
||||
data_out.normalMat = normalize(gl_NormalMatrix * gl_Normal);
|
||||
|
||||
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
vec3 worldNormals = viewToWorld(data_out.normalMat);
|
||||
|
||||
// position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
||||
|
||||
#if defined PLANET_CURVATURE
|
||||
float curvature = length(worldpos.xz) / (16.0*8.0);
|
||||
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
|
||||
#endif
|
||||
|
||||
gl_Position = toClipSpace3(mat3(gbufferModelView) * vec3(worldpos) + gbufferModelView[3].xyz);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
in vec3 worldPos;
|
||||
in vec3 cageNormal;
|
||||
in vec3 color;
|
||||
|
||||
uniform int frameCounter, frameTime;
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform mat4 shadowProjection, shadowProjectionInverse;
|
||||
uniform mat4 shadowModelView, shadowModelViewInverse;
|
||||
|
||||
uniform sampler2D depthtex0;
|
||||
|
||||
#include "/photonics/photonics.glsl"
|
||||
|
||||
void main() {
|
||||
#ifdef NETHER_SHADER
|
||||
discard;
|
||||
#else
|
||||
RayJob ray = RayJob(vec3(0), vec3(0), vec3(0), vec3(0), vec3(0), false);
|
||||
ray.origin = worldPos - world_offset - 0.01f * cageNormal;
|
||||
ray.direction = mat3(shadowModelViewInverse) * vec3(0.0f, 0.0f, -1.0f);
|
||||
ray_constraint = ivec3(ray.origin);
|
||||
trace_ray(ray);
|
||||
|
||||
if (!ray.result_hit) {
|
||||
discard;
|
||||
}
|
||||
|
||||
vec4 shadowColor = vec4(ray.result_color * color, 1.0f);
|
||||
|
||||
gl_FragData[0] = shadowColor;
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
|
||||
#include "/lib/SSBOs.glsl"
|
||||
|
||||
uniform mat4 shadowProjectionInverse;
|
||||
uniform mat4 shadowProjection;
|
||||
uniform mat4 shadowModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 gbufferProjection;
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform int hideGUI;
|
||||
uniform vec3 cameraPosition;
|
||||
uniform vec3 relativeEyePosition;
|
||||
uniform float frameTimeCounter;
|
||||
uniform int frameCounter;
|
||||
uniform float screenBrightness;
|
||||
uniform vec3 sunVec;
|
||||
uniform float aspectRatio;
|
||||
uniform float sunElevation;
|
||||
uniform vec3 sunPosition;
|
||||
uniform float lightSign;
|
||||
uniform float cosFov;
|
||||
uniform vec3 shadowViewDir;
|
||||
uniform vec3 shadowCamera;
|
||||
uniform vec3 shadowLightVec;
|
||||
uniform float shadowMaxProj;
|
||||
|
||||
uniform int blockEntityId;
|
||||
uniform int entityId;
|
||||
|
||||
out vec3 worldPos;
|
||||
out vec3 cageNormal;
|
||||
out vec3 color;
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
|
||||
// mat4 projection = DH_shadowProjectionTweak(gl_ProjectionMatrix);
|
||||
|
||||
return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),1.0);
|
||||
}
|
||||
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
|
||||
void main() {
|
||||
color = gl_Color.rgb;
|
||||
|
||||
#ifdef NETHER_SHADER
|
||||
worldPos = vec3(0.0);
|
||||
cageNormal = vec3(0.0);
|
||||
|
||||
gl_Position = vec4(-1.0);
|
||||
#else
|
||||
cageNormal = gl_Normal;
|
||||
|
||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||
|
||||
worldPos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
|
||||
|
||||
#ifdef CUSTOM_MOON_ROTATION
|
||||
position = mat3(customShadowMatrixSSBO) * worldPos + customShadowMatrixSSBO[3].xyz;
|
||||
#else
|
||||
position = mat3(shadowModelView) * worldPos + shadowModelView[3].xyz;
|
||||
#endif
|
||||
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
gl_Position = BiasShadowProjection(toClipSpace3(position));
|
||||
#else
|
||||
gl_Position = toClipSpace3(position);
|
||||
#endif
|
||||
|
||||
gl_Position.z /= 6.0;
|
||||
#endif
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - A Bliss Edit
|
||||
prefix.SHADER_VERSION_LABEL = V
|
||||
value.SHADER_VERSION_LABEL.482 = 6.2.0
|
||||
value.SHADER_VERSION_LABEL.482 = 6.3.0
|
||||
|
||||
# if you're here to translate, this is not a joke, these do what they say
|
||||
profile.POTATO=§4Potato
|
||||
@@ -642,7 +642,7 @@ screen.Climate = Climate Settings
|
||||
option.DARKFOREST_G = Green Amount
|
||||
option.DARKFOREST_B = Blue Amount
|
||||
|
||||
screen.PALE_GARDEN = Dark Forest
|
||||
screen.PALE_GARDEN = Pale Garden
|
||||
option.PALE_GARDEN_ENV = Pale Garden Environment
|
||||
option.PALE_GARDEN_UNIFORM_DENSITY = Uniform Fog Density
|
||||
option.PALE_GARDEN_CLOUDY_DENSITY = Cloudy Fog Density
|
||||
@@ -1269,6 +1269,11 @@ screen.VOXY_SETTINGS = Voxy Settings
|
||||
option.VOXY_SSS = Sub-Surface Scattering on LOD Chunks
|
||||
option.VOXY_REFLECTIONS = Screen-Space Reflections on LOD Chunks
|
||||
|
||||
screen.PHOTONICS_SETTINGS = Photonic Settings
|
||||
option.PHOTONICS_ENABLED = Enable Photonics
|
||||
option.PHOTONICS_INDIRECT_BRIGHTNESS = Indirect Brightness
|
||||
|
||||
|
||||
option.TRANSLUCENT_COLORED_SHADOWS.comment = §bWhat is this?§r This effect allows translucent things like stained glass to color the sunlight as it passes through it. §aPERFORMANCE COST:§r medium
|
||||
option.MINIMUM_WATER_ABSORBANCE.comment = §bWhat is this?§r This controls how "clear" the water is in shallow areas. AUTO allows water to be clear outdoors, but adjust to be at a minimum value of 7 when indoors, to make it clearly visible. §dTHIS SETTING DOES NOT IMPACT UNDER-WATER VISUALS.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - Bliss 编辑版
|
||||
prefix.SHADER_VERSION_LABEL = 版本
|
||||
value.SHADER_VERSION_LABEL.482 = 6.2.0
|
||||
value.SHADER_VERSION_LABEL.482 = 6.3.0
|
||||
|
||||
# 如果你是来翻译的,这不是玩笑,这些选项的功能正如其名
|
||||
profile.POTATO=§4土豆 (极低配置)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
layout(std430, binding = 0) buffer SSBO1 {
|
||||
layout(std430, binding = 6) buffer SSBO1 {
|
||||
mat4 customShadowMatrixSSBO; // 64 bytes
|
||||
|
||||
vec3 customMoonVecSSBO; // 12 bytes
|
||||
|
||||
@@ -92,6 +92,12 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PHOTONICS_ENABLED
|
||||
uniform sampler2D radiosity_direct;
|
||||
uniform sampler2D radiosity_direct_soft;
|
||||
uniform sampler2D radiosity_handheld;
|
||||
#endif
|
||||
|
||||
vec3 doBlockLightLighting(
|
||||
vec3 lightColor, float lightmap,
|
||||
vec3 playerPos, vec3 lpvPos
|
||||
@@ -161,6 +167,17 @@ vec3 doBlockLightLighting(
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef PHOTONICS_ENABLED
|
||||
vec3 ph_direct_hand = texture(radiosity_handheld, gl_FragCoord.xy*texelSize).xyz;
|
||||
vec3 ph_direct = texture(radiosity_direct, gl_FragCoord.xy*texelSize).xyz;
|
||||
vec4 ph_direct_soft = texture(radiosity_direct_soft, gl_FragCoord.xy*texelSize);
|
||||
|
||||
blockLight = ph_direct_hand * 1.35;
|
||||
blockLight += ph_direct;
|
||||
blockLight = pow(blockLight, vec3(1.45));
|
||||
blockLight += (ph_direct_soft.xyz / max(ph_direct_soft.w, 1.0f));
|
||||
#endif
|
||||
|
||||
return blockLight * TORCH_AMOUNT;
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
|
||||
|
||||
#if EMISSIVE_TYPE_SETTING == 4
|
||||
#ifdef MC_TEXTURE_FORMAT_LAB_PBR
|
||||
#define EMISSIVE_TYPE 3
|
||||
#define EMISSIVE_TYPE 2
|
||||
#else
|
||||
#define EMISSIVE_TYPE 1
|
||||
#endif
|
||||
@@ -347,7 +347,7 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
|
||||
|
||||
#if SSS_TYPE_SETTING == 4
|
||||
#ifdef MC_TEXTURE_FORMAT_LAB_PBR
|
||||
#define SSS_TYPE 3
|
||||
#define SSS_TYPE 2
|
||||
#else
|
||||
#define SSS_TYPE 1
|
||||
#endif
|
||||
@@ -1154,6 +1154,19 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
||||
#ifdef VOXY_SSS
|
||||
#endif
|
||||
|
||||
//////////////////////////////////
|
||||
// ----- PHOTONICS SETTINGS ----- //
|
||||
//////////////////////////////////
|
||||
|
||||
// #define PHOTONICS_ENABLED
|
||||
|
||||
#ifdef PHOTONICS_ENABLED
|
||||
#undef Hand_Held_lights
|
||||
#undef LPV_ENABLED
|
||||
#undef IS_LPV_ENABLED
|
||||
#endif
|
||||
|
||||
#define PHOTONICS_INDIRECT_BRIGHTNESS 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 2.5 3.0 3.5 4.0 4.5 5.0]
|
||||
|
||||
////////////////////////////////
|
||||
// ----- DEBUG SETTINGS ----- //
|
||||
|
||||
@@ -176,40 +176,31 @@ void endText(inout vec3 fragColor) {
|
||||
fragColor = mix(fragColor.rgb, text.result.rgb, text.result.a);
|
||||
}
|
||||
|
||||
const int scale = 4;
|
||||
|
||||
void printChar(uint character) {
|
||||
ivec2 scaledCharSize = charSize * scale;
|
||||
ivec2 scaledSpaceSize = spaceSize * scale;
|
||||
// Calculate effective spacing that includes current padding settings
|
||||
ivec2 effectiveSpaceSize = spaceSize + text.charPadding * 2;
|
||||
|
||||
// Use this effective spacing for positioning
|
||||
ivec2 pos = text.fragPos - text.textPos - scaledSpaceSize * text.charPos * ivec2(1, -1) + ivec2(0, scaledSpaceSize.y);
|
||||
|
||||
ivec2 bgPaddingScaled = text.bgPadding * scale;
|
||||
ivec2 bgArea = scaledSpaceSize + bgPaddingScaled * 2;
|
||||
ivec2 pos = text.fragPos - text.textPos - effectiveSpaceSize * text.charPos * ivec2(1, -1) + ivec2(0, effectiveSpaceSize.y);
|
||||
|
||||
// Draw background (larger area with padding)
|
||||
ivec2 bgPos = pos + bgPaddingScaled;
|
||||
if (clamp(bgPos, ivec2(0), bgArea - 1) == bgPos) {
|
||||
ivec2 bgPos = pos + text.bgPadding;
|
||||
if (clamp(bgPos, ivec2(0), effectiveSpaceSize + text.bgPadding * 2 - 1) == bgPos) {
|
||||
float bgAlpha = text.result.a;
|
||||
// Only apply background if this pixel hasn't been colored yet
|
||||
if (bgAlpha < 0.01) {
|
||||
text.result = mix(text.result, text.bgCol, text.bgCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
vec2 pixelInChar = vec2(pos) / float(scale);
|
||||
|
||||
if (pixelInChar.x >= 0.0 && pixelInChar.x < float(charWidth) &&
|
||||
pixelInChar.y >= 0.0 && pixelInChar.y < float(charHeight)) {
|
||||
|
||||
ivec2 originalPixel = ivec2(floor(pixelInChar.x), floor(pixelInChar.y));
|
||||
uint index = uint(charWidth - originalPixel.x + originalPixel.y * charWidth + 1);
|
||||
|
||||
if ((character >> index & 1u) == 1u) {
|
||||
text.result = mix(text.result, text.fgCol, text.fgCol.a);
|
||||
}
|
||||
// Draw character
|
||||
ivec2 charPos = pos - text.charPadding;
|
||||
if (clamp(charPos, ivec2(0), charSize - 1) == charPos) {
|
||||
uint index = uint(charWidth - charPos.x + charPos.y * charWidth + 1);
|
||||
text.result = mix(text.result, text.fgCol, text.fgCol.a * float(character >> index & 1u));
|
||||
}
|
||||
|
||||
// Advance to next character
|
||||
text.charPos.x++;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,6 @@
|
||||
#version 430 compatibility
|
||||
|
||||
|
||||
#define NETHER_SHADER
|
||||
|
||||
#include "/dimensions/voxels.fsh"
|
||||
@@ -0,0 +1,5 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#define NETHER_SHADER
|
||||
|
||||
#include "/dimensions/voxels.vsh"
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define NETHER_SHADER
|
||||
|
||||
#include "/dimensions/voxels_shadow.fsh"
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define NETHER_SHADER
|
||||
|
||||
#include "/dimensions/voxels_shadow.vsh"
|
||||
@@ -0,0 +1,6 @@
|
||||
#version 430 compatibility
|
||||
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
|
||||
#include "/dimensions/voxels.fsh"
|
||||
@@ -0,0 +1,5 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
|
||||
#include "/dimensions/voxels.vsh"
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
|
||||
#include "/dimensions/voxels_shadow.fsh"
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
|
||||
#include "/dimensions/voxels_shadow.vsh"
|
||||
@@ -0,0 +1,7 @@
|
||||
#version 430 compatibility
|
||||
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#include "/dimensions/voxels.fsh"
|
||||
@@ -0,0 +1,6 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#include "/dimensions/voxels.vsh"
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#include "/dimensions/voxels_shadow.fsh"
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#include "/dimensions/voxels_shadow.vsh"
|
||||
@@ -0,0 +1,7 @@
|
||||
#version 430 compatibility
|
||||
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#include "/dimensions/voxels.fsh"
|
||||
@@ -0,0 +1,6 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#include "/dimensions/voxels.vsh"
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#include "/dimensions/voxels_shadow.fsh"
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#include "/dimensions/voxels_shadow.vsh"
|
||||
@@ -0,0 +1,6 @@
|
||||
#version 430 compatibility
|
||||
|
||||
|
||||
#define END_SHADER
|
||||
|
||||
#include "/dimensions/voxels.fsh"
|
||||
@@ -0,0 +1,5 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#define END_SHADER
|
||||
|
||||
#include "/dimensions/voxels.vsh"
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define END_SHADER
|
||||
|
||||
#include "/dimensions/voxels_shadow.fsh"
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define END_SHADER
|
||||
|
||||
#include "/dimensions/voxels_shadow.vsh"
|
||||
Reference in New Issue
Block a user