diff --git a/shaders/lib/lpv_common.glsl b/shaders/lib/lpv_common.glsl new file mode 100644 index 0000000..f597b3b --- /dev/null +++ b/shaders/lib/lpv_common.glsl @@ -0,0 +1,11 @@ +const uint LpvSize = uint(exp2(LPV_SIZE)); + +layout(r16ui) uniform uimage3D imgVoxelMask; + +// #if defined RENDER_SHADOWCOMP || defined RENDER_GBUFFER +// layout(r16ui) uniform uimage2D imgVoxelMask; +// #elif defined RENDER_BEGIN || defined RENDER_GEOMETRY || defined RENDER_VERTEX +// layout(r16ui) uniform writeonly uimage2D imgVoxelMask; +// #else +// layout(r16ui) uniform readonly uimage2D imgVoxelMask; +// #endif diff --git a/shaders/lib/lpv_write.glsl b/shaders/lib/lpv_write.glsl new file mode 100644 index 0000000..3f48e83 --- /dev/null +++ b/shaders/lib/lpv_write.glsl @@ -0,0 +1,5 @@ +void SetVoxelBlock(const in vec3 playerPos, const in uint blockId) { + vec3 cameraOffset = fract(cameraPosition); + ivec3 voxelPos = ivec3(floor(playerPos + cameraOffset + LpvSize/2u)); + imageStore(imgVoxelMask, voxelPos, uvec4(blockId)); +} diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index da90382..b5cef8c 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -669,6 +669,18 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #define DH_KNOWN_ISSUES 0 // [0 1 2 3 4 5] +/////////////////////////////////////////// +// ----- DISTANT HORIZONS SETTINGS ----- // +/////////////////////////////////////////// + +#define LPV_ENABLED +#define LPV_SIZE 7 // [6 7 8] + +#if defined LPV_ENABLED && defined IRIS_FEATURE_CUSTOM_IMAGES + #define IS_LPV_ENABLED +#endif + + //////////////////////////////// // ----- DEBUG SETTINGS ----- // //////////////////////////////// diff --git a/shaders/shaders.properties b/shaders/shaders.properties index fa38741..a2d01b0 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -8,6 +8,8 @@ separateAo = true rain.depth = false beacon.beam.depth = true +iris.features.optional=ENTITY_TRANSLUCENT REVERSED_CULLING COMPUTE_SHADERS CUSTOM_IMAGES + #if RESOURCEPACK_SKY == 2 sun=true moon=true @@ -602,4 +604,25 @@ variable.float.shSunZ = (shadowModelView.0.2 * wSunX + shadowModelView.1.2 * wSu uniform.vec3.shadowLightVec = vec3(lightSign*shSunX, lightSign*shSunY, lightSign*shSunZ) -uniform.float.shadowMaxProj = 150.0/abs(sunPosY) \ No newline at end of file +uniform.float.shadowMaxProj = 150.0/abs(sunPosY) + + +############################### +####### FLOODFILL STUFF ####### +############################### + +#if defined LPV_ENABLED && defined IRIS_FEATURE_CUSTOM_IMAGES + #if LPV_SIZE == 8 + image.imgVoxelMask=none RED_INTEGER R16UI UNSIGNED_SHORT true false 256 256 256 + image.imgLpv1=none RGBA RGBA8 BYTE false false 256 256 256 + image.imgLpv2=none RGBA RGBA8 BYTE false false 256 256 256 + #elif LPV_SIZE == 7 + image.imgVoxelMask=none RED_INTEGER R16UI UNSIGNED_SHORT true false 128 128 128 + image.imgLpv1=none RGBA RGBA8 BYTE false false 128 128 128 + image.imgLpv2=none RGBA RGBA8 BYTE false false 128 128 128 + #elif LPV_SIZE == 6 + image.imgVoxelMask=none RED_INTEGER R16UI UNSIGNED_SHORT true false 64 64 64 + image.imgLpv1=none RGBA RGBA8 BYTE false false 64 64 64 + image.imgLpv2=none RGBA RGBA8 BYTE false false 64 64 64 + #endif +#endif diff --git a/shaders/world0/shadow.vsh b/shaders/world0/shadow.vsh index c8c26ef..5d04f81 100644 --- a/shaders/world0/shadow.vsh +++ b/shaders/world0/shadow.vsh @@ -1,5 +1,8 @@ #version 120 #include "/lib/settings.glsl" +#ifdef IS_LPV_ENABLED + #extension GL_EXT_shader_image_load_store: enable +#endif @@ -46,6 +49,11 @@ uniform int entityId; #include "/lib/Shadow_Params.glsl" #include "/lib/bokeh.glsl" +#ifdef IS_LPV_ENABLED + #include "/lib/lpv_common.glsl" + #include "/lib/lpv_write.glsl" +#endif + const float PI48 = 150.796447372*WAVY_SPEED; float pi2wt = PI48*frameTimeCounter; @@ -170,18 +178,26 @@ void main() { // } // #endif + uint blockId = uint(mc_Entity.x + 0.5); + + #if defined IS_LPV_ENABLED || defined WAVY_PLANTS + vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; + #endif + + #if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store + SetVoxelBlock(playerpos, blockId); + #endif + #ifdef WAVY_PLANTS bool istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t; - if ((mc_Entity.x == 10001 || mc_Entity.x == 10009 && istopv) && length(position.xy) < 24.0) { - vec3 worldpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; - worldpos.xyz += calcMovePlants(worldpos.xyz + cameraPosition)*gl_MultiTexCoord1.y; - position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz ; + if ((blockId == 10001u || blockId == 10009u && istopv) && length(position.xy) < 24.0) { + playerpos += calcMovePlants(playerpos + cameraPosition)*gl_MultiTexCoord1.y; + position = mat3(shadowModelView) * playerpos + shadowModelView[3].xyz; } - if (mc_Entity.x == 10003 && length(position.xy) < 24.0) { - vec3 worldpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; - worldpos.xyz += calcMoveLeaves(worldpos.xyz + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y; - position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz ; + if (blockId == 10003u && length(position.xy) < 24.0) { + playerpos += calcMoveLeaves(playerpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y; + position = mat3(shadowModelView) * playerpos + shadowModelView[3].xyz; } #endif @@ -193,13 +209,13 @@ void main() { - if(mc_Entity.x == 8 ) gl_Position.w = -1.0; + if (blockId == 8u) gl_Position.w = -1.0; // color.a = 1.0; - // if(mc_Entity.x != 10002) color.a = 0.0; + // if(blockId != 10002) color.a = 0.0; // materials = 0.0; - // if(mc_Entity.x == 8) materials = 1.0; + // if(blockId == 8) materials = 1.0; /// this is to ease the shadow acne on big fat entities like ghasts.