Better Organized Generated Normal stuff
This commit is contained in:
1 parent
0f859671ea
commit
16d5613af1
25 files changed
+1204
-497
No files matched your search
@@ -142,10 +142,6 @@ vec2 moonDiffuse[8] = vec2[8](
|
||||
);
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
float GetLinearDepth(float depth) {
|
||||
return (2.0 * near) / (far + near - depth * (far - near));
|
||||
}
|
||||
@@ -209,6 +205,7 @@ void GlowOutline(inout vec3 color){
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/color/skyColor.glsl"
|
||||
#include "/lib/color/blocklightColor.glsl"
|
||||
@@ -220,6 +217,7 @@ void GlowOutline(inout vec3 color){
|
||||
#include "/lib/atmospherics/clouds.glsl"
|
||||
#include "/lib/atmospherics/sunmoon.glsl"
|
||||
|
||||
|
||||
#ifdef OUTLINE_ENABLED
|
||||
#include "/lib/util/outlineOffset.glsl"
|
||||
#include "/lib/util/outlineDepth.glsl"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
|
||||
//Settings//
|
||||
#include "/lib/settings.glsl"
|
||||
@@ -28,7 +28,7 @@ uniform float far;
|
||||
uniform float frameTimeCounter;
|
||||
uniform float blindFactor, darknessFactor, nightVision;
|
||||
uniform float rainStrength;
|
||||
uniform float screenBrightness;
|
||||
uniform float screenBrightness;
|
||||
uniform float shadowFade;
|
||||
uniform float timeAngle, timeBrightness;
|
||||
uniform float viewWidth, viewHeight;
|
||||
@@ -65,9 +65,6 @@ vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.
|
||||
mat4 gbufferProjectionInverse = dhProjectionInverse;
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
float GetBlueNoise3D(vec3 pos, vec3 normal) {
|
||||
pos = (floor(pos + 0.01) + 0.5) / 512.0;
|
||||
@@ -88,6 +85,7 @@ float GetBlueNoise3D(vec3 pos, vec3 normal) {
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/blocklightColor.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/color/specularColor.glsl"
|
||||
@@ -96,6 +94,7 @@ float GetBlueNoise3D(vec3 pos, vec3 normal) {
|
||||
#include "/lib/lighting/forwardLighting.glsl"
|
||||
#include "/lib/surface/ggx.glsl"
|
||||
|
||||
|
||||
#ifdef TAA
|
||||
#include "/lib/util/jitter.glsl"
|
||||
#endif
|
||||
@@ -107,7 +106,7 @@ void main() {
|
||||
|
||||
if (albedo.a > 0.001) {
|
||||
vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0));
|
||||
|
||||
|
||||
float foliage = float(mat > 0.98 && mat < 1.02);
|
||||
float leaves = float(mat > 1.98 && mat < 2.02);
|
||||
float emissive = float(mat > 2.98 && mat < 3.02);
|
||||
@@ -119,9 +118,9 @@ void main() {
|
||||
float subsurface = 0.0;
|
||||
float basicSubsurface = leaves * 0.5;
|
||||
vec3 baseReflectance = vec3(0.04);
|
||||
|
||||
|
||||
emission *= pow(max(max(albedo.r, albedo.g), albedo.b), 4.0) * 0.4;
|
||||
|
||||
|
||||
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
|
||||
#ifdef TAA
|
||||
vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z));
|
||||
@@ -155,16 +154,16 @@ void main() {
|
||||
#ifdef WHITE_WORLD
|
||||
albedo.rgb = vec3(0.35);
|
||||
#endif
|
||||
|
||||
|
||||
vec3 outNormal = newNormal;
|
||||
|
||||
|
||||
float NoL = clamp(dot(newNormal, lightVec), 0.0, 1.0);
|
||||
|
||||
float NoU = clamp(dot(newNormal, upVec), -1.0, 1.0);
|
||||
float NoE = clamp(dot(newNormal, eastVec), -1.0, 1.0);
|
||||
float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15;
|
||||
vanillaDiffuse*= vanillaDiffuse;
|
||||
|
||||
|
||||
#ifndef NORMAL_PLANTS
|
||||
if (foliage > 0.5) vanillaDiffuse *= 1.8;
|
||||
#endif
|
||||
@@ -172,9 +171,9 @@ void main() {
|
||||
float halfNoL = dot(newNormal, lightVec) * 0.5 + 0.5;
|
||||
basicSubsurface *= halfNoL * step(length(albedo.rgb), 1.7);
|
||||
}
|
||||
|
||||
|
||||
vec3 shadow = vec3(0.0);
|
||||
GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL,
|
||||
GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL,
|
||||
vanillaDiffuse, 1.0, emission, subsurface, basicSubsurface);
|
||||
|
||||
#if ALPHA_BLEND == 0
|
||||
@@ -243,16 +242,16 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
//Program//
|
||||
void main() {
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
|
||||
lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
|
||||
lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0));
|
||||
|
||||
int blockID = dhMaterialId;
|
||||
|
||||
normal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
|
||||
|
||||
color = gl_Color;
|
||||
|
||||
|
||||
mat = 0.0;
|
||||
|
||||
if (blockID == DH_BLOCK_LEAVES){
|
||||
@@ -281,7 +280,7 @@ void main() {
|
||||
#endif
|
||||
|
||||
gl_Position = dhProjection * gbufferModelView * position;
|
||||
|
||||
|
||||
#ifdef TAA
|
||||
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
|
||||
//Settings//
|
||||
#include "/lib/settings.glsl"
|
||||
@@ -31,7 +31,7 @@ uniform float dhFarPlane;
|
||||
uniform float far, near;
|
||||
uniform float frameTimeCounter;
|
||||
uniform float rainStrength;
|
||||
uniform float screenBrightness;
|
||||
uniform float screenBrightness;
|
||||
uniform float shadowFade, voidFade;
|
||||
uniform float timeAngle, timeBrightness;
|
||||
uniform float viewWidth, viewHeight;
|
||||
@@ -78,13 +78,10 @@ mat4 gbufferPreviousProjection = dhPreviousProjection;
|
||||
mat4 gbufferProjectionInverse = dhProjectionInverse;
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
float GetWaterHeightMap(vec3 worldPos, vec2 offset) {
|
||||
float noise = 0.0;
|
||||
|
||||
|
||||
vec2 wind = vec2(frametime) * 0.5 * WATER_SPEED;
|
||||
|
||||
worldPos.xz += worldPos.y * 0.2;
|
||||
@@ -99,7 +96,7 @@ float GetWaterHeightMap(vec3 worldPos, vec2 offset) {
|
||||
float noiseB = texture2D(noisetex, (worldPos.xz + wind) / 96.0 + offset).r;
|
||||
noiseA *= noiseA; noiseB *= noiseB;
|
||||
#endif
|
||||
|
||||
|
||||
#if WATER_NORMALS > 0
|
||||
noise = mix(noiseA, noiseB, WATER_DETAIL);
|
||||
#endif
|
||||
@@ -109,7 +106,7 @@ float GetWaterHeightMap(vec3 worldPos, vec2 offset) {
|
||||
|
||||
vec3 GetParallaxWaves(vec3 worldPos, vec3 viewVector) {
|
||||
vec3 parallaxPos = worldPos;
|
||||
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
float height = -1.25 * GetWaterHeightMap(parallaxPos, vec2(0.0)) + 0.25;
|
||||
parallaxPos.xz += height * viewVector.xy / dist;
|
||||
@@ -129,7 +126,7 @@ vec3 GetWaterNormal(vec3 worldPos, vec3 viewPos, vec3 viewVector) {
|
||||
#endif
|
||||
|
||||
float normalOffset = WATER_SHARPNESS;
|
||||
|
||||
|
||||
float fresnel = pow(clamp(1.0 + dot(normalize(normal), normalize(viewPos)), 0.0, 1.0), 8.0);
|
||||
float normalStrength = 0.35 * (1.0 - fresnel);
|
||||
|
||||
@@ -146,6 +143,7 @@ vec3 GetWaterNormal(vec3 worldPos, vec3 viewPos, vec3 viewVector) {
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/blocklightColor.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/color/skyColor.glsl"
|
||||
@@ -163,6 +161,7 @@ vec3 GetWaterNormal(vec3 worldPos, vec3 viewPos, vec3 viewVector) {
|
||||
#include "/lib/reflections/simpleReflections.glsl"
|
||||
#include "/lib/surface/ggx.glsl"
|
||||
|
||||
|
||||
#ifdef TAA
|
||||
#include "/lib/util/jitter.glsl"
|
||||
#endif
|
||||
@@ -186,12 +185,12 @@ void main() {
|
||||
|
||||
if (albedo.a > 0.001) {
|
||||
vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0));
|
||||
|
||||
|
||||
float water = float(mat > 0.98 && mat < 1.02);
|
||||
float glass = float(mat > 1.98 && mat < 2.02);
|
||||
float translucent = float(mat > 2.98 && mat < 3.02);
|
||||
float portal = float(mat > 3.98 && mat < 4.02);
|
||||
|
||||
|
||||
float metalness = 0.0;
|
||||
float emission = portal;
|
||||
float subsurface = 0.0;
|
||||
@@ -199,7 +198,7 @@ void main() {
|
||||
vec3 baseReflectance = vec3(0.04);
|
||||
|
||||
emission *= pow(max(max(albedo.r, albedo.g), albedo.b), 4.0) * 0.4;
|
||||
|
||||
|
||||
#ifndef REFLECTION_TRANSLUCENT
|
||||
glass = 0.0;
|
||||
translucent = 0.0;
|
||||
@@ -213,7 +212,7 @@ void main() {
|
||||
vec3 worldPos = ToWorld(viewPos);
|
||||
|
||||
float dither = Bayer8(gl_FragCoord.xy);
|
||||
|
||||
|
||||
float viewLength = length(viewPos);
|
||||
float minDist = (dither - 1.0) * 16.0 + far;
|
||||
if (viewLength < minDist) {
|
||||
@@ -237,7 +236,7 @@ void main() {
|
||||
#endif
|
||||
|
||||
vec3 normalMap = vec3(0.0, 0.0, 1.0);
|
||||
|
||||
|
||||
mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z);
|
||||
@@ -261,13 +260,13 @@ void main() {
|
||||
#endif
|
||||
|
||||
albedo.rgb = pow(albedo.rgb, vec3(2.2));
|
||||
|
||||
|
||||
vlAlbedo = albedo.rgb;
|
||||
|
||||
#ifdef WHITE_WORLD
|
||||
albedo.rgb = vec3(0.35);
|
||||
#endif
|
||||
|
||||
|
||||
if (water > 0.5) {
|
||||
#if WATER_MODE == 0
|
||||
albedo.rgb = waterColor.rgb * waterColor.a;
|
||||
@@ -285,20 +284,20 @@ void main() {
|
||||
vlAlbedo = sqrt(albedo.rgb);
|
||||
baseReflectance = vec3(0.02);
|
||||
}
|
||||
|
||||
|
||||
vlAlbedo = mix(vec3(1.0), vlAlbedo, sqrt(albedo.a)) * (1.0 - pow(albedo.a, 64.0));
|
||||
|
||||
|
||||
float NoL = clamp(dot(newNormal, lightVec), 0.0, 1.0);
|
||||
|
||||
float NoU = clamp(dot(newNormal, upVec), -1.0, 1.0);
|
||||
float NoE = clamp(dot(newNormal, eastVec), -1.0, 1.0);
|
||||
float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15;
|
||||
vanillaDiffuse*= vanillaDiffuse;
|
||||
|
||||
|
||||
vec3 shadow = vec3(0.0);
|
||||
GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, color.a, NoL,
|
||||
GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, color.a, NoL,
|
||||
vanillaDiffuse, 1.0, emission, subsurface, basicSubsurface);
|
||||
|
||||
|
||||
float fresnel = pow(clamp(1.0 + dot(newNormal, normalize(viewPos)), 0.0, 1.0), 5.0);
|
||||
|
||||
if (water > 0.5 || ((translucent + glass) > 0.5 && albedo.a < 0.95)) {
|
||||
@@ -306,21 +305,21 @@ void main() {
|
||||
vec4 reflection = vec4(0.0);
|
||||
vec3 skyReflection = vec3(0.0);
|
||||
float reflectionMask = 0.0;
|
||||
|
||||
|
||||
fresnel = fresnel * 0.98 + 0.02;
|
||||
fresnel*= max(1.0 - isEyeInWater * 0.5 * water, 0.5);
|
||||
// fresnel = 1.0;
|
||||
|
||||
|
||||
#if REFLECTION == 2
|
||||
reflection = DHReflection(viewPos, newNormal, dither, reflectionMask);
|
||||
reflection.rgb = pow(reflection.rgb * 2.0, vec3(8.0));
|
||||
#endif
|
||||
|
||||
|
||||
if (reflection.a < 1.0) {
|
||||
#ifdef OVERWORLD
|
||||
vec3 skyRefPos = reflect(normalize(viewPos), newNormal);
|
||||
skyReflection = GetSkyColor(skyRefPos, true);
|
||||
|
||||
|
||||
#ifdef AURORA
|
||||
skyReflection += DrawAurora(skyRefPos * 100.0, dither, 12);
|
||||
#endif
|
||||
@@ -340,7 +339,7 @@ void main() {
|
||||
#ifdef CLASSIC_EXPOSURE
|
||||
skyReflection *= 4.0 - 3.0 * eBS;
|
||||
#endif
|
||||
|
||||
|
||||
float waterSkyOcclusion = lightmap.y;
|
||||
#if REFLECTION_SKY_FALLOFF > 1
|
||||
waterSkyOcclusion = clamp(1.0 - (1.0 - waterSkyOcclusion) * REFLECTION_SKY_FALLOFF, 0.0, 1.0);
|
||||
@@ -359,7 +358,7 @@ void main() {
|
||||
|
||||
skyReflection *= clamp(1.0 - isEyeInWater, 0.0, 1.0);
|
||||
}
|
||||
|
||||
|
||||
reflection.rgb = max(mix(skyReflection, reflection.rgb, reflection.a), vec3(0.0));
|
||||
|
||||
#if defined OVERWORLD || defined END
|
||||
@@ -375,7 +374,7 @@ void main() {
|
||||
|
||||
reflection.rgb += specular * (1.0 - reflectionMask) / specularAlpha;
|
||||
#endif
|
||||
|
||||
|
||||
albedo.rgb = mix(albedo.rgb, reflection.rgb, fresnel);
|
||||
albedo.a = mix(albedo.a, 1.0, fresnel);
|
||||
#endif
|
||||
@@ -458,11 +457,11 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
float WavingWater(vec3 worldPos) {
|
||||
worldPos += cameraPosition;
|
||||
float fractY = fract(worldPos.y + 0.005);
|
||||
|
||||
|
||||
float wave = sin(6.2831854 * (frametime * 0.7 + worldPos.x * 0.14 + worldPos.z * 0.07)) +
|
||||
sin(6.2831854 * (frametime * 0.5 + worldPos.x * 0.10 + worldPos.z * 0.20));
|
||||
if (fractY > 0.01) return wave * 0.0125;
|
||||
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@@ -478,28 +477,28 @@ float WavingWater(vec3 worldPos) {
|
||||
//Program//
|
||||
void main() {
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
|
||||
lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
|
||||
lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0));
|
||||
|
||||
|
||||
int blockID = dhMaterialId;
|
||||
|
||||
normal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
binormal = normalize(gbufferModelView[2].xyz);
|
||||
tangent = normalize(gbufferModelView[0].xyz);
|
||||
|
||||
|
||||
mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z);
|
||||
|
||||
|
||||
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
|
||||
|
||||
|
||||
dist = length(gl_ModelViewMatrix * gl_Vertex);
|
||||
|
||||
|
||||
color = gl_Color;
|
||||
|
||||
|
||||
mat = 0.0;
|
||||
|
||||
|
||||
if (blockID == DH_BLOCK_WATER) mat = 1.0;
|
||||
|
||||
const vec2 sunRotationData = vec2(
|
||||
@@ -514,7 +513,7 @@ void main() {
|
||||
eastVec = tangent;
|
||||
|
||||
vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
|
||||
#ifdef WAVING_WATER
|
||||
float istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t ? 1.0 : 0.0;
|
||||
if (blockID == 300 || blockID == 302 || blockID == 304) position.y += WavingWater(position.xyz);
|
||||
@@ -526,7 +525,7 @@ void main() {
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * gbufferModelView * position;
|
||||
if (mat == 0.0) gl_Position.z -= 0.00001;
|
||||
|
||||
|
||||
#ifdef TAA
|
||||
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
|
||||
//Settings//
|
||||
#include "/lib/settings.glsl"
|
||||
@@ -25,7 +25,7 @@ uniform int worldTime;
|
||||
uniform float frameTimeCounter;
|
||||
uniform float nightVision;
|
||||
uniform float rainStrength;
|
||||
uniform float screenBrightness;
|
||||
uniform float screenBrightness;
|
||||
uniform float shadowFade;
|
||||
uniform float timeAngle, timeBrightness;
|
||||
uniform float viewWidth, viewHeight;
|
||||
@@ -68,16 +68,15 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/blocklightColor.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/util/spaceConversion.glsl"
|
||||
#include "/lib/lighting/forwardLighting.glsl"
|
||||
|
||||
|
||||
#ifdef TAA
|
||||
#include "/lib/util/jitter.glsl"
|
||||
#endif
|
||||
@@ -100,7 +99,7 @@ void main() {
|
||||
vec3 viewPos = ToNDC(screenPos);
|
||||
#endif
|
||||
vec3 worldPos = ToWorld(viewPos);
|
||||
|
||||
|
||||
#ifdef DYNAMIC_HANDLIGHT
|
||||
float heldLightValue = max(float(heldBlockLightValue), float(heldBlockLightValue2));
|
||||
float handlight = clamp((heldLightValue - 2.0 * length(viewPos)) / 15.0, 0.0, 0.9333);
|
||||
@@ -129,9 +128,9 @@ void main() {
|
||||
#ifdef MULTICOLORED_BLOCKLIGHT
|
||||
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos);
|
||||
#endif
|
||||
|
||||
|
||||
vec3 shadow = vec3(0.0);
|
||||
GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL,
|
||||
GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL,
|
||||
vanillaDiffuse, 1.0, 0.0, 0.0, 0.0);
|
||||
|
||||
#if ALPHA_BLEND == 0
|
||||
@@ -215,12 +214,12 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
//Program//
|
||||
void main() {
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
|
||||
lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
|
||||
lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0));
|
||||
|
||||
normal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
|
||||
|
||||
color = gl_Color;
|
||||
|
||||
const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994));
|
||||
@@ -238,7 +237,7 @@ void main() {
|
||||
#else
|
||||
gl_Position = ftransform();
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TAA
|
||||
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,6 @@ https://bitslablab.com
|
||||
|
||||
//Settings//
|
||||
#include "/lib/settings.glsl"
|
||||
#include "/lib/util/commonFunctions.glsl"
|
||||
|
||||
//Fragment Shader///////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef FSH
|
||||
@@ -18,7 +17,7 @@ varying vec3 sunVec, upVec, eastVec;
|
||||
|
||||
varying vec4 color;
|
||||
|
||||
#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS
|
||||
#if defined ADVANCED_MATERIALS
|
||||
varying float dist;
|
||||
|
||||
varying vec3 binormal, tangent;
|
||||
@@ -27,9 +26,17 @@ varying vec4 color;
|
||||
|
||||
varying vec4 vTexCoord, vTexCoordAM;
|
||||
|
||||
flat varying vec2 absMidCoordPos;
|
||||
varying vec2 signMidCoordPos;
|
||||
#ifdef GENERATED_NORMALS
|
||||
|
||||
flat varying vec2 absMidCoordPos;
|
||||
varying vec2 signMidCoordPos;
|
||||
|
||||
vec2 mipx;
|
||||
vec2 mipy;
|
||||
float mipDelta;
|
||||
float miplevel;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
@@ -58,7 +65,7 @@ uniform mat4 shadowModelView;
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D noisetex;
|
||||
|
||||
#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS
|
||||
#if defined ADVANCED_MATERIALS
|
||||
uniform ivec2 atlasSize;
|
||||
vec2 atlasSizeM = atlasSize;
|
||||
|
||||
@@ -90,34 +97,28 @@ float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED;
|
||||
float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
#endif
|
||||
|
||||
#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS
|
||||
vec2 dcdx = dFdx(texCoord);
|
||||
vec2 dcdy = dFdy(texCoord);
|
||||
#if defined ADVANCED_MATERIALS
|
||||
vec2 dcdx = dFdx(texCoord);
|
||||
vec2 dcdy = dFdy(texCoord);
|
||||
|
||||
vec2 mipx;
|
||||
vec2 mipy;
|
||||
float mipDelta;
|
||||
float miplevel;
|
||||
#ifdef GENERATED_NORMALS
|
||||
mat3 tbnMatrix = mat3(
|
||||
tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z
|
||||
);
|
||||
|
||||
vec2 midCoordPos = absMidCoordPos * signMidCoordPos;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
|
||||
|
||||
#if defined GENERATED_NORMALS
|
||||
mat3 tbnMatrix = mat3(
|
||||
tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z
|
||||
);
|
||||
|
||||
vec2 midCoordPos = absMidCoordPos * signMidCoordPos;
|
||||
#endif
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/blocklightColor.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/color/specularColor.glsl"
|
||||
@@ -129,15 +130,12 @@ float GetLuminance(vec3 color) {
|
||||
#include "/lib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS
|
||||
#if defined ADVANCED_MATERIALS
|
||||
#include "/lib/util/encode.glsl"
|
||||
#include "/lib/reflections/complexFresnel.glsl"
|
||||
#include "/lib/surface/materialGbuffers.glsl"
|
||||
#include "/lib/surface/parallax.glsl"
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
#include "/lib/surface/generatedNormals.glsl"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -207,11 +205,8 @@ void main() {
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
float f0 = 0.0, porosity = 0.5, ao = 1.0;
|
||||
vec3 normalMap = vec3(0.0, 0.0, 1.0);
|
||||
#ifdef GENERATED_NORMALS
|
||||
#include "/lib/surface/materialHandling/blockEntityMaterials.glsl"
|
||||
#else
|
||||
GetMaterials(smoothness, metalness, f0, emission, subsurface, porosity, ao, normalMap,
|
||||
newCoord, dcdx, dcdy);
|
||||
GetMaterials(smoothness, metalness, f0, emission, subsurface, porosity, ao, normalMap,
|
||||
newCoord, dcdx, dcdy);
|
||||
#endif
|
||||
|
||||
#ifdef NORMAL_SKIP
|
||||
@@ -239,7 +234,8 @@ void main() {
|
||||
|
||||
albedo.rgb = pow(albedo.rgb, vec3(2.2));
|
||||
|
||||
#elif defined GENERATED_NORMALS
|
||||
#ifdef GENERATED_NORMALS
|
||||
newNormal = normalMap;
|
||||
GenerateNormals(newNormal, albedo.rgb);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
|
||||
//Settings//
|
||||
#include "/lib/settings.glsl"
|
||||
@@ -23,11 +23,11 @@ void main() {
|
||||
#if ALPHA_BLEND == 1
|
||||
albedo.rgb = pow(albedo.rgb,vec3(2.2)) * 2.25;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WHITE_WORLD
|
||||
albedo.a = 0.0;
|
||||
#endif
|
||||
|
||||
|
||||
/* DRAWBUFFERS:0 */
|
||||
gl_FragData[0] = albedo;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ void main() {
|
||||
#else
|
||||
gl_Position = ftransform();
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TAA
|
||||
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
|
||||
//Settings//
|
||||
#include "/lib/settings.glsl"
|
||||
@@ -9,6 +9,8 @@ https://bitslablab.com
|
||||
//Fragment Shader///////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef FSH
|
||||
|
||||
#define GBUFFERS_ENTITIES
|
||||
|
||||
//Varyings//
|
||||
varying vec2 texCoord, lmCoord;
|
||||
|
||||
@@ -18,12 +20,25 @@ varying vec3 sunVec, upVec, eastVec;
|
||||
varying vec4 color;
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
varying float dist;
|
||||
varying float dist;
|
||||
|
||||
varying vec3 binormal, tangent;
|
||||
varying vec3 viewVector;
|
||||
varying vec3 binormal, tangent;
|
||||
varying vec3 viewVector;
|
||||
|
||||
varying vec4 vTexCoord, vTexCoordAM;
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
|
||||
flat varying vec2 absMidCoordPos;
|
||||
varying vec2 signMidCoordPos;
|
||||
|
||||
vec2 mipx;
|
||||
vec2 mipy;
|
||||
float mipDelta;
|
||||
float miplevel;
|
||||
|
||||
#endif
|
||||
|
||||
varying vec4 vTexCoord, vTexCoordAM;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
@@ -35,7 +50,7 @@ uniform int worldTime;
|
||||
uniform float frameTimeCounter;
|
||||
uniform float nightVision;
|
||||
uniform float rainStrength;
|
||||
uniform float screenBrightness;
|
||||
uniform float screenBrightness;
|
||||
uniform float shadowFade;
|
||||
uniform float timeAngle, timeBrightness;
|
||||
uniform float viewWidth, viewHeight;
|
||||
@@ -56,6 +71,7 @@ uniform sampler2D noisetex;
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
uniform ivec2 atlasSize;
|
||||
vec2 atlasSizeM = atlasSize;
|
||||
|
||||
uniform sampler2D specular;
|
||||
uniform sampler2D normals;
|
||||
@@ -86,18 +102,25 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
#endif
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
vec2 dcdx = dFdx(texCoord);
|
||||
vec2 dcdy = dFdy(texCoord);
|
||||
vec2 dcdx = dFdx(texCoord);
|
||||
vec2 dcdy = dFdy(texCoord);
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
mat3 tbnMatrix = mat3(
|
||||
tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z
|
||||
);
|
||||
|
||||
vec2 midCoordPos = absMidCoordPos * signMidCoordPos;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/blocklightColor.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/color/specularColor.glsl"
|
||||
@@ -141,7 +164,7 @@ void main() {
|
||||
float surfaceDepth = 1.0;
|
||||
float parallaxFade = clamp((dist - PARALLAX_DISTANCE) / 32.0, 0.0, 1.0);
|
||||
float skipAdvMat = float(entityId == 10100);
|
||||
|
||||
|
||||
#ifdef PARALLAX
|
||||
if (skipAdvMat < 0.5) {
|
||||
newCoord = GetParallaxCoord(texCoord, parallaxFade, surfaceDepth);
|
||||
@@ -156,7 +179,7 @@ void main() {
|
||||
#ifdef ENTITY_FLASH
|
||||
albedo.rgb = mix(albedo.rgb, entityColor.rgb, entityColor.a);
|
||||
#endif
|
||||
|
||||
|
||||
float lightningBolt = float(entityId == 10101);
|
||||
if(lightningBolt > 0.5) {
|
||||
#ifdef OVERWORLD
|
||||
@@ -174,12 +197,12 @@ void main() {
|
||||
|
||||
if (albedo.a > 0.001 && lightningBolt < 0.5) {
|
||||
vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0));
|
||||
|
||||
|
||||
float metalness = 0.0;
|
||||
float emission = float(entityColor.a > 0.05) * 0.125;
|
||||
float subsurface = 0.0;
|
||||
vec3 baseReflectance = vec3(0.04);
|
||||
|
||||
|
||||
emission *= dot(albedo.rgb, albedo.rgb) * 0.333;
|
||||
|
||||
#ifndef ENTITY_FLASH
|
||||
@@ -197,14 +220,14 @@ void main() {
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
float f0 = 0.0, porosity = 0.5, ao = 1.0;
|
||||
vec3 normalMap = vec3(0.0, 0.0, 1.0);
|
||||
|
||||
|
||||
GetMaterials(smoothness, metalness, f0, emission, subsurface, porosity, ao, normalMap,
|
||||
newCoord, dcdx, dcdy);
|
||||
|
||||
|
||||
#ifdef NORMAL_SKIP
|
||||
normalMap = vec3(0.0, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
|
||||
mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z);
|
||||
@@ -212,7 +235,7 @@ void main() {
|
||||
if ((normalMap.x > -0.999 || normalMap.y > -0.999) && viewVector == viewVector && skipAdvMat < 0.5)
|
||||
newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0));
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DYNAMIC_HANDLIGHT
|
||||
float heldLightValue = max(float(heldBlockLightValue), float(heldBlockLightValue2));
|
||||
float handlight = clamp((heldLightValue - 2.0 * length(viewPos)) / 15.0, 0.0, 0.9333);
|
||||
@@ -223,13 +246,13 @@ void main() {
|
||||
lightmap = floor(lightmap * 14.999 * (0.75 + 0.25 * color.a)) / 14.0;
|
||||
lightmap = clamp(lightmap, vec2(0.0), vec2(1.0));
|
||||
#endif
|
||||
|
||||
|
||||
albedo.rgb = pow(albedo.rgb, vec3(2.2));
|
||||
|
||||
#ifdef WHITE_WORLD
|
||||
albedo.rgb = vec3(0.35);
|
||||
#endif
|
||||
|
||||
|
||||
float NoL = clamp(dot(newNormal, lightVec), 0.0, 1.0);
|
||||
|
||||
float NoU = clamp(dot(newNormal, upVec), -1.0, 1.0);
|
||||
@@ -254,7 +277,7 @@ void main() {
|
||||
#ifdef END
|
||||
doParallax = float(NoL > 0.0);
|
||||
#endif
|
||||
|
||||
|
||||
if (doParallax > 0.5) {
|
||||
parallaxShadow = GetParallaxShadow(surfaceDepth, parallaxFade, newCoord, lightVec,
|
||||
tbnMatrix);
|
||||
@@ -265,9 +288,9 @@ void main() {
|
||||
#ifdef MULTICOLORED_BLOCKLIGHT
|
||||
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos);
|
||||
#endif
|
||||
|
||||
|
||||
vec3 shadow = vec3(0.0);
|
||||
GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL,
|
||||
GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL,
|
||||
vanillaDiffuse, parallaxShadow, emission, subsurface, 0.0);
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
@@ -286,7 +309,7 @@ void main() {
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
float aoSquared = ao * ao;
|
||||
shadow *= aoSquared; fresnel3 *= aoSquared;
|
||||
albedo.rgb = albedo.rgb * (1.0 - fresnel3 * smoothness * smoothness * (1.0 - metalness));
|
||||
@@ -294,7 +317,7 @@ void main() {
|
||||
|
||||
#if (defined OVERWORLD || defined END) && (defined ADVANCED_MATERIALS || defined SPECULAR_HIGHLIGHT_ROUGH)
|
||||
vec3 specularColor = GetSpecularColor(lightmap.y, metalness, baseReflectance);
|
||||
|
||||
|
||||
albedo.rgb += GetSpecularHighlight(newNormal, viewPos, smoothness, baseReflectance,
|
||||
specularColor, shadow * vanillaDiffuse, 1.0);
|
||||
#endif
|
||||
@@ -314,7 +337,7 @@ void main() {
|
||||
#ifdef MULTICOLORED_BLOCKLIGHT
|
||||
/* DRAWBUFFERS:08 */
|
||||
gl_FragData[1] = vec4(0.0,0.0,0.0,1.0);
|
||||
|
||||
|
||||
#if defined TAA_SELECTIVE && !(defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR)
|
||||
/* DRAWBUFFERS:083 */
|
||||
gl_FragData[2] = vec4(0.0, 0.0, 0.25, 1.0);
|
||||
@@ -341,6 +364,8 @@ void main() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef GBUFFERS_ENTITIES
|
||||
|
||||
#endif
|
||||
|
||||
//Vertex Shader/////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -406,7 +431,7 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
//Program//
|
||||
void main() {
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
|
||||
lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
|
||||
lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0));
|
||||
|
||||
@@ -415,13 +440,13 @@ void main() {
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
|
||||
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
|
||||
|
||||
|
||||
mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z);
|
||||
|
||||
|
||||
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
|
||||
|
||||
|
||||
dist = length(gl_ModelViewMatrix * gl_Vertex);
|
||||
|
||||
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
|
||||
@@ -432,7 +457,7 @@ void main() {
|
||||
|
||||
vTexCoord.xy = sign(texMinMidCoord) * 0.5 + 0.5;
|
||||
#endif
|
||||
|
||||
|
||||
color = gl_Color;
|
||||
|
||||
const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994));
|
||||
@@ -450,7 +475,7 @@ void main() {
|
||||
#else
|
||||
gl_Position = ftransform();
|
||||
#endif
|
||||
|
||||
|
||||
#if defined TAA && !defined TAA_SELECTIVE
|
||||
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
|
||||
#endif
|
||||
|
||||
@@ -18,12 +18,24 @@ varying vec3 sunVec, upVec, eastVec;
|
||||
varying vec4 color;
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
varying float dist;
|
||||
varying float dist;
|
||||
|
||||
varying vec3 binormal, tangent;
|
||||
varying vec3 viewVector;
|
||||
varying vec3 binormal, tangent;
|
||||
varying vec3 viewVector;
|
||||
|
||||
varying vec4 vTexCoord, vTexCoordAM;
|
||||
varying vec4 vTexCoord, vTexCoordAM;
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
|
||||
flat varying vec2 absMidCoordPos;
|
||||
varying vec2 signMidCoordPos;
|
||||
|
||||
vec2 mipx;
|
||||
vec2 mipy;
|
||||
float mipDelta;
|
||||
float miplevel;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
@@ -86,18 +98,27 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
#endif
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
vec2 dcdx = dFdx(texCoord);
|
||||
vec2 dcdy = dFdy(texCoord);
|
||||
vec2 dcdx = dFdx(texCoord);
|
||||
vec2 dcdy = dFdy(texCoord);
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
mat3 tbnMatrix = mat3(
|
||||
tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z
|
||||
);
|
||||
|
||||
vec2 midCoordPos = absMidCoordPos * signMidCoordPos;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/blocklightColor.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/color/specularColor.glsl"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
|
||||
//Settings//
|
||||
#include "/lib/settings.glsl"
|
||||
@@ -20,12 +20,25 @@ varying vec3 sunVec, upVec, eastVec;
|
||||
varying vec4 color;
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
varying float dist;
|
||||
varying float dist;
|
||||
|
||||
varying vec3 binormal, tangent;
|
||||
varying vec3 viewVector;
|
||||
varying vec3 binormal, tangent;
|
||||
varying vec3 viewVector;
|
||||
|
||||
varying vec4 vTexCoord, vTexCoordAM;
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
|
||||
flat varying vec2 absMidCoordPos;
|
||||
varying vec2 signMidCoordPos;
|
||||
|
||||
vec2 mipx;
|
||||
vec2 mipy;
|
||||
float mipDelta;
|
||||
float miplevel;
|
||||
|
||||
#endif
|
||||
|
||||
varying vec4 vTexCoord, vTexCoordAM;
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
@@ -37,7 +50,7 @@ uniform int worldTime;
|
||||
uniform float frameTimeCounter;
|
||||
uniform float nightVision;
|
||||
uniform float rainStrength;
|
||||
uniform float screenBrightness;
|
||||
uniform float screenBrightness;
|
||||
uniform float shadowFade;
|
||||
uniform float timeAngle, timeBrightness;
|
||||
uniform float viewWidth, viewHeight;
|
||||
@@ -56,6 +69,7 @@ uniform sampler2D noisetex;
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
uniform ivec2 atlasSize;
|
||||
vec2 atlasSizeM = atlasSize;
|
||||
|
||||
uniform sampler2D specular;
|
||||
uniform sampler2D normals;
|
||||
@@ -86,22 +100,31 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
#endif
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
vec2 dcdx = dFdx(texCoord);
|
||||
vec2 dcdy = dFdy(texCoord);
|
||||
vec2 dcdx = dFdx(texCoord);
|
||||
vec2 dcdy = dFdy(texCoord);
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
mat3 tbnMatrix = mat3(
|
||||
tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z
|
||||
);
|
||||
|
||||
vec2 midCoordPos = absMidCoordPos * signMidCoordPos;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
float GetHandItem(int id) {
|
||||
return float((heldItemId == id && isMainHand > 0.5) || (heldItemId2 == id && isMainHand < 0.5));
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/blocklightColor.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/color/specularColor.glsl"
|
||||
@@ -140,7 +163,7 @@ void main() {
|
||||
vec2 newCoord = vTexCoord.st * vTexCoordAM.pq + vTexCoordAM.st;
|
||||
float surfaceDepth = 1.0;
|
||||
float skipAdvMat = float(heldItemId == 358 || (heldItemId2 == 358 && isMainHand < 0.5));
|
||||
|
||||
|
||||
#ifdef PARALLAX
|
||||
if (skipAdvMat < 0.5) {
|
||||
newCoord = GetParallaxCoord(texCoord, 0.0, surfaceDepth);
|
||||
@@ -162,12 +185,12 @@ void main() {
|
||||
lightmap.x = max(lightmap.x, GetHandItem(213));
|
||||
|
||||
float emissive = (GetHandItem(50) + GetHandItem(89) + GetHandItem(213));
|
||||
|
||||
|
||||
float metalness = 0.0;
|
||||
float emission = emissive;
|
||||
float subsurface = 0.0;
|
||||
vec3 baseReflectance = vec3(0.04);
|
||||
|
||||
|
||||
emission *= pow(max(max(albedo.r, albedo.g), albedo.b), 4.0) * 0.25;
|
||||
|
||||
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z + 0.38);
|
||||
@@ -181,14 +204,14 @@ void main() {
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
float f0 = 0.0, porosity = 0.5, ao = 1.0;
|
||||
vec3 normalMap = vec3(0.0, 0.0, 1.0);
|
||||
|
||||
|
||||
GetMaterials(smoothness, metalness, f0, emission, subsurface, porosity, ao, normalMap,
|
||||
newCoord, dcdx, dcdy);
|
||||
|
||||
#ifdef NORMAL_SKIP
|
||||
normalMap = vec3(0.0, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
|
||||
mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z);
|
||||
@@ -196,7 +219,7 @@ void main() {
|
||||
if ((normalMap.x > -0.999 || normalMap.y > -0.999) && viewVector == viewVector)
|
||||
newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0));
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DYNAMIC_HANDLIGHT
|
||||
float heldLightValue = max(float(heldBlockLightValue), float(heldBlockLightValue2));
|
||||
float handlight = clamp(heldLightValue / 15.0, 0.0, 0.9333);
|
||||
@@ -219,7 +242,7 @@ void main() {
|
||||
albedo.rgb /= 0.7 * albedo.rgb + 0.7;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MULTICOLORED_BLOCKLIGHT
|
||||
lightAlbedo = albedo.rgb + 0.00001;
|
||||
lightAlbedo = sqrt(normalize(lightAlbedo) * emission * emissive);
|
||||
@@ -253,7 +276,7 @@ void main() {
|
||||
#ifdef END
|
||||
doParallax = float(NoL > 0.0);
|
||||
#endif
|
||||
|
||||
|
||||
if (doParallax > 0.5 && skipAdvMat < 0.5) {
|
||||
parallaxShadow = GetParallaxShadow(surfaceDepth, 0.0, newCoord, lightVec, tbnMatrix);
|
||||
}
|
||||
@@ -263,9 +286,9 @@ void main() {
|
||||
#ifdef MULTICOLORED_BLOCKLIGHT
|
||||
blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos);
|
||||
#endif
|
||||
|
||||
|
||||
vec3 shadow = vec3(0.0);
|
||||
GetLighting(albedo.rgb, shadow, viewPos, worldPos, vec3(0.0), lightmap, 1.0, NoL,
|
||||
GetLighting(albedo.rgb, shadow, viewPos, worldPos, vec3(0.0), lightmap, 1.0, NoL,
|
||||
vanillaDiffuse, parallaxShadow, emission, subsurface, 0.0);
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
@@ -284,7 +307,7 @@ void main() {
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
float aoSquared = ao * ao;
|
||||
shadow *= aoSquared; fresnel3 *= aoSquared;
|
||||
albedo.rgb = albedo.rgb * (1.0 - fresnel3 * smoothness * smoothness * (1.0 - metalness));
|
||||
@@ -292,7 +315,7 @@ void main() {
|
||||
|
||||
#if (defined OVERWORLD || defined END) && (defined ADVANCED_MATERIALS || defined SPECULAR_HIGHLIGHT_ROUGH)
|
||||
vec3 specularColor = GetSpecularColor(lightmap.y, metalness, baseReflectance);
|
||||
|
||||
|
||||
albedo.rgb += GetSpecularHighlight(newNormal, viewPos, smoothness, baseReflectance,
|
||||
specularColor, shadow * vanillaDiffuse, 1.0);
|
||||
#endif
|
||||
@@ -312,7 +335,7 @@ void main() {
|
||||
#ifdef MULTICOLORED_BLOCKLIGHT
|
||||
/* DRAWBUFFERS:08 */
|
||||
gl_FragData[1] = vec4(lightAlbedo,1.0);
|
||||
|
||||
|
||||
#if defined TAA_SELECTIVE && !(defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR)
|
||||
/* DRAWBUFFERS:083 */
|
||||
gl_FragData[2] = vec4(0.0, 0.0, 0.25, 1.0);
|
||||
@@ -408,7 +431,7 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
//Program//
|
||||
void main() {
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
|
||||
lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
|
||||
lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0));
|
||||
|
||||
@@ -417,13 +440,13 @@ void main() {
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w);
|
||||
tangent = normalize(gl_NormalMatrix * at_tangent.xyz);
|
||||
|
||||
|
||||
mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z);
|
||||
|
||||
|
||||
viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz;
|
||||
|
||||
|
||||
dist = length(gl_ModelViewMatrix * gl_Vertex);
|
||||
|
||||
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
|
||||
@@ -431,10 +454,10 @@ void main() {
|
||||
|
||||
vTexCoordAM.pq = abs(texMinMidCoord) * 2;
|
||||
vTexCoordAM.st = min(texCoord, midCoord - texMinMidCoord);
|
||||
|
||||
|
||||
vTexCoord.xy = sign(texMinMidCoord) * 0.5 + 0.5;
|
||||
#endif
|
||||
|
||||
|
||||
color = gl_Color;
|
||||
|
||||
isMainHand = float(gl_ModelViewMatrix[3][0] > 0.0);
|
||||
@@ -454,11 +477,11 @@ void main() {
|
||||
#else
|
||||
gl_Position = ftransform();
|
||||
#endif
|
||||
|
||||
|
||||
#if defined TAA && !defined TAA_SELECTIVE
|
||||
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
|
||||
#endif
|
||||
|
||||
|
||||
#if MC_VERSION >= 11500
|
||||
isMainHand = float(gl_Position.x > 0.0);
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
|
||||
//Settings//
|
||||
#include "/lib/settings.glsl"
|
||||
@@ -74,12 +74,8 @@ vec2 moonDiffuse[8] = vec2[8](
|
||||
vec2(-0.125, 1.0 )
|
||||
);
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/color/skyColor.glsl"
|
||||
#include "/lib/util/dither.glsl"
|
||||
@@ -91,14 +87,14 @@ float GetLuminance(vec3 color) {
|
||||
//Program//
|
||||
void main() {
|
||||
vec3 albedo = vec3(0.0);
|
||||
|
||||
|
||||
#if defined OVERWORLD && !defined SKY_DEFERRED
|
||||
vec4 screenPos = vec4(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z, 1.0);
|
||||
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
|
||||
viewPos /= viewPos.w;
|
||||
|
||||
|
||||
albedo = GetSkyColor(viewPos.xyz, false);
|
||||
|
||||
|
||||
#ifdef ROUND_SUN_MOON
|
||||
vec3 lightMA = mix(lightMorning, lightEvening, mefade);
|
||||
vec3 sunColor = mix(lightMA, sqrt(lightDay * lightMA * LIGHT_DI), timeBrightness);
|
||||
@@ -129,7 +125,7 @@ void main() {
|
||||
albedo.rgb = albedo.rgb + dither / vec3(128.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* DRAWBUFFERS:0 */
|
||||
gl_FragData[0] = vec4(albedo, 1.0 - star);
|
||||
}
|
||||
@@ -157,7 +153,7 @@ void main() {
|
||||
sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz);
|
||||
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
|
||||
|
||||
gl_Position = ftransform();
|
||||
|
||||
star = float(gl_Color.r == gl_Color.g && gl_Color.g == gl_Color.b && gl_Color.r > 0.0);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
/*
|
||||
BSL Shaders v8 Series by Capt Tatsu
|
||||
https://bitslablab.com
|
||||
*/
|
||||
|
||||
//Settings//
|
||||
#include "/lib/settings.glsl"
|
||||
@@ -52,11 +52,9 @@ float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0);
|
||||
float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0);
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/util/dither.glsl"
|
||||
|
||||
@@ -72,7 +70,7 @@ void main() {
|
||||
vec4 screenPos = vec4(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z, 1.0);
|
||||
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
|
||||
viewPos /= viewPos.w;
|
||||
|
||||
|
||||
float VoU = dot(normalize(viewPos.xyz), upVec);
|
||||
|
||||
float sunFade = smoothstep(0.0, 1.0, 1.0 - pow(1.0 - max(VoU * 0.975 + 0.025, 0.0), 8.0));
|
||||
@@ -88,17 +86,17 @@ void main() {
|
||||
if (renderStage == MC_RENDER_STAGE_MOON) {
|
||||
albedo.rgb *= MOON_INTENSITY * MOON_INTENSITY * sunFade;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
albedo.rgb *= SKYBOX_INTENSITY * SKYBOX_INTENSITY;
|
||||
albedo.a *= SKYBOX_OPACITY;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ROUND_SUN_MOON
|
||||
if (renderStage == MC_RENDER_STAGE_SUN || renderStage == MC_RENDER_STAGE_MOON) {
|
||||
albedo *= 0.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SKY_DESATURATION
|
||||
vec3 desat = GetLuminance(albedo.rgb) * pow(lightNight, vec3(1.6)) * 4.0;
|
||||
albedo.rgb = mix(desat, albedo.rgb, sunVisibility);
|
||||
@@ -122,7 +120,7 @@ void main() {
|
||||
#if ALPHA_BLEND == 0
|
||||
albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0)));
|
||||
#endif
|
||||
|
||||
|
||||
/* DRAWBUFFERS:0 */
|
||||
gl_FragData[0] = albedo;
|
||||
}
|
||||
@@ -157,16 +155,16 @@ void main() {
|
||||
texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
|
||||
|
||||
color = gl_Color;
|
||||
|
||||
|
||||
const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994));
|
||||
float ang = fract(timeAngle - 0.25);
|
||||
ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959;
|
||||
sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz);
|
||||
|
||||
upVec = normalize(gbufferModelView[1].xyz);
|
||||
|
||||
|
||||
gl_Position = ftransform();
|
||||
|
||||
|
||||
#ifdef TAA
|
||||
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w);
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,7 @@ varying vec4 color;
|
||||
|
||||
varying vec4 glColor;
|
||||
|
||||
#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS
|
||||
#if defined ADVANCED_MATERIALS
|
||||
varying float dist;
|
||||
|
||||
varying vec3 binormal, tangent;
|
||||
@@ -30,8 +30,17 @@ varying vec4 glColor;
|
||||
|
||||
varying vec4 vTexCoord, vTexCoordAM;
|
||||
|
||||
flat varying vec2 absMidCoordPos;
|
||||
varying vec2 signMidCoordPos;
|
||||
#ifdef GENERATED_NORMALS
|
||||
|
||||
flat varying vec2 absMidCoordPos;
|
||||
varying vec2 signMidCoordPos;
|
||||
|
||||
vec2 mipx;
|
||||
vec2 mipy;
|
||||
float mipDelta;
|
||||
float miplevel;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -104,128 +113,32 @@ float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED;
|
||||
float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
#endif
|
||||
|
||||
vec4 debugNormals;
|
||||
|
||||
vec2 mipx;
|
||||
vec2 mipy;
|
||||
float mipDelta;
|
||||
float miplevel;
|
||||
|
||||
#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS
|
||||
#if defined ADVANCED_MATERIALS
|
||||
vec2 dcdx = dFdx(texCoord);
|
||||
vec2 dcdy = dFdy(texCoord);
|
||||
|
||||
#if defined GENERATED_NORMALS
|
||||
mat3 tbnMatrix = mat3(
|
||||
tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z
|
||||
);
|
||||
|
||||
vec2 midCoordPos = absMidCoordPos * signMidCoordPos;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
|
||||
|
||||
#if defined GENERATED_NORMALS
|
||||
mat3 tbnMatrix = mat3(
|
||||
tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z
|
||||
);
|
||||
|
||||
vec2 midCoordPos = absMidCoordPos * signMidCoordPos;
|
||||
#endif
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
float max0(float x) {
|
||||
return max(x, 0.0);
|
||||
}
|
||||
|
||||
float min1(float x) {
|
||||
return min(x, 1.0);
|
||||
}
|
||||
|
||||
float pow2(float x) {
|
||||
return x * x;
|
||||
}
|
||||
vec2 pow2(vec2 x) {
|
||||
return x * x;
|
||||
}
|
||||
|
||||
vec3 pow2(vec3 x) {
|
||||
return x * x;
|
||||
}
|
||||
float pow1_5(float x) { // Faster pow(x, 1.5) approximation (that isn't accurate at all) if x is between 0 and 1
|
||||
return x - x * pow2(1.0 - x); // Thanks to SixthSurge
|
||||
}
|
||||
vec2 pow1_5(vec2 x) {
|
||||
return x - x * pow2(1.0 - x);
|
||||
}
|
||||
vec3 pow1_5(vec3 x) {
|
||||
return x - x * pow2(1.0 - x);
|
||||
}
|
||||
|
||||
bool CheckForColor(vec3 albedo, vec3 check) { // Thanks to Builderb0y
|
||||
vec3 dif = albedo - check * 0.003921568;
|
||||
return dif == clamp(dif, vec3(-0.001), vec3(0.001));
|
||||
}
|
||||
|
||||
float GetMaxColorDif(vec3 color) {
|
||||
vec3 dif = abs(vec3(color.r - color.g, color.g - color.b, color.r - color.b));
|
||||
return max(dif.r, max(dif.g, dif.b));
|
||||
}
|
||||
|
||||
float smoothstep1(float x) {
|
||||
return x * x * (3.0 - 2.0 * x);
|
||||
}
|
||||
vec2 smoothstep1(vec2 x) {
|
||||
return x * x * (3.0 - 2.0 * x);
|
||||
}
|
||||
vec3 smoothstep1(vec3 x) {
|
||||
return x * x * (3.0 - 2.0 * x);
|
||||
}
|
||||
float sqrt1(float x) { // Faster sqrt() approximation (that isn't accurate at all) if x is between 0 and 1
|
||||
return x * (2.0 - x); // Thanks to Builderb0y
|
||||
}
|
||||
vec2 sqrt1(vec2 x) {
|
||||
return x * (2.0 - x);
|
||||
}
|
||||
vec3 sqrt1(vec3 x) {
|
||||
return x * (2.0 - x);
|
||||
}
|
||||
vec4 sqrt1(vec4 x) {
|
||||
return x * (2.0 - x);
|
||||
}
|
||||
// common functions
|
||||
vec3 ViewToPlayer(vec3 pos) {
|
||||
return mat3(gbufferModelViewInverse) * pos + gbufferModelViewInverse[3].xyz;
|
||||
}
|
||||
|
||||
float sqrt3(float x) {
|
||||
x = 1.0 - x;
|
||||
x *= x;
|
||||
x *= x;
|
||||
x *= x;
|
||||
return 1.0 - x;
|
||||
}
|
||||
vec2 sqrt3(vec2 x) {
|
||||
x = 1.0 - x;
|
||||
x *= x;
|
||||
x *= x;
|
||||
x *= x;
|
||||
return 1.0 - x;
|
||||
}
|
||||
vec3 sqrt3(vec3 x) {
|
||||
x = 1.0 - x;
|
||||
x *= x;
|
||||
x *= x;
|
||||
x *= x;
|
||||
return 1.0 - x;
|
||||
}
|
||||
vec4 sqrt3(vec4 x) {
|
||||
x = 1.0 - x;
|
||||
x *= x;
|
||||
x *= x;
|
||||
x *= x;
|
||||
return 1.0 - x;
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/blocklightColor.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/color/specularColor.glsl"
|
||||
@@ -237,17 +150,13 @@ vec4 sqrt3(vec4 x) {
|
||||
#include "/lib/util/jitter.glsl"
|
||||
#endif
|
||||
|
||||
#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS
|
||||
#if defined ADVANCED_MATERIALS
|
||||
#include "/lib/util/encode.glsl"
|
||||
#include "/lib/reflections/complexFresnel.glsl"
|
||||
#include "/lib/surface/directionalLightmap.glsl"
|
||||
#include "/lib/surface/materialGbuffers.glsl"
|
||||
#include "/lib/surface/parallax.glsl"
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
#include "/lib/surface/generatedNormals.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef REFLECTION_RAIN
|
||||
#include "/lib/reflections/rainPuddles.glsl"
|
||||
#endif
|
||||
@@ -335,7 +244,6 @@ void main() {
|
||||
// #include "/lib/materials/materialHandling/terrainMaterials.glsl"
|
||||
GenerateNormals(newNormal, albedo.rgb);
|
||||
#endif
|
||||
debugNormals = vec4(newNormal , 1.0);
|
||||
|
||||
|
||||
#ifdef DYNAMIC_HANDLIGHT
|
||||
|
||||
@@ -78,9 +78,6 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
#ifdef SOFT_PARTICLES
|
||||
float GetLinearDepth(float depth) {
|
||||
@@ -89,6 +86,7 @@ float GetLinearDepth(float depth) {
|
||||
#endif
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/blocklightColor.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/color/skyColor.glsl"
|
||||
|
||||
@@ -9,6 +9,8 @@ https://bitslablab.com
|
||||
//Fragment Shader///////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef FSH
|
||||
|
||||
#define GBUFFERS_WATER
|
||||
|
||||
//Varyings//
|
||||
varying float mat;
|
||||
varying float dist;
|
||||
@@ -22,7 +24,19 @@ varying vec3 viewVector;
|
||||
varying vec4 color;
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
varying vec4 vTexCoord, vTexCoordAM;
|
||||
varying vec4 vTexCoord, vTexCoordAM;
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
|
||||
flat varying vec2 absMidCoordPos;
|
||||
varying vec2 signMidCoordPos;
|
||||
|
||||
vec2 mipx;
|
||||
vec2 mipy;
|
||||
float mipDelta;
|
||||
float miplevel;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Uniforms//
|
||||
@@ -56,6 +70,7 @@ uniform sampler2D noisetex;
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
uniform ivec2 atlasSize;
|
||||
vec2 atlasSizeM = atlasSize;
|
||||
|
||||
uniform sampler2D specular;
|
||||
uniform sampler2D normals;
|
||||
@@ -95,16 +110,24 @@ float frametime = frameTimeCounter * ANIMATION_SPEED;
|
||||
#endif
|
||||
|
||||
#ifdef ADVANCED_MATERIALS
|
||||
vec2 dcdx = dFdx(texCoord);
|
||||
vec2 dcdy = dFdy(texCoord);
|
||||
vec2 dcdx = dFdx(texCoord);
|
||||
vec2 dcdy = dFdy(texCoord);
|
||||
|
||||
#ifdef GENERATED_NORMALS
|
||||
mat3 tbnMatrix = mat3(
|
||||
tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z
|
||||
);
|
||||
|
||||
vec2 midCoordPos = absMidCoordPos * signMidCoordPos;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0);
|
||||
|
||||
//Common Functions//
|
||||
float GetLuminance(vec3 color) {
|
||||
return dot(color,vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
float GetWaterHeightMap(vec3 worldPos, vec2 offset) {
|
||||
float noise = 0.0;
|
||||
@@ -170,6 +193,7 @@ vec3 GetWaterNormal(vec3 worldPos, vec3 viewPos, vec3 viewVector) {
|
||||
}
|
||||
|
||||
//Includes//
|
||||
#include "/lib/common.glsl"
|
||||
#include "/lib/color/blocklightColor.glsl"
|
||||
#include "/lib/color/dimensionColor.glsl"
|
||||
#include "/lib/color/skyColor.glsl"
|
||||
@@ -630,6 +654,8 @@ void main() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef GBUFFERS_WATER
|
||||
|
||||
#endif
|
||||
|
||||
//Vertex Shader/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in new issue
Block a user