diff --git a/shaders/dimensions/all_particles.fsh b/shaders/dimensions/all_particles.fsh index 849071f..2a1a2c7 100644 --- a/shaders/dimensions/all_particles.fsh +++ b/shaders/dimensions/all_particles.fsh @@ -67,6 +67,8 @@ flat varying float HELD_ITEM_BRIGHTNESS; #endif #ifdef IS_LPV_ENABLED + uniform int heldItemId; + uniform int heldItemId2; uniform int frameCounter; #include "/lib/hsv.glsl" diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index 03145fb..b1e188b 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -107,6 +107,9 @@ uniform vec3 nsunColor; #endif #ifdef IS_LPV_ENABLED + uniform int heldItemId; + uniform int heldItemId2; + #include "/lib/hsv.glsl" #include "/lib/lpv_common.glsl" #include "/lib/lpv_render.glsl" diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index 056ab96..10a7440 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -123,6 +123,11 @@ flat varying vec3 WsunVec; flat varying vec3 unsigned_WsunVec; flat varying float exposure; +#ifdef IS_LPV_ENABLED + uniform int heldItemId; + uniform int heldItemId2; +#endif + #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) diff --git a/shaders/dimensions/shadowcomp.csh b/shaders/dimensions/shadowcomp.csh index dd26f01..043449c 100644 --- a/shaders/dimensions/shadowcomp.csh +++ b/shaders/dimensions/shadowcomp.csh @@ -131,9 +131,6 @@ void main() { uint tintData = LpvBlockMap[blockId].Tint; tintColor = unpackUnorm4x8(tintData).rgb; - } - - if (blockId > 0u) { vec4 lightColorRange = unpackUnorm4x8(LpvBlockMap[blockId].ColorRange); float lightRange = lightColorRange.a * 255.0; diff --git a/shaders/entity.properties b/shaders/entity.properties index 23b7965..8bb72e9 100644 --- a/shaders/entity.properties +++ b/shaders/entity.properties @@ -1,27 +1,34 @@ -entity.1201= player +entity.1201=player -entity.1202= minecraft:lightning_bolt weather2:lightning_bolt +entity.1202=minecraft:lightning_bolt weather2:lightning_bolt ## misc stuff -entity.1203= ender_dragon wither -entity.1301= item_frame item_display -entity.1302= spectral_arrow bigglobe:torch_arrow -entity.1303= tnt firework_rocket +entity.1203=blaze + +entity.1204=ender_dragon wither + +entity.1205=item_frame item_display + +entity.1206=magma_cube + +entity.1207=tnt firework_rocket + +entity.1208=spectral_arrow bigglobe:torch_arrow ################################################ ###### SUB-SURFACE SCATTERING ################################################ ## medium sss (same as strong sss for blocks) -entity.1401 = giant ghast elder_guardian +entity.1401=giant ghast elder_guardian ## weak sss (same as weak sss for blocks) -entity.1402 = furnace_minecart sheep frog chicken iron_golem snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin polar_bear pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin blaze creeper drowned endermite evoker guardian hoglin husk magma_cube phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager trader_llama -#removed: player +entity.1402=furnace_minecart sheep frog chicken iron_golem snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin polar_bear pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin creeper drowned endermite evoker guardian hoglin husk phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager trader_llama +#removed: player blaze magma_cube ################################################ ###### REFLECTIVE TRANSLUCENTS ################################################ -entity.1403 = slime \ No newline at end of file +entity.1403=slime diff --git a/shaders/lib/diffuse_lighting.glsl b/shaders/lib/diffuse_lighting.glsl index c5904a1..53b9a7a 100644 --- a/shaders/lib/diffuse_lighting.glsl +++ b/shaders/lib/diffuse_lighting.glsl @@ -1,3 +1,14 @@ +#ifdef IS_LPV_ENABLED + vec3 GetHandLight(const in int itemId) { + if (itemId < 1000) { + // TODO: block lights + } + else { + // TODO: item lights + } + } +#endif + vec3 DoAmbientLightColor( vec3 lpvPos, vec3 SkyColor, @@ -24,9 +35,6 @@ vec3 DoAmbientLightColor( vec4 lpvSample = SampleLpvLinear(lpvPos); vec3 LpvTorchLight = GetLpvBlockLight(lpvSample); - // TODO: needs work, just binary transition for now - // float LpvFadeF = clamp(lpvPos, vec3(0.0), LpvSize3 - 1.0) == lpvPos ? 1.0 : 0.0; - // i gotchu float fadeLength = 10.0; // in blocks vec3 cubicRadius = clamp( min(((LpvSize3-1.0) - lpvPos)/fadeLength, lpvPos/fadeLength) ,0.0,1.0); @@ -34,7 +42,13 @@ vec3 DoAmbientLightColor( LpvFadeF = 1.0 - pow(1.0-pow(LpvFadeF,1.5),3.0); // make it nice and soft :) - TorchLight = mix(TorchLight,LpvTorchLight/5.0, LpvFadeF) ; + TorchLight = mix(TorchLight,LpvTorchLight/5.0, LpvFadeF); + + if (heldItemId > 0) + TorchLight += GetHandLight(heldItemId); + + if (heldItemId2 > 0) + TorchLight += GetHandLight(heldItemId2); #endif return IndirectLight + TorchLight * TorchBrightness_autoAdjust; diff --git a/shaders/lib/entities.glsl b/shaders/lib/entities.glsl index 141d86a..de0bc1b 100644 --- a/shaders/lib/entities.glsl +++ b/shaders/lib/entities.glsl @@ -1,10 +1,11 @@ #define ENTITY_PLAYER 1201 #define ENTITY_LIGHTNING 1202 -//#define ENTITY_DRAGON_WITHER 1203 - -#define ENTITY_ITEM_FRAME 1301 -#define ENTITY_SPECTRAL_ARROW 1302 -#define ENTITY_TNT 1303 - +#define ENTITY_BLAZE 1203 +#define ENTITY_DRAGON_WITHER 1204 +#define ENTITY_ITEM_FRAME 1205 +#define ENTITY_MAGMA_CUBE 1206 +#define ENTITY_TNT 1207 +#define ENTITY_SPECTRAL_ARROW 1208 #define ENTITY_SSS_MEDIUM 1401 #define ENTITY_SSS_WEAK 1402 +#define ENTITY_SLIME 1403 diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index 2f9716a..575bf24 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -687,6 +687,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #define LPV_REDSTONE_LIGHTS //#define LPV_COLORED_CANDLES +#define LPV_NOSHADOW_HACK + #ifdef LPV_ENABLED #ifdef IRIS_FEATURE_CUSTOM_IMAGES #define IS_LPV_ENABLED diff --git a/shaders/template/entity.properties b/shaders/template/entity.properties new file mode 100644 index 0000000..12a87f3 --- /dev/null +++ b/shaders/template/entity.properties @@ -0,0 +1,45 @@ +#= ENTITY_PLAYER +entity.1201= player + +#= ENTITY_LIGHTNING +entity.*= minecraft:lightning_bolt weather2:lightning_bolt + +## misc stuff + +#= ENTITY_BLAZE +entity.*= blaze + +#= ENTITY_DRAGON_WITHER +entity.*= ender_dragon wither + +#= ENTITY_ITEM_FRAME +entity.*= item_frame item_display + +#= ENTITY_MAGMA_CUBE +entity.*= magma_cube + +#= ENTITY_TNT +entity.*= tnt firework_rocket + +#= ENTITY_SPECTRAL_ARROW +entity.*= spectral_arrow bigglobe:torch_arrow + +################################################ +###### SUB-SURFACE SCATTERING +################################################ + +## medium sss (same as strong sss for blocks) +#= ENTITY_SSS_MEDIUM +entity.1401 = giant ghast elder_guardian + +## weak sss (same as weak sss for blocks) +#= ENTITY_SSS_WEAK +entity.* = furnace_minecart sheep frog chicken iron_golem snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin polar_bear pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin creeper drowned endermite evoker guardian hoglin husk phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager trader_llama +#removed: player blaze magma_cube + +################################################ +###### REFLECTIVE TRANSLUCENTS +################################################ + +#= ENTITY_SLIME +entity.* = slime diff --git a/shaders/world-1/shadow.vsh b/shaders/world-1/shadow.vsh index 5b7f190..79049b3 100644 --- a/shaders/world-1/shadow.vsh +++ b/shaders/world-1/shadow.vsh @@ -37,8 +37,12 @@ Read the terms of modification and sharing before changing something below pleas void main() { #if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store - vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; - vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; + #ifdef LPV_NOSHADOW_HACK + vec3 playerpos = gl_Vertex.xyz; + #else + vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; + vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; + #endif if ( renderStage == MC_RENDER_STAGE_TERRAIN_SOLID || renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT || @@ -60,20 +64,16 @@ void main() { uint voxelId = 0u; if (currentRenderedItemId > 0) { - if (entityId == ENTITY_PLAYER) { - if (currentRenderedItemId < 1000) - voxelId = uint(currentRenderedItemId); - } - else if (entityId != ENTITY_ITEM_FRAME) + if (entityId != ENTITY_ITEM_FRAME && entityId != ENTITY_PLAYER) voxelId = uint(currentRenderedItemId); } else { switch (entityId) { + case ENTITY_BLAZE: + case ENTITY_MAGMA_CUBE: case ENTITY_SPECTRAL_ARROW: voxelId = uint(BLOCK_TORCH); break; - - // TODO: blaze, magma_cube } } diff --git a/shaders/world0/shadow.vsh b/shaders/world0/shadow.vsh index 1d08937..27d23af 100644 --- a/shaders/world0/shadow.vsh +++ b/shaders/world0/shadow.vsh @@ -213,21 +213,16 @@ void main() { uint voxelId = 0u; if (currentRenderedItemId > 0) { - if (entityId == ENTITY_PLAYER) { - // TODO: remove once hand-light is added - if (currentRenderedItemId < 1000) - voxelId = uint(currentRenderedItemId); - } - else if (entityId != ENTITY_ITEM_FRAME) + if (entityId != ENTITY_ITEM_FRAME && entityId != ENTITY_PLAYER) voxelId = uint(currentRenderedItemId); } else { switch (entityId) { + case ENTITY_BLAZE: + case ENTITY_MAGMA_CUBE: case ENTITY_SPECTRAL_ARROW: voxelId = uint(BLOCK_TORCH); break; - - // TODO: blaze, magma_cube } } diff --git a/shaders/world1/shadow.vsh b/shaders/world1/shadow.vsh index 5b7f190..79049b3 100644 --- a/shaders/world1/shadow.vsh +++ b/shaders/world1/shadow.vsh @@ -37,8 +37,12 @@ Read the terms of modification and sharing before changing something below pleas void main() { #if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store - vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; - vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; + #ifdef LPV_NOSHADOW_HACK + vec3 playerpos = gl_Vertex.xyz; + #else + vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; + vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; + #endif if ( renderStage == MC_RENDER_STAGE_TERRAIN_SOLID || renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT || @@ -60,20 +64,16 @@ void main() { uint voxelId = 0u; if (currentRenderedItemId > 0) { - if (entityId == ENTITY_PLAYER) { - if (currentRenderedItemId < 1000) - voxelId = uint(currentRenderedItemId); - } - else if (entityId != ENTITY_ITEM_FRAME) + if (entityId != ENTITY_ITEM_FRAME && entityId != ENTITY_PLAYER) voxelId = uint(currentRenderedItemId); } else { switch (entityId) { + case ENTITY_BLAZE: + case ENTITY_MAGMA_CUBE: case ENTITY_SPECTRAL_ARROW: voxelId = uint(BLOCK_TORCH); break; - - // TODO: blaze, magma_cube } }