mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-23 01:59:39 +08:00
ADD Colored shadows
This commit is contained in:
parent
cc40afe271
commit
6576c835dc
@ -12,6 +12,12 @@ varying vec4 color;
|
||||
const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
uniform sampler2D shadowcolor0;
|
||||
uniform sampler2DShadow shadowtex0;
|
||||
uniform sampler2DShadow shadowtex1;
|
||||
#endif
|
||||
|
||||
flat varying vec3 WsunVec;
|
||||
|
||||
flat varying vec3 averageSkyCol_Clouds;
|
||||
@ -147,7 +153,7 @@ void main() {
|
||||
if(lightmap.x >= 0.9) Torch_Color *= LIT_PARTICLE_BRIGHTNESS;
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
float Shadows = 1.0;
|
||||
vec3 Shadows = vec3(1.0);
|
||||
|
||||
vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz;
|
||||
@ -163,10 +169,21 @@ void main() {
|
||||
|
||||
//do shadows only if on shadow map
|
||||
if (abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution){
|
||||
Shadows = vec3(0.0);
|
||||
|
||||
projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5);
|
||||
|
||||
Shadows = shadow2D(shadow, projectedShadowPosition).x;
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
float opaqueShadow = shadow2D(shadowtex0, projectedShadowPosition).x;
|
||||
Shadows += vec3(opaqueShadow);
|
||||
|
||||
if(shadow2D(shadowtex1, projectedShadowPosition).x > projectedShadowPosition.z){
|
||||
vec4 translucentShadow = texture2D(shadowcolor0, projectedShadowPosition.xy);
|
||||
if(translucentShadow.a < 0.9) Shadows += normalize(translucentShadow.rgb+0.0001) * (1.0-opaqueShadow);
|
||||
}
|
||||
#else
|
||||
Shadows = vec3(shadow2D(shadow, projectedShadowPosition).x);
|
||||
#endif
|
||||
}
|
||||
|
||||
float cloudShadow = GetCloudShadow(feetPlayerPos);
|
||||
|
@ -8,6 +8,12 @@ varying vec4 color;
|
||||
const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
uniform sampler2D shadowcolor0;
|
||||
uniform sampler2DShadow shadowtex0;
|
||||
uniform sampler2DShadow shadowtex1;
|
||||
#endif
|
||||
|
||||
uniform float lightSign;
|
||||
flat varying vec3 WsunVec;
|
||||
|
||||
@ -350,6 +356,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
|
||||
vec4 COLORTEST = vec4(Albedo, UnchangedAlpha);
|
||||
if (iswater > 0.95) COLORTEST = vec4(0.0);
|
||||
|
||||
#ifdef BIOME_TINT_WATER
|
||||
if (iswater > 0.95) COLORTEST.rgb = color.rgb;
|
||||
@ -418,7 +425,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
float NdotL = clamp(dot(normal, normalize(WsunVec*mat3(gbufferModelViewInverse))),0.0,1.0); NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0);
|
||||
float Shadows = 0.0;
|
||||
vec3 Shadows = vec3(0.0);
|
||||
bool inShadowmapBounds = false;
|
||||
|
||||
vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
@ -444,7 +451,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
// sample shadows only if on shadow map
|
||||
if(ShadowBounds){
|
||||
if (NdotL > 0.0){
|
||||
Shadows = 0.0;
|
||||
Shadows = vec3(0.0);
|
||||
projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5);
|
||||
|
||||
#ifndef HAND
|
||||
@ -458,25 +465,52 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
int SampleCount = 7;
|
||||
for(int i = 0; i < SampleCount; i++){
|
||||
// vec2 offsetS = tapLocation(i,SampleCount,1.618,noise,0.0);
|
||||
vec2 offsetS = tapLocation_simple(i, 7, 9, noise) * 0.5;
|
||||
|
||||
float weight = 1.0+(i+noise)*rdMul/9.0*shadowMapResolution;
|
||||
float isShadow = shadow2D(shadow, projectedShadowPosition + vec3(rdMul*offsetS, -diffthresh*weight)).x / SampleCount;
|
||||
Shadows += isShadow;
|
||||
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
vec3 shadowProjOffsets = projectedShadowPosition + vec3(rdMul*offsetS, -diffthresh*weight);
|
||||
|
||||
float opaqueShadow = shadow2D(shadowtex0, shadowProjOffsets).x;
|
||||
Shadows += vec3(opaqueShadow/SampleCount);
|
||||
|
||||
if(shadow2D(shadowtex1, shadowProjOffsets).x > shadowProjOffsets.z){
|
||||
vec4 translucentShadow = texture2D(shadowcolor0, shadowProjOffsets.xy);
|
||||
if(translucentShadow.a < 0.9) Shadows += (normalize(translucentShadow.rgb+0.0001) * clamp(1.0-opaqueShadow,0.0,1.0)) / SampleCount;
|
||||
}
|
||||
|
||||
#else
|
||||
Shadows = shadow2D(shadow, projectedShadowPosition - vec3(0.0,0.0,0.0001)).x;
|
||||
Shadows += vec3(shadow2D(shadow, projectedShadowPosition + vec3(rdMul*offsetS, -diffthresh*weight)).x / SampleCount);
|
||||
#endif
|
||||
|
||||
}
|
||||
#else
|
||||
Shadows = shadow2D(shadow, projectedShadowPosition - vec3(0.0,0.0,0.0005)).x;
|
||||
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
projectedShadowPosition -= vec3(0.0,0.0,0.0001);
|
||||
Shadows = vec3(shadow2D(shadowtex0, projectedShadowPosition ).x);
|
||||
|
||||
if(shadow2D(shadowtex1, projectedShadowPosition).x > projectedShadowPosition.z){
|
||||
vec4 shadowLightColor = texture2D(shadowcolor0, projectedShadowPosition.xy);
|
||||
if(shadowLightColor.a < 0.9) Shadows += normalize(shadowLightColor.rgb+0.0001);
|
||||
}
|
||||
#else
|
||||
Shadows = vec3(shadow2D(shadow, projectedShadowPosition - vec3(0.0,0.0,0.0001)).x);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#else
|
||||
Shadows = vec3(shadow2D(shadow, projectedShadowPosition - vec3(0.0,0.0,0.0005)).x);
|
||||
#endif
|
||||
}
|
||||
inShadowmapBounds = true;
|
||||
}
|
||||
|
||||
if(!inShadowmapBounds) Shadows = 1.0;
|
||||
if(!inShadowmapBounds) Shadows = vec3(1.0);
|
||||
|
||||
Shadows *= GetCloudShadow(feetPlayerPos);
|
||||
|
||||
@ -529,9 +563,9 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
|
||||
|
||||
#ifdef Glass_Tint
|
||||
FinalColor *= min(pow(gl_FragData[0].a,2.0),1.0);
|
||||
#endif
|
||||
// #ifdef Glass_Tint
|
||||
// FinalColor *= min(pow(gl_FragData[0].a,2.0),1.0);
|
||||
// #endif
|
||||
|
||||
////////////////////////////////
|
||||
//////////////////////////////// SPECULAR
|
||||
@ -548,8 +582,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
float roughness = max(pow(1.0-SpecularTex.r,2.0),0.05);
|
||||
float f0 = SpecularTex.g;
|
||||
|
||||
// roughness = 0.0;
|
||||
// f0 = 0.9;
|
||||
// roughness = 0.1;
|
||||
// f0 = 1.0;
|
||||
|
||||
if (iswater > 0.0 && gl_FragData[0].a < 0.9999999){
|
||||
vec3 Reflections_Final = vec3(0.0);
|
||||
@ -571,20 +605,20 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
fresnel = mix(f0, 1.0, fresnel);
|
||||
|
||||
vec3 Metals = f0 > 229.5/255.0 ? mix(normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3), vec3(1.0), fresnel * pow(1.0-roughness,25.0)) : vec3(1.0);
|
||||
vec3 Metals = f0 > 229.5/255.0 ? normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3) : vec3(1.0);
|
||||
|
||||
|
||||
// Sun, Sky, and screen-space reflections
|
||||
#ifdef OVERWORLD_SHADER
|
||||
#ifdef WATER_SUN_SPECULAR
|
||||
SunReflection = Direct_lighting * GGX(normal, -normalize(viewPos), WsunVec*mat3(gbufferModelViewInverse), roughness, vec3(f0)) * Metals;
|
||||
SunReflection = Direct_lighting * GGX(normal, -normalize(viewPos), WsunVec*mat3(gbufferModelViewInverse), roughness, vec3(f0)) ;
|
||||
#endif
|
||||
#ifdef WATER_BACKGROUND_SPECULAR
|
||||
if(isEyeInWater == 0) SkyReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0 *Metals;
|
||||
if(isEyeInWater == 0) SkyReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0 ;
|
||||
#endif
|
||||
#else
|
||||
#ifdef WATER_BACKGROUND_SPECULAR
|
||||
if(isEyeInWater == 0) SkyReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0 * Metals;
|
||||
if(isEyeInWater == 0) SkyReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0 ;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef SCREENSPACE_REFLECTIONS
|
||||
@ -596,7 +630,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
previousPosition.xy = projMAD(gbufferPreviousProjection, 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) {
|
||||
Reflections.a = 1.0;
|
||||
Reflections.rgb = texture2D(colortex5,previousPosition.xy).rgb * Metals;
|
||||
Reflections.rgb = texture2D(colortex5,previousPosition.xy).rgb ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -613,10 +647,10 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
Reflections_Final = FinalColor;
|
||||
#else
|
||||
Reflections_Final = mix(SkyReflection*indoors, Reflections.rgb, Reflections.a);
|
||||
Reflections_Final = mix(FinalColor, Reflections_Final, fresnel);
|
||||
Reflections_Final = mix(FinalColor, Reflections_Final * Metals, fresnel);
|
||||
#endif
|
||||
|
||||
Reflections_Final += SunReflection;
|
||||
Reflections_Final += SunReflection * Metals;
|
||||
|
||||
|
||||
gl_FragData[0].rgb = Reflections_Final ;
|
||||
|
@ -2,14 +2,28 @@
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
|
||||
vec3 saturation(inout vec3 color, float saturation){
|
||||
|
||||
|
||||
float luminance = dot(color, vec3(0.21, 0.72, 0.07));
|
||||
|
||||
vec3 difference = color - luminance;
|
||||
|
||||
return color = color + difference*saturation;
|
||||
}
|
||||
|
||||
const bool colortex5MipmapEnabled = true;
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
uniform sampler2D shadowcolor0;
|
||||
uniform sampler2DShadow shadowtex0;
|
||||
uniform sampler2DShadow shadowtex1;
|
||||
#endif
|
||||
|
||||
flat varying vec3 averageSkyCol_Clouds;
|
||||
flat varying vec4 lightCol;
|
||||
|
||||
@ -844,19 +858,20 @@ void main() {
|
||||
vec3 Direct_lighting = vec3(0.0);
|
||||
vec3 Direct_SSS = vec3(0.0);
|
||||
float cloudShadow = 1.0;
|
||||
float Shadows = 1.0;
|
||||
vec3 Shadows = vec3(1.0);
|
||||
float NdotL = 1.0;
|
||||
|
||||
|
||||
|
||||
float shadowMap = 1.0;
|
||||
vec3 shadowMap = vec3(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)) / shadowDistance,0.0)*5.0,1.0),2.0),2.0);
|
||||
#endif
|
||||
float shadowMapFalloff2 = 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);
|
||||
|
||||
// shadowMapFalloff = 0;
|
||||
// shadowMapFalloff2 = 0;
|
||||
float LM_shadowMapFallback = min(max(lightmap.y-0.8, 0.0) * 25,1.0);
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
@ -895,8 +910,8 @@ void main() {
|
||||
#endif
|
||||
|
||||
float ShadowBlockerDepth = filteredShadow.y;
|
||||
Shadows = clamp(1.0 - filteredShadow.b,0.0,1.0);
|
||||
shadowMap = Shadows;
|
||||
Shadows = vec3(clamp(1.0 - filteredShadow.b,0.0,1.0));
|
||||
shadowMap = vec3(Shadows);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -1019,7 +1034,8 @@ void main() {
|
||||
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;
|
||||
shadowMap = vec3(0.0);
|
||||
vec3 ShadowColor = vec3(0.0);
|
||||
|
||||
projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5);
|
||||
|
||||
@ -1032,16 +1048,46 @@ void main() {
|
||||
for(int i = 0; i < SHADOW_FILTER_SAMPLE_COUNT; i++){
|
||||
vec2 offsetS = tapLocation_simple(i, 7, 9, noise_2) * 0.5;
|
||||
|
||||
shadowMap += shadow2D(shadow, projectedShadowPosition + vec3(rdMul*offsetS, biasOffset) ).x/SHADOW_FILTER_SAMPLE_COUNT;
|
||||
projectedShadowPosition += vec3(rdMul*offsetS, biasOffset);
|
||||
|
||||
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
float opaqueShadow = shadow2D(shadowtex0, projectedShadowPosition).x;
|
||||
ShadowColor += vec3(opaqueShadow/SHADOW_FILTER_SAMPLE_COUNT);
|
||||
|
||||
if(shadow2D(shadowtex1, projectedShadowPosition).x > projectedShadowPosition.z){
|
||||
vec4 translucentShadow = texture2D(shadowcolor0, projectedShadowPosition.xy);
|
||||
if(translucentShadow.a < 0.9) ShadowColor += (normalize(translucentShadow.rgb+0.0001) * clamp(1.0-opaqueShadow,0.0,1.0)) / SHADOW_FILTER_SAMPLE_COUNT;
|
||||
}
|
||||
#else
|
||||
shadowMap = shadow2D(shadow, projectedShadowPosition + vec3(0.0,0.0, biasOffset)).x;
|
||||
ShadowColor += vec3(shadow2D(shadow, projectedShadowPosition).x/SHADOW_FILTER_SAMPLE_COUNT);
|
||||
#endif
|
||||
}
|
||||
|
||||
shadowMap = ShadowColor;
|
||||
|
||||
#else
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
|
||||
float OPAQUESHADOW = shadow2D(shadowtex0, projectedShadowPosition).x;
|
||||
shadowMap += vec3(OPAQUESHADOW);
|
||||
|
||||
if(shadow2D(shadowtex1, projectedShadowPosition).x > projectedShadowPosition.z){
|
||||
vec4 shadowLightColor = texture2D(shadowcolor0, projectedShadowPosition.xy);
|
||||
if(shadowLightColor.a < 0.9) shadowMap += normalize(shadowLightColor.rgb+0.0001) * (1.0-OPAQUESHADOW);
|
||||
}
|
||||
#else
|
||||
shadowMap += vec3(shadow2D(shadow, projectedShadowPosition).x);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Shadows = shadowMap;
|
||||
|
||||
// if(shadow2D(shadowtex0, projectedShadowPosition).x < projectedShadowPosition.z) DirectLightColor *= shadow2D(shadowtex1, projectedShadowPosition).x * waterCaustics(feetPlayerPos + cameraPosition, WsunVec)*WATER_CAUSTICS_BRIGHTNESS + 0.25;
|
||||
|
||||
}
|
||||
|
||||
if(!iswater) Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2);
|
||||
if(!iswater) Shadows = mix(vec3(LM_shadowMapFallback), Shadows, shadowMapFalloff2);
|
||||
|
||||
#ifdef OLD_LIGHTLEAK_FIX
|
||||
if (isEyeInWater == 0) Shadows *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix
|
||||
@ -1064,7 +1110,7 @@ void main() {
|
||||
#endif
|
||||
|
||||
#if !defined Variable_Penumbra_Shadows
|
||||
ShadowBlockerDepth = pow(1.0 - Shadows,2.0);
|
||||
ShadowBlockerDepth = pow(1.0 - clamp(dot(Shadows,vec3(0.33333)),0,1),2.0);
|
||||
#endif
|
||||
|
||||
|
||||
@ -1273,11 +1319,11 @@ void main() {
|
||||
|
||||
|
||||
//////// DEBUG VIEW STUFF
|
||||
#if DEBUG_VIEW == debug_SHADOWMAP
|
||||
vec3 OutsideShadowMap_and_DH_shadow = (shadowMapFalloff > 0.0 && z >= 1.0) ? vec3(0.25,1.0,0.25) : vec3(1.0,0.25,0.25);
|
||||
vec3 Normal_Shadowmap = z < 1.0 ? vec3(0.25,0.25,1.0) : OutsideShadowMap_and_DH_shadow;
|
||||
gl_FragData[0].rgb = mix(vec3(0.1) * (normal.y * 0.1 +0.9), Normal_Shadowmap, shadowMap);
|
||||
#endif
|
||||
// #if DEBUG_VIEW == debug_SHADOWMAP
|
||||
// vec3 OutsideShadowMap_and_DH_shadow = (shadowMapFalloff > 0.0 && z >= 1.0) ? vec3(0.25,1.0,0.25) : vec3(1.0,0.25,0.25);
|
||||
// vec3 Normal_Shadowmap = z < 1.0 ? vec3(0.25,0.25,1.0) : OutsideShadowMap_and_DH_shadow;
|
||||
// gl_FragData[0].rgb = mix(vec3(0.1) * (normal.y * 0.1 +0.9), Normal_Shadowmap, shadowMap) * 30.0;
|
||||
// #endif
|
||||
#if DEBUG_VIEW == debug_NORMALS
|
||||
gl_FragData[0].rgb = FlatNormals;
|
||||
#endif
|
||||
@ -1293,7 +1339,6 @@ void main() {
|
||||
#if DEBUG_VIEW == debug_VIEW_POSITION
|
||||
gl_FragData[0].rgb = viewPos * 0.001;
|
||||
#endif
|
||||
|
||||
#if DEBUG_VIEW == debug_FILTERED_STUFF
|
||||
vec3 FilteredDebug = vec3(15.0) * exp(-1.0 * vec3(1.0,0.5,1.0) * filteredShadow.y);
|
||||
FilteredDebug += vec3(15.0) * exp(-7.0 * vec3(1.0,1.0,0.5) * pow(SSAO_SSS.x,2));
|
||||
|
@ -65,7 +65,11 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
||||
#ifdef OVERWORLD_SHADER
|
||||
const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
uniform sampler2D shadowcolor0;
|
||||
uniform sampler2DShadow shadowtex0;
|
||||
uniform sampler2DShadow shadowtex1;
|
||||
#endif
|
||||
flat varying vec3 refractedSunVec;
|
||||
|
||||
#define TIMEOFDAYFOG
|
||||
@ -263,7 +267,7 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
||||
|
||||
progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||
|
||||
float sh = 1.0;
|
||||
vec3 sh = vec3(1.0);
|
||||
#ifdef OVERWORLD_SHADER
|
||||
vec3 spPos = start.xyz + dV*d;
|
||||
|
||||
@ -276,7 +280,16 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
||||
vec3 pos = vec3(spPos.xy*distortFactor, spPos.z);
|
||||
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;
|
||||
// sh = shadow2D( shadow, pos).x;
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
sh = vec3(shadow2D(shadowtex0, pos).x);
|
||||
|
||||
if(shadow2D(shadowtex1, pos).x > pos.z && sh.x < 1.0){
|
||||
sh = normalize(texture2D(shadowcolor0, pos.xy).rgb+0.0001);
|
||||
}
|
||||
#else
|
||||
sh = vec3(shadow2D(shadow, pos).x);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef VL_CLOUDS_SHADOWS
|
||||
@ -291,7 +304,7 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
||||
float sunCaustics = (waterCaustics(progressW, WsunVec)) * mix(0.25,10.0,bubble) + 0.75;
|
||||
|
||||
vec3 sunMul = exp(-1 * d * waterCoefs * 1.1);
|
||||
vec3 Directlight = (lightSource * phase * sunMul * sunCaustics) * sh * lowlightlevel * pow(abs(WsunVec.y),1);
|
||||
vec3 Directlight = ((lightSource* sh) * phase * sunMul * sunCaustics) * lowlightlevel * pow(abs(WsunVec.y),1);
|
||||
#else
|
||||
vec3 Directlight = vec3(0.0);
|
||||
#endif
|
||||
|
@ -328,7 +328,7 @@ void main() {
|
||||
|
||||
if (TranslucentShader.a > 0.0){
|
||||
#ifdef Glass_Tint
|
||||
if(albedo.a > 0.2 && !iswater) color = color*albedo.rgb + color * clamp(pow(1.0-luma(albedo.rgb),20.),0.0,1.0);
|
||||
if(albedo.a > 0.01) color *= normalize(albedo.rgb+0.0001)*0.9+0.1;
|
||||
#endif
|
||||
|
||||
color = color*(1.0-TranslucentShader.a) + TranslucentShader.rgb;
|
||||
|
@ -127,8 +127,15 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
||||
// uniform sampler2D colortex12;
|
||||
// const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
|
||||
// #undef TRANSLUCENT_COLORED_SHADOWS
|
||||
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
uniform sampler2D shadowcolor0;
|
||||
uniform sampler2DShadow shadowtex0;
|
||||
uniform sampler2DShadow shadowtex1;
|
||||
#endif
|
||||
|
||||
#define TEST
|
||||
#define TIMEOFDAYFOG
|
||||
#include "/lib/lightning_stuff.glsl"
|
||||
|
@ -67,12 +67,20 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
||||
const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
|
||||
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
uniform sampler2D shadowcolor0;
|
||||
uniform sampler2DShadow shadowtex0;
|
||||
uniform sampler2DShadow shadowtex1;
|
||||
#endif
|
||||
flat varying vec3 refractedSunVec;
|
||||
|
||||
|
||||
#define TIMEOFDAYFOG
|
||||
#include "/lib/lightning_stuff.glsl"
|
||||
#include "/lib/volumetricClouds.glsl"
|
||||
#include "/lib/overworld_fog.glsl"
|
||||
|
||||
#endif
|
||||
#ifdef NETHER_SHADER
|
||||
uniform sampler2D colortex4;
|
||||
@ -145,124 +153,6 @@ void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEn
|
||||
inColor += vL;
|
||||
|
||||
}
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
// float waterCaustics(vec3 wPos, vec3 lightSource) { // water waves
|
||||
|
||||
// vec2 pos = wPos.xz + (lightSource.xz/lightSource.y*wPos.y);
|
||||
// if(isEyeInWater==1) pos = wPos.xz - (lightSource.xz/lightSource.y*wPos.y); // fix the fucky
|
||||
// vec2 movement = vec2(-0.035*frameTimeCounter);
|
||||
// float caustic = 0.0;
|
||||
// float weightSum = 0.0;
|
||||
// float radiance = 2.39996;
|
||||
// mat2 rotationMatrix = mat2(vec2(cos(radiance), -sin(radiance)), vec2(sin(radiance), cos(radiance)));
|
||||
|
||||
// const vec2 wave_size[4] = vec2[](
|
||||
// vec2(64.),
|
||||
// vec2(32.,16.),
|
||||
// vec2(16.,32.),
|
||||
// vec2(48.)
|
||||
// );
|
||||
|
||||
// for (int i = 0; i < 4; i++){
|
||||
// pos = rotationMatrix * pos;
|
||||
|
||||
// vec2 speed = movement;
|
||||
// float waveStrength = 1.0;
|
||||
|
||||
// if( i == 0) {
|
||||
// speed *= 0.15;
|
||||
// waveStrength = 2.0;
|
||||
// }
|
||||
|
||||
// float small_wave = texture2D(noisetex, pos / wave_size[i] + speed ).b * waveStrength;
|
||||
|
||||
// caustic += max( 1.0-sin( 1.0-pow( 0.5+sin( small_wave*3.0 )*0.5, 25.0) ), 0);
|
||||
|
||||
// weightSum -= exp2(caustic*0.1);
|
||||
// }
|
||||
// return caustic / weightSum;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEyeDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){
|
||||
// int spCount = 8;
|
||||
|
||||
// vec3 start = toShadowSpaceProjected(rayStart);
|
||||
// vec3 end = toShadowSpaceProjected(rayEnd);
|
||||
// vec3 dV = (end-start);
|
||||
|
||||
// //limit ray length at 32 blocks for performance and reducing integration error
|
||||
// //you can't see above this anyway
|
||||
// float maxZ = min(rayLength,32.0)/(1e-8+rayLength);
|
||||
// dV *= maxZ;
|
||||
// vec3 dVWorld = mat3(gbufferModelViewInverse) * (rayEnd - rayStart) * maxZ;
|
||||
// rayLength *= maxZ;
|
||||
// float dY = normalize(mat3(gbufferModelViewInverse) * rayEnd).y * rayLength;
|
||||
|
||||
// vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition;
|
||||
|
||||
// float phase = fogPhase(VdotL) * 5.0;
|
||||
// vec3 absorbance = vec3(1.0);
|
||||
// vec3 vL = vec3(0.0);
|
||||
|
||||
// float YFade = pow(normalize(dVWorld).y*0.5+0.6,1.5);
|
||||
// // float YFade = pow(max(normalize(dVWorld).y,0.0)*0.5+0.5,2);
|
||||
|
||||
// float lowlightlevel = clamp(eyeBrightnessSmooth.y/240.0,0.2,1.0);
|
||||
// float lowlightlevel2 = clamp(eyeBrightnessSmooth.y/240.0,0.02,1.0);
|
||||
// // lowlightlevel = pow(lowlightlevel,0.5);
|
||||
|
||||
// float expFactor = 11.0;
|
||||
// for (int i=0;i<spCount;i++) {
|
||||
// float d = (pow(expFactor, float(i+dither)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor); // exponential step position (0-1)
|
||||
// float dd = pow(expFactor, float(i+dither)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0); //step length (derivative)
|
||||
// vec3 spPos = start.xyz + dV*d;
|
||||
// progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||
// //project into biased shadowmap space
|
||||
// #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){
|
||||
// pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5;
|
||||
// sh = shadow2D( shadow, pos).x;
|
||||
// }
|
||||
|
||||
// #ifdef VL_CLOUDS_SHADOWS
|
||||
// sh *= GetCloudShadow_VLFOG(progressW,WsunVec);
|
||||
// #endif
|
||||
|
||||
// // float bubble = 1.0 - pow(1.0-pow(1.0-min(max(1.0 - length(d*dVWorld) / (16),0.0)*5.0,1.0),2.0),2.0);
|
||||
// float bubble = exp( -7.0 * clamp(1.0 - length(d*dVWorld) / 16.0, 0.0,1.0) );
|
||||
// float bubble2 = max(pow(length(d*dVWorld)/24,5)*100.0,0.0) + 1;
|
||||
|
||||
|
||||
// float sunCaustics = (waterCaustics(progressW, WsunVec)) * mix(0.25,10.0,bubble) + 0.75;
|
||||
|
||||
// vec3 sunMul = exp(-1 * d * waterCoefs * 1.1);
|
||||
// vec3 ambientMul = exp(-1 * d * waterCoefs);
|
||||
|
||||
// vec3 Directlight = (lightSource * phase * sunMul * sunCaustics) * sh * lowlightlevel * pow(abs(WsunVec.y),1);
|
||||
// vec3 Indirectlight = ambient * ambientMul * lowlightlevel;
|
||||
|
||||
// // vec3 Indirectlight = max(ambient * ambientMul * lowlightlevel, vec3(0.01,0.2,0.4) * YFade * exp(-1.0 * d * waterCoefs));
|
||||
|
||||
// vec3 light = (Indirectlight + Directlight) * scatterCoef;
|
||||
|
||||
// vL += (light - light * exp(-waterCoefs * dd * rayLength)) / waterCoefs * absorbance;
|
||||
// absorbance *= exp(-waterCoefs * dd * rayLength);
|
||||
// }
|
||||
// inColor += vL;
|
||||
// }
|
||||
#endif
|
||||
|
||||
vec4 blueNoise(vec2 coord){
|
||||
return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ;
|
||||
}
|
||||
@ -316,7 +206,7 @@ vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float
|
||||
|
||||
vec3 progressW = start.xyz+cameraPosition+dVWorld;
|
||||
|
||||
float sh = 1.0;
|
||||
vec3 sh = vec3(1.0);
|
||||
#ifdef OVERWORLD_SHADER
|
||||
vec3 spPos = start.xyz + dV*d;
|
||||
|
||||
@ -330,7 +220,18 @@ vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float
|
||||
vec3 pos = vec3(spPos.xy*distortFactor, spPos.z);
|
||||
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;
|
||||
// sh = shadow2D( shadow, pos).x;
|
||||
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
sh = vec3(shadow2D(shadowtex0, pos).x);
|
||||
|
||||
if(shadow2D(shadowtex1, pos).x > pos.z && sh.x < 1.0){
|
||||
vec4 translucentShadow = texture2D(shadowcolor0, pos.xy);
|
||||
if(translucentShadow.a < 0.9) sh = normalize(translucentShadow.rgb+0.0001);
|
||||
}
|
||||
#else
|
||||
sh = vec3(shadow2D(shadow, pos).x);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef VL_CLOUDS_SHADOWS
|
||||
@ -341,7 +242,7 @@ vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float
|
||||
vec3 sunMul = exp(-estSunDepth * d * waterCoefs * 1.1);
|
||||
vec3 ambientMul = exp(-estEndDepth * d * waterCoefs );
|
||||
|
||||
vec3 Directlight = (lightSource * phase * sunMul) * sh;
|
||||
vec3 Directlight = ((lightSource * sh) * phase * sunMul) ;
|
||||
vec3 Indirectlight = max(ambient * ambientMul, vec3(0.01,0.2,0.4) * ambientMul * 0.1) ;
|
||||
|
||||
vec3 light = (Indirectlight + Directlight) * scatterCoef;
|
||||
|
@ -308,7 +308,7 @@ void ApplySSRT(
|
||||
|
||||
// rgb = torch color * lightmap. a = sky lightmap.
|
||||
vec4 Lighting = RT_AmbientLight(torchcolor, lightmaps);
|
||||
skylightcolor = skylightcolor * Lighting.a;
|
||||
skylightcolor = skylightcolor * ambient_brightness * Lighting.a;
|
||||
|
||||
for (int i = 0; i < nrays; i++){
|
||||
int seed = (frameCounter%40000)*nrays+i;
|
||||
|
@ -147,7 +147,7 @@ vec4 GetVolumetricFog(
|
||||
skyLightPhased = max(skyLightPhased + skyLightPhased*(normalize(wpos).y*0.9+0.1),0.0);
|
||||
LightSourcePhased *= mie;
|
||||
|
||||
float lightleakfix = clamp(pow(eyeBrightnessSmooth.y/240.,2) ,0.0,1.0);
|
||||
float lightleakfix = 1; //clamp(pow(eyeBrightnessSmooth.y/240.,2) ,0.0,1.0);
|
||||
|
||||
#ifdef RAYMARCH_CLOUDS_WITH_FOG
|
||||
vec3 SkyLightColor = AmbientColor;
|
||||
@ -194,13 +194,24 @@ vec4 GetVolumetricFog(
|
||||
#endif
|
||||
vec3 pos = vec3(progress.xy*distortFactor, progress.z);
|
||||
|
||||
float sh = 1.0;
|
||||
vec3 sh = vec3(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;
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
sh = vec3(shadow2D(shadowtex0, pos).x);
|
||||
|
||||
if(shadow2D(shadowtex1, pos).x > pos.z && sh.x < 1.0){
|
||||
|
||||
vec4 translucentShadow = texture2D(shadowcolor0, pos.xy);
|
||||
if(translucentShadow.a < 0.9) sh = normalize(translucentShadow.rgb+0.0001);
|
||||
}
|
||||
float sh2 = sh;
|
||||
#else
|
||||
sh = vec3(shadow2D(shadow, pos).x);
|
||||
#endif
|
||||
|
||||
}
|
||||
// float sh2 = sh;
|
||||
|
||||
#ifdef VL_CLOUDS_SHADOWS
|
||||
// if(clamp(progressW.y - CloudLayer1_height,0.0,1.0) < 1.0 && clamp(progressW.y-50,0.0,1.0) > 0.0)
|
||||
|
@ -131,7 +131,6 @@ const float entityShadowDistanceMul = 1.0; // [0.05 0.10 1.50 0.20 0.25 0.30 0.3
|
||||
#define RENDER_ENTITY_SHADOWS
|
||||
|
||||
#define SCREENSPACE_CONTACT_SHADOWS
|
||||
|
||||
#define Variable_Penumbra_Shadows
|
||||
#define VPS_Search_Samples 4 // [4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32]
|
||||
#define Min_Shadow_Filter_Radius 5.0 // [0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.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 ]
|
||||
@ -143,10 +142,11 @@ const float entityShadowDistanceMul = 1.0; // [0.05 0.10 1.50 0.20 0.25 0.30 0.3
|
||||
#define SHADOW_DISABLE_ALPHA_MIPMAPS
|
||||
#define Stochastic_Transparent_Shadows
|
||||
|
||||
//#define SHADOW_FRUSTRUM_CULLING
|
||||
|
||||
|
||||
|
||||
#define TRANSLUCENT_COLORED_SHADOWS
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
#define Glass_Tint
|
||||
#undef Stochastic_Transparent_Shadows
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// ----- FOG RELATED SETTINGS ----- //
|
||||
@ -610,7 +610,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
||||
// ----- MISC SETTINGS ----- //
|
||||
///////////////////////////////
|
||||
|
||||
// #define Glass_Tint // multiply the background through glass by the color of the glass for a strong tint.
|
||||
|
||||
|
||||
// #define ambientLight_only // THIS IS A DEBUG VIEW. turn the sunlight off. DOES NOT increase performance, the shadows are still working in the background
|
||||
// #define WhiteWorld // THIS IS A DEBUG VIEW. uses to see AO easier. used to see fake GI better (green light)
|
||||
// #define Compositing_Sky // make the sky some color to make compositing a sky in some photoediting software easier.
|
||||
|
@ -59,6 +59,10 @@ program.composite5.enabled = TAA_UPSCALING
|
||||
# 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
|
||||
|
||||
# terrible blending for shadows on purpose
|
||||
blend.shadow = SRC_COLOR ZERO ONE ZERO
|
||||
|
||||
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
|
||||
@ -115,7 +119,7 @@ BLISS_SHADERS <empty> \
|
||||
######## LIGHTING
|
||||
### DIRECT LIGHT
|
||||
screen.Direct_Light.columns=1
|
||||
screen.Direct_Light = [Shadows] [Subsurface_Scattering] [Sun_and_Moon_Colors] OLD_LIGHTLEAK_FIX sunPathRotation sun_illuminance MOONPHASE_BASED_MOONLIGHT moon_illuminance
|
||||
screen.Direct_Light = TRANSLUCENT_COLORED_SHADOWS [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 entityShadowDistanceMul <empty> [Filtering] shadowMapResolution shadowDistance shadowDistanceRenderMul
|
||||
@ -297,7 +301,7 @@ BLISS_SHADERS <empty> \
|
||||
|
||||
|
||||
######## MISC SETTINGS
|
||||
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 SELECT_BOX DENOISE_SSS_AND_SSAO WATER_CAUSTICS_BRIGHTNESS HYPER_DETAILED_WAVES
|
||||
screen.Misc_Settings = DEBUG_VIEW [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER CLOUDS_INFRONT_OF_WORLD SELECT_BOX DENOISE_SSS_AND_SSAO WATER_CAUSTICS_BRIGHTNESS HYPER_DETAILED_WAVES
|
||||
|
||||
screen.the_orb.columns = 1
|
||||
screen.the_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B
|
||||
|
@ -8,24 +8,46 @@ varying vec2 texcoord;
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D noisetex;
|
||||
uniform int frameCounter;
|
||||
// varying vec4 color;
|
||||
uniform float frameTimeCounter;
|
||||
uniform vec3 cameraPosition;
|
||||
varying vec4 color;
|
||||
varying float materials;
|
||||
|
||||
flat varying vec4 playerpos;
|
||||
|
||||
#include "/lib/waterBump.glsl"
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowModelViewInverse;
|
||||
uniform mat4 shadowProjection;
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
float blueNoise(){
|
||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 );
|
||||
}
|
||||
// float R2_dither(){
|
||||
// vec2 coord = gl_FragCoord.xy;
|
||||
// vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||
// return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
||||
// }
|
||||
|
||||
|
||||
void main() {
|
||||
gl_FragData[0] = texture2D(tex,texcoord.xy);
|
||||
|
||||
gl_FragData[0] = texture2D(tex,texcoord.xy) * color;
|
||||
|
||||
|
||||
|
||||
#ifdef SHADOW_DISABLE_ALPHA_MIPMAPS
|
||||
gl_FragData[0].a = texture2DLod(tex, texcoord.xy, 0).a;
|
||||
@ -37,4 +59,9 @@ void main() {
|
||||
|
||||
#ifdef RENDER_ENTITY_SHADOWS
|
||||
#endif
|
||||
|
||||
// if(materials > 0.95){
|
||||
// // gl_FragData[0] = vec4(0.3,0.8,1.0,0.1);
|
||||
// gl_FragData[0] = vec4(1.0,1.0,1.0,0.1);
|
||||
// }
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ uniform float shadowMaxProj;
|
||||
attribute vec4 mc_midTexCoord;
|
||||
varying vec4 color;
|
||||
|
||||
varying float materials;
|
||||
|
||||
attribute vec4 mc_Entity;
|
||||
uniform int blockEntityId;
|
||||
uniform int entityId;
|
||||
@ -114,12 +116,15 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
|
||||
// uniform int renderStage;
|
||||
|
||||
flat varying vec4 playerpos;
|
||||
// uniform mat4 gbufferModelViewInverse;
|
||||
void main() {
|
||||
texcoord.xy = gl_MultiTexCoord0.xy;
|
||||
color = gl_Color;
|
||||
|
||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||
|
||||
playerpos = vec4(0.0);
|
||||
playerpos = gbufferModelViewInverse * (gl_ModelViewMatrix * gl_Vertex);
|
||||
|
||||
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
|
||||
// mat4 Custom_ProjectionMatrix = BuildShadowProjectionMatrix();
|
||||
@ -190,7 +195,13 @@ void main() {
|
||||
#endif
|
||||
|
||||
|
||||
if(mc_Entity.x == 8 || mc_Entity.x == 9) gl_Position.w = -1.0;
|
||||
|
||||
if(mc_Entity.x == 8 ) gl_Position.w = -1.0;
|
||||
|
||||
|
||||
// materials = 0.0;
|
||||
// if(mc_Entity.x == 8) materials = 1.0;
|
||||
|
||||
|
||||
/// this is to ease the shadow acne on big fat entities like ghasts.
|
||||
float bias = 6.0;
|
||||
|
Loading…
Reference in New Issue
Block a user