make emissives work again

This commit is contained in:
Xonk 2023-06-13 14:36:07 -04:00
parent 4cc83166db
commit 33a2c1d0f3
10 changed files with 107 additions and 141 deletions

View File

@ -20,9 +20,6 @@
block.200 = minecraft:white_wool minecraft:orange_wool minecraft:magenta_wool minecraft:light_blue_wool minecraft:yellow_wool minecraft:lime_wool minecraft:pink_wool minecraft:gray_wool minecraft:light_gray_wool minecraft:cyan_wool minecraft:purple_wool minecraft:blue_wool minecraft:brown_wool minecraft:green_wool minecraft:red_wool minecraft:black_wool minecraft:orange_carpet minecraft:magenta_carpet minecraft:light_blue_carpet minecraft:yellow_carpet minecraft:lime_carpet minecraft:pink_carpet minecraft:gray_carpet minecraft:light_gray_carpet minecraft:cyan_carpet minecraft:purple_carpet minecraft:blue_carpet minecraft:brown_carpet minecraft:green_carpet minecraft:red_carpet minecraft:black_carpet
# block.201 =
block.10010 = minecraft:white_wall_banner minecraft:orange_wall_banner minecraft:magenta_wall_banner minecraft:light_blue_wall_banner minecraft:yellow_wall_banner minecraft:lime_wall_banner minecraft:pink_wall_banner minecraft:gray_wall_banner minecraft:light_gray_wall_banner minecraft:cyan_wall_banner minecraft:purple_wall_banner minecraft:blue_wall_banner minecraft:brown_wall_banner minecraft:green_wall_banner minecraft:red_wall_banner minecraft:black_wall_banner minecraft:white_banner minecraft:orange_banner minecraft:magenta_banner minecraft:light_blue_banner minecraft:yellow_banner minecraft:lime_banner minecraft:pink_banner minecraft:gray_banner minecraft:light_gray_banner minecraft:cyan_banner minecraft:purple_banner minecraft:blue_banner minecraft:brown_banner minecraft:green_banner minecraft:red_banner minecraft:black_banner
@ -33,7 +30,7 @@
####### ----- lightsources ----- #######
block.10005 = minecraft:sculk_sensor minecraft:soul_fire minecraft:soul_campfire:lit=true minecraft:cave_vines_plant:berries=true minecraft:soul_lantern minecraft:soul_torch minecraft:soul_wall_torch minecraft:conduit minecraft:beacon minecraft:sea_pickle minecraft:respawn_anchor:charges=4 minecraft:smoker:lit=true minecraft:blast_furnace:lit=true minecraft:furnace:lit=true minecraft:lava_cauldron minecraft:sea_lantern minecraft:cave_vines:berries=true minecraft:glowstone minecraft:torch minecraft:wall_torch minecraft:lava minecraft:fire minecraft:redstone_torch minecraft:redstone_wall_torch minecraft:jack_o_lantern minecraft:magma_block minecraft:redstone_lamp:lit=true minecraft:lantern minecraft:campfire:lit=true minecraft:shroomlight minecraft:end_rod minecraft:end_gateway minecraft:lava minecraft:fire
block.10005 = minecraft:sculk_sensor:skulk_sensor_phase=active minecraft:soul_fire minecraft:soul_campfire:lit=true minecraft:cave_vines_plant:berries=true minecraft:soul_lantern minecraft:soul_torch minecraft:soul_wall_torch minecraft:conduit minecraft:beacon minecraft:sea_pickle minecraft:respawn_anchor:charges=4 minecraft:smoker:lit=true minecraft:blast_furnace:lit=true minecraft:furnace:lit=true minecraft:lava_cauldron minecraft:sea_lantern minecraft:cave_vines:berries=true minecraft:glowstone minecraft:torch minecraft:wall_torch minecraft:lava minecraft:fire minecraft:redstone_torch minecraft:redstone_wall_torch minecraft:jack_o_lantern minecraft:magma_block minecraft:redstone_lamp:lit=true minecraft:lantern minecraft:campfire:lit=true minecraft:shroomlight minecraft:end_rod minecraft:end_gateway minecraft:lava minecraft:fire
####### ----- reflective translucents / glass ----- #######

View File

@ -195,14 +195,13 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
vec3 viewVector = cartToSphere(p);
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024.,vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), sunColorCloud, moonColor, ambientUp*5.0);
vec4 VL_Fog = getVolumetricRays(mat3(gbufferModelView)*viewVector*1024., fract(frameCounter/1.6180339887), ambientUp);
vec3 skytex = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.;
if(viewVector.y < -0.025) skytex = skytex * clamp( exp(viewVector.y) - 1.0,0.25,1.0) ;
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024.,vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), sunColorCloud, moonColor, ambientUp*5.0);
skytex = skytex*clouds.a + clouds.rgb/5.0;
vec4 VL_Fog = getVolumetricRays(mat3(gbufferModelView)*viewVector*1024., fract(frameCounter/1.6180339887), ambientUp);
skytex = skytex*VL_Fog.a + VL_Fog.rgb*20;
gl_FragData[0] = vec4(skytex,1.0);

View File

@ -79,7 +79,7 @@ uniform sampler2D depthtex0;
in vec3 velocity;
flat varying float blockID;
flat varying int EMISSIVE;
flat varying float EMISSIVE;
flat varying int LIGHTNING;
#ifdef ENTITIES
@ -409,13 +409,20 @@ void main() {
SpecularTex.r = max(SpecularTex.r, Puddle_shape);
SpecularTex.g = max(SpecularTex.g, Puddle_shape*0.04);
#ifdef ENTITIES
if(NameTags == 1) SpecularTex = vec4(0.0);
#endif
// #ifdef ENTITIES
// if(NameTags == 1) SpecularTex = vec4(0.0);
// #endif
gl_FragData[2].rg = SpecularTex.rg;
#ifdef LabPBR_Emissives
gl_FragData[2].a = SpecularTex.a;
#else
gl_FragData[2].a = EMISSIVE;
#endif
#if SSS_TYPE == 0
gl_FragData[2].b = 0.0;
#endif
@ -433,9 +440,6 @@ void main() {
gl_FragData[2].b = SpecularTex.b;
#endif
if(EMISSIVE > 0) gl_FragData[2].a = 0.9;
if(LIGHTNING > 0.0) gl_FragData[2].a = 0.9;
////////////////////////////////
//////////////////////////////// FINALIZE
////////////////////////////////
@ -489,13 +493,20 @@ void main() {
SpecularTex.r = max(SpecularTex.r, Puddle_shape);
SpecularTex.g = max(SpecularTex.g, Puddle_shape*0.04);
#ifdef ENTITIES
if(NameTags == 1) SpecularTex = vec4(0.0);
#endif
// #ifdef ENTITIES
// if(NameTags == 1) SpecularTex = vec4(0.0);
// #endif
gl_FragData[2].rg = SpecularTex.rg;
#ifdef LabPBR_Emissives
gl_FragData[2].a = SpecularTex.a;
#else
gl_FragData[2].a = EMISSIVE;
#endif
#if SSS_TYPE == 0
gl_FragData[2].b = 0.0;
#endif
@ -516,7 +527,6 @@ void main() {
#endif
if(EMISSIVE > 0) gl_FragData[2].a = 0.9;
#ifdef ENTITIES
if(LIGHTNING > 0) gl_FragData[2].a = 0.5;

View File

@ -46,13 +46,13 @@ attribute vec4 mc_Entity;
uniform int blockEntityId;
uniform int entityId;
flat varying int EMISSIVE;
flat varying float blockID;
flat varying int LIGHTNING;
flat varying float SSSAMOUNT;
flat varying float EMISSIVE;
flat varying int NameTags;
@ -161,26 +161,20 @@ void main() {
gl_Position = ftransform();
SSSAMOUNT = 0.0;
EMISSIVE = 0;
#ifdef ENTITIES
LIGHTNING = 0;
if(entityId == 12345){
LIGHTNING = 1;
}
#endif
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
blockID = mc_Entity.x;
velocity = at_velocity;
// emission and shit...
// #ifndef LabPBR_Emissives
// if(mc_Entity.x == 10005) EMISSIVE = 1;
// #endif
/////// ----- COLOR STUFF ----- ///////
color = gl_Color;
VanillaAO = 1.0 - clamp(color.a,0,1);
if (color.a < 0.3) color.a = 1.0; // fix vanilla ao on some custom block models.
/////// ----- RANDOM STUFF ----- ///////
lmtexcoord.xy = (gl_MultiTexCoord0).xy;
@ -197,21 +191,18 @@ void main() {
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
color = gl_Color;
VanillaAO = 1.0 - clamp(color.a,0,1);
if (color.a < 0.3) color.a = 1.0; // fix vanilla ao on some custom block models.
#ifdef MC_NORMAL_MAP
tangent = vec4(normalize(gl_NormalMatrix *at_tangent.rgb),at_tangent.w);
#endif
normalMat = vec4(normalize(gl_NormalMatrix *gl_Normal), 1.0);
FlatNormals = normalMat.xyz;
blockID = mc_Entity.x;
velocity = at_velocity;
// #ifdef ENTITIES
// NameTags = 0;
@ -221,6 +212,21 @@ void main() {
// #endif
/////// ----- EMISSIVE STUFF ----- ///////
EMISSIVE = 0.0;
// normal block lightsources
if(mc_Entity.x == 10005) EMISSIVE = 0.5;
// special cases light lightning and beacon beams...
#ifdef ENTITIES
if(entityId == 12345) EMISSIVE = 0.9;
#endif
/////// ----- SSS STUFF ----- ///////
SSSAMOUNT = 0.0;
#ifdef WORLD
/////// ----- SSS ON BLOCKS ----- ///////
@ -306,5 +312,4 @@ void main() {
gl_Position.xy += offsets[framemod8] * gl_Position.w * texelSize;
#endif
}

View File

@ -5,23 +5,7 @@ varying vec4 color;
uniform sampler2D texture;
//faster and actually more precise than pow 2.2
// vec3 toLinear(vec3 sRGB){
// return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
// }
// vec3 viewToWorld(vec3 viewPosition) {
// vec4 pos;
// pos.xyz = viewPosition;
// pos.w = 0.0;
// pos = gbufferModelViewInverse * pos;
// return pos.xyz;
// }
// vec3 worldToView(vec3 worldPos) {
// vec4 pos = vec4(worldPos, 0.0);
// pos = gbufferModelView * pos;
// return pos.xyz;
// }
vec4 encode (vec3 n, vec2 lightmaps){
n.xy = n.xy / dot(abs(n), vec3(1.0));
n.xy = n.z <= 0.0 ? (1.0 - abs(n.yx)) * sign(n.xy) : n.xy;

View File

@ -50,41 +50,48 @@ vec3 hash31(float p)
return fract((p3.xxy+p3.yzz)*p3.zyx);
}
// uniform float ifEndBoss;
// uniform float isSneaking;
// uniform float EndSequence1;
// uniform float EndSequence2;
// position related stuff
// vec2 SEED = vec2(sin(frameTimeCounter*5) + 1);
// uvec3 HASH = hash(SEED);
// vec3 RandomPosition = clamp(vec3(HASH) * (1.0/float(0xffffffffu)), 0.0, 1.0);
vec3 RandomPosition = hash31(1);
// vec3 ManualLightPos = vec3(109.25, 128.73, 1189.4) ;
// vec3 ManualLightPos = vec3(307.96, 141.00, 1107.05) - vec3(sin(frameTimeCounter), 0, -cos(frameTimeCounter))*25;
// ManualLightPos -= vec3(sin(frameTimeCounter), 0, -cos(frameTimeCounter))*100;
///////////////// POSITION
///////////////// POSITION
///////////////// POSITION
vec3 RandomPosition = hash31(frameTimeCounter);
vec3 ManualLightPos = vec3(ORB_X, ORB_Y, ORB_Z);
///////////////// POSITION
///////////////// POSITION
///////////////// POSITION
float densityAtPosFog(in vec3 pos){
pos /= 18.;
pos.xz *= 0.5;
vec3 p = floor(pos);
vec3 f = fract(pos);
f = (f*f) * (3.-2.*f);
vec2 uv = p.xz + f.xz + p.y * vec2(0.0,193.0);
vec2 coord = uv / 512.0;
vec2 xy = texture2D(noisetex, coord).yx;
return mix(xy.r,xy.g, f.y);
}
vec3 LightSourcePosition(vec3 WorldPos, vec3 CameraPos){
vec3 Origin = WorldPos ;
vec3 RandomPosition2 = hash31(Origin.y);
// make the swirl only happen within a radius
float SwirlBounds = clamp(sqrt(length(vec3(Origin.x,Origin.y-100,Origin.z)) / 150.0 - 1.0) ,0.0,1.0);
if( SwirlBounds < 1.0) {
Origin.y -= 200;
} else {
Origin = WorldPos - cameraPosition - ManualLightPos ;
// Origin -= RandomPosition * 100;
Origin = WorldPos - CameraPos - ManualLightPos;
float nosie = (densityAtPosFog(Origin / 30 + sin(frameTimeCounter/5)*100)-0.15) * 15 ;
Origin.xz += vec2( sin(nosie),-cos(nosie) )*50;
Origin.y -= sin(nosie)*100;
float cellSize = 100.0;
vec3 cellPos = CameraPos - vec3(0,10,0) ;
// cellPos += vec3(frameTimeCounter,0,0)*25.0;
Origin += (fract(cellPos/cellSize)*cellSize - cellSize*0.5);
}
return Origin;
@ -99,27 +106,19 @@ vec3 LightSourceColor(float SwirlBounds){
if( SwirlBounds < 1.0) {
//////// STAGE 1
Color = vec3(0.5, 0.5, 1.0);
//////// STAGE 2
// Color = mix(Color, vec3(1.0,0.3,0.3), pow(EndSequence1,3.0));
// //////// STAGE 3
// // yes rico, kaboom
// Color = mix(Color, vec3(1.0,0.0,1.0) * (1.0-EndSequence2), EndSequence2);
} else {
// Color = vec3(0.6, 0.8 ,1.0);
Color = vec3(ORB_R, ORB_G, ORB_B) * ORB_ColMult;
// float Timing = dot(RandomPosition, vec3(1.0/3.0));
// float Flash = max(sin(frameTimeCounter*10) * Timing,0.0);
// Color *= blackbody2(RandomPosition.y*4000 + 1000);
// Color *= Flash;
float Timing = dot(RandomPosition, vec3(1.0/3.0));
float Flash = max(sin(frameTimeCounter) * cos(Timing) ,0.0);
Color *= Flash;
}
@ -169,19 +168,7 @@ vec3 LightSourceShape(vec3 WorldPos){
}
float densityAtPosFog(in vec3 pos){
pos /= 18.;
pos.xz *= 0.5;
vec3 p = floor(pos);
vec3 f = fract(pos);
f = (f*f) * (3.-2.*f);
vec2 uv = p.xz + f.xz + p.y * vec2(0.0,193.0);
vec2 coord = uv / 512.0;
vec2 xy = texture2D(noisetex, coord).yx;
return mix(xy.r,xy.g, f.y);
}
float cloudVol(in vec3 pos, int LOD){
@ -299,7 +286,6 @@ mat2x3 getVolumetricRays(float dither,vec3 fragpos,float dither2) {
// #ifdef THE_ORB
// density += clamp((1.0 - length(LightPos) / 10.0) * 10 ,0.0,1.0) ;
// InnerLight = vec3(0.0);
// #endif
vec3 AmbientLight = fogColor * 0.05 * pow(exp(density * -2),20);

View File

@ -212,8 +212,8 @@ void MaterialReflections(
f0 = f0.y == 0.0 ? vec3(0.02) : f0;
// f0 = vec3(0.9);
// roughness = 0.0;
f0 = vec3(0.9);
roughness = 0.0;
mat3 basis = CoordBase(normal);
vec3 normSpaceView = -np3*basis ;

View File

@ -386,23 +386,10 @@ float GetCloudShadow_VLFOG(vec3 WorldPos){
// shadow = shadow/2.0; // perhaps i should average the 2 shadows being added....
shadow = clamp(exp(-shadow*35.0),0.0,1.0);
shadow = clamp(exp(-shadow*255.0),0.0,1.0);
// do not allow it to exist above the lowest cloud plane
// shadow *= clamp(((MaxCumulusHeight + CumulusHeight)*0.435 - WorldPos.y)/100,0.0,1.0) ;
return shadow;
}
float GetCloudShadow_occluson(vec3 WorldPos){
float shadow = 0.0;
#ifdef Cumulus
vec3 lowShadowStart = WorldPos + vec3(0,0.7,0) * max((MaxCumulusHeight - 60) - WorldPos.y,0.0) ;
shadow += GetCumulusDensity(lowShadowStart,1)*Cumulus_density;
shadow = clamp(exp(-shadow * 5),0.0,1.0);
#endif
return shadow;
}

View File

@ -109,10 +109,10 @@ vec4 getVolumetricRays(
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;
// }
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);
@ -154,9 +154,9 @@ vec4 InsideACloudFog(
vec3 MoonColor,
vec3 SkyColor
){
#ifndef VOLUMETRIC_CLOUDS
return vec4(0.0,0.0,0.0,1.0);
#endif
// #ifndef VOLUMETRIC_CLOUDS
// return vec4(0.0,0.0,0.0,1.0);
// #endif
float total_extinction = 1.0;
vec3 color = vec3(0.0);
@ -253,7 +253,7 @@ vec4 InsideACloudFog(
float cloudhsadow = 1;
float cloudhsadow = sh;
#ifdef VL_CLOUDS_SHADOWS
cloudhsadow = sh * GetCloudShadow_VLFOG(progressW);
@ -316,11 +316,8 @@ vec4 InsideACloudFog(
#endif
float ambientlightshadow = 1.0 - clamp(exp((progress_view.y - (MaxCumulusHeight - 50)) / 100.0),0.0,1.0) ;
vec3 S = Cloud_lighting(muE, cumulus*Cumulus_density, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, ambientlightshadow, 0, progress_view, timing);
vec3 Sint = (S - S * exp(-mult*muE)) / muE;
color += max(muE*Sint*total_extinction,0.0);
total_extinction *= max(exp(-mult*muE),0.0);

View File

@ -408,6 +408,7 @@ void main() {
float fogshadow = GetCloudShadow(p3+cameraPosition, LightPos, blueNoise());
vec3 LightSource = (LightColor * max(LightColor - (1-fogshadow) ,0.0)) * LightFalloff * NdotL ;
// vec3 LightSource = LightColor * fogshadow * LightFalloff * NdotL ;
@ -417,7 +418,7 @@ void main() {
LightFalloff2 = pow(1.0-pow(1.0-LightFalloff2,0.5),2.0);
LightFalloff2 *= 25;
LightSource += (LightColor * (LightColor - 0.6)) * vec3(1.0,1.3,1.0) * LightFalloff2 * (NdotL*0.7+0.3);
LightSource += (LightColor * max(LightColor - 0.6,0.0)) * vec3(1.0,1.3,1.0) * LightFalloff2 * (NdotL*0.7+0.3);
// float RT_Shadows = rayTraceShadow(worldToView(normalize(-LightPos)), fragpos_RTSHADOW, blueNoise());
// if(!hand) LightSource *= RT_Shadows*RT_Shadows;