nether/end shadow pass for voxel data, broken iris uniforms though

This commit is contained in:
NULL511 2024-05-05 16:07:28 -04:00
parent 1cdd018491
commit 7cd1cde2c3
7 changed files with 268 additions and 2 deletions

View File

@ -393,7 +393,7 @@ block.321=yellow_stained_glass yellow_stained_glass_pane
####### ----- LPV shapes ----- #######
block.401=chain ladder lever tripwire_hook candle:lit=false black_candle:lit=false blue_candle:lit=false brown_candle:lit=false cyan_candle:lit=false gray_candle:lit=false green_candle:lit=false light_blue_candle:lit=false light_gray_candle:lit=false lime_candle:lit=false magenta_candle:lit=false orange_candle:lit=false pink_candle:lit=false purple_candle:lit=false red_candle:lit=false white_candle:lit=false yellow_candle:lit=false acacia_button bamboo_button birch_button cherry_button crimson_button dark_oak_button jungle_button mangrove_button oak_button polished_blackstone_button spruce_button stone_button warped_button
block.401=chain ladder lever tripwire_hook snow:layers=1 candle:lit=false black_candle:lit=false blue_candle:lit=false brown_candle:lit=false cyan_candle:lit=false gray_candle:lit=false green_candle:lit=false light_blue_candle:lit=false light_gray_candle:lit=false lime_candle:lit=false magenta_candle:lit=false orange_candle:lit=false pink_candle:lit=false purple_candle:lit=false red_candle:lit=false white_candle:lit=false yellow_candle:lit=false acacia_button bamboo_button birch_button cherry_button crimson_button dark_oak_button jungle_button mangrove_button oak_button polished_blackstone_button spruce_button stone_button warped_button
block.402=black_carpet blue_carpet brown_carpet cyan_carpet gray_carpet green_carpet light_blue_carpet light_gray_carpet lime_carpet magenta_carpet moss_carpet orange_carpet pink_carpet purple_carpet red_carpet white_carpet yellow_carpet

View File

@ -19,7 +19,7 @@ iris.features.optional = ENTITY_TRANSLUCENT REVERSED_CULLING COMPUTE_SHADERS CUS
#endif
#ifdef LPV_ENABLED
# shadow.enabled = true
shadow.enabled = true
shadow.culling = reversed
voxelizeLightBlocks = true
#endif
@ -576,6 +576,9 @@ uniform.float.shadowMaxProj = 150.0/abs(sunPosY)
program.world0/setup.enabled = false
program.world-1/setup.enabled = false
program.world1/shadow.enabled = false
program.world-1/shadow.enabled = false
program.world1/shadowcomp.enabled = false
program.world0/shadowcomp.enabled = false
program.world-1/shadowcomp.enabled = false

View File

@ -578,6 +578,7 @@ block.*= vine
#= BLOCK_LPV_IGNORE
block.401= chain ladder lever tripwire_hook \
snow:layers=1 \
[candle]:lit=false \
acacia_button bamboo_button birch_button cherry_button crimson_button dark_oak_button jungle_button mangrove_button oak_button polished_blackstone_button spruce_button stone_button warped_button

View File

@ -0,0 +1,10 @@
#version 120
#include "/lib/settings.glsl"
//////////////////////////////VOID MAIN//////////////////////////////
void main() {
gl_FragData[0] = vec4(0.0);
}

121
shaders/world-1/shadow.vsh Normal file
View File

@ -0,0 +1,121 @@
#version 120
#extension GL_ARB_explicit_attrib_location: enable
#extension GL_ARB_shader_image_load_store: enable
#include "/lib/settings.glsl"
#define RENDER_SHADOW
/*
!! DO NOT REMOVE !!
This code is from Chocapic13' shaders
Read the terms of modification and sharing before changing something below please !
!! DO NOT REMOVE !!
*/
// #define SHADOW_MAP_BIAS 0.5
// const float PI = 3.1415927;
// varying vec2 texcoord;
// uniform mat4 shadowProjectionInverse;
// uniform mat4 shadowProjection;
uniform mat4 shadowModelViewInverse;
// uniform mat4 shadowModelView;
// uniform mat4 gbufferModelView;
// uniform mat4 gbufferModelViewInverse;
// uniform mat4 gbufferProjection;
// uniform mat4 gbufferProjectionInverse;
// uniform int hideGUI;
uniform vec3 cameraPosition;
// uniform float frameTimeCounter;
// uniform int frameCounter;
// uniform float screenBrightness;
// uniform vec3 sunVec;
// uniform float aspectRatio;
// uniform float sunElevation;
// uniform vec3 sunPosition;
// uniform float lightSign;
// uniform float cosFov;
// uniform vec3 shadowViewDir;
// uniform vec3 shadowCamera;
// uniform vec3 shadowLightVec;
// uniform float shadowMaxProj;
// attribute vec4 mc_midTexCoord;
// varying vec4 color;
#ifdef IS_LPV_ENABLED
attribute vec4 mc_Entity;
attribute vec3 at_midBlock;
uniform int renderStage;
uniform int currentRenderedItemId;
uniform int blockEntityId;
uniform int entityId;
// #include "/lib/Shadow_Params.glsl"
// #include "/lib/bokeh.glsl"
#include "/lib/blocks.glsl"
#include "/lib/entities.glsl"
#include "/lib/voxel_common.glsl"
#include "/lib/voxel_write.glsl"
#endif
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;
int blockId = int(mc_Entity.x + 0.5);
#if defined IS_LPV_ENABLED || defined WAVY_PLANTS
vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
#endif
if (
renderStage == MC_RENDER_STAGE_TERRAIN_SOLID || renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT ||
renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT || renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT_MIPPED
) {
uint voxelId = uint(blockId);
if (voxelId == 0u) voxelId = 1u;
vec3 originPos = playerpos + at_midBlock/64.0;
SetVoxelBlock(originPos, voxelId);
}
#ifdef LPV_ENTITY_LIGHTS
if (
(currentRenderedItemId > 0 || entityId > 0) &&
(renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES || renderStage == MC_RENDER_STAGE_ENTITIES)
) {
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)
voxelId = uint(currentRenderedItemId);
}
else {
switch (entityId) {
case ENTITY_SPECTRAL_ARROW:
voxelId = uint(BLOCK_TORCH);
break;
// TODO: blaze, magma_cube
}
}
if (voxelId > 0u)
SetVoxelBlock(playerpos, voxelId);
}
#endif
#endif
gl_Position = vec4(-1.0);
}

10
shaders/world1/shadow.fsh Normal file
View File

@ -0,0 +1,10 @@
#version 120
#include "/lib/settings.glsl"
//////////////////////////////VOID MAIN//////////////////////////////
void main() {
gl_FragData[0] = vec4(0.0);
}

121
shaders/world1/shadow.vsh Normal file
View File

@ -0,0 +1,121 @@
#version 120
#extension GL_ARB_explicit_attrib_location: enable
#extension GL_ARB_shader_image_load_store: enable
#include "/lib/settings.glsl"
#define RENDER_SHADOW
/*
!! DO NOT REMOVE !!
This code is from Chocapic13' shaders
Read the terms of modification and sharing before changing something below please !
!! DO NOT REMOVE !!
*/
// #define SHADOW_MAP_BIAS 0.5
// const float PI = 3.1415927;
// varying vec2 texcoord;
// uniform mat4 shadowProjectionInverse;
// uniform mat4 shadowProjection;
uniform mat4 shadowModelViewInverse;
// uniform mat4 shadowModelView;
// uniform mat4 gbufferModelView;
// uniform mat4 gbufferModelViewInverse;
// uniform mat4 gbufferProjection;
// uniform mat4 gbufferProjectionInverse;
// uniform int hideGUI;
uniform vec3 cameraPosition;
// uniform float frameTimeCounter;
// uniform int frameCounter;
// uniform float screenBrightness;
// uniform vec3 sunVec;
// uniform float aspectRatio;
// uniform float sunElevation;
// uniform vec3 sunPosition;
// uniform float lightSign;
// uniform float cosFov;
// uniform vec3 shadowViewDir;
// uniform vec3 shadowCamera;
// uniform vec3 shadowLightVec;
// uniform float shadowMaxProj;
// attribute vec4 mc_midTexCoord;
// varying vec4 color;
#ifdef IS_LPV_ENABLED
attribute vec4 mc_Entity;
attribute vec3 at_midBlock;
uniform int renderStage;
uniform int currentRenderedItemId;
uniform int blockEntityId;
uniform int entityId;
// #include "/lib/Shadow_Params.glsl"
// #include "/lib/bokeh.glsl"
#include "/lib/blocks.glsl"
#include "/lib/entities.glsl"
#include "/lib/voxel_common.glsl"
#include "/lib/voxel_write.glsl"
#endif
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;
int blockId = int(mc_Entity.x + 0.5);
#if defined IS_LPV_ENABLED || defined WAVY_PLANTS
vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
#endif
if (
renderStage == MC_RENDER_STAGE_TERRAIN_SOLID || renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT ||
renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT || renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT_MIPPED
) {
uint voxelId = uint(blockId);
if (voxelId == 0u) voxelId = 1u;
vec3 originPos = playerpos + at_midBlock/64.0;
SetVoxelBlock(originPos, voxelId);
}
#ifdef LPV_ENTITY_LIGHTS
if (
(currentRenderedItemId > 0 || entityId > 0) &&
(renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES || renderStage == MC_RENDER_STAGE_ENTITIES)
) {
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)
voxelId = uint(currentRenderedItemId);
}
else {
switch (entityId) {
case ENTITY_SPECTRAL_ARROW:
voxelId = uint(BLOCK_TORCH);
break;
// TODO: blaze, magma_cube
}
}
if (voxelId > 0u)
SetVoxelBlock(playerpos, voxelId);
}
#endif
#endif
gl_Position = vec4(-1.0);
}