mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-23 01:59:39 +08:00
kinda working
This commit is contained in:
parent
2c4eea5b26
commit
3ab6b68165
@ -30,7 +30,29 @@
|
||||
block.10008 = minecraft:grass_block:snowy=false
|
||||
|
||||
####### ----- lightsources ----- #######
|
||||
block.10005 = minecraft:sculk_sensor:sculk_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: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 westerosblocks:safe_fire conquest:white_paper_lantern conquest:yellow_paper_lantern conquest:small_red_paper_lantern conquest:chinese_palace_lantern conquest:campfire conquest:brazier conquest:hanging_brazier conquest:chandelier conquest:candelabra conquest:cross_chandelier conquest:iron_candelabrum_1 conquest:golden_candelabrum_1 conquest:candle conquest:hanging_candle_holder conquest:candle_in_a_lantern conquest:candles conquest:hand_candle conquest:torch_with_grille conquest:elven_hand_light conquest:ship_lantern conquest:victorian_lantern conquest:small_lantern conquest:big_lantern conquest:hanging_oil_lamp conquest:oil_lamp conquest:terracotta_oil_lamp conquest:invisible_light_low conquest:invisible_light_medium conquest:invisible_light
|
||||
#block.10005 = minecraft:sculk_sensor:sculk_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: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 westerosblocks:safe_fire conquest:white_paper_lantern conquest:yellow_paper_lantern conquest:small_red_paper_lantern conquest:chinese_palace_lantern conquest:campfire conquest:brazier conquest:hanging_brazier conquest:chandelier conquest:candelabra conquest:cross_chandelier conquest:iron_candelabrum_1 conquest:golden_candelabrum_1 conquest:candle conquest:hanging_candle_holder conquest:candle_in_a_lantern conquest:candles conquest:hand_candle conquest:torch_with_grille conquest:elven_hand_light conquest:ship_lantern conquest:victorian_lantern conquest:small_lantern conquest:big_lantern conquest:hanging_oil_lamp conquest:oil_lamp conquest:terracotta_oil_lamp conquest:invisible_light_low conquest:invisible_light_medium conquest:invisible_light
|
||||
block.1000 = cave_vines_plant:berries=true cave_vines:berries=true
|
||||
block.1001 = soul_fire soul_campfire:lit=true
|
||||
block.1002 = soul_lantern
|
||||
block.1003 = soul_torch soul_wall_torch
|
||||
block.1004 = conduit
|
||||
block.1005 = beacon
|
||||
block.1006 = sea_pickle
|
||||
block.1007 = respawn_anchor:charges=4
|
||||
block.1008 = smoker:lit=true
|
||||
block.1009 = sea_lantern
|
||||
block.1010 = glowstone
|
||||
block.1011 = torch wall_torch
|
||||
block.1012 = lava
|
||||
block.1013 = fire
|
||||
block.1014 = redstone_torch redstone_wall_torch
|
||||
block.1015 = jack_o_lantern
|
||||
block.1016 = magma_block
|
||||
block.1017 = redstone_lamp:lit=true
|
||||
block.1018 = lantern
|
||||
block.1019 = campfire:lit=true
|
||||
block.1020 = shroomlight
|
||||
block.1021 = end_rod minecraft:end_gateway westerosblocks:safe_fire conquest:white_paper_lantern conquest:yellow_paper_lantern conquest:small_red_paper_lantern conquest:chinese_palace_lantern conquest:campfire conquest:brazier conquest:hanging_brazier conquest:chandelier conquest:candelabra conquest:cross_chandelier conquest:iron_candelabrum_1 conquest:golden_candelabrum_1 conquest:candle conquest:hanging_candle_holder conquest:candle_in_a_lantern conquest:candles conquest:hand_candle conquest:torch_with_grille conquest:elven_hand_light conquest:ship_lantern conquest:victorian_lantern conquest:small_lantern conquest:big_lantern conquest:hanging_oil_lamp conquest:oil_lamp conquest:terracotta_oil_lamp conquest:invisible_light_low conquest:invisible_light_medium conquest:invisible_light
|
||||
|
||||
####### ----- reflective translucents / glass ----- #######
|
||||
block.10002 = minecraft:slime_block minecraft:nether_portal minecraft:honey_block ice minecraft:frosted_ice minecraft:black_stained_glass minecraft:black_stained_glass_pane minecraft:blue_stained_glass minecraft:blue_stained_glass_pane minecraft:brown_stained_glass minecraft:brown_stained_glass_pane minecraft:cyan_stained_glass minecraft:cyan_stained_glass_pane minecraft:gray_stained_glass minecraft:gray_stained_glass_pane minecraft:green_stained_glass minecraft:green_stained_glass_pane minecraft:light_blue_stained_glass minecraft:light_blue_stained_glass_pane minecraft:light_gray_stained_glass minecraft:light_gray_stained_glass_pane minecraft:lime_stained_glass minecraft:lime_stained_glass_pane minecraft:magenta_stained_glass minecraft:magenta_stained_glass_pane minecraft:orange_stained_glass minecraft:orange_stained_glass_pane minecraft:pink_stained_glass minecraft:pink_stained_glass_pane minecraft:purple_stained_glass minecraft:purple_stained_glass_pane minecraft:red_stained_glass minecraft:red_stained_glass_pane minecraft:white_stained_glass minecraft:white_stained_glass_pane minecraft:yellow_stained_glass minecraft:yellow_stained_glass_pane minecraft:glass_pane minecraft:glass
|
||||
|
@ -1,4 +1,9 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
#extension GL_EXT_shader_image_load_store: enable
|
||||
#endif
|
||||
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
varying vec4 lmtexcoord;
|
||||
@ -56,6 +61,14 @@ flat varying float HELD_ITEM_BRIGHTNESS;
|
||||
#include "/lib/volumetricClouds.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
uniform int frameCounter;
|
||||
|
||||
#include "/lib/hsv.glsl"
|
||||
#include "/lib/lpv_common.glsl"
|
||||
#include "/lib/lpv_render.glsl"
|
||||
#endif
|
||||
|
||||
#include "/lib/diffuse_lighting.glsl"
|
||||
#include "/lib/sky_gradient.glsl"
|
||||
|
||||
@ -226,7 +239,7 @@ void main() {
|
||||
vec3 AmbientLightColor = vec3(1.0);
|
||||
#endif
|
||||
|
||||
Indirect_lighting = DoAmbientLightColor(AmbientLightColor,MinimumLightColor, Torch_Color, clamp(lightmap.xy,0,1));
|
||||
Indirect_lighting = DoAmbientLightColor(feetPlayerPos, AmbientLightColor,MinimumLightColor, Torch_Color, clamp(lightmap.xy,0,1));
|
||||
|
||||
#ifdef LINES
|
||||
gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * toLinear(color.rgb);
|
||||
|
@ -1,4 +1,9 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
#extension GL_EXT_shader_image_load_store: enable
|
||||
#endif
|
||||
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
varying vec4 lmtexcoord;
|
||||
@ -97,6 +102,12 @@ uniform vec3 nsunColor;
|
||||
#include "/lib/end_fog.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
#include "/lib/hsv.glsl"
|
||||
#include "/lib/lpv_common.glsl"
|
||||
#include "/lib/lpv_render.glsl"
|
||||
#endif
|
||||
|
||||
#include "/lib/diffuse_lighting.glsl"
|
||||
|
||||
float blueNoise(){
|
||||
@ -572,7 +583,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
AmbientLightColor *= clamp(1.5 + dot(WS_normal, normalize(feetPlayerPos))*0.5,0,2);
|
||||
|
||||
#endif
|
||||
Indirect_lighting = DoAmbientLightColor(AmbientLightColor, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
|
||||
Indirect_lighting = DoAmbientLightColor(feetPlayerPos, AmbientLightColor, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
|
||||
|
||||
#ifdef ENTITIES
|
||||
Albedo.rgb = mix(Albedo.rgb, entityColor.rgb, clamp(entityColor.a*1.5,0,1));
|
||||
|
@ -1,4 +1,9 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
#extension GL_EXT_shader_image_load_store: enable
|
||||
#endif
|
||||
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
|
||||
@ -162,6 +167,12 @@ vec3 toScreenSpace(vec3 p) {
|
||||
#include "/lib/volumetricClouds.glsl"
|
||||
#endif
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
#include "/lib/hsv.glsl"
|
||||
#include "/lib/lpv_common.glsl"
|
||||
#include "/lib/lpv_render.glsl"
|
||||
#endif
|
||||
|
||||
#include "/lib/diffuse_lighting.glsl"
|
||||
|
||||
float ld(float dist) {
|
||||
@ -1256,7 +1267,8 @@ void main() {
|
||||
|
||||
#endif
|
||||
|
||||
Indirect_lighting = DoAmbientLightColor(Indirect_lighting, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
|
||||
vec3 lpvPos = GetLpvPosition(feetPlayerPos) - 0.5*FlatNormals + slopednormal;
|
||||
Indirect_lighting = DoAmbientLightColor(lpvPos, Indirect_lighting, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
|
||||
|
||||
Indirect_lighting *= Absorbtion;
|
||||
#ifdef OVERWORLD_SHADER
|
||||
|
@ -1,2 +1,19 @@
|
||||
#define BLOCK_WATER 8
|
||||
#define BLOCK_LIGHT_SOURCES 10005
|
||||
|
||||
#define BLOCK_CAVE_VINE_BERRIES 1000
|
||||
#define BLOCK_SOUL_FIRE 1001
|
||||
#define BLOCK_SOUL_LANTERN 1002
|
||||
#define BLOCK_SOUL_TORCH 1003
|
||||
|
||||
#define BLOCK_SEA_LANTERN 1009
|
||||
#define BLOCK_GLOWSTONE 1010
|
||||
#define BLOCK_TORCH 1011
|
||||
#define BLOCK_LAVA 1012
|
||||
#define BLOCK_FIRE 1013
|
||||
#define BLOCK_REDSTONE_TORCH 1014
|
||||
|
||||
#define BLOCK_MAGMA 1016
|
||||
|
||||
#define BLOCK_LANTERN 1018
|
||||
|
||||
#define BLOCK_SHROOMLIGHT 1020
|
||||
|
@ -1,4 +1,5 @@
|
||||
vec3 DoAmbientLightColor(
|
||||
vec3 lpvPos,
|
||||
vec3 SkyColor,
|
||||
vec3 MinimumColor,
|
||||
vec3 TorchColor,
|
||||
@ -12,11 +13,16 @@ vec3 DoAmbientLightColor(
|
||||
vec3 IndirectLight = max(SkyColor * ambient_brightness * skyLM, MinimumLight);
|
||||
|
||||
// do torch lighting.
|
||||
// float TorchLM = 10.0 - ( 1.0 / (pow(exp(-0.5*inversesqrt(Lightmap.x)),5.0)+0.1));
|
||||
// TorchLM = pow(TorchLM/4,10) + pow(Lightmap.x,1.5)*0.5;
|
||||
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
|
||||
vec4 lpvSample = SampleLpv(lpvPos);
|
||||
vec3 TorchLight = GetLpvBlockLight(lpvSample);
|
||||
#else
|
||||
// float TorchLM = 10.0 - ( 1.0 / (pow(exp(-0.5*inversesqrt(Lightmap.x)),5.0)+0.1));
|
||||
// TorchLM = pow(TorchLM/4,10) + pow(Lightmap.x,1.5)*0.5;
|
||||
|
||||
float TorchLM = pow(Lightmap.x,10.0)*5.0 + pow(Lightmap.x,1.5);
|
||||
vec3 TorchLight = TorchColor * TORCH_AMOUNT * TorchLM * (1.0 + LightLevelZero*dot(SkyColor * ambient_brightness,vec3(0.3333)));
|
||||
float TorchLM = pow(Lightmap.x,10.0)*5.0 + pow(Lightmap.x,1.5);
|
||||
vec3 TorchLight = TorchColor * TORCH_AMOUNT * TorchLM * (1.0 + LightLevelZero*dot(SkyColor * ambient_brightness,vec3(0.3333)));
|
||||
#endif
|
||||
|
||||
return IndirectLight + TorchLight;
|
||||
}
|
||||
|
@ -12,4 +12,9 @@ const uvec3 LpvSize3 = uvec3(LpvSize);
|
||||
// layout(r16ui) uniform readonly uimage2D imgVoxelMask;
|
||||
// #endif
|
||||
|
||||
#define LIGHT_NONE 0
|
||||
// #define LIGHT_NONE 0
|
||||
|
||||
vec3 GetLpvPosition(const in vec3 playerPos) {
|
||||
vec3 cameraOffset = fract(cameraPosition);
|
||||
return playerPos + cameraOffset + LpvSize3/2u + 0.5;
|
||||
}
|
||||
|
@ -1,35 +1,35 @@
|
||||
vec4 cubic(const in float v) {
|
||||
vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - v;
|
||||
vec4 s = n * n * n;
|
||||
float x = s.x;
|
||||
float y = s.y - 4.0 * s.x;
|
||||
float z = s.z - 4.0 * s.y + 6.0 * s.x;
|
||||
float w = 6.0 - x - y - z;
|
||||
return vec4(x, y, z, w) * (1.0/6.0);
|
||||
}
|
||||
// vec4 cubic(const in float v) {
|
||||
// vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - v;
|
||||
// vec4 s = n * n * n;
|
||||
// float x = s.x;
|
||||
// float y = s.y - 4.0 * s.x;
|
||||
// float z = s.z - 4.0 * s.y + 6.0 * s.x;
|
||||
// float w = 6.0 - x - y - z;
|
||||
// return vec4(x, y, z, w) * (1.0/6.0);
|
||||
// }
|
||||
|
||||
float LpvVoxelTest(const in ivec3 voxelCoord) {
|
||||
ivec3 gridCell = ivec3(floor(voxelCoord / LIGHT_BIN_SIZE));
|
||||
uint gridIndex = GetVoxelGridCellIndex(gridCell);
|
||||
ivec3 blockCell = voxelCoord - gridCell * LIGHT_BIN_SIZE;
|
||||
// float LpvVoxelTest(const in ivec3 voxelCoord) {
|
||||
// ivec3 gridCell = ivec3(floor(voxelCoord / LIGHT_BIN_SIZE));
|
||||
// uint gridIndex = GetVoxelGridCellIndex(gridCell);
|
||||
// ivec3 blockCell = voxelCoord - gridCell * LIGHT_BIN_SIZE;
|
||||
|
||||
uint blockId = GetVoxelBlockMask(blockCell, gridIndex);
|
||||
return IsTraceOpenBlock(blockId) ? 1.0 : 0.0;
|
||||
}
|
||||
// uint blockId = GetVoxelBlockMask(blockCell, gridIndex);
|
||||
// return IsTraceOpenBlock(blockId) ? 1.0 : 0.0;
|
||||
// }
|
||||
|
||||
vec4 SampleLpvNearest(const in ivec3 lpvPos) {
|
||||
vec4 lpvSample = (frameCounter % 2) == 0
|
||||
#ifndef RENDER_GBUFFER
|
||||
? texelFetch(texLPV_1, lpvPos, 0)
|
||||
: texelFetch(texLPV_2, lpvPos, 0);
|
||||
#else
|
||||
? texelFetch(texLPV_2, lpvPos, 0)
|
||||
: texelFetch(texLPV_1, lpvPos, 0);
|
||||
#endif
|
||||
// #ifndef RENDER_GBUFFER
|
||||
? imageLoad(imgLpv1, lpvPos)
|
||||
: imageLoad(imgLpv2, lpvPos);
|
||||
// #else
|
||||
// ? imageLoad(imgLpv2, lpvPos, 0)
|
||||
// : imageLoad(imgLpv1, lpvPos, 0);
|
||||
// #endif
|
||||
|
||||
lpvSample.rgb = HsvToRgb(lpvSample.rgb);
|
||||
|
||||
return lpvSample / DynamicLightRangeF;
|
||||
return lpvSample;// / DynamicLightRangeF;
|
||||
}
|
||||
|
||||
vec4 SampleLpvLinear(const in vec3 lpvPos) {
|
||||
@ -48,55 +48,55 @@ vec4 SampleLpvLinear(const in vec3 lpvPos) {
|
||||
vec4 sample_x1y2z2 = SampleLpvNearest(lpvCoord + ivec3(0, 1, 1));
|
||||
vec4 sample_x2y2z2 = SampleLpvNearest(lpvCoord + ivec3(1, 1, 1));
|
||||
|
||||
#ifdef LPV_VOXEL_TEST
|
||||
vec3 lpvCameraOffset = fract(cameraPosition);
|
||||
vec3 voxelCameraOffset = fract(cameraPosition / LIGHT_BIN_SIZE) * LIGHT_BIN_SIZE;
|
||||
ivec3 voxelPos = ivec3(lpvPos - SceneLPVCenter + VoxelBlockCenter + voxelCameraOffset - lpvCameraOffset + 0.5);
|
||||
// #ifdef LPV_VOXEL_TEST
|
||||
// vec3 lpvCameraOffset = fract(cameraPosition);
|
||||
// vec3 voxelCameraOffset = fract(cameraPosition / LIGHT_BIN_SIZE) * LIGHT_BIN_SIZE;
|
||||
// ivec3 voxelPos = ivec3(lpvPos - SceneLPVCenter + VoxelBlockCenter + voxelCameraOffset - lpvCameraOffset + 0.5);
|
||||
|
||||
float voxel_x1y1z1 = LpvVoxelTest(voxelPos + ivec3(0, 0, 0));
|
||||
float voxel_x2y1z1 = LpvVoxelTest(voxelPos + ivec3(1, 0, 0));
|
||||
float voxel_x1y2z1 = LpvVoxelTest(voxelPos + ivec3(0, 1, 0));
|
||||
float voxel_x2y2z1 = LpvVoxelTest(voxelPos + ivec3(1, 1, 0));
|
||||
// float voxel_x1y1z1 = LpvVoxelTest(voxelPos + ivec3(0, 0, 0));
|
||||
// float voxel_x2y1z1 = LpvVoxelTest(voxelPos + ivec3(1, 0, 0));
|
||||
// float voxel_x1y2z1 = LpvVoxelTest(voxelPos + ivec3(0, 1, 0));
|
||||
// float voxel_x2y2z1 = LpvVoxelTest(voxelPos + ivec3(1, 1, 0));
|
||||
|
||||
float voxel_x1y1z2 = LpvVoxelTest(voxelPos + ivec3(0, 0, 1));
|
||||
float voxel_x2y1z2 = LpvVoxelTest(voxelPos + ivec3(1, 0, 1));
|
||||
float voxel_x1y2z2 = LpvVoxelTest(voxelPos + ivec3(0, 1, 1));
|
||||
float voxel_x2y2z2 = LpvVoxelTest(voxelPos + ivec3(1, 1, 1));
|
||||
// float voxel_x1y1z2 = LpvVoxelTest(voxelPos + ivec3(0, 0, 1));
|
||||
// float voxel_x2y1z2 = LpvVoxelTest(voxelPos + ivec3(1, 0, 1));
|
||||
// float voxel_x1y2z2 = LpvVoxelTest(voxelPos + ivec3(0, 1, 1));
|
||||
// float voxel_x2y2z2 = LpvVoxelTest(voxelPos + ivec3(1, 1, 1));
|
||||
|
||||
sample_x1y1z1 *= voxel_x1y1z1;
|
||||
sample_x2y1z1 *= voxel_x2y1z1;
|
||||
sample_x1y2z1 *= voxel_x1y2z1;
|
||||
sample_x2y2z1 *= voxel_x2y2z1;
|
||||
// sample_x1y1z1 *= voxel_x1y1z1;
|
||||
// sample_x2y1z1 *= voxel_x2y1z1;
|
||||
// sample_x1y2z1 *= voxel_x1y2z1;
|
||||
// sample_x2y2z1 *= voxel_x2y2z1;
|
||||
|
||||
sample_x1y1z2 *= voxel_x1y1z2;
|
||||
sample_x2y1z2 *= voxel_x2y1z2;
|
||||
sample_x1y2z2 *= voxel_x1y2z2;
|
||||
sample_x2y2z2 *= voxel_x2y2z2;
|
||||
// sample_x1y1z2 *= voxel_x1y1z2;
|
||||
// sample_x2y1z2 *= voxel_x2y1z2;
|
||||
// sample_x1y2z2 *= voxel_x1y2z2;
|
||||
// sample_x2y2z2 *= voxel_x2y2z2;
|
||||
|
||||
|
||||
// TODO: Add special checks for avoiding diagonal blending between occluded edges/corners
|
||||
// // TODO: Add special checks for avoiding diagonal blending between occluded edges/corners
|
||||
|
||||
// TODO: preload voxel grid into array
|
||||
// then prevent blending if all but current and opposing quadrants are empty
|
||||
// // TODO: preload voxel grid into array
|
||||
// // then prevent blending if all but current and opposing quadrants are empty
|
||||
|
||||
// ivec3 iq = 1 - ivec3(step(vec3(0.5), lpvF));
|
||||
// float voxel_iqx = 1.0 - LpvVoxelTest(ivec3(voxelPos) + ivec3(iq.x, 0, 0));
|
||||
// float voxel_iqy = 1.0 - LpvVoxelTest(ivec3(voxelPos) + ivec3(0, iq.y, 0));
|
||||
// float voxel_iqz = 1.0 - LpvVoxelTest(ivec3(voxelPos) + ivec3(0, 0, iq.z));
|
||||
// float voxel_corner = 1.0 - voxel_iqx * voxel_iqy * voxel_iqz;
|
||||
// // ivec3 iq = 1 - ivec3(step(vec3(0.5), lpvF));
|
||||
// // float voxel_iqx = 1.0 - LpvVoxelTest(ivec3(voxelPos) + ivec3(iq.x, 0, 0));
|
||||
// // float voxel_iqy = 1.0 - LpvVoxelTest(ivec3(voxelPos) + ivec3(0, iq.y, 0));
|
||||
// // float voxel_iqz = 1.0 - LpvVoxelTest(ivec3(voxelPos) + ivec3(0, 0, iq.z));
|
||||
// // float voxel_corner = 1.0 - voxel_iqx * voxel_iqy * voxel_iqz;
|
||||
|
||||
// float voxel_y1 = LpvVoxelTest(ivec3(voxelPos + vec3(0, 0, 0)));
|
||||
// sample_x1y1z1 *= voxel_y1;
|
||||
// sample_x2y1z1 *= voxel_y1;
|
||||
// sample_x1y1z2 *= voxel_y1;
|
||||
// sample_x2y1z2 *= voxel_y1;
|
||||
// // float voxel_y1 = LpvVoxelTest(ivec3(voxelPos + vec3(0, 0, 0)));
|
||||
// // sample_x1y1z1 *= voxel_y1;
|
||||
// // sample_x2y1z1 *= voxel_y1;
|
||||
// // sample_x1y1z2 *= voxel_y1;
|
||||
// // sample_x2y1z2 *= voxel_y1;
|
||||
|
||||
// float voxel_y2 = LpvVoxelTest(voxelPos + ivec3(0, 1, 0));
|
||||
// sample_x1y2z1 *= voxel_y2;
|
||||
// sample_x2y2z1 *= voxel_y2;
|
||||
// sample_x1y2z2 *= voxel_y2;
|
||||
// sample_x2y2z2 *= voxel_y2;
|
||||
#endif
|
||||
// // float voxel_y2 = LpvVoxelTest(voxelPos + ivec3(0, 1, 0));
|
||||
// // sample_x1y2z1 *= voxel_y2;
|
||||
// // sample_x2y2z1 *= voxel_y2;
|
||||
// // sample_x1y2z2 *= voxel_y2;
|
||||
// // sample_x2y2z2 *= voxel_y2;
|
||||
// #endif
|
||||
|
||||
vec4 sample_y1z1 = mix(sample_x1y1z1, sample_x2y1z1, lpvF.x);
|
||||
vec4 sample_y2z1 = mix(sample_x1y2z1, sample_x2y2z1, lpvF.x);
|
||||
@ -110,96 +110,98 @@ vec4 SampleLpvLinear(const in vec3 lpvPos) {
|
||||
return mix(sample_z1, sample_z2, lpvF.z);// * voxel_corner;
|
||||
}
|
||||
|
||||
vec4 SampleLpvCubic(in vec3 lpvPos) {
|
||||
vec3 pos = lpvPos - 0.5;
|
||||
vec3 texF = fract(pos);
|
||||
pos = floor(pos);
|
||||
// vec4 SampleLpvCubic(in vec3 lpvPos) {
|
||||
// vec3 pos = lpvPos - 0.5;
|
||||
// vec3 texF = fract(pos);
|
||||
// pos = floor(pos);
|
||||
|
||||
vec4 cubic_x = cubic(texF.x);
|
||||
vec4 cubic_y = cubic(texF.y);
|
||||
vec4 cubic_z = cubic(texF.z);
|
||||
// vec4 cubic_x = cubic(texF.x);
|
||||
// vec4 cubic_y = cubic(texF.y);
|
||||
// vec4 cubic_z = cubic(texF.z);
|
||||
|
||||
vec3 pos_min = pos - 0.5;
|
||||
vec3 pos_max = pos + 1.5;
|
||||
// vec3 pos_min = pos - 0.5;
|
||||
// vec3 pos_max = pos + 1.5;
|
||||
|
||||
vec3 s_min = vec3(cubic_x.x, cubic_y.x, cubic_z.x) + vec3(cubic_x.y, cubic_y.y, cubic_z.y);
|
||||
vec3 s_max = vec3(cubic_x.z, cubic_y.z, cubic_z.z) + vec3(cubic_x.w, cubic_y.w, cubic_z.w);
|
||||
// vec3 s_min = vec3(cubic_x.x, cubic_y.x, cubic_z.x) + vec3(cubic_x.y, cubic_y.y, cubic_z.y);
|
||||
// vec3 s_max = vec3(cubic_x.z, cubic_y.z, cubic_z.z) + vec3(cubic_x.w, cubic_y.w, cubic_z.w);
|
||||
|
||||
vec3 offset_min = pos_min + vec3(cubic_x.y, cubic_y.y, cubic_z.y) / s_min;
|
||||
vec3 offset_max = pos_max + vec3(cubic_x.w, cubic_y.w, cubic_z.w) / s_max;
|
||||
// vec3 offset_min = pos_min + vec3(cubic_x.y, cubic_y.y, cubic_z.y) / s_min;
|
||||
// vec3 offset_max = pos_max + vec3(cubic_x.w, cubic_y.w, cubic_z.w) / s_max;
|
||||
|
||||
vec4 sample_x1y1z1 = SampleLpvLinear(vec3(offset_max.x, offset_max.y, offset_max.z));
|
||||
vec4 sample_x2y1z1 = SampleLpvLinear(vec3(offset_min.x, offset_max.y, offset_max.z));
|
||||
vec4 sample_x1y2z1 = SampleLpvLinear(vec3(offset_max.x, offset_min.y, offset_max.z));
|
||||
vec4 sample_x2y2z1 = SampleLpvLinear(vec3(offset_min.x, offset_min.y, offset_max.z));
|
||||
// vec4 sample_x1y1z1 = SampleLpvLinear(vec3(offset_max.x, offset_max.y, offset_max.z));
|
||||
// vec4 sample_x2y1z1 = SampleLpvLinear(vec3(offset_min.x, offset_max.y, offset_max.z));
|
||||
// vec4 sample_x1y2z1 = SampleLpvLinear(vec3(offset_max.x, offset_min.y, offset_max.z));
|
||||
// vec4 sample_x2y2z1 = SampleLpvLinear(vec3(offset_min.x, offset_min.y, offset_max.z));
|
||||
|
||||
vec4 sample_x1y1z2 = SampleLpvLinear(vec3(offset_max.x, offset_max.y, offset_min.z));
|
||||
vec4 sample_x2y1z2 = SampleLpvLinear(vec3(offset_min.x, offset_max.y, offset_min.z));
|
||||
vec4 sample_x1y2z2 = SampleLpvLinear(vec3(offset_max.x, offset_min.y, offset_min.z));
|
||||
vec4 sample_x2y2z2 = SampleLpvLinear(vec3(offset_min.x, offset_min.y, offset_min.z));
|
||||
// vec4 sample_x1y1z2 = SampleLpvLinear(vec3(offset_max.x, offset_max.y, offset_min.z));
|
||||
// vec4 sample_x2y1z2 = SampleLpvLinear(vec3(offset_min.x, offset_max.y, offset_min.z));
|
||||
// vec4 sample_x1y2z2 = SampleLpvLinear(vec3(offset_max.x, offset_min.y, offset_min.z));
|
||||
// vec4 sample_x2y2z2 = SampleLpvLinear(vec3(offset_min.x, offset_min.y, offset_min.z));
|
||||
|
||||
#ifdef LPV_VOXEL_TEST
|
||||
vec3 lpvCameraOffset = fract(cameraPosition);
|
||||
vec3 voxelCameraOffset = fract(cameraPosition / LIGHT_BIN_SIZE) * LIGHT_BIN_SIZE;
|
||||
ivec3 voxelPos = ivec3(lpvPos - SceneLPVCenter + VoxelBlockCenter + voxelCameraOffset - lpvCameraOffset + 0.5);
|
||||
// // #ifdef LPV_VOXEL_TEST
|
||||
// // vec3 lpvCameraOffset = fract(cameraPosition);
|
||||
// // vec3 voxelCameraOffset = fract(cameraPosition / LIGHT_BIN_SIZE) * LIGHT_BIN_SIZE;
|
||||
// // ivec3 voxelPos = ivec3(lpvPos - SceneLPVCenter + VoxelBlockCenter + voxelCameraOffset - lpvCameraOffset + 0.5);
|
||||
|
||||
float voxel_x1y1z1 = LpvVoxelTest(voxelPos + ivec3(1, 1, 1));
|
||||
float voxel_x2y1z1 = LpvVoxelTest(voxelPos + ivec3(0, 1, 1));
|
||||
float voxel_x1y2z1 = LpvVoxelTest(voxelPos + ivec3(1, 0, 1));
|
||||
float voxel_x2y2z1 = LpvVoxelTest(voxelPos + ivec3(0, 0, 1));
|
||||
// // float voxel_x1y1z1 = LpvVoxelTest(voxelPos + ivec3(1, 1, 1));
|
||||
// // float voxel_x2y1z1 = LpvVoxelTest(voxelPos + ivec3(0, 1, 1));
|
||||
// // float voxel_x1y2z1 = LpvVoxelTest(voxelPos + ivec3(1, 0, 1));
|
||||
// // float voxel_x2y2z1 = LpvVoxelTest(voxelPos + ivec3(0, 0, 1));
|
||||
|
||||
float voxel_x1y1z2 = LpvVoxelTest(voxelPos + ivec3(1, 1, 0));
|
||||
float voxel_x2y1z2 = LpvVoxelTest(voxelPos + ivec3(0, 1, 0));
|
||||
float voxel_x1y2z2 = LpvVoxelTest(voxelPos + ivec3(1, 0, 0));
|
||||
float voxel_x2y2z2 = LpvVoxelTest(voxelPos + ivec3(0, 0, 0));
|
||||
// // float voxel_x1y1z2 = LpvVoxelTest(voxelPos + ivec3(1, 1, 0));
|
||||
// // float voxel_x2y1z2 = LpvVoxelTest(voxelPos + ivec3(0, 1, 0));
|
||||
// // float voxel_x1y2z2 = LpvVoxelTest(voxelPos + ivec3(1, 0, 0));
|
||||
// // float voxel_x2y2z2 = LpvVoxelTest(voxelPos + ivec3(0, 0, 0));
|
||||
|
||||
sample_x1y1z1 *= voxel_x1y1z1;
|
||||
sample_x2y1z1 *= voxel_x2y1z1;
|
||||
sample_x1y2z1 *= voxel_x1y2z1;
|
||||
sample_x2y2z1 *= voxel_x2y2z1;
|
||||
// // sample_x1y1z1 *= voxel_x1y1z1;
|
||||
// // sample_x2y1z1 *= voxel_x2y1z1;
|
||||
// // sample_x1y2z1 *= voxel_x1y2z1;
|
||||
// // sample_x2y2z1 *= voxel_x2y2z1;
|
||||
|
||||
sample_x1y1z2 *= voxel_x1y1z2;
|
||||
sample_x2y1z2 *= voxel_x2y1z2;
|
||||
sample_x1y2z2 *= voxel_x1y2z2;
|
||||
sample_x2y2z2 *= voxel_x2y2z2;
|
||||
#endif
|
||||
// // sample_x1y1z2 *= voxel_x1y1z2;
|
||||
// // sample_x2y1z2 *= voxel_x2y1z2;
|
||||
// // sample_x1y2z2 *= voxel_x1y2z2;
|
||||
// // sample_x2y2z2 *= voxel_x2y2z2;
|
||||
// // #endif
|
||||
|
||||
vec3 mixF = s_min / (s_min + s_max);
|
||||
// vec3 mixF = s_min / (s_min + s_max);
|
||||
|
||||
vec4 sample_y1z1 = mix(sample_x1y1z1, sample_x2y1z1, mixF.x);
|
||||
vec4 sample_y2z1 = mix(sample_x1y2z1, sample_x2y2z1, mixF.x);
|
||||
// vec4 sample_y1z1 = mix(sample_x1y1z1, sample_x2y1z1, mixF.x);
|
||||
// vec4 sample_y2z1 = mix(sample_x1y2z1, sample_x2y2z1, mixF.x);
|
||||
|
||||
vec4 sample_y1z2 = mix(sample_x1y1z2, sample_x2y1z2, mixF.x);
|
||||
vec4 sample_y2z2 = mix(sample_x1y2z2, sample_x2y2z2, mixF.x);
|
||||
// vec4 sample_y1z2 = mix(sample_x1y1z2, sample_x2y1z2, mixF.x);
|
||||
// vec4 sample_y2z2 = mix(sample_x1y2z2, sample_x2y2z2, mixF.x);
|
||||
|
||||
vec4 sample_z1 = mix(sample_y1z1, sample_y2z1, mixF.y);
|
||||
vec4 sample_z2 = mix(sample_y1z2, sample_y2z2, mixF.y);
|
||||
// vec4 sample_z1 = mix(sample_y1z1, sample_y2z1, mixF.y);
|
||||
// vec4 sample_z2 = mix(sample_y1z2, sample_y2z2, mixF.y);
|
||||
|
||||
return mix(sample_z1, sample_z2, mixF.z);
|
||||
}
|
||||
// return mix(sample_z1, sample_z2, mixF.z);
|
||||
// }
|
||||
|
||||
vec4 SampleLpv(const in vec3 samplePos) {
|
||||
#if LPV_SAMPLE_MODE == LPV_SAMPLE_CUBIC
|
||||
vec4 lpvSample = SampleLpvCubic(samplePos);
|
||||
#elif LPV_SAMPLE_MODE == LPV_SAMPLE_LINEAR
|
||||
// #if LPV_SAMPLE_MODE == LPV_SAMPLE_CUBIC
|
||||
// vec4 lpvSample = SampleLpvCubic(samplePos);
|
||||
// #elif LPV_SAMPLE_MODE == LPV_SAMPLE_LINEAR
|
||||
vec4 lpvSample = SampleLpvLinear(samplePos);
|
||||
#else
|
||||
ivec3 coord = ivec3(samplePos);
|
||||
vec4 lpvSample = SampleLpvNearest(coord);
|
||||
#endif
|
||||
// #else
|
||||
// ivec3 coord = ivec3(samplePos);
|
||||
// vec4 lpvSample = SampleLpvNearest(coord);
|
||||
// #endif
|
||||
|
||||
return lpvSample;
|
||||
}
|
||||
|
||||
vec4 SampleLpv(const in vec3 lpvPos, const in vec3 geoNormal, const in vec3 texNormal) {
|
||||
#if MATERIAL_NORMALS != 0
|
||||
vec3 samplePos = lpvPos - 0.5 * geoNormal + texNormal;
|
||||
#else
|
||||
vec3 samplePos = lpvPos + 0.5 * geoNormal;
|
||||
#endif
|
||||
// vec4 SampleLpv(const in vec3 playerPos, const in vec3 geoNormal, const in vec3 texNormal) {
|
||||
// ivec3 lpvPos = GetLpvPosition(playerPos);
|
||||
|
||||
return SampleLpv(samplePos);
|
||||
}
|
||||
// // #if MATERIAL_NORMALS != 0
|
||||
// vec3 samplePos = lpvPos - 0.5 * geoNormal + texNormal;
|
||||
// // #else
|
||||
// // vec3 samplePos = lpvPos + 0.5 * geoNormal;
|
||||
// // #endif
|
||||
|
||||
// return SampleLpvLinear(samplePos);
|
||||
// }
|
||||
|
||||
// vec3 GetLpvBlockLight(in vec4 lpvSample, const in float power) {
|
||||
// return (lpvSample.rgb * LPV_BLOCKLIGHT_SCALE) / 8.0 * DynamicLightBrightness;
|
||||
@ -207,10 +209,11 @@ vec4 SampleLpv(const in vec3 lpvPos, const in vec3 geoNormal, const in vec3 texN
|
||||
|
||||
vec3 GetLpvBlockLight(const in vec4 lpvSample) {
|
||||
// return GetLpvBlockLight(lpvSample, 1.0);
|
||||
return (1.0/8.0) * (lpvSample.rgb * LPV_BLOCKLIGHT_SCALE) * DynamicLightBrightness;
|
||||
return 4.0 * lpvSample.rgb;// * LPV_BLOCKLIGHT_SCALE);// * DynamicLightBrightness;
|
||||
}
|
||||
|
||||
float GetLpvSkyLight(const in vec4 lpvSample) {
|
||||
float skyLight = saturate(lpvSample.a);
|
||||
return _pow2(skyLight);
|
||||
// return _pow2(skyLight);
|
||||
return skyLight*skyLight;
|
||||
}
|
||||
|
@ -673,11 +673,13 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
||||
// ----- DISTANT HORIZONS SETTINGS ----- //
|
||||
///////////////////////////////////////////
|
||||
|
||||
#define LPV_ENABLED
|
||||
//#define LPV_ENABLED
|
||||
#define LPV_SIZE 7 // [6 7 8]
|
||||
|
||||
#if defined LPV_ENABLED && defined IRIS_FEATURE_CUSTOM_IMAGES
|
||||
#define IS_LPV_ENABLED
|
||||
#ifdef LPV_ENABLED
|
||||
#ifdef IRIS_FEATURE_CUSTOM_IMAGES
|
||||
#define IS_LPV_ENABLED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -4,3 +4,8 @@ const uint VoxelSize = uint(exp2(LPV_SIZE));
|
||||
const uvec3 VoxelSize3 = uvec3(VoxelSize);
|
||||
|
||||
#define BLOCK_EMPTY 0
|
||||
|
||||
ivec3 GetVoxelIndex(const in vec3 playerPos) {
|
||||
vec3 cameraOffset = fract(cameraPosition);
|
||||
return ivec3(floor(playerPos + cameraOffset + VoxelSize3/2u));
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
uint GetVoxelBlock(const in ivec3 voxelPos) {
|
||||
// TODO: exit early if outside bounds
|
||||
|
||||
return imageLoad(imgVoxelMask, voxelPos).r;
|
||||
}
|
||||
|
||||
uint GetVoxelBlock(const in vec3 playerPos) {
|
||||
vec3 cameraOffset = fract(cameraPosition);
|
||||
ivec3 voxelPos = ivec3(floor(playerPos + cameraOffset + VoxelSize/2u));
|
||||
ivec3 voxelPos = GetVoxelIndex(playerPos);
|
||||
|
||||
// TODO: exit early if outside bounds
|
||||
return imageLoad(imgVoxelMask, voxelPos).r;
|
||||
|
@ -1,6 +1,5 @@
|
||||
void SetVoxelBlock(const in vec3 playerPos, const in uint blockId) {
|
||||
vec3 cameraOffset = fract(cameraPosition);
|
||||
ivec3 voxelPos = ivec3(floor(playerPos + cameraOffset + VoxelSize/2u));
|
||||
ivec3 voxelPos = GetVoxelIndex(playerPos);
|
||||
|
||||
// TODO: exit early if outside bounds
|
||||
imageStore(imgVoxelMask, voxelPos, uvec4(blockId));
|
||||
|
@ -8,7 +8,7 @@ separateAo = true
|
||||
rain.depth = false
|
||||
beacon.beam.depth = true
|
||||
|
||||
iris.features.optional=ENTITY_TRANSLUCENT REVERSED_CULLING COMPUTE_SHADERS CUSTOM_IMAGES
|
||||
iris.features.optional=ENTITY_TRANSLUCENT REVERSED_CULLING COMPUTE_SHADERS CUSTOM_IMAGES SSBO
|
||||
|
||||
#if RESOURCEPACK_SKY == 2
|
||||
sun=true
|
||||
@ -120,7 +120,7 @@ BLISS_SHADERS <empty> \
|
||||
######## LIGHTING
|
||||
### DIRECT LIGHT
|
||||
screen.Direct_Light.columns=1
|
||||
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.Direct_Light = TRANSLUCENT_COLORED_SHADOWS [Shadows] [Subsurface_Scattering] [Sun_and_Moon_Colors] OLD_LIGHTLEAK_FIX sunPathRotation sun_illuminance MOONPHASE_BASED_MOONLIGHT moon_illuminance LPV_ENABLED
|
||||
|
||||
screen.Shadows.columns=1
|
||||
screen.Shadows = SCREENSPACE_CONTACT_SHADOWS RENDER_ENTITY_SHADOWS entityShadowDistanceMul <empty> [Filtering] shadowMapResolution shadowDistance shadowDistanceRenderMul
|
||||
@ -611,7 +611,8 @@ uniform.float.shadowMaxProj = 150.0/abs(sunPosY)
|
||||
####### FLOODFILL STUFF #######
|
||||
###############################
|
||||
|
||||
#if defined LPV_ENABLED && defined IRIS_FEATURE_CUSTOM_IMAGES
|
||||
# if defined LPV_ENABLED && defined IRIS_FEATURE_CUSTOM_IMAGES
|
||||
#ifdef LPV_ENABLED
|
||||
bufferObject.0=20480
|
||||
|
||||
#if LPV_SIZE == 8
|
||||
|
@ -9,23 +9,8 @@ layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
|
||||
const ivec3 workGroups = ivec3(4, 5, 1);
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
#include "/lib/blocks.glsl"
|
||||
#include "/lib/lpv_blocks.glsl"
|
||||
|
||||
|
||||
vec3 GetSceneLightColor(const in uint blockId) {
|
||||
if (blockId == 10005) return vec3(1.0);
|
||||
return vec3(0.0);
|
||||
}
|
||||
|
||||
float GetSceneLightRange(const in uint blockId) {
|
||||
if (blockId == 10005) return 12.0;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
void GetLpvBlockMask(const in uint blockId, out float mixWeight, out uint mixMask) {
|
||||
mixWeight = 0.0;
|
||||
mixMask = 0xFFFF;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -34,25 +19,38 @@ void main() {
|
||||
uint blockId = uint(gl_GlobalInvocationID.x + gl_GlobalInvocationID.y * 32);
|
||||
//if (blockId >= 1280) return;
|
||||
|
||||
vec3 lightColor = vec3(0.0);
|
||||
float lightRange = 0.0;
|
||||
float mixWeight = 0.0;
|
||||
uint mixMask = 0xFFFF;
|
||||
|
||||
switch (blockId) {
|
||||
case BLOCK_GLOWSTONE:
|
||||
lightColor = vec3(0.8, 0.7, 0.1);
|
||||
lightRange = 15.0;
|
||||
break;
|
||||
case BLOCK_REDSTONE_TORCH:
|
||||
lightColor = vec3(1.0, 0.1, 0.1);
|
||||
lightRange = 7.0;
|
||||
break;
|
||||
case BLOCK_SEA_LANTERN:
|
||||
lightColor = vec3(1.0);
|
||||
lightRange = 15.0;
|
||||
break;
|
||||
case BLOCK_SOUL_TORCH:
|
||||
lightColor = vec3(0.1, 0.6, 1.0);
|
||||
lightRange = 10.0;
|
||||
break;
|
||||
case BLOCK_TORCH:
|
||||
lightColor = vec3(1.0, 0.6, 0.1);
|
||||
lightRange = 14.0;
|
||||
break;
|
||||
}
|
||||
|
||||
LpvBlockData block;
|
||||
|
||||
uint mixMask;
|
||||
float mixWeight;
|
||||
GetLpvBlockMask(blockId, mixWeight, mixMask);
|
||||
block.data = BuildBlockLpvData(mixMask, mixWeight);
|
||||
|
||||
// vec3 lightOffset = GetSceneLightOffset(lightType);
|
||||
vec3 lightColor = GetSceneLightColor(blockId);
|
||||
float lightRange = GetSceneLightRange(blockId);
|
||||
float lightSize = 0.0;//GetSceneLightSize(lightType);
|
||||
// bool lightTraced = GetLightTraced(lightType);
|
||||
// bool lightSelfTraced = GetLightSelfTraced(lightType);
|
||||
|
||||
// light.Offset = packSnorm4x8(vec4(lightOffset, 0.0));
|
||||
block.LightColor = packUnorm4x8(vec4(lightColor, 0.0));
|
||||
block.LightRangeSize = packUnorm4x8(vec4(lightRange/255.0, lightSize, 0.0, 0.0));
|
||||
// light.LightMetadata = (lightTraced ? 1u : 0u);
|
||||
// light.LightMetadata |= (lightSelfTraced ? 1u : 0u) << 1u;
|
||||
block.LightRangeSize = packUnorm4x8(vec4(lightRange/255.0, 0.0, 0.0, 0.0));
|
||||
|
||||
LpvBlockMap[blockId] = block;
|
||||
#endif
|
||||
|
@ -50,6 +50,9 @@ uniform int entityId;
|
||||
#include "/lib/bokeh.glsl"
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
attribute vec3 at_midBlock;
|
||||
uniform int renderStage;
|
||||
|
||||
#include "/lib/voxel_common.glsl"
|
||||
#include "/lib/voxel_write.glsl"
|
||||
#endif
|
||||
@ -185,8 +188,18 @@ void main() {
|
||||
#endif
|
||||
|
||||
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
|
||||
// TODO: limit to blocks; entities later
|
||||
SetVoxelBlock(playerpos, blockId);
|
||||
if (
|
||||
renderStage == MC_RENDER_STAGE_TERRAIN_SOLID ||
|
||||
renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT ||
|
||||
renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT_MIPPED ||
|
||||
renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT
|
||||
) {
|
||||
uint voxelId = blockId;
|
||||
if (voxelId == 0u) voxelId = 1u;
|
||||
|
||||
vec3 origin = playerpos + at_midBlock/64.0;
|
||||
SetVoxelBlock(origin, voxelId);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WAVY_PLANTS
|
||||
|
@ -131,8 +131,8 @@ void main() {
|
||||
if (any(greaterThanEqual(imgCoord, LpvSize3))) return;
|
||||
|
||||
// vec3 viewDir = gbufferModelViewInverse[2].xyz;
|
||||
vec3 lpvCenter = vec3(0.0);//GetLpvCenter(cameraPosition, viewDir);
|
||||
vec3 blockLocalPos = imgCoord - lpvCenter + 0.5;
|
||||
//vec3 lpvCenter = vec3(0.0);//GetLpvCenter(cameraPosition, viewDir);
|
||||
//vec3 blockLocalPos = imgCoord - lpvCenter + 0.5;
|
||||
|
||||
vec4 lightValue = vec4(0.0);
|
||||
uint mixMask = 0xFFFF;
|
||||
@ -161,24 +161,22 @@ void main() {
|
||||
lightValue.rgb = RgbToHsv(lightValue.rgb);
|
||||
lightValue.ba = log2(lightValue.ba + 1.0) / LpvBlockSkyRange;
|
||||
|
||||
#if LIGHTING_MODE >= LIGHTING_MODE_FLOODFILL
|
||||
if (blockId > 0 && blockId != BLOCK_EMPTY) {
|
||||
vec3 lightColor = unpackUnorm4x8(blockData.LightColor).rgb;
|
||||
vec2 lightRangeSize = unpackUnorm4x8(blockData.LightRangeSize).xy;
|
||||
float lightRange = lightRangeSize.x * 255.0;
|
||||
if (blockId > 0 && blockId != BLOCK_EMPTY) {
|
||||
vec3 lightColor = unpackUnorm4x8(blockData.LightColor).rgb;
|
||||
vec2 lightRangeSize = unpackUnorm4x8(blockData.LightRangeSize).xy;
|
||||
float lightRange = lightRangeSize.x * 255.0;
|
||||
|
||||
lightColor = RGBToLinear(lightColor);
|
||||
lightColor = RGBToLinear(lightColor);
|
||||
|
||||
// #ifdef LIGHTING_FLICKER
|
||||
// vec2 lightNoise = GetDynLightNoise(cameraPosition + blockLocalPos);
|
||||
// ApplyLightFlicker(lightColor, lightType, lightNoise);
|
||||
// #endif
|
||||
// #ifdef LIGHTING_FLICKER
|
||||
// vec2 lightNoise = GetDynLightNoise(cameraPosition + blockLocalPos);
|
||||
// ApplyLightFlicker(lightColor, lightType, lightNoise);
|
||||
// #endif
|
||||
|
||||
if (lightRange > EPSILON) {
|
||||
lightValue.rgb = Lpv_RgbToHsv(lightColor, lightRange);
|
||||
}
|
||||
if (lightRange > EPSILON) {
|
||||
lightValue.rgb = Lpv_RgbToHsv(lightColor, lightRange);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (frameCounter % 2 == 0)
|
||||
imageStore(imgLpv1, imgCoord, lightValue);
|
||||
|
Loading…
Reference in New Issue
Block a user