diff --git a/shaders/block.properties b/shaders/block.properties index 992493f..4d2aa86 100644 --- a/shaders/block.properties +++ b/shaders/block.properties @@ -1,51 +1,456 @@ +layer.translucent = minecraft:glass minecraft:glass_pane + +block.8=minecraft:water minecraft:flowing_water + +block.11=bamboo bamboo_sapling + +block.12=minecraft:short_grass minecraft:grass + +block.13=minecraft:tall_grass:half=lower + +block.14=minecraft:tall_grass:half=upper + +block.15=minecraft:oak_sapling minecraft:spruce_sapling minecraft:birch_sapling minecraft:jungle_sapling minecraft:acacia_sapling minecraft:dark_oak_sapling + +block.16=vine + + ####### ----- waving blocks with SSS ----- ####### - ##ground waving - # add a newline to organize for modded blocks - block.10001 = minecraft:sunflower:half=upper minecraft:beetroots minecraft:potatoes minecraft:carrots minecraft:wheat minecraft:nether_wart minecraft:kelp minecraft:large_fern:half=upper minecraft:peony:half=upper minecraft:rose_bush:half=upper minecraft:lilac:half=upper minecraft:crimson_roots minecraft:nether_sprouts minecraft:warped_roots minecraft:seagrass minecraft:tall_seagrass:half=upper minecraft:tall_grass:half=upper minecraft:wither_rose minecraft:lily_of_the_valley minecraft:cornflower minecraft:sweet_berry_bush minecraft:oxeye_daisy minecraft:pink_tulip minecraft:white_tulip minecraft:orange_tulip minecraft:red_tulip minecraft:azure_bluet minecraft:allium minecraft:blue_orchid minecraft:poppy minecraft:dandelion minecraft:dead_bush minecraft:oak_sapling minecraft:spruce_sapling minecraft:birch_sapling minecraft:jungle_sapling minecraft:acacia_sapling minecraft:dark_oak_sapling - - # ground waving vertical models. this exists to brighten up the sides of grass and stuff in shaded places they blend in better with the world. - block.10009 = minecraft:short_grass minecraft:grass minecraft:fern conquest:acacia_sapling conquest:alder_tree_sapling conquest:apple_tree_sapling conquest:aspen_tree_sapling conquest:birch_sapling conquest:cherry_tree_sapling conquest:dark_oak_sapling conquest:downy_willow_tree_sapling conquest:gorse_tree_sapling conquest:grape_vine_sapling conquest:horse_chestnut_tree_sapling conquest:jungle_sapling conquest:larch_tree_sapling conquest:mallorn_tree_sapling conquest:oak_sapling conquest:orange_tree_sapling conquest:pear_tree_sapling conquest:pine_tree_sapling conquest:plum_tree_sapling conquest:rowan_tree_sapling conquest:spruce_sapling conquest:willow_tree_sapling conquest:angelica conquest:black_knapweed conquest:buttercups conquest:cornflower conquest:dandelion conquest:elanor conquest:goldenrod conquest:harebell conquest:lily_of_the_valley conquest:lobelia_flowers conquest:marsh_ragwort conquest:meadow_saffron conquest:mediterranean_wild_tulip conquest:moorland_spotted_orchid conquest:niphredil conquest:orange_tulip conquest:orpine conquest:oxeye_daisy conquest:pasque_flower conquest:pink_tulip conquest:poppy conquest:red_tulip conquest:rock_rose conquest:sea_lavender conquest:simbelmyne conquest:white_clematis conquest:white_tulip conquest:wild_dagga conquest:allium conquest:barley conquest:bean_pole conquest:beetroots conquest:cabbage conquest:carrots conquest:common_beans conquest:corn conquest:flax conquest:heirloom_wheat_crops conquest:hemp conquest:lavender conquest:peas conquest:potatoes conquest:rice conquest:thyme conquest:tobacco conquest:turnips conquest:water_mint conquest:wheat conquest:wild_basil conquest:wild_parsley conquest:wild_wheat conquest:common_meadow_grass conquest:cotton_grass conquest:dead_grass conquest:deergrass conquest:grass conquest:kentucky_bluegrass conquest:lush_grass conquest:purple_moor_grass conquest:sea_arrowgrass conquest:seagrass conquest:sweet_grass conquest:timothy_grass conquest:wavy_hair_grass conquest:pine_cones conquest:spruce_cones conquest:beautyberry_bush conquest:bilberry_bush conquest:blackberry_bush conquest:bog_blueberry_bush conquest:broom_bush conquest:dead_bush conquest:hawthorn_bush conquest:lingonberry_bush conquest:raspberry_bush conquest:alpine_sow_thristle conquest:athelas conquest:autumnal_dwarf_birch conquest:birdsfoot_trefoil conquest:bog_asphodel conquest:bottle_sedge conquest:cattails conquest:common_cow_wheat conquest:cow_parsley conquest:cross leaved heath conquest:dead_reeds conquest:dead_shrubs conquest:desert_shrub conquest:dogs_mercury conquest:dooryard_dock conquest:dry_reeds conquest:greater_fen_sedge conquest:greater_wood_rush conquest:green_meadow_fescue conquest:green_spurge conquest:heather conquest:meadow_fescue conquest:melancholy_thristle conquest:nettles conquest:nightshade conquest:papyrus conquest:purple_wolfs_bane conquest:red_common_cow_wheat conquest:rosebay_willowherb conquest:rushes conquest:wild_shrub conquest:sedge conquest:small_fescue conquest:small_scabious conquest:sweet_woodruff conquest:wild_overgrown_nettles conquest:wild_shrub conquest:wood_horsetail conquest:woodland_sedge conquest:wormwood conquest:yellow_wolfs_bane conquest:autumnal_bracken conquest:bracken conquest:dark_autumnal_bracken conquest:dead_bracken conquest:fern conquest:fern_1 conquest:fern_2 conquest:harts_tongue_fern conquest:large_fern_1 conquest:large_fern_2 conquest:large_fern_3 conquest:thick_fern conquest:tall_grass conquest:large_fern conquest:sunflower conquest:tall_lilac conquest:peony conquest:rose_bush conquest:tall_seagrass conquest:cypress conquest:young_tree conquest:young_frozen_tree conquest:cross_leaved_heath conquest:jungle_ground_cover conquest:alpine_sow_thistle conquest:duckweed conquest:red_mushroom conquest:brown_mushroom - - ##air waving - # add a newline to organize for modded blocks - block.10003 = minecraft:azalea_leaves minecraft:flowering_azalea_leaves minecraft:cherry_leaves minecraft:mangrove_leaves minecraft:vine minecraft:oak_leaves minecraft:spruce_leaves minecraft:birch_leaves minecraft:jungle_leaves minecraft:acacia_leaves minecraft:dark_oak_leaves westerosblocks:vine_jasmine westerosblocks:apple_fruit_leaves westerosblocks:apricot_fruit_leaves westerosblocks:cherry_fruit_leaves westerosblocks:purple_grape_fruit_leaves westerosblocks:lemon_fruit_leaves westerosblocks:lime_fruit_leaves westerosblocks:orange_fruit_leaves westerosblocks:peach_fruit_leaves westerosblocks:plum_fruit_leaves westerosblocks:pomegranate_fruit_leaves westerosblocks:weirwood_leaves westerosblocks:hop_fruit_leaves westerosblocks:olive_fruit_leaves westerosblocks:palm_leaves westerosblocks:white_grape_fruit_leaves conquest:apple_tree_leaves conquest:ash_tree_leaves conquest:aspen_leaves conquest:autumnal_aspen_leaves conquest:dark_deciduous_leaves conquest:autumnal_beech_tree_leaves conquest:autumnal_birch_leaves conquest:autumnal_horse_chestnut_leaves conquest:autumnal_maple_leaves conquest:autumnal_oak_leaves conquest:autumnal_weeping_willow_leaves conquest:banana_tree_leaves conquest:beech_tree_leaves conquest:bright_autumnal_beech_tree_leaves conquest:bright_autumnal_weeping_willow_leaves conquest:bushy_joshua_tree_leaves conquest:caribbean_royal_palm_leaves conquest:caribbean_royal_palm_leaves_corner conquest:cherry_tree_leaves conquest:dark_beech_tree_leaves conquest:date_palm_leaves conquest:diseased_horse_chestnut_leaves conquest:downy_willow_leaves conquest:downy_willow_leaves_tip conquest:faded_autumnal_beech_tree_leaves conquest:dead_norway_spruce_needles conquest:orange_larch_leaf_top conquest:yellow_larch_leaf_top conquest:larch_leaf_top conquest:larch_spruce_leaf_top conquest:larch_leaf_slab conquest:larch_leaf_long_branch conquest:larch_leaf_branch conquest:larch_spruce_leaf_top conquest:yellow_larch_spruce_leaf_top conquest:yellow_larch_leaf_slab conquest:yellow_larch_leaf_long_branch conquest:yellow_larch_leaf_branch conquest:orange_larch_spruce_leaf_top conquest:orange_larch_leaf_slab conquest:oranch_larch_leaf_long_branch conquest:orange_larch_leaf_branch conquest:dead_spruce_leaf_top conquest:dead_spruce_leaf_slab conquest:dead_spruce_leaf_long_branch conquest:dead_spruce_leaf_branch conquest:light_spruce_leaf_top conquest:light_spruce_leaf_slab conquest:light_spruce_leaf_long_branch conquest:light_spruce_leaf_branch conquest:goat_willow_leaves conquest:gorse_leaves conquest:grape_vine_leaves conquest:holly_leaves conquest:horse_chestnut_leaves conquest:joshua_tree_leaves conquest:lemon_tree_leaves conquest:old_caribbean_royal_palm_leaves conquest:old_caribbean_royal_palm_leaves_corner conquest:olive_tree_leaves conquest:orange_tree_leaves conquest:pear_tree_leaves conquest:plum_tree_leaves conquest:rowan_leaves conquest:weeping_willow_leaves conquest:wisteria_leaves conquest:yellow_autumnal_weeping_willow_leaves conquest:dark_spruce_needles conquest:dead_pine_needles conquest:dead_spruce_needles conquest:larch_needles conquest:light_spruce_needles conquest:orange_autumnal_larch_needles conquest:pine_needles conquest:yellow_autumnal_larch_needles conquest:dead_deciduous_branches conquest:mistletoe_garland conquest:lilac conquest:pink_cherry_blossoms conquest:purple_cherry_blossoms conquest:red_cherry_blossoms conquest:white_cherry_blossoms conquest:wisteria_blossoms conquest:hanging_moss conquest:lianas conquest:moss_vines conquest:spruce_leaf_top conquest:spruce_leaf_branch conquest:spruce_leaf_slab conquest:spruce_leaf_long_branch conquest:thick_hanging_ivy conquest:thick_ivy conquest:hanging_roots conquest:acacia_branch_tip conquest:acacia_branch_tip_45 conquest:acacia_branch_tip_2 conquest:acacia_branch_tip_2_45 conquest:beech_branch_tip conquest:beech_branch_tip_45 conquest:beech_branch_tip_2 conquest:beech _branch_tip_2_45 conquest:birch_branch_tip conquest:birch_branch_tip_45 conquest:birch_branch_tip_2 conquest:birch_branch_tip_2_45 conquest:oak_branch_tip conquest:oak_branch_tip_45 conquest:oak_branch_tip_2 conquest:oak_branch_tip_2_45 conquest:spruce_branch_tip conquest:spruce_branch_tip_45 conquest:spruce_branch_tip_2 conquest:spruce_branch_tip_2_45 conquest:orange_pine_branch_tip conquest:orange_pine_branch_tip_45 conquest:orange_pine_branch_tip_2 conquest:orange_pine_branch_tip_2_45 + +## ground waving +## add a newline to organize for modded blocks +block.60=minecraft:sunflower:half=upper minecraft:beetroots minecraft:potatoes minecraft:carrots minecraft:wheat minecraft:nether_wart minecraft:kelp minecraft:large_fern:half=upper minecraft:peony:half=upper minecraft:rose_bush:half=upper minecraft:lilac:half=upper minecraft:crimson_roots minecraft:nether_sprouts minecraft:warped_roots minecraft:seagrass minecraft:tall_seagrass:half=upper minecraft:wither_rose minecraft:lily_of_the_valley minecraft:cornflower minecraft:sweet_berry_bush minecraft:oxeye_daisy minecraft:pink_tulip minecraft:white_tulip minecraft:orange_tulip minecraft:red_tulip minecraft:azure_bluet minecraft:allium minecraft:blue_orchid minecraft:poppy minecraft:dandelion minecraft:dead_bush +# removed: sapling(s) + +## ground waving vertical models. this exists to brighten up the sides of grass and stuff in shaded places they blend in better with the world. +block.61=minecraft:fern conquest:acacia_sapling conquest:alder_tree_sapling conquest:apple_tree_sapling conquest:aspen_tree_sapling conquest:birch_sapling conquest:cherry_tree_sapling conquest:dark_oak_sapling conquest:downy_willow_tree_sapling conquest:gorse_tree_sapling conquest:grape_vine_sapling conquest:horse_chestnut_tree_sapling conquest:jungle_sapling conquest:larch_tree_sapling conquest:mallorn_tree_sapling conquest:oak_sapling conquest:orange_tree_sapling conquest:pear_tree_sapling conquest:pine_tree_sapling conquest:plum_tree_sapling conquest:rowan_tree_sapling conquest:spruce_sapling conquest:willow_tree_sapling conquest:angelica conquest:black_knapweed conquest:buttercups conquest:cornflower conquest:dandelion conquest:elanor conquest:goldenrod conquest:harebell conquest:lily_of_the_valley conquest:lobelia_flowers conquest:marsh_ragwort conquest:meadow_saffron conquest:mediterranean_wild_tulip conquest:moorland_spotted_orchid conquest:niphredil conquest:orange_tulip conquest:orpine conquest:oxeye_daisy conquest:pasque_flower conquest:pink_tulip conquest:poppy conquest:red_tulip conquest:rock_rose conquest:sea_lavender conquest:simbelmyne conquest:white_clematis conquest:white_tulip conquest:wild_dagga conquest:allium conquest:barley conquest:bean_pole conquest:beetroots conquest:cabbage conquest:carrots conquest:common_beans conquest:corn conquest:flax conquest:heirloom_wheat_crops conquest:hemp conquest:lavender conquest:peas conquest:potatoes conquest:rice conquest:thyme conquest:tobacco conquest:turnips conquest:water_mint conquest:wheat conquest:wild_basil conquest:wild_parsley conquest:wild_wheat conquest:common_meadow_grass conquest:cotton_grass conquest:dead_grass conquest:deergrass conquest:grass conquest:kentucky_bluegrass conquest:lush_grass conquest:purple_moor_grass conquest:sea_arrowgrass conquest:seagrass conquest:sweet_grass conquest:timothy_grass conquest:wavy_hair_grass conquest:pine_cones conquest:spruce_cones conquest:beautyberry_bush conquest:bilberry_bush conquest:blackberry_bush conquest:bog_blueberry_bush conquest:broom_bush conquest:dead_bush conquest:hawthorn_bush conquest:lingonberry_bush conquest:raspberry_bush conquest:alpine_sow_thristle conquest:athelas conquest:autumnal_dwarf_birch conquest:birdsfoot_trefoil conquest:bog_asphodel conquest:bottle_sedge conquest:cattails conquest:common_cow_wheat conquest:cow_parsley conquest:cross leaved heath conquest:dead_reeds conquest:dead_shrubs conquest:desert_shrub conquest:dogs_mercury conquest:dooryard_dock conquest:dry_reeds conquest:greater_fen_sedge conquest:greater_wood_rush conquest:green_meadow_fescue conquest:green_spurge conquest:heather conquest:meadow_fescue conquest:melancholy_thristle conquest:nettles conquest:nightshade conquest:papyrus conquest:purple_wolfs_bane conquest:red_common_cow_wheat conquest:rosebay_willowherb conquest:rushes conquest:wild_shrub conquest:sedge conquest:small_fescue conquest:small_scabious conquest:sweet_woodruff conquest:wild_overgrown_nettles conquest:wild_shrub conquest:wood_horsetail conquest:woodland_sedge conquest:wormwood conquest:yellow_wolfs_bane conquest:autumnal_bracken conquest:bracken conquest:dark_autumnal_bracken conquest:dead_bracken conquest:fern conquest:fern_1 conquest:fern_2 conquest:harts_tongue_fern conquest:large_fern_1 conquest:large_fern_2 conquest:large_fern_3 conquest:thick_fern conquest:tall_grass conquest:large_fern conquest:sunflower conquest:tall_lilac conquest:peony conquest:rose_bush conquest:tall_seagrass conquest:cypress conquest:young_tree conquest:young_frozen_tree conquest:cross_leaved_heath conquest:jungle_ground_cover conquest:alpine_sow_thistle conquest:duckweed conquest:red_mushroom conquest:brown_mushroom + +## air waving +## add a newline to organize for modded blocks +block.62=minecraft:azalea_leaves minecraft:flowering_azalea_leaves minecraft:cherry_leaves minecraft:mangrove_leaves minecraft:vine minecraft:oak_leaves minecraft:spruce_leaves minecraft:birch_leaves minecraft:jungle_leaves minecraft:acacia_leaves minecraft:dark_oak_leaves westerosblocks:vine_jasmine westerosblocks:apple_fruit_leaves westerosblocks:apricot_fruit_leaves westerosblocks:cherry_fruit_leaves westerosblocks:purple_grape_fruit_leaves westerosblocks:lemon_fruit_leaves westerosblocks:lime_fruit_leaves westerosblocks:orange_fruit_leaves westerosblocks:peach_fruit_leaves westerosblocks:plum_fruit_leaves westerosblocks:pomegranate_fruit_leaves westerosblocks:weirwood_leaves westerosblocks:hop_fruit_leaves westerosblocks:olive_fruit_leaves westerosblocks:palm_leaves westerosblocks:white_grape_fruit_leaves conquest:apple_tree_leaves conquest:ash_tree_leaves conquest:aspen_leaves conquest:autumnal_aspen_leaves conquest:dark_deciduous_leaves conquest:autumnal_beech_tree_leaves conquest:autumnal_birch_leaves conquest:autumnal_horse_chestnut_leaves conquest:autumnal_maple_leaves conquest:autumnal_oak_leaves conquest:autumnal_weeping_willow_leaves conquest:banana_tree_leaves conquest:beech_tree_leaves conquest:bright_autumnal_beech_tree_leaves conquest:bright_autumnal_weeping_willow_leaves conquest:bushy_joshua_tree_leaves conquest:caribbean_royal_palm_leaves conquest:caribbean_royal_palm_leaves_corner conquest:cherry_tree_leaves conquest:dark_beech_tree_leaves conquest:date_palm_leaves conquest:diseased_horse_chestnut_leaves conquest:downy_willow_leaves conquest:downy_willow_leaves_tip conquest:faded_autumnal_beech_tree_leaves conquest:dead_norway_spruce_needles conquest:orange_larch_leaf_top conquest:yellow_larch_leaf_top conquest:larch_leaf_top conquest:larch_spruce_leaf_top conquest:larch_leaf_slab conquest:larch_leaf_long_branch conquest:larch_leaf_branch conquest:larch_spruce_leaf_top conquest:yellow_larch_spruce_leaf_top conquest:yellow_larch_leaf_slab conquest:yellow_larch_leaf_long_branch conquest:yellow_larch_leaf_branch conquest:orange_larch_spruce_leaf_top conquest:orange_larch_leaf_slab conquest:oranch_larch_leaf_long_branch conquest:orange_larch_leaf_branch conquest:dead_spruce_leaf_top conquest:dead_spruce_leaf_slab conquest:dead_spruce_leaf_long_branch conquest:dead_spruce_leaf_branch conquest:light_spruce_leaf_top conquest:light_spruce_leaf_slab conquest:light_spruce_leaf_long_branch conquest:light_spruce_leaf_branch conquest:goat_willow_leaves conquest:gorse_leaves conquest:grape_vine_leaves conquest:holly_leaves conquest:horse_chestnut_leaves conquest:joshua_tree_leaves conquest:lemon_tree_leaves conquest:old_caribbean_royal_palm_leaves conquest:old_caribbean_royal_palm_leaves_corner conquest:olive_tree_leaves conquest:orange_tree_leaves conquest:pear_tree_leaves conquest:plum_tree_leaves conquest:rowan_leaves conquest:weeping_willow_leaves conquest:wisteria_leaves conquest:yellow_autumnal_weeping_willow_leaves conquest:dark_spruce_needles conquest:dead_pine_needles conquest:dead_spruce_needles conquest:larch_needles conquest:light_spruce_needles conquest:orange_autumnal_larch_needles conquest:pine_needles conquest:yellow_autumnal_larch_needles conquest:dead_deciduous_branches conquest:mistletoe_garland conquest:lilac conquest:pink_cherry_blossoms conquest:purple_cherry_blossoms conquest:red_cherry_blossoms conquest:white_cherry_blossoms conquest:wisteria_blossoms conquest:hanging_moss conquest:lianas conquest:moss_vines conquest:spruce_leaf_top conquest:spruce_leaf_branch conquest:spruce_leaf_slab conquest:spruce_leaf_long_branch conquest:thick_hanging_ivy conquest:thick_ivy conquest:hanging_roots conquest:acacia_branch_tip conquest:acacia_branch_tip_45 conquest:acacia_branch_tip_2 conquest:acacia_branch_tip_2_45 conquest:beech_branch_tip conquest:beech_branch_tip_45 conquest:beech_branch_tip_2 conquest:beech _branch_tip_2_45 conquest:birch_branch_tip conquest:birch_branch_tip_45 conquest:birch_branch_tip_2 conquest:birch_branch_tip_2_45 conquest:oak_branch_tip conquest:oak_branch_tip_45 conquest:oak_branch_tip_2 conquest:oak_branch_tip_2_45 conquest:spruce_branch_tip conquest:spruce_branch_tip_45 conquest:spruce_branch_tip_2 conquest:spruce_branch_tip_2_45 conquest:orange_pine_branch_tip conquest:orange_pine_branch_tip_45 conquest:orange_pine_branch_tip_2 conquest:orange_pine_branch_tip_2_45 + ####### ----- blocks with SSS ----- ####### - ## strong sss - block.10004 = minecraft:flowering_azalea minecraft:tall_seagrass minecraft:seagrass minecraft:kelp minecraft:large_fern:half=lower minecraft:tall_grass minecraft:tall_seagrass minecraft:kelp_plant minecraft:peony minecraft:rose_bush minecraft:lilac minecraft:sunflower:half=lower minecraft:packed_ice minecraft:blue_ice minecraft:melon_stem minecraft:pumpkin_stem minecraft:attached_melon_stem minecraft:attached_pumpkin_stem minecraft:lily_pad westerosblocks:blackberry_bush westerosblocks:blueberry_bush westerosblocks:raspberry_bush westerosblocks:juniper_bush westerosblocks:red_rose_bush westerosblocks:pink_rose_bush westerosblocks:white_rose_bush westerosblocks:yellow_rose_bush westerosblocks:yellow_wildflowers westerosblocks:green_spiny_herb westerosblocks:green_leafy_herb westerosblocks:orange_marigolds westerosblocks:orange_trollius westerosblocks:blue_forgetmenots westerosblocks:pink_wildflowers westerosblocks:yellow_tansy westerosblocks:blue_flax westerosblocks:white_daisies westerosblocks:yellow_daisies westerosblocks:green_scrub_grass westerosblocks:dead_scrub_grass westerosblocks:yellow_bedstraw westerosblocks:orange_bells westerosblocks:blue_bells westerosblocks:blue_swamp_bells westerosblocks:yellow_buttercups westerosblocks:orange_bog_asphodel westerosblocks:yellow_lupine westerosblocks:blue_hyacinth westerosblocks:pink_thistle westerosblocks:yellow_dandelions westerosblocks:yellow_daffodils westerosblocks:yellow_roses westerosblocks:strawberry_bush westerosblocks:white_lilyofthevalley westerosblocks:yellow_bells westerosblocks:yellow_sunflower westerosblocks:white_roses westerosblocks:red_dark_roses westerosblocks:yellow_hellebore westerosblocks:meadow_fescue westerosblocks:red_poppies westerosblocks:red_roses westerosblocks:purple_pansies westerosblocks:purple_roses westerosblocks:orange_sun_star westerosblocks:pink_primrose westerosblocks:red_aster westerosblocks:blue_chicory westerosblocks:red_flowering_spiny_herb westerosblocks:purple_foxglove westerosblocks:pink_allium westerosblocks:purple_violets westerosblocks:white_chamomile westerosblocks:red_tulips westerosblocks:white_peony westerosblocks:purple_alpine_sowthistle westerosblocks:red_carnations westerosblocks:magenta_roses westerosblocks:red_chrysanthemum westerosblocks:blue_orchid westerosblocks:yellow_rudbeckia westerosblocks:pink_tulips westerosblocks:cranberry_bush westerosblocks:purple_lavender westerosblocks:red_sourleaf_bush westerosblocks:pink_sweet_peas westerosblocks:red_sorrel westerosblocks:pink_roses westerosblocks:unshaded_grass westerosblocks:cow_parsely westerosblocks:bracken westerosblocks:lady_fern westerosblocks:nettle westerosblocks:dead_bracken westerosblocks:fireweed westerosblocks:heather westerosblocks:red_fern westerosblocks:dock_leaf westerosblocks:jasmine_vines westerosblocks:dappled_moss westerosblocks:cushion_moss_wall westerosblocks:hemp_short westerosblocks:hemp_tall westerosblocks:hemp_dense westerosblocks:crop_carrots westerosblocks:crop_wheat westerosblocks:crop_turnips westerosblocks:crop_peas westerosblocks:cattails westerosblocks:jungle_tall_fern westerosblocks:jungle_tall_grass westerosblocks:savanna_tall_grass \ - - ## weak sss - block.10006 = minecraft:amethyst_block minecraft:budding_amethyst minecraft:small_amethyst_bud minecraft:medium_amethyst_bud minecraft:large_amethyst_bud minecraft:amethyst_cluster minecraft:pitcher_plant minecraft:small_dripleaf minecraft:grass_block:snowy=true minecraft:snow_block minecraft:snow powder_snow cobweb red_mushroom_block brown_mushroom_block weeping_vines weeping_vines_plant twisting_vines twisting_vines_plant vine tube_coral tube_coral_block tube_coral_fan tube_coral_wall_fan horn_coral horn_coral_block horn_coral_fan horn_coral_wall_fan fire_coral fire_coral_block fire_coral_fan fire_coral_wall_fan dead_brain_coral dead_brain_coral_block dead_brain_coral_fan dead_brain_coral_wall_fan dead_bubble_coral dead_bubble_coral_block dead_bubble_coral_fan dead_bubble_coral_wall_fan dead_bush dead_fire_coral dead_fire_coral_block dead_fire_coral_fan dead_fire_coral_wall_fan dead_horn_coral dead_horn_coral_block dead_horn_coral_fan dead_horn_coral_wall_fan dead_tube_coral dead_tube_coral_block dead_tube_coral_fan dead_tube_coral_wall_fan bubble_coral bubble_coral_block bubble_coral_fan bubble_coral_wall_fan brain_coral brain_coral_block brain_coral_fan brain_coral_wall_fan bamboo bamboo_sapling minecraft:spore_blossom minecraft:cave_vines minecraft:cave_vines_plant minecraft:glow_lichen minecraft:melon minecraft:pumpkin minecraft:big_dripleaf minecraft:big_dripleaf_stem minecraft:cactus minecraft:hay_block minecraft:brown_mushroom minecraft:mushroom_stem minecraft:sugar_cane minecraft:crimson_fungus minecraft:warped_fungus minecraft:sea_pickle minecraft:honeycomb_block - ## weak sss - 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 westerosblocks:clothesline westerosblocks:smoke westerosblocks:brown_mushroom_1 westerosblocks:brown_mushroom_2 westerosblocks:brown_mushroom_3 westerosblocks:brown_mushroom_4 westerosblocks:brown_mushroom_5 westerosblocks:brown_mushroom_6 westerosblocks:brown_mushroom_7 westerosblocks:brown_mushroom_8 westerosblocks:brown_mushroom_9 westerosblocks:brown_mushroom_10 westerosblocks:brown_mushroom_11 westerosblocks:brown_mushroom_12 westerosblocks:brown_mushroom_13 westerosblocks:red_mushroom_1 westerosblocks:red_mushroom_2 westerosblocks:red_mushroom_3 westerosblocks:red_mushroom_4 westerosblocks:red_mushroom_5 westerosblocks:red_mushroom_6 westerosblocks:red_mushroom_7 westerosblocks:red_mushroom_8 westerosblocks:red_mushroom_9 westerosblocks:white_wool_slab westerosblocks:orange_wool_slab westerosblocks:light_brown_wool_slab westerosblocks:light_blue_wool_slab westerosblocks:yellow_wool_slab westerosblocks:dirty_white_wool_slab westerosblocks:pink_wool_slab westerosblocks:grey_wool_slab westerosblocks:light_grey_wool_slab westerosblocks:cyan_wool_slab westerosblocks:purple_wool_slab westerosblocks:blue_wool_slab westerosblocks:brown_wool_slab westerosblocks:green_wool_slab westerosblocks:red_wool_slab westerosblocks:black_wool_slab westerosblocks:white_wool_carpet westerosblocks:orange_wool_carpet westerosblocks:light_brown_wool_carpet westerosblocks:light_blue_wool_carpet westerosblocks:yellow_wool_carpet westerosblocks:dirty_white_wool_carpet westerosblocks:pink_wool_carpet westerosblocks:grey_wool_carpet westerosblocks:light_grey_wool_carpet westerosblocks:cyan_wool_carpet westerosblocks:purple_wool_carpet westerosblocks:blue_wool_carpet westerosblocks:brown_wool_carpet westerosblocks:green_wool_carpet westerosblocks:red_wool_carpet westerosblocks:black_wool_carpet westerosblocks:thatch_light_fur_carpet westerosblocks:thatch_dark_fur_carpet - - ## weak sss - 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 westerosblocks:renly_banner westerosblocks:redwyne_banner westerosblocks:grafton_banner westerosblocks:grey_banner westerosblocks:red_banner westerosblocks:black_banner westerosblocks:the_faith_of_the_seven_banner westerosblocks:cream_banner westerosblocks:blue_banner westerosblocks:brown_banner westerosblocks:cyan_banner westerosblocks:green_banner westerosblocks:orange_banner westerosblocks:pink_banner westerosblocks:purple_banner westerosblocks:lord_of_light_rhllor_banner westerosblocks:yellow_banner westerosblocks:arryn_banner westerosblocks:baratheon_banner westerosblocks:bolton_banner westerosblocks:dayne_banner westerosblocks:frey_banner westerosblocks:greyjoy_banner westerosblocks:hightower_banner westerosblocks:lannister_banner westerosblocks:manderly_banner westerosblocks:martell_banner westerosblocks:stannis_banner westerosblocks:stark_banner westerosblocks:targaryen_banner westerosblocks:tarly_banner westerosblocks:tully_banner westerosblocks:tyrell_banner - - ## weird blocks - block.10007 = minecraft:sand minecraft:red_sand - - ## grass uwu - block.10008 = minecraft:grass_block:snowy=false - +## strong sss +block.80=minecraft:flowering_azalea minecraft:tall_seagrass minecraft:seagrass minecraft:kelp minecraft:large_fern:half=lower minecraft:tall_seagrass minecraft:kelp_plant minecraft:peony minecraft:rose_bush minecraft:lilac minecraft:sunflower:half=lower minecraft:packed_ice minecraft:blue_ice minecraft:melon_stem minecraft:pumpkin_stem minecraft:attached_melon_stem minecraft:attached_pumpkin_stem minecraft:lily_pad westerosblocks:blackberry_bush westerosblocks:blueberry_bush westerosblocks:raspberry_bush westerosblocks:juniper_bush westerosblocks:red_rose_bush westerosblocks:pink_rose_bush westerosblocks:white_rose_bush westerosblocks:yellow_rose_bush westerosblocks:yellow_wildflowers westerosblocks:green_spiny_herb westerosblocks:green_leafy_herb westerosblocks:orange_marigolds westerosblocks:orange_trollius westerosblocks:blue_forgetmenots westerosblocks:pink_wildflowers westerosblocks:yellow_tansy westerosblocks:blue_flax westerosblocks:white_daisies westerosblocks:yellow_daisies westerosblocks:green_scrub_grass westerosblocks:dead_scrub_grass westerosblocks:yellow_bedstraw westerosblocks:orange_bells westerosblocks:blue_bells westerosblocks:blue_swamp_bells westerosblocks:yellow_buttercups westerosblocks:orange_bog_asphodel westerosblocks:yellow_lupine westerosblocks:blue_hyacinth westerosblocks:pink_thistle westerosblocks:yellow_dandelions westerosblocks:yellow_daffodils westerosblocks:yellow_roses westerosblocks:strawberry_bush westerosblocks:white_lilyofthevalley westerosblocks:yellow_bells westerosblocks:yellow_sunflower westerosblocks:white_roses westerosblocks:red_dark_roses westerosblocks:yellow_hellebore westerosblocks:meadow_fescue westerosblocks:red_poppies westerosblocks:red_roses westerosblocks:purple_pansies westerosblocks:purple_roses westerosblocks:orange_sun_star westerosblocks:pink_primrose westerosblocks:red_aster westerosblocks:blue_chicory westerosblocks:red_flowering_spiny_herb westerosblocks:purple_foxglove westerosblocks:pink_allium westerosblocks:purple_violets westerosblocks:white_chamomile westerosblocks:red_tulips westerosblocks:white_peony westerosblocks:purple_alpine_sowthistle westerosblocks:red_carnations westerosblocks:magenta_roses westerosblocks:red_chrysanthemum westerosblocks:blue_orchid westerosblocks:yellow_rudbeckia westerosblocks:pink_tulips westerosblocks:cranberry_bush westerosblocks:purple_lavender westerosblocks:red_sourleaf_bush westerosblocks:pink_sweet_peas westerosblocks:red_sorrel westerosblocks:pink_roses westerosblocks:unshaded_grass westerosblocks:cow_parsely westerosblocks:bracken westerosblocks:lady_fern westerosblocks:nettle westerosblocks:dead_bracken westerosblocks:fireweed westerosblocks:heather westerosblocks:red_fern westerosblocks:dock_leaf westerosblocks:jasmine_vines westerosblocks:dappled_moss westerosblocks:cushion_moss_wall westerosblocks:hemp_short westerosblocks:hemp_tall westerosblocks:hemp_dense westerosblocks:crop_carrots westerosblocks:crop_wheat westerosblocks:crop_turnips westerosblocks:crop_peas westerosblocks:cattails westerosblocks:jungle_tall_fern westerosblocks:jungle_tall_grass westerosblocks:savanna_tall_grass + +## weak sss +block.81=minecraft:amethyst_block minecraft:budding_amethyst minecraft:small_amethyst_bud minecraft:pitcher_plant minecraft:small_dripleaf minecraft:grass_block:snowy=true minecraft:snow_block minecraft:snow powder_snow cobweb red_mushroom_block brown_mushroom_block weeping_vines weeping_vines_plant twisting_vines twisting_vines_plant tube_coral tube_coral_block tube_coral_fan tube_coral_wall_fan horn_coral horn_coral_block horn_coral_fan horn_coral_wall_fan fire_coral fire_coral_block fire_coral_fan fire_coral_wall_fan dead_brain_coral dead_brain_coral_block dead_brain_coral_fan dead_brain_coral_wall_fan dead_bubble_coral dead_bubble_coral_block dead_bubble_coral_fan dead_bubble_coral_wall_fan dead_bush dead_fire_coral dead_fire_coral_block dead_fire_coral_fan dead_fire_coral_wall_fan dead_horn_coral dead_horn_coral_block dead_horn_coral_fan dead_horn_coral_wall_fan dead_tube_coral dead_tube_coral_block dead_tube_coral_fan dead_tube_coral_wall_fan bubble_coral bubble_coral_block bubble_coral_fan bubble_coral_wall_fan brain_coral brain_coral_block brain_coral_fan brain_coral_wall_fan minecraft:spore_blossom minecraft:cave_vines:berries=false minecraft:cave_vines_plant:berries=false minecraft:glow_lichen minecraft:melon minecraft:pumpkin minecraft:big_dripleaf minecraft:big_dripleaf_stem minecraft:cactus minecraft:hay_block minecraft:brown_mushroom minecraft:mushroom_stem minecraft:sugar_cane minecraft:crimson_fungus minecraft:warped_fungus minecraft:sea_pickle:waterlogged=false minecraft:honeycomb_block + +## weak sss +block.82=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 westerosblocks:clothesline westerosblocks:smoke westerosblocks:brown_mushroom_1 westerosblocks:brown_mushroom_2 westerosblocks:brown_mushroom_3 westerosblocks:brown_mushroom_4 westerosblocks:brown_mushroom_5 westerosblocks:brown_mushroom_6 westerosblocks:brown_mushroom_7 westerosblocks:brown_mushroom_8 westerosblocks:brown_mushroom_9 westerosblocks:brown_mushroom_10 westerosblocks:brown_mushroom_11 westerosblocks:brown_mushroom_12 westerosblocks:brown_mushroom_13 westerosblocks:red_mushroom_1 westerosblocks:red_mushroom_2 westerosblocks:red_mushroom_3 westerosblocks:red_mushroom_4 westerosblocks:red_mushroom_5 westerosblocks:red_mushroom_6 westerosblocks:red_mushroom_7 westerosblocks:red_mushroom_8 westerosblocks:red_mushroom_9 westerosblocks:white_wool_slab westerosblocks:orange_wool_slab westerosblocks:light_brown_wool_slab westerosblocks:light_blue_wool_slab westerosblocks:yellow_wool_slab westerosblocks:dirty_white_wool_slab westerosblocks:pink_wool_slab westerosblocks:grey_wool_slab westerosblocks:light_grey_wool_slab westerosblocks:cyan_wool_slab westerosblocks:purple_wool_slab westerosblocks:blue_wool_slab westerosblocks:brown_wool_slab westerosblocks:green_wool_slab westerosblocks:red_wool_slab westerosblocks:black_wool_slab westerosblocks:white_wool_carpet westerosblocks:orange_wool_carpet westerosblocks:light_brown_wool_carpet westerosblocks:light_blue_wool_carpet westerosblocks:yellow_wool_carpet westerosblocks:dirty_white_wool_carpet westerosblocks:pink_wool_carpet westerosblocks:grey_wool_carpet westerosblocks:light_grey_wool_carpet westerosblocks:cyan_wool_carpet westerosblocks:purple_wool_carpet westerosblocks:blue_wool_carpet westerosblocks:brown_wool_carpet westerosblocks:green_wool_carpet westerosblocks:red_wool_carpet westerosblocks:black_wool_carpet westerosblocks:thatch_light_fur_carpet westerosblocks:thatch_dark_fur_carpet + +## weak sss +block.83=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 westerosblocks:renly_banner westerosblocks:redwyne_banner westerosblocks:grafton_banner westerosblocks:grey_banner westerosblocks:red_banner westerosblocks:black_banner westerosblocks:the_faith_of_the_seven_banner westerosblocks:cream_banner westerosblocks:blue_banner westerosblocks:brown_banner westerosblocks:cyan_banner westerosblocks:green_banner westerosblocks:orange_banner westerosblocks:pink_banner westerosblocks:purple_banner westerosblocks:lord_of_light_rhllor_banner westerosblocks:yellow_banner westerosblocks:arryn_banner westerosblocks:baratheon_banner westerosblocks:bolton_banner westerosblocks:dayne_banner westerosblocks:frey_banner westerosblocks:greyjoy_banner westerosblocks:hightower_banner westerosblocks:lannister_banner westerosblocks:manderly_banner westerosblocks:martell_banner westerosblocks:stannis_banner westerosblocks:stark_banner westerosblocks:targaryen_banner westerosblocks:tarly_banner westerosblocks:tully_banner westerosblocks:tyrell_banner + +## weird blocks +block.84=minecraft:sand minecraft:red_sand + +## grass uwu +block.85=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.101=large_amethyst_bud + +block.102=medium_amethyst_bud + +block.103=amethyst_cluster + +block.104=beacon + +block.105=brewing_stand + + +#ifdef LPV_COLORED_CANDLES +block.106=candle:candles=1:lit=true + +block.107=candle:candles=2:lit=true + +block.108=candle:candles=3:lit=true + +block.109=candle:candles=4:lit=true + +block.110=black_candle:candles=1:lit=true + +block.111=black_candle:candles=2:lit=true + +block.112=black_candle:candles=3:lit=true + +block.113=black_candle:candles=4:lit=true + +block.114=blue_candle:candles=1:lit=true + +block.115=blue_candle:candles=2:lit=true + +block.116=blue_candle:candles=3:lit=true + +block.117=blue_candle:candles=4:lit=true + +block.118=brown_candle:candles=1:lit=true + +block.119=brown_candle:candles=2:lit=true + +block.120=brown_candle:candles=3:lit=true + +block.121=brown_candle:candles=4:lit=true + +block.122=cyan_candle:candles=1:lit=true + +block.123=cyan_candle:candles=2:lit=true + +block.124=cyan_candle:candles=3:lit=true + +block.125=cyan_candle:candles=4:lit=true + +block.126=gray_candle:candles=1:lit=true + +block.127=gray_candle:candles=2:lit=true + +block.128=gray_candle:candles=2:lit=true + +block.129=gray_candle:candles=4:lit=true + +block.130=green_candle:candles=1:lit=true + +block.131=green_candle:candles=2:lit=true + +block.132=green_candle:candles=3:lit=true + +block.133=green_candle:candles=4:lit=true + +block.134=light_blue_candle:candles=1:lit=true + +block.135=light_blue_candle:candles=2:lit=true + +block.136=light_blue_candle:candles=3:lit=true + +block.137=light_blue_candle:candles=4:lit=true + +block.138=light_gray_candle:candles=1:lit=true + +block.139=light_gray_candle:candles=2:lit=true + +block.140=light_gray_candle:candles=3:lit=true + +block.141=light_gray_candle:candles=4:lit=true + +block.142=lime_candle:candles=1:lit=true + +block.143=lime_candle:candles=2:lit=true + +block.144=lime_candle:candles=3:lit=true + +block.145=lime_candle:candles=4:lit=true + +block.146=magenta_candle:candles=1:lit=true + +block.147=magenta_candle:candles=2:lit=true + +block.148=magenta_candle:candles=3:lit=true + +block.149=magenta_candle:candles=4:lit=true + +block.150=orange_candle:candles=1:lit=true + +block.151=orange_candle:candles=2:lit=true + +block.152=orange_candle:candles=3:lit=true + +block.153=orange_candle:candles=4:lit=true + +block.154=pink_candle:candles=1:lit=true + +block.155=pink_candle:candles=2:lit=true + +block.156=pink_candle:candles=3:lit=true + +block.157=pink_candle:candles=4:lit=true + +block.158=purple_candle:candles=1:lit=true + +block.159=purple_candle:candles=2:lit=true + +block.160=purple_candle:candles=3:lit=true + +block.161=purple_candle:candles=4:lit=true + +block.162=red_candle:candles=1:lit=true + +block.163=red_candle:candles=2:lit=true + +block.164=red_candle:candles=3:lit=true + +block.165=red_candle:candles=4:lit=true + +block.166=white_candle:candles=1:lit=true + +block.167=white_candle:candles=2:lit=true + +block.168=white_candle:candles=3:lit=true + +block.169=white_candle:candles=4:lit=true + +block.170=yellow_candle:candles=1:lit=true + +block.171=yellow_candle:candles=2:lit=true + +block.172=yellow_candle:candles=3:lit=true + +block.173=yellow_candle:candles=4:lit=true +#else +block.174=candle:candles=1:lit=true black_candle:candles=1:lit=true blue_candle:candles=1:lit=true brown_candle:candles=1:lit=true cyan_candle:candles=1:lit=true gray_candle:candles=1:lit=true green_candle:candles=1:lit=true light_blue_candle:candles=1:lit=true light_gray_candle:candles=1:lit=true lime_candle:candles=1:lit=true magenta_candle:candles=1:lit=true orange_candle:candles=1:lit=true pink_candle:candles=1:lit=true purple_candle:candles=1:lit=true red_candle:candles=1:lit=true white_candle:candles=1:lit=true yellow_candle:candles=1:lit=true + +block.175=candle:candles=2:lit=true black_candle:candles=2:lit=true blue_candle:candles=2:lit=true brown_candle:candles=2:lit=true cyan_candle:candles=2:lit=true gray_candle:candles=2:lit=true green_candle:candles=2:lit=true light_blue_candle:candles=2:lit=true light_gray_candle:candles=2:lit=true lime_candle:candles=2:lit=true magenta_candle:candles=2:lit=true orange_candle:candles=2:lit=true pink_candle:candles=2:lit=true purple_candle:candles=2:lit=true red_candle:candles=2:lit=true white_candle:candles=2:lit=true yellow_candle:candles=2:lit=true + +block.176=candle:candles=3:lit=true black_candle:candles=3:lit=true blue_candle:candles=3:lit=true brown_candle:candles=3:lit=true cyan_candle:candles=3:lit=true gray_candle:candles=3:lit=true green_candle:candles=3:lit=true light_blue_candle:candles=3:lit=true light_gray_candle:candles=3:lit=true lime_candle:candles=3:lit=true magenta_candle:candles=3:lit=true orange_candle:candles=3:lit=true pink_candle:candles=3:lit=true purple_candle:candles=3:lit=true red_candle:candles=3:lit=true white_candle:candles=3:lit=true yellow_candle:candles=3:lit=true + +block.177=candle:candles=4:lit=true black_candle:candles=4:lit=true blue_candle:candles=4:lit=true brown_candle:candles=4:lit=true cyan_candle:candles=4:lit=true gray_candle:candles=4:lit=true green_candle:candles=4:lit=true light_blue_candle:candles=4:lit=true light_gray_candle:candles=4:lit=true lime_candle:candles=4:lit=true magenta_candle:candles=4:lit=true orange_candle:candles=4:lit=true pink_candle:candles=4:lit=true purple_candle:candles=4:lit=true red_candle:candles=4:lit=true white_candle:candles=4:lit=true yellow_candle:candles=4:lit=true +#endif + +block.178=cave_vines_plant:berries=true cave_vines:berries=true + +block.179=comparator:powered=true + +block.180=copper_bulb:lit=true waxed_copper_bulb:lit=true + +block.181=exposed_copper_bulb:lit=true waxed_exposed_copper_bulb:lit=true + +block.182=oxidized_copper_bulb:lit=true waxed_oxidized_copper_bulb:lit=true + +block.183=weathered_copper_bulb:lit=true waxed_weathered_copper_bulb:lit=true + +block.184=conduit + +block.185=crying_obsidian + +block.186=end_gateway + +block.187=end_rod + +block.188=fire campfire:lit=true + +block.189=ochre_froglight + +block.190=pearlescent_froglight + +block.191=verdant_froglight + +block.192=glow_lichen + +block.193=glowstone + +block.194=jack_o_lantern + +block.195=lantern + +block.196=lava + +block.197=light:level=1 + +block.198=light:level=2 + +block.199=light:level=3 + +block.200=light:level=4 + +block.201=light:level=5 + +block.202=light:level=6 + +block.203=light:level=7 + +block.204=light:level=8 + +block.205=light:level=9 + +block.206=light:level=10 + +block.207=light:level=11 + +block.208=light:level=12 + +block.209=light:level=13 + +block.210=light:level=14 + +block.211=light:level=15 + +block.212=magma_block + +block.213=redstone_lamp:lit=true + +block.214=redstone_torch:lit=true redstone_wall_torch:lit=true + +block.215=redstone_wire:power=1 + +block.216=redstone_wire:power=2 + +block.217=redstone_wire:power=3 + +block.218=redstone_wire:power=4 + +block.219=redstone_wire:power=5 + +block.220=redstone_wire:power=6 + +block.221=redstone_wire:power=7 + +block.222=redstone_wire:power=8 + +block.223=redstone_wire:power=9 + +block.224=redstone_wire:power=10 + +block.225=redstone_wire:power=11 + +block.226=redstone_wire:power=12 + +block.227=redstone_wire:power=13 + +block.228=redstone_wire:power=14 + +block.229=redstone_wire:power=15 + +block.230=repeater:powered=true + +block.231=respawn_anchor:charges=4 + +block.232=sculk_sensor:sculk_sensor_phase=active + +block.233=sea_pickle:waterlogged=true:pickles=1 + +block.234=sea_pickle:waterlogged=true:pickles=2 + +block.235=sea_pickle:waterlogged=true:pickles=3 + +block.236=sea_pickle:waterlogged=true:pickles=4 + +block.237=sea_lantern + +block.238=shroomlight + +block.239=smoker:lit=true + +block.240=soul_fire soul_campfire:lit=true + +block.241=soul_lantern + +block.242=soul_torch soul_wall_torch + +block.243=torch wall_torch + +block.244=westerosblocks:safe_fire +block.245=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 + +block.301=glass glass_pane + +block.302=honey_block + +block.303=ice frosted_ice + +block.304=nether_portal + +block.305=slime_block + +block.306=black_stained_glass black_stained_glass_pane + +block.307=blue_stained_glass blue_stained_glass_pane + +block.308=brown_stained_glass brown_stained_glass_pane + +block.309=cyan_stained_glass cyan_stained_glass_pane + +block.310=gray_stained_glass gray_stained_glass_pane + +block.311=green_stained_glass green_stained_glass_pane + +block.312=light_blue_stained_glass light_blue_stained_glass_pane + +block.313=light_gray_stained_glass light_gray_stained_glass_pane + +block.314=lime_stained_glass lime_stained_glass_pane + +block.315=magenta_stained_glass magenta_stained_glass_pane + +block.316=orange_stained_glass orange_stained_glass_pane + +block.317=pink_stained_glass pink_stained_glass_pane + +block.318=purple_stained_glass purple_stained_glass_pane + +block.319=red_stained_glass red_stained_glass_pane + +block.320=white_stained_glass white_stained_glass_pane + +block.321=yellow_stained_glass yellow_stained_glass_pane + + +####### ----- LPV shapes ----- ####### + +block.401=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=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 + +block.403=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 + +block.404=chain + + +block.405=acacia_door:facing=north:open=false bamboo_door:facing=north:open=false birch_door:facing=north:open=false cherry_door:facing=north:open=false crimson_door:facing=north:open=false dark_oak_door:facing=north:open=false iron_door:facing=north:open=false jungle_door:facing=north:open=false mangrove_door:facing=north:open=false oak_door:facing=north:open=false spruce_door:facing=north:open=false warped_door:facing=north:open=false copper_door:facing=north:open=false exposed_copper_door:facing=north:open=false weathered_copper_door:facing=north:open=false oxidized_copper_door:facing=north:open=false waxed_copper_door:facing=north:open=false waxed_exposed_copper_door:facing=north:open=false waxed_weathered_copper_door:facing=north:open=false waxed_oxidized_copper_door:facing=north:open=false acacia_door:facing=west:hinge=left:open=true bamboo_door:facing=west:hinge=left:open=true birch_door:facing=west:hinge=left:open=true cherry_door:facing=west:hinge=left:open=true crimson_door:facing=west:hinge=left:open=true dark_oak_door:facing=west:hinge=left:open=true iron_door:facing=west:hinge=left:open=true jungle_door:facing=west:hinge=left:open=true mangrove_door:facing=west:hinge=left:open=true oak_door:facing=west:hinge=left:open=true spruce_door:facing=west:hinge=left:open=true warped_door:facing=west:hinge=left:open=true copper_door:facing=west:hinge=left:open=true exposed_copper_door:facing=west:hinge=left:open=true weathered_copper_door:facing=west:hinge=left:open=true oxidized_copper_door:facing=west:hinge=left:open=true waxed_copper_door:facing=west:hinge=left:open=true waxed_exposed_copper_door:facing=west:hinge=left:open=true waxed_weathered_copper_door:facing=west:hinge=left:open=true waxed_oxidized_copper_door:facing=west:hinge=left:open=true acacia_door:facing=east:hinge=right:open=true bamboo_door:facing=east:hinge=right:open=true birch_door:facing=east:hinge=right:open=true cherry_door:facing=east:hinge=right:open=true crimson_door:facing=east:hinge=right:open=true dark_oak_door:facing=east:hinge=right:open=true iron_door:facing=east:hinge=right:open=true jungle_door:facing=east:hinge=right:open=true mangrove_door:facing=east:hinge=right:open=true oak_door:facing=east:hinge=right:open=true spruce_door:facing=east:hinge=right:open=true warped_door:facing=east:hinge=right:open=true copper_door:facing=east:hinge=right:open=true exposed_copper_door:facing=east:hinge=right:open=true weathered_copper_door:facing=east:hinge=right:open=true oxidized_copper_door:facing=east:hinge=right:open=true waxed_copper_door:facing=east:hinge=right:open=true waxed_exposed_copper_door:facing=east:hinge=right:open=true waxed_weathered_copper_door:facing=east:hinge=right:open=true waxed_oxidized_copper_door:facing=east:hinge=right:open=true + +block.406=acacia_door:facing=east:open=false bamboo_door:facing=east:open=false birch_door:facing=east:open=false cherry_door:facing=east:open=false crimson_door:facing=east:open=false dark_oak_door:facing=east:open=false iron_door:facing=east:open=false jungle_door:facing=east:open=false mangrove_door:facing=east:open=false oak_door:facing=east:open=false spruce_door:facing=east:open=false warped_door:facing=east:open=false copper_door:facing=east:open=false exposed_copper_door:facing=east:open=false weathered_copper_door:facing=east:open=false oxidized_copper_door:facing=east:open=false waxed_copper_door:facing=east:open=false waxed_exposed_copper_door:facing=east:open=false waxed_weathered_copper_door:facing=east:open=false waxed_oxidized_copper_door:facing=east:open=false acacia_door:facing=north:hinge=left:open=true bamboo_door:facing=north:hinge=left:open=true birch_door:facing=north:hinge=left:open=true cherry_door:facing=north:hinge=left:open=true crimson_door:facing=north:hinge=left:open=true dark_oak_door:facing=north:hinge=left:open=true iron_door:facing=north:hinge=left:open=true jungle_door:facing=north:hinge=left:open=true mangrove_door:facing=north:hinge=left:open=true oak_door:facing=north:hinge=left:open=true spruce_door:facing=north:hinge=left:open=true warped_door:facing=north:hinge=left:open=true copper_door:facing=north:hinge=left:open=true exposed_copper_door:facing=north:hinge=left:open=true weathered_copper_door:facing=north:hinge=left:open=true oxidized_copper_door:facing=north:hinge=left:open=true waxed_copper_door:facing=north:hinge=left:open=true waxed_exposed_copper_door:facing=north:hinge=left:open=true waxed_weathered_copper_door:facing=north:hinge=left:open=true waxed_oxidized_copper_door:facing=north:hinge=left:open=true acacia_door:facing=south:hinge=right:open=true bamboo_door:facing=south:hinge=right:open=true birch_door:facing=south:hinge=right:open=true cherry_door:facing=south:hinge=right:open=true crimson_door:facing=south:hinge=right:open=true dark_oak_door:facing=south:hinge=right:open=true iron_door:facing=south:hinge=right:open=true jungle_door:facing=south:hinge=right:open=true mangrove_door:facing=south:hinge=right:open=true oak_door:facing=south:hinge=right:open=true spruce_door:facing=south:hinge=right:open=true warped_door:facing=south:hinge=right:open=true copper_door:facing=south:hinge=right:open=true exposed_copper_door:facing=south:hinge=right:open=true weathered_copper_door:facing=south:hinge=right:open=true oxidized_copper_door:facing=south:hinge=right:open=true waxed_copper_door:facing=south:hinge=right:open=true waxed_exposed_copper_door:facing=south:hinge=right:open=true waxed_weathered_copper_door:facing=south:hinge=right:open=true waxed_oxidized_copper_door:facing=south:hinge=right:open=true + +block.407=acacia_door:facing=south:open=false bamboo_door:facing=south:open=false birch_door:facing=south:open=false cherry_door:facing=south:open=false crimson_door:facing=south:open=false dark_oak_door:facing=south:open=false iron_door:facing=south:open=false jungle_door:facing=south:open=false mangrove_door:facing=south:open=false oak_door:facing=south:open=false spruce_door:facing=south:open=false warped_door:facing=south:open=false copper_door:facing=south:open=false exposed_copper_door:facing=south:open=false weathered_copper_door:facing=south:open=false oxidized_copper_door:facing=south:open=false waxed_copper_door:facing=south:open=false waxed_exposed_copper_door:facing=south:open=false waxed_weathered_copper_door:facing=south:open=false waxed_oxidized_copper_door:facing=south:open=false acacia_door:facing=east:hinge=left:open=true bamboo_door:facing=east:hinge=left:open=true birch_door:facing=east:hinge=left:open=true cherry_door:facing=east:hinge=left:open=true crimson_door:facing=east:hinge=left:open=true dark_oak_door:facing=east:hinge=left:open=true iron_door:facing=east:hinge=left:open=true jungle_door:facing=east:hinge=left:open=true mangrove_door:facing=east:hinge=left:open=true oak_door:facing=east:hinge=left:open=true spruce_door:facing=east:hinge=left:open=true warped_door:facing=east:hinge=left:open=true copper_door:facing=east:hinge=left:open=true exposed_copper_door:facing=east:hinge=left:open=true weathered_copper_door:facing=east:hinge=left:open=true oxidized_copper_door:facing=east:hinge=left:open=true waxed_copper_door:facing=east:hinge=left:open=true waxed_exposed_copper_door:facing=east:hinge=left:open=true waxed_weathered_copper_door:facing=east:hinge=left:open=true waxed_oxidized_copper_door:facing=east:hinge=left:open=true acacia_door:facing=west:hinge=right:open=true bamboo_door:facing=west:hinge=right:open=true birch_door:facing=west:hinge=right:open=true cherry_door:facing=west:hinge=right:open=true crimson_door:facing=west:hinge=right:open=true dark_oak_door:facing=west:hinge=right:open=true iron_door:facing=west:hinge=right:open=true jungle_door:facing=west:hinge=right:open=true mangrove_door:facing=west:hinge=right:open=true oak_door:facing=west:hinge=right:open=true spruce_door:facing=west:hinge=right:open=true warped_door:facing=west:hinge=right:open=true copper_door:facing=west:hinge=right:open=true exposed_copper_door:facing=west:hinge=right:open=true weathered_copper_door:facing=west:hinge=right:open=true oxidized_copper_door:facing=west:hinge=right:open=true waxed_copper_door:facing=west:hinge=right:open=true waxed_exposed_copper_door:facing=west:hinge=right:open=true waxed_weathered_copper_door:facing=west:hinge=right:open=true waxed_oxidized_copper_door:facing=west:hinge=right:open=true + +block.408=acacia_door:facing=west:open=false bamboo_door:facing=west:open=false birch_door:facing=west:open=false cherry_door:facing=west:open=false crimson_door:facing=west:open=false dark_oak_door:facing=west:open=false iron_door:facing=west:open=false jungle_door:facing=west:open=false mangrove_door:facing=west:open=false oak_door:facing=west:open=false spruce_door:facing=west:open=false warped_door:facing=west:open=false copper_door:facing=west:open=false exposed_copper_door:facing=west:open=false weathered_copper_door:facing=west:open=false oxidized_copper_door:facing=west:open=false waxed_copper_door:facing=west:open=false waxed_exposed_copper_door:facing=west:open=false waxed_weathered_copper_door:facing=west:open=false waxed_oxidized_copper_door:facing=west:open=false acacia_door:facing=south:hinge=left:open=true bamboo_door:facing=south:hinge=left:open=true birch_door:facing=south:hinge=left:open=true cherry_door:facing=south:hinge=left:open=true crimson_door:facing=south:hinge=left:open=true dark_oak_door:facing=south:hinge=left:open=true iron_door:facing=south:hinge=left:open=true jungle_door:facing=south:hinge=left:open=true mangrove_door:facing=south:hinge=left:open=true oak_door:facing=south:hinge=left:open=true spruce_door:facing=south:hinge=left:open=true warped_door:facing=south:hinge=left:open=true copper_door:facing=south:hinge=left:open=true exposed_copper_door:facing=south:hinge=left:open=true weathered_copper_door:facing=south:hinge=left:open=true oxidized_copper_door:facing=south:hinge=left:open=true waxed_copper_door:facing=south:hinge=left:open=true waxed_exposed_copper_door:facing=south:hinge=left:open=true waxed_weathered_copper_door:facing=south:hinge=left:open=true waxed_oxidized_copper_door:facing=south:hinge=left:open=true acacia_door:facing=north:hinge=right:open=true bamboo_door:facing=north:hinge=right:open=true birch_door:facing=north:hinge=right:open=true cherry_door:facing=north:hinge=right:open=true crimson_door:facing=north:hinge=right:open=true dark_oak_door:facing=north:hinge=right:open=true iron_door:facing=north:hinge=right:open=true jungle_door:facing=north:hinge=right:open=true mangrove_door:facing=north:hinge=right:open=true oak_door:facing=north:hinge=right:open=true spruce_door:facing=north:hinge=right:open=true warped_door:facing=north:hinge=right:open=true copper_door:facing=north:hinge=right:open=true exposed_copper_door:facing=north:hinge=right:open=true weathered_copper_door:facing=north:hinge=right:open=true oxidized_copper_door:facing=north:hinge=right:open=true waxed_copper_door:facing=north:hinge=right:open=true waxed_exposed_copper_door:facing=north:hinge=right:open=true waxed_weathered_copper_door:facing=north:hinge=right:open=true waxed_oxidized_copper_door:facing=north:hinge=right:open=true + +block.409=acacia_fence bamboo_fence birch_fence cherry_fence crimson_fence dark_oak_fence jungle_fence mangrove_fence nether_brick_fence oak_fence spruce_fence warped_fence + +block.410=acacia_fence_gate bamboo_fence_gate birch_fence_gate cherry_fence_gate crimson_fence_gate dark_oak_fence_gate jungle_fence_gate mangrove_fence_gate oak_fence_gate spruce_fence_gate warped_fence_gate + +block.411=flower_pot potted_acacia_sapling potted_allium potted_azalea_bush potted_bamboo potted_azure_bluet potted_birch_sapling potted_blue_orchid potted_brown_mushroom potted_cactus potted_cornflower potted_crimson_fungus potted_crimson_roots potted_dandelion potted_dark_oak_sapling potted_dead_bush potted_fern potted_flowering_azalea_bush potted_jungle_sapling potted_lily_of_the_valley potted_mangrove_propagule potted_oak_sapling potted_orange_tulip potted_oxeye_daisy potted_pink_tulip potted_poppy potted_red_mushroom potted_red_tulip potted_spruce_sapling potted_torchflower potted_warped_fungus potted_warped_roots potted_white_tulip potted_wither_rose + +block.412=iron_bars + +block.413=ladder + +block.414=lever + +block.415=acacia_pressure_plate bamboo_pressure_plate birch_pressure_plate cherry_pressure_plate crimson_pressure_plate dark_oak_pressure_plate heavy_weighted_pressure_plate jungle_pressure_plate light_weighted_pressure_plate mangrove_pressure_plate oak_pressure_plate polished_blackstone_pressure_plate spruce_pressure_plate stone_pressure_plate warped_pressure_plate + + +block.416=acacia_slab:type=top bamboo_slab:type=top bamboo_mosaic_slab:type=top birch_slab:type=top cherry_slab:type=top crimson_slab:type=top dark_oak_slab:type=top jungle_slab:type=top mangrove_slab:type=top oak_slab:type=top spruce_slab:type=top warped_slab:type=top andesite_slab:type=top blackstone_slab:type=top brick_slab:type=top cobbled_deepslate_slab:type=top cobblestone_slab:type=top cut_copper_slab:type=top cut_red_sandstone_slab:type=top cut_sandstone_slab:type=top dark_prismarine_slab:type=top deepslate_brick_slab:type=top deepslate_tile_slab:type=top diorite_slab:type=top end_stone_brick_slab:type=top exposed_cut_copper_slab:type=top granite_slab:type=top mossy_cobblestone_slab:type=top mossy_stone_brick_slab:type=top mud_brick_slab:type=top nether_brick_slab:type=top oxidized_cut_copper_slab:type=top petrified_oak_slab:type=top polished_andesite_slab:type=top polished_blackstone_brick_slab:type=top polished_blackstone_slab:type=top polished_deepslate_slab:type=top polished_diorite_slab:type=top polished_granite_slab:type=top prismarine_brick_slab:type=top prismarine_slab:type=top purpur_slab:type=top quartz_slab:type=top red_nether_brick_slab:type=top red_sandstone_slab:type=top sandstone_slab:type=top smooth_quartz_slab:type=top smooth_red_sandstone_slab:type=top smooth_sandstone_slab:type=top smooth_stone_slab:type=top stone_brick_slab:type=top stone_slab:type=top waxed_cut_copper_slab:type=top waxed_exposed_cut_copper_slab:type=top waxed_oxidized_cut_copper_slab:type=top waxed_weathered_cut_copper_slab:type=top weathered_cut_copper_slab:type=top + +block.417=acacia_slab:type=bottom bamboo_slab:type=bottom bamboo_mosaic_slab:type=bottom birch_slab:type=bottom cherry_slab:type=bottom crimson_slab:type=bottom dark_oak_slab:type=bottom jungle_slab:type=bottom mangrove_slab:type=bottom oak_slab:type=bottom spruce_slab:type=bottom warped_slab:type=bottom andesite_slab:type=bottom blackstone_slab:type=bottom brick_slab:type=bottom cobbled_deepslate_slab:type=bottom cobblestone_slab:type=bottom cut_copper_slab:type=bottom cut_red_sandstone_slab:type=bottom cut_sandstone_slab:type=bottom dark_prismarine_slab:type=bottom deepslate_brick_slab:type=bottom deepslate_tile_slab:type=bottom diorite_slab:type=bottom end_stone_brick_slab:type=bottom exposed_cut_copper_slab:type=bottom granite_slab:type=bottom mossy_cobblestone_slab:type=bottom mossy_stone_brick_slab:type=bottom mud_brick_slab:type=bottom nether_brick_slab:type=bottom oxidized_cut_copper_slab:type=bottom petrified_oak_slab:type=bottom polished_andesite_slab:type=bottom polished_blackstone_brick_slab:type=bottom polished_blackstone_slab:type=bottom polished_deepslate_slab:type=bottom polished_diorite_slab:type=bottom polished_granite_slab:type=bottom prismarine_brick_slab:type=bottom prismarine_slab:type=bottom purpur_slab:type=bottom quartz_slab:type=bottom red_nether_brick_slab:type=bottom red_sandstone_slab:type=bottom sandstone_slab:type=bottom smooth_quartz_slab:type=bottom smooth_red_sandstone_slab:type=bottom smooth_sandstone_slab:type=bottom smooth_stone_slab:type=bottom stone_brick_slab:type=bottom stone_slab:type=bottom waxed_cut_copper_slab:type=bottom waxed_exposed_cut_copper_slab:type=bottom waxed_oxidized_cut_copper_slab:type=bottom waxed_weathered_cut_copper_slab:type=bottom weathered_cut_copper_slab:type=bottom daylight_detector + + +block.418=acacia_trapdoor:half=bottom:open=false bamboo_trapdoor:half=bottom:open=false birch_trapdoor:half=bottom:open=false cherry_trapdoor:half=bottom:open=false crimson_trapdoor:half=bottom:open=false dark_oak_trapdoor:half=bottom:open=false iron_trapdoor:half=bottom:open=false jungle_trapdoor:half=bottom:open=false mangrove_trapdoor:half=bottom:open=false oak_trapdoor:half=bottom:open=false spruce_trapdoor:half=bottom:open=false warped_trapdoor:half=bottom:open=false copper_trapdoor:half=bottom:open=false exposed_copper_trapdoor:half=bottom:open=false weathered_copper_trapdoor:half=bottom:open=false oxidized_copper_trapdoor:half=bottom:open=false waxed_copper_trapdoor:half=bottom:open=false waxed_exposed_copper_trapdoor:half=bottom:open=false waxed_weathered_copper_trapdoor:half=bottom:open=false waxed_oxidized_copper_trapdoor:half=bottom:open=false + +block.419=acacia_trapdoor:half=top:open=false bamboo_trapdoor:half=top:open=false birch_trapdoor:half=top:open=false cherry_trapdoor:half=top:open=false crimson_trapdoor:half=top:open=false dark_oak_trapdoor:half=top:open=false iron_trapdoor:half=top:open=false jungle_trapdoor:half=top:open=false mangrove_trapdoor:half=top:open=false oak_trapdoor:half=top:open=false spruce_trapdoor:half=top:open=false warped_trapdoor:half=top:open=false copper_trapdoor:half=top:open=false exposed_copper_trapdoor:half=top:open=false weathered_copper_trapdoor:half=top:open=false oxidized_copper_trapdoor:half=top:open=false waxed_copper_trapdoor:half=top:open=false waxed_exposed_copper_trapdoor:half=top:open=false waxed_weathered_copper_trapdoor:half=top:open=false waxed_oxidized_copper_trapdoor:half=top:open=false + +block.420=acacia_trapdoor:facing=north:open=true bamboo_trapdoor:facing=north:open=true birch_trapdoor:facing=north:open=true cherry_trapdoor:facing=north:open=true crimson_trapdoor:facing=north:open=true dark_oak_trapdoor:facing=north:open=true iron_trapdoor:facing=north:open=true jungle_trapdoor:facing=north:open=true mangrove_trapdoor:facing=north:open=true oak_trapdoor:facing=north:open=true spruce_trapdoor:facing=north:open=true warped_trapdoor:facing=north:open=true copper_trapdoor:facing=north:open=true exposed_copper_trapdoor:facing=north:open=true weathered_copper_trapdoor:facing=north:open=true oxidized_copper_trapdoor:facing=north:open=true waxed_copper_trapdoor:facing=north:open=true waxed_exposed_copper_trapdoor:facing=north:open=true waxed_weathered_copper_trapdoor:facing=north:open=true waxed_oxidized_copper_trapdoor:facing=north:open=true + +block.421=acacia_trapdoor:facing=east:open=true bamboo_trapdoor:facing=east:open=true birch_trapdoor:facing=east:open=true cherry_trapdoor:facing=east:open=true crimson_trapdoor:facing=east:open=true dark_oak_trapdoor:facing=east:open=true iron_trapdoor:facing=east:open=true jungle_trapdoor:facing=east:open=true mangrove_trapdoor:facing=east:open=true oak_trapdoor:facing=east:open=true spruce_trapdoor:facing=east:open=true warped_trapdoor:facing=east:open=true copper_trapdoor:facing=east:open=true exposed_copper_trapdoor:facing=east:open=true weathered_copper_trapdoor:facing=east:open=true oxidized_copper_trapdoor:facing=east:open=true waxed_copper_trapdoor:facing=east:open=true waxed_exposed_copper_trapdoor:facing=east:open=true waxed_weathered_copper_trapdoor:facing=east:open=true waxed_oxidized_copper_trapdoor:facing=east:open=true + +block.422=acacia_trapdoor:facing=south:open=true bamboo_trapdoor:facing=south:open=true birch_trapdoor:facing=south:open=true cherry_trapdoor:facing=south:open=true crimson_trapdoor:facing=south:open=true dark_oak_trapdoor:facing=south:open=true iron_trapdoor:facing=south:open=true jungle_trapdoor:facing=south:open=true mangrove_trapdoor:facing=south:open=true oak_trapdoor:facing=south:open=true spruce_trapdoor:facing=south:open=true warped_trapdoor:facing=south:open=true copper_trapdoor:facing=south:open=true exposed_copper_trapdoor:facing=south:open=true weathered_copper_trapdoor:facing=south:open=true oxidized_copper_trapdoor:facing=south:open=true waxed_copper_trapdoor:facing=south:open=true waxed_exposed_copper_trapdoor:facing=south:open=true waxed_weathered_copper_trapdoor:facing=south:open=true waxed_oxidized_copper_trapdoor:facing=south:open=true + +block.423=acacia_trapdoor:facing=west:open=true bamboo_trapdoor:facing=west:open=true birch_trapdoor:facing=west:open=true cherry_trapdoor:facing=west:open=true crimson_trapdoor:facing=west:open=true dark_oak_trapdoor:facing=west:open=true iron_trapdoor:facing=west:open=true jungle_trapdoor:facing=west:open=true mangrove_trapdoor:facing=west:open=true oak_trapdoor:facing=west:open=true spruce_trapdoor:facing=west:open=true warped_trapdoor:facing=west:open=true copper_trapdoor:facing=west:open=true exposed_copper_trapdoor:facing=west:open=true weathered_copper_trapdoor:facing=west:open=true oxidized_copper_trapdoor:facing=west:open=true waxed_copper_trapdoor:facing=west:open=true waxed_exposed_copper_trapdoor:facing=west:open=true waxed_weathered_copper_trapdoor:facing=west:open=true waxed_oxidized_copper_trapdoor:facing=west:open=true + ####### ----- misc ----- ####### - ## all blocks here get exluded from POM. - block.2200 = minecraft:oak_sign minecraft:spruce_sign minecraft:birch_sign minecraft:jungle_sign minecraft:acacia_sign minecraft:dark_oak_sign minecraft:mangrove_sign minecraft:crimson_sign minecraft:warped_sign minecraft:oak_wall_sign minecraft:spruce_wall_sign minecraft:birch_wall_sign minecraft:jungle_wall_sign minecraft:acacia_wall_sign minecraft:dark_oak_wall_sign minecraft:mangrove_wall_sign minecraft:crimson_wall_sign minecraft:warped_wall_sign - - ## stuff - block.2100 = minecraft:end_portal - - block.8 = minecraft:water minecraft:flowing_water +## stuff +block.500=minecraft:end_portal - # workaround mixed render stages - block.3000 = minecraft:redstone_wire - - layer.translucent = minecraft:glass_pane minecraft:glass +## all blocks here get exluded from POM. +block.501=minecraft:oak_sign minecraft:spruce_sign minecraft:birch_sign minecraft:jungle_sign minecraft:acacia_sign minecraft:dark_oak_sign minecraft:mangrove_sign minecraft:crimson_sign minecraft:warped_sign minecraft:oak_wall_sign minecraft:spruce_wall_sign minecraft:birch_wall_sign minecraft:jungle_wall_sign minecraft:acacia_wall_sign minecraft:dark_oak_wall_sign minecraft:mangrove_wall_sign minecraft:crimson_wall_sign minecraft:warped_wall_sign + +## workaround mixed render stages +##= BLOCK_REDSTONE_WIRE +##block.*= minecraft:redstone_wire diff --git a/shaders/dimensions/DH_solid.fsh b/shaders/dimensions/DH_solid.fsh index 00e227c..f03e900 100644 --- a/shaders/dimensions/DH_solid.fsh +++ b/shaders/dimensions/DH_solid.fsh @@ -109,8 +109,12 @@ void main() { vec3 normals = viewToWorld(normals_and_materials.xyz); float materials = normals_and_materials.a; + vec2 PackLightmaps = lightmapCoords; + + PackLightmaps.y *= 1.05; + PackLightmaps = min(max(PackLightmaps - 0.001*blueNoise(),0.0)*1.002,1.0); - vec4 data1 = clamp( encode(normals.xyz, vec2(lightmapCoords)), 0.0, 1.0); + vec4 data1 = clamp( encode(normals.xyz, PackLightmaps), 0.0, 1.0); // alpha is material masks, set it to 0.65 to make a DH LODs mask. vec4 Albedo = vec4(gcolor.rgb, 1.0); diff --git a/shaders/dimensions/DH_solid.vsh b/shaders/dimensions/DH_solid.vsh index a5e0f18..d48deaf 100644 --- a/shaders/dimensions/DH_solid.vsh +++ b/shaders/dimensions/DH_solid.vsh @@ -68,7 +68,7 @@ void main() { gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize; #endif - lightmapCoords = gl_MultiTexCoord1.xy * 0.975; // is this even correct? lol' + lightmapCoords = gl_MultiTexCoord1.xy; // is this even correct? lol' gcolor = gl_Color; pos = gl_ModelViewMatrix * gl_Vertex; diff --git a/shaders/dimensions/DH_translucent.fsh b/shaders/dimensions/DH_translucent.fsh index 2804414..1c3ca4c 100644 --- a/shaders/dimensions/DH_translucent.fsh +++ b/shaders/dimensions/DH_translucent.fsh @@ -11,9 +11,10 @@ uniform sampler2D noisetex; const bool shadowHardwareFiltering = true; uniform sampler2DShadow shadow; +#ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex; -// uniform sampler2D dhDepthTex0; uniform sampler2D dhDepthTex1; +#endif uniform sampler2D depthtex0; uniform sampler2D depthtex1; @@ -110,10 +111,8 @@ uniform int isEyeInWater; uniform float rainStrength; #include "/lib/volumetricClouds.glsl" - -vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) { - r = pow(r,2.5); -// r*=r; +float GGX(vec3 n, vec3 v, vec3 l, float r, float f0) { + r = max(pow(r,2.5), 0.0001); vec3 h = l + v; float hn = inversesqrt(dot(h, h)); @@ -125,11 +124,13 @@ vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) { float denom = dotNHsq * r - dotNHsq + 1.; float D = r / (3.141592653589793 * denom * denom); - vec3 F = 0.2 + (1. - F0) * exp2((-5.55473*dotLH-6.98316)*dotLH); + + float F = f0 + (1. - f0) * exp2((-5.55473*dotLH-6.98316)*dotLH); float k2 = .25 * r; return dotNL * D * F / (dotLH*dotLH*(1.0-k2)+k2); } + uniform int framemod8; const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), @@ -226,143 +227,190 @@ uniform float near; float ld(float dist) { return (2.0 * near) / (far + near - dist * (far - near)); } +vec3 applyBump(mat3 tbnMatrix, vec3 bump, float puddle_values){ + float bumpmult = puddle_values; + bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult); + // + return normalize(bump*tbnMatrix); +} - +varying vec4 tangent; /* RENDERTARGETS:2,7 */ void main() { - if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) { + bool iswater = isWater > 0; + + float material = 0.7; + if(iswater) material = 1.0; vec3 normals = normals_and_materials.xyz; - - vec3 playerPos = mat3(gbufferModelViewInverse) * pos.xyz; + vec3 viewPos = pos.xyz; + vec3 playerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; float transition = exp(-25* pow(clamp(1.0 - length(playerPos)/(far-8),0.0,1.0),2)); - + + #ifdef DH_OVERDRAW_PREVENTION + if(length(playerPos) < max(far-16*4,16) ){ discard; return;} + #endif + + if(iswater){ vec3 posxz = playerPos+cameraPosition; - vec3 waterHeightmap = normalize(getWaveNormal(posxz, true)); - - float bumpmult = WATER_WAVE_STRENGTH; - waterHeightmap = waterHeightmap * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult); - waterHeightmap = normalize(waterHeightmap); + vec3 bump = normalize(getWaveNormal(posxz, true)); - // vec2 TangentNormal = waterHeightmap.xy*0.5+0.5; - // gl_FragData[2] = vec4(encodeVec2(TangentNormal), encodeVec2(vec2(1.0)), encodeVec2(vec2(1.0)), 1.0); + float bumpmult = 10.0 * WATER_WAVE_STRENGTH; + bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult); - if(normals.y > 0.0) normals = vec3(waterHeightmap.x,normals.y,waterHeightmap.y); + normals.xz = bump.xy; } normals = worldToView(normals); - vec3 Albedo = toLinear(gcolor.rgb); - gl_FragData[0] = vec4(Albedo, gcolor.a); - vec4 COLORTEST = gl_FragData[0]; + gl_FragData[0] = gcolor; + // float UnchangedAlpha = gl_FragData[0].a; - #ifndef Vanilla_like_water - if(iswater){ - Albedo = vec3(0.0); - gl_FragData[0].a = 1.0/255.0; - } + #ifdef WhiteWorld + gl_FragData[0].rgb = vec3(0.5); + gl_FragData[0].a = 1.0; + #endif + + vec3 Albedo = toLinear(gl_FragData[0].rgb); + + #ifndef WhiteWorld + #ifndef Vanilla_like_water + if (iswater){ + Albedo = vec3(0.0); + gl_FragData[0].a = 1.0/255.0; + } + #endif #endif // diffuse - vec3 Direct_lighting = lightCol.rgb/80.0; + vec3 Indirect_lighting = vec3(0.0); + // vec3 MinimumLightColor = vec3(1.0); + // if(isEyeInWater == 1) MinimumLightColor = vec3(10.0); + vec3 Direct_lighting = vec3(0.0); - float NdotL = max(dot(normals, WsunVec2), 0.0f); - Direct_lighting *= NdotL; - - #ifdef CLOUDS_SHADOWS - Direct_lighting *= GetCloudShadow(playerPos); - #endif + #ifdef OVERWORLD_SHADER + vec3 DirectLightColor = lightCol.rgb/80.0; + + float NdotL = clamp(dot(normals, normalize(WsunVec2)),0.0,1.0); + NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0); - #ifdef DISTANT_HORIZONS_SHADOWMAP float Shadows = 1.0; - - vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * pos.xyz + gbufferModelViewInverse[3].xyz; - vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz; - projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; + #ifdef DISTANT_HORIZONS_SHADOWMAP + vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * pos.xyz + gbufferModelViewInverse[3].xyz; - //apply distortion - #ifdef DISTORT_SHADOWMAP - float distortFactor = calcDistort(projectedShadowPosition.xy); - projectedShadowPosition.xy *= distortFactor; - #else - float distortFactor = 1.0; - #endif + vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz; + projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; - float smallbias = -0.0035; + //apply distortion + #ifdef DISTORT_SHADOWMAP + float distortFactor = calcDistort(projectedShadowPosition.xy); + projectedShadowPosition.xy *= distortFactor; + #else + float distortFactor = 1.0; + #endif - bool ShadowBounds = abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0; - - if(ShadowBounds){ - Shadows = 0.0; - projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5); + float smallbias = -0.0035; - Shadows = shadow2D(shadow, projectedShadowPosition + vec3(0.0,0.0, smallbias)).x; - } - - Direct_lighting *= Shadows; - #endif + bool ShadowBounds = abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0; + if(ShadowBounds){ + Shadows = 0.0; + projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5); - vec3 Indirect_lighting = averageSkyCol_Clouds/30.0; - - gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * Albedo; - // specular - vec3 reflectedVector = reflect(normalize(pos.xyz), normals); - - float normalDotEye = dot(normals, normalize(pos.xyz)); - float fresnel = pow(clamp(1.0 + normalDotEye, 0.0, 1.0),5.0); - - fresnel = mix(0.02, 1.0, fresnel); - - #ifdef SNELLS_WINDOW - if(isEyeInWater == 1) fresnel = pow(clamp(1.5 + normalDotEye,0.0,1.0), 25.0); - #endif - - #ifdef WATER_REFLECTIONS - - vec4 ssReflections = vec4(0); - #ifdef SCREENSPACE_REFLECTIONS - vec3 rtPos = rayTrace(reflectedVector, pos.xyz, interleaved_gradientNoise(), fresnel, false); - - if (rtPos.z < 1.){ - vec3 previousPosition = mat3(gbufferModelViewInverse) * DH_toScreenSpace(rtPos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition; - previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz; - previousPosition.xy = projMAD(dhPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5; - if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) { - ssReflections.a = 1.0; - ssReflections.rgb = texture2D(colortex5, previousPosition.xy).rgb; - } - } + Shadows = shadow2D(shadow, projectedShadowPosition + vec3(0.0,0.0, smallbias)).x; + } + #endif + #ifdef CLOUDS_SHADOWS + Shadows *= pow(GetCloudShadow(playerPos),3); #endif - vec3 skyReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0 ; - skyReflection = mix(skyReflection, ssReflections.rgb, ssReflections.a); + Direct_lighting = DirectLightColor * NdotL * Shadows; - vec3 sunReflection = Direct_lighting * GGX(normals, -normalize(pos.xyz), WsunVec2, 0.05, vec3(0.02)) * (1-ssReflections.a) ; + vec3 AmbientLightColor = averageSkyCol_Clouds/30.0; - gl_FragData[0].rgb = mix(gl_FragData[0].rgb, skyReflection, fresnel) + sunReflection ; - gl_FragData[0].a = mix(gl_FragData[0].a, 1.0, fresnel); - #endif + vec3 ambientcoefs = normals_and_materials.xyz / dot(abs(normals_and_materials.xyz), vec3(1.0)); + float SkylightDir = ambientcoefs.y*1.5; - float material = 1.0; - #ifdef DH_OVERDRAW_PREVENTION - float distancefade = min(max(1.0 - length(pos.xz)/max(far-16.0,0.0),0.0)*2.0,1.0); - gl_FragData[0].a = mix(gl_FragData[0].a, 0.0, distancefade); - - material = distancefade < 1.0 ? 1.0 : 0.0; + float skylight = max(pow(viewToWorld(normals_and_materials.xyz).y*0.5+0.5,0.1) + SkylightDir, 0.2); + AmbientLightColor *= skylight; + #endif - if(texture2D(depthtex1, gl_FragCoord.xy*texelSize).x < 1.0){ + Indirect_lighting = AmbientLightColor; + + vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo; + + // specular + #ifdef WATER_REFLECTIONS + vec3 Reflections_Final = vec3(0.0); + vec4 Reflections = vec4(0.0); + vec3 BackgroundReflection = FinalColor; + vec3 SunReflection = vec3(0.0); + + float roughness = 0.035; + float f0 = 0.02; + // float f0 = 0.9; + + vec3 reflectedVector = reflect(normalize(viewPos), normals); + float normalDotEye = dot(normals, normalize(viewPos)); + + float fresnel = pow(clamp(1.0 + normalDotEye, 0.0, 1.0),5.0); + + fresnel = mix(f0, 1.0, fresnel); + + #ifdef SNELLS_WINDOW + if(isEyeInWater == 1) fresnel = pow(clamp(1.5 + normalDotEye,0.0,1.0), 25.0); + #endif + + + #ifdef SCREENSPACE_REFLECTIONS + vec3 rtPos = rayTrace(reflectedVector, viewPos, interleaved_gradientNoise(), fresnel, false); + if (rtPos.z < 1.){ + vec3 previousPosition = mat3(gbufferModelViewInverse) * DH_toScreenSpace(rtPos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition; + previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz; + previousPosition.xy = projMAD(dhPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5; + if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) { + Reflections.a = 1.0; + Reflections.rgb = texture2D(colortex5, previousPosition.xy).rgb; + } + } + #endif + #ifdef WATER_BACKGROUND_SPECULAR + BackgroundReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0; + #endif + #ifdef WATER_SUN_SPECULAR + SunReflection = Direct_lighting * GGX(normalize(normals), -normalize(viewPos), normalize(WsunVec2), roughness, f0) * (1.0 - Reflections.a); + #endif + Reflections_Final = mix(BackgroundReflection, Reflections.rgb, Reflections.a) * fresnel; + Reflections_Final += SunReflection; + + //correct alpha channel with fresnel + float alpha0 = gl_FragData[0].a; + + gl_FragData[0].a = -gl_FragData[0].a * fresnel + gl_FragData[0].a + fresnel; + + // prevent reflections from being darkened by buffer blending + gl_FragData[0].rgb = clamp(FinalColor / gl_FragData[0].a*alpha0*(1.0-fresnel) * 0.1 + Reflections_Final / gl_FragData[0].a * 0.1,0.0,65100.0); + + if (gl_FragData[0].r > 65000.) gl_FragData[0].rgba = vec4(0.0); + #else + gl_FragData[0].rgb = FinalColor*0.1; + #endif + + #ifdef DH_OVERDRAW_PREVENTION + float distancefade = min(max(1.0 - length(playerPos)/max(far-16*4,16),0.0)*5,1.0); + + if(texture2D(depthtex1, gl_FragCoord.xy*texelSize).x < 1.0 || distancefade > 0.0){ gl_FragData[0].a = 0.0; material = 0.0; } + #endif - #if DEBUG_VIEW == debug_DH_WATER_BLENDING if(gl_FragCoord.x*texelSize.x > 0.53) gl_FragData[0] = vec4(0.0); diff --git a/shaders/dimensions/all_particles.fsh b/shaders/dimensions/all_particles.fsh index 5326e26..849071f 100644 --- a/shaders/dimensions/all_particles.fsh +++ b/shaders/dimensions/all_particles.fsh @@ -1,8 +1,14 @@ #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; varying vec4 color; +flat varying float exposure; #ifdef LINES flat varying int SELECTION_BOX; @@ -29,6 +35,10 @@ uniform int isEyeInWater; uniform sampler2D texture; uniform sampler2D noisetex; uniform sampler2D colortex4; +#ifdef IS_LPV_ENABLED + uniform sampler3D texLpv1; + uniform sampler3D texLpv2; +#endif uniform mat4 gbufferProjectionInverse; @@ -56,6 +66,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" @@ -100,6 +118,135 @@ float encodeVec2(float x,float y){ } + +// #undef BASIC_SHADOW_FILTER +#ifdef OVERWORLD_SHADER +float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDistFade){ + + if(maxDistFade <= 0.0) return 1.0; + + // setup shadow projection + vec3 projectedShadowPosition = mat3(shadowModelView) * playerPos + shadowModelView[3].xyz; + projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; + + // un-distort + #ifdef DISTORT_SHADOWMAP + float distortFactor = calcDistort(projectedShadowPosition.xy); + projectedShadowPosition.xy *= distortFactor; + #else + float distortFactor = 1.0; + #endif + + // hamburger + projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5); + + float shadowmap = 0.0; + vec3 translucentTint = vec3(0.0); + + #ifdef TRANSLUCENT_COLORED_SHADOWS + + // determine when opaque shadows are overlapping translucent shadows by getting the difference of opaque depth and translucent depth + float shadowDepthDiff = pow(clamp((shadow2D(shadowtex1, projectedShadowPosition).x - projectedShadowPosition.z) * 2.0,0.0,1.0),2.0); + + // get opaque shadow data to get opaque data from translucent shadows. + float opaqueShadow = shadow2D(shadowtex0, projectedShadowPosition).x; + shadowmap += max(opaqueShadow, shadowDepthDiff); + + // get translucent shadow data + vec4 translucentShadow = texture2D(shadowcolor0, projectedShadowPosition.xy); + + // this curve simply looked the nicest. it has no other meaning. + float shadowAlpha = pow(1.0 - pow(translucentShadow.a,5.0),0.2); + + // normalize the color to remove luminance, and keep the hue. remove all opaque color. + // mulitply shadow alpha to shadow color, but only on surfaces facing the lightsource. this is a tradeoff to protect subsurface scattering's colored shadow tint from shadow bias on the back of the caster. + translucentShadow.rgb = max(normalize(translucentShadow.rgb + 0.0001), max(opaqueShadow, 1.0-shadowAlpha)) * shadowAlpha; + + // make it such that full alpha areas that arent in a shadow have a value of 1.0 instead of 0.0 + translucentTint += mix(translucentShadow.rgb, vec3(1.0), opaqueShadow*shadowDepthDiff); + + #else + shadowmap += shadow2D(shadow, projectedShadowPosition).x; + #endif + + #ifdef TRANSLUCENT_COLORED_SHADOWS + // tint the lightsource color with the translucent shadow color + directLightColor *= mix(vec3(1.0), translucentTint.rgb, maxDistFade); + #endif + + return mix(1.0, shadowmap, maxDistFade); +} +#endif + +#if defined DAMAGE_BLOCK_EFFECT && defined POM +#extension GL_ARB_shader_texture_lod : enable + +mat3 inverseMatrix(mat3 m) { + float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2]; + float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2]; + float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2]; + + float b01 = a22 * a11 - a12 * a21; + float b11 = -a22 * a10 + a12 * a20; + float b21 = a21 * a10 - a11 * a20; + + float det = a00 * b01 + a01 * b11 + a02 * b21; + + return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11), + b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10), + b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det; +} +const float MAX_OCCLUSION_DISTANCE = MAX_DIST; +const float MIX_OCCLUSION_DISTANCE = MAX_DIST*0.9; +const int MAX_OCCLUSION_POINTS = MAX_ITERATIONS; + +varying vec4 vtexcoordam; // .st for add, .pq for mul +varying vec4 vtexcoord; + +vec2 dcdx = dFdx(vtexcoord.st*vtexcoordam.pq)*exp2(Texture_MipMap_Bias); +vec2 dcdy = dFdy(vtexcoord.st*vtexcoordam.pq)*exp2(Texture_MipMap_Bias); + + +#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) +#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) + +uniform mat4 gbufferProjection; + +vec3 toClipSpace3(vec3 viewSpacePosition) { + return projMAD(gbufferProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5; +} + + flat varying vec3 WsunVec2; +const float mincoord = 1.0/4096.0; +const float maxcoord = 1.0-mincoord; + + uniform sampler2D normals; + varying vec4 tangent; + varying vec4 normalMat; + + vec4 readNormal(in vec2 coord) + { + return texture2DGradARB(normals,fract(coord)*vtexcoordam.pq+vtexcoordam.st,dcdx,dcdy); + } + vec4 readTexture(in vec2 coord) + { + return texture2DGradARB(texture,fract(coord)*vtexcoordam.pq+vtexcoordam.st,dcdx,dcdy); + } +#endif +uniform float near; +// uniform float far; +float ld(float dist) { + return (2.0 * near) / (far + near - dist * (far - near)); +} + +vec3 texture2D_POMSwitch( + sampler2D sampler, + vec2 lightmapCoord, + vec4 dcdxdcdy +){ + return texture2DGradARB(sampler, lightmapCoord, dcdxdcdy.xy, dcdxdcdy.zw).rgb; +} + //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// @@ -114,6 +261,73 @@ float encodeVec2(float x,float y){ void main() { +#ifdef DAMAGE_BLOCK_EFFECT + vec2 adjustedTexCoord = lmtexcoord.xy; + #ifdef POM + vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(0.0)); + vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition; + + vec3 normal = normalMat.xyz; + vec3 tangent2 = normalize(cross(tangent.rgb,normal)*tangent.w); + mat3 tbnMatrix = mat3(tangent.x, tangent2.x, normal.x, + tangent.y, tangent2.y, normal.y, + tangent.z, tangent2.z, normal.z); + + adjustedTexCoord = fract(vtexcoord.st)*vtexcoordam.pq+vtexcoordam.st; + vec3 viewVector = normalize(tbnMatrix*fragpos); + + float dist = length(fragpos); + + float maxdist = MAX_OCCLUSION_DISTANCE; + + // float depth = gl_FragCoord.z; + if (dist < maxdist) { + + float depthmap = readNormal(vtexcoord.st).a; + float used_POM_DEPTH = 1.0; + + if ( viewVector.z < 0.0 && depthmap < 0.9999 && depthmap > 0.00001) { + + #ifdef Adaptive_Step_length + vec3 interval = (viewVector.xyz /-viewVector.z/MAX_OCCLUSION_POINTS * POM_DEPTH) * clamp(1.0-pow(depthmap,2),0.1,1.0); + used_POM_DEPTH = 1.0; + #else + vec3 interval = viewVector.xyz/-viewVector.z/ MAX_OCCLUSION_POINTS*POM_DEPTH; + #endif + vec3 coord = vec3(vtexcoord.st, 1.0); + + coord += interval * used_POM_DEPTH; + + float sumVec = 0.5; + for (int loopCount = 0; (loopCount < MAX_OCCLUSION_POINTS) && (1.0 - POM_DEPTH + POM_DEPTH * readNormal(coord.st).a ) < coord.p && coord.p >= 0.0; ++loopCount) { + coord = coord + interval * used_POM_DEPTH; + sumVec += used_POM_DEPTH; + } + + if (coord.t < mincoord) { + if (readTexture(vec2(coord.s,mincoord)).a == 0.0) { + coord.t = mincoord; + discard; + } + } + + adjustedTexCoord = mix(fract(coord.st)*vtexcoordam.pq+vtexcoordam.st, adjustedTexCoord, max(dist-MIX_OCCLUSION_DISTANCE,0.0)/(MAX_OCCLUSION_DISTANCE-MIX_OCCLUSION_DISTANCE)); + + // vec3 truePos = fragpos + sumVec*inverseMatrix(tbnMatrix)*interval; + + // depth = toClipSpace3(truePos).z; + } + } + + vec3 Albedo = toLinear(texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy))); + #else + vec3 Albedo = toLinear(texture2D(texture, adjustedTexCoord.xy).rgb); + #endif + + gl_FragData[0] = vec4(encodeVec2(vec2(0.5)), encodeVec2(Albedo.rg), encodeVec2(vec2(Albedo.b,0.02)), 1.0); +#endif + +#if !defined DAMAGE_BLOCK_EFFECT #ifdef LINES #ifndef SELECT_BOX if(SELECTION_BOX > 0) discard; @@ -127,8 +341,9 @@ void main() { vec4 TEXTURE = texture2D(texture, lmtexcoord.xy)*color; - - + #ifdef WhiteWorld + TEXTURE.rgb = vec3(0.5); + #endif vec3 Albedo = toLinear(TEXTURE.rgb); @@ -142,104 +357,77 @@ void main() { lightmap.x = max(lightmap.x, HELD_ITEM_BRIGHTNESS * clamp( pow(max(1.0-length(viewPos)/HANDHELD_LIGHT_RANGE,0.0),1.5),0.0,1.0)); #endif - - #ifdef WEATHER gl_FragData[1].a = TEXTURE.a; // for bloomy rain and stuff #endif - -#ifndef WEATHER - #ifndef LINES - gl_FragData[0].a = TEXTURE.a; - #else - gl_FragData[0].a = 1.0; - #endif - #ifndef BLOOMY_PARTICLES - gl_FragData[1].a = 0.0; // for bloomy rain and stuff - #endif - - vec3 Direct_lighting = vec3(0.0); - vec3 Indirect_lighting = vec3(0.0); - - vec3 MinimumLightColor = vec3(1.0); - if(isEyeInWater == 1) MinimumLightColor = vec3(10.0); - - vec3 Torch_Color = vec3(TORCH_R,TORCH_G,TORCH_B); - - - if(lightmap.x >= 0.9) Torch_Color *= LIT_PARTICLE_BRIGHTNESS; - - #ifdef OVERWORLD_SHADER - vec3 Shadows = vec3(1.0); - - vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; - vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz; - projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; - - //apply distortion - #ifdef DISTORT_SHADOWMAP - float distortFactor = calcDistort(projectedShadowPosition.xy); - projectedShadowPosition.xy *= distortFactor; - #else - float distortFactor = 1.0; - #endif - - //do shadows only if on shadow map - if (abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution){ - Shadows = vec3(0.0); - - projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5); - - #ifdef TRANSLUCENT_COLORED_SHADOWS - float opaqueShadow = shadow2D(shadowtex0, projectedShadowPosition).x; - Shadows += vec3(opaqueShadow); - - if(shadow2D(shadowtex1, projectedShadowPosition).x > projectedShadowPosition.z){ - vec4 translucentShadow = texture2D(shadowcolor0, projectedShadowPosition.xy); - if(translucentShadow.a < 0.9) Shadows += normalize(translucentShadow.rgb+0.0001) * (1.0-opaqueShadow); - } - #else - Shadows = vec3(shadow2D(shadow, projectedShadowPosition).x); - #endif - } - - float cloudShadow = GetCloudShadow(feetPlayerPos); - - Direct_lighting = (lightCol.rgb/80.0) * Shadows * cloudShadow; - - + #ifndef WEATHER #ifndef LINES - Direct_lighting *= phaseg(clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), 0.65)*2 + 0.5; + gl_FragData[0].a = TEXTURE.a; + #else + gl_FragData[0].a = 1.0; + #endif + #ifndef BLOOMY_PARTICLES + gl_FragData[1].a = 0.0; // for bloomy rain and stuff #endif - vec3 AmbientLightColor = (averageSkyCol_Clouds / 30.0) * 3.0; + vec3 Direct_lighting = vec3(0.0); + vec3 directLightColor = vec3(0.0); + + vec3 Indirect_lighting = vec3(0.0); + vec3 AmbientLightColor = vec3(0.0); + vec3 Torch_Color = vec3(TORCH_R,TORCH_G,TORCH_B); + vec3 MinimumLightColor = vec3(1.0); + + if(isEyeInWater == 1) MinimumLightColor = vec3(10.0); + if(lightmap.x >= 0.9) Torch_Color *= LIT_PARTICLE_BRIGHTNESS; + + #ifdef OVERWORLD_SHADER + directLightColor = lightCol.rgb/80.0; + float Shadows = 1.0; + + vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; + + float shadowMapFalloff = smoothstep(0.0, 1.0, min(max(1.0 - length(shadowPlayerPos) / (shadowDistance+16),0.0)*5.0,1.0)); + float shadowMapFalloff2 = smoothstep(0.0, 1.0, min(max(1.0 - length(shadowPlayerPos) / (shadowDistance+11),0.0)*5.0,1.0)); + + float LM_shadowMapFallback = min(max(lightmap.y-0.8, 0.0) * 25,1.0); + + Shadows = ComputeShadowMap(directLightColor, shadowPlayerPos, shadowMapFalloff); + + Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2); + + float cloudShadow = GetCloudShadow(feetPlayerPos); + + Direct_lighting = directLightColor * Shadows * cloudShadow; + + #ifndef LINES + Direct_lighting *= phaseg(clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), 0.65)*2 + 0.5; + #endif + + AmbientLightColor = averageSkyCol_Clouds / 30.0; + AmbientLightColor *= 2.5; + #endif + + #ifdef IS_LPV_ENABLED + vec3 lpvPos = GetLpvPosition(feetPlayerPos); + #else + const vec3 lpvPos = vec3(0.0); + #endif + + Indirect_lighting = DoAmbientLightColor(lpvPos, AmbientLightColor, MinimumLightColor, Torch_Color, clamp(lightmap.xy,0,1), exposure); + + #ifdef LINES + gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * toLinear(color.rgb); + #else + gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * Albedo; + #endif + + // distance fade targeting the world border... + if(TEXTURE.a < 0.7 && TEXTURE.a > 0.2) gl_FragData[0] *= clamp(1.0 - length(feetPlayerPos) / 100.0 ,0.0,1.0); + + gl_FragData[0].rgb *= 0.1; #endif - - #ifdef NETHER_SHADER - // vec3 AmbientLightColor = skyCloudsFromTexLOD2(vec3( 0, 1, 0), colortex4, 6).rgb / 15; - vec3 AmbientLightColor = vec3(0.1); - #endif - - #ifdef END_SHADER - vec3 AmbientLightColor = vec3(1.0); - #endif - - Indirect_lighting = DoAmbientLightColor(AmbientLightColor,MinimumLightColor, Torch_Color, clamp(lightmap.xy,0,1)); - - #ifdef LINES - gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * toLinear(color.rgb); - #else - gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * Albedo; - #endif - - #ifdef DAMAGE_BLOCK_EFFECT - - gl_FragData[0] = vec4(0.0, encodeVec2(TEXTURE.rg), encodeVec2(vec2(TEXTURE.b,0.0)), TEXTURE.a); - #endif - - // distance fade targeting the world border... - if(TEXTURE.a < 0.7 && TEXTURE.a > 0.2) gl_FragData[0] *= clamp(1.0 - length(feetPlayerPos) / 100.0 ,0.0,1.0); #endif } \ No newline at end of file diff --git a/shaders/dimensions/all_particles.vsh b/shaders/dimensions/all_particles.vsh index a04de5b..4756731 100644 --- a/shaders/dimensions/all_particles.vsh +++ b/shaders/dimensions/all_particles.vsh @@ -1,5 +1,6 @@ #include "/lib/settings.glsl" #include "/lib/res_params.glsl" +#include "/lib/items.glsl" /* !! DO NOT REMOVE !! @@ -10,6 +11,9 @@ Read the terms of modification and sharing before changing something below pleas varying vec4 lmtexcoord; varying vec4 color; +uniform sampler2D colortex4; + +flat varying float exposure; #ifdef LINES flat varying int SELECTION_BOX; @@ -19,11 +23,9 @@ varying vec4 color; flat varying vec3 averageSkyCol_Clouds; flat varying vec4 lightCol; flat varying vec3 WsunVec; - uniform sampler2D colortex4; #endif - uniform vec3 sunPosition; uniform float sunElevation; @@ -52,7 +54,22 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) vec4 toClipSpace3(vec3 viewSpacePosition) { return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),-viewSpacePosition.z); -} +} + + + + +#ifdef DAMAGE_BLOCK_EFFECT + varying vec4 vtexcoordam; // .st for add, .pq for mul + varying vec4 vtexcoord; + + attribute vec4 mc_midTexCoord; + varying vec4 tangent; + attribute vec4 at_tangent; + varying vec4 normalMat; + flat varying vec3 WsunVec2; +#endif + //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// @@ -61,15 +78,30 @@ vec4 toClipSpace3(vec3 viewSpacePosition) { void main() { +#ifdef DAMAGE_BLOCK_EFFECT + WsunVec2 = (float(sunElevation > 1e-5)*2.0 - 1.0)*normalize(mat3(gbufferModelViewInverse) * sunPosition); +#endif lmtexcoord.xy = (gl_MultiTexCoord0).xy; vec2 lmcoord = gl_MultiTexCoord1.xy / 240.0; // is this even correct? lol' lmtexcoord.zw = lmcoord; + #ifdef DAMAGE_BLOCK_EFFECT + vec2 midcoord = (gl_TextureMatrix[0] * mc_midTexCoord).st; + vec2 texcoordminusmid = lmtexcoord.xy-midcoord; + vtexcoordam.pq = abs(texcoordminusmid)*2; + vtexcoordam.st = min(lmtexcoord.xy,midcoord-texcoordminusmid); + vtexcoord.xy = sign(texcoordminusmid)*0.5+0.5; + + tangent = vec4(normalize(gl_NormalMatrix * at_tangent.rgb), at_tangent.w); + + normalMat = vec4(normalize(gl_NormalMatrix * gl_Normal), 1.0); + #endif + HELD_ITEM_BRIGHTNESS = 0.0; #ifdef Hand_Held_lights - if(heldItemId == 100 || heldItemId2 == 100) HELD_ITEM_BRIGHTNESS = 0.9; + if(heldItemId == ITEM_LIGHT_SOURCES || heldItemId2 == ITEM_LIGHT_SOURCES) HELD_ITEM_BRIGHTNESS = 0.9; #endif @@ -94,6 +126,8 @@ void main() { color = gl_Color; + + exposure = texelFetch2D(colortex4,ivec2(10,37),0).r; // color.rgb = worldpos; #ifdef LINES @@ -110,6 +144,7 @@ void main() { WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition); #endif + #ifndef WEATHER #ifdef TAA_UPSCALING gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w; diff --git a/shaders/dimensions/all_solid.fsh b/shaders/dimensions/all_solid.fsh index 4fab275..b2a24ad 100644 --- a/shaders/dimensions/all_solid.fsh +++ b/shaders/dimensions/all_solid.fsh @@ -280,12 +280,10 @@ vec4 texture2D_POMSwitch( //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// -varying vec3 pos; - -#ifdef HAND - /* RENDERTARGETS: 1,7,8,15,2 */ +#if defined HAND || defined ENTITIES + /* RENDERTARGETS:1,7,8,15,2 */ #else - /* RENDERTARGETS: 1,7,8,15 */ + /* RENDERTARGETS:1,7,8,15 */ #endif void main() { @@ -312,19 +310,9 @@ void main() { vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0)); vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition; - // #if defined DH_OVERDRAW_PREVENTION && defined DISTANT_HORIZONS - // // overdraw prevention - // if(clamp(1.0-length(pos.xyz)/max(far - 16.0 * sqrt(interleaved_gradientNoise_temporal()),0.0),0.0,1.0) <= 0.0 ){ - // discard; - // return; - // } - // #endif - float torchlightmap = lmtexcoord.z; #ifdef Hand_Held_lights - - if(HELD_ITEM_BRIGHTNESS > 0.0) torchlightmap = max(torchlightmap, HELD_ITEM_BRIGHTNESS * clamp( pow(max(1.0-length(fragpos)/HANDHELD_LIGHT_RANGE,0.0),1.5),0.0,1.0)); #ifdef HAND @@ -365,7 +353,7 @@ void main() { float used_POM_DEPTH = 1.0; if ( viewVector.z < 0.0 && depthmap < 0.9999 && depthmap > 0.00001) { - float noise = blueNoise(); + // float noise = blueNoise(); #ifdef Adaptive_Step_length vec3 interval = (viewVector.xyz /-viewVector.z/MAX_OCCLUSION_POINTS * POM_DEPTH) * clamp(1.0-pow(depthmap,2),0.1,1.0); used_POM_DEPTH = 1.0; @@ -374,9 +362,9 @@ void main() { #endif vec3 coord = vec3(vtexcoord.st , 1.0); - coord += interval * noise * used_POM_DEPTH; + coord += interval * used_POM_DEPTH; - float sumVec = noise; + float sumVec = 0.5; for (int loopCount = 0; (loopCount < MAX_OCCLUSION_POINTS) && (1.0 - POM_DEPTH + POM_DEPTH * readNormal(coord.st).a ) < coord.p && coord.p >= 0.0; ++loopCount) { coord = coord + interval * used_POM_DEPTH; sumVec += used_POM_DEPTH; @@ -392,13 +380,11 @@ void main() { adjustedTexCoord = mix(fract(coord.st)*vtexcoordam.pq+vtexcoordam.st, adjustedTexCoord, max(dist-MIX_OCCLUSION_DISTANCE,0.0)/(MAX_OCCLUSION_DISTANCE-MIX_OCCLUSION_DISTANCE)); vec3 truePos = fragpos + sumVec*inverseMatrix(tbnMatrix)*interval; - // #ifdef Depth_Write_POM - gl_FragDepth = toClipSpace3(truePos).z; - // #endif + + gl_FragDepth = toClipSpace3(truePos).z; } } #endif - if(!ifPOM) adjustedTexCoord = lmtexcoord.xy; @@ -408,7 +394,6 @@ void main() { float textureLOD = bias(); vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD) * color; - #if defined HAND if (Albedo.a < 0.1) discard; #endif @@ -427,22 +412,26 @@ void main() { #ifdef AEROCHROME_MODE float gray = dot(Albedo.rgb, vec3(0.2, 1.0, 0.07)); - if(blockID == 10001 || blockID == 10003 || blockID == 10004 || blockID == 10006 || blockID == 10009) { - // IR Reflective (Pink-red) + if ( + blockID == BLOCK_AMETHYST_BUD_MEDIUM || blockID == BLOCK_AMETHYST_BUD_LARGE || blockID == BLOCK_AMETHYST_CLUSTER || + blockID == BLOCK_SSS_STRONG || blockID == BLOCK_SSS_WEAK || + blockID >= 10 && blockId < 80 + ) { + // IR Reflective (Pink-red) Albedo.rgb = mix(vec3(gray), aerochrome_color, 0.7); } - else if(blockID == 10008) { + else if(blockID == BLOCK_GRASS) { // Special handling for grass block float strength = 1.0 - color.b; Albedo.rgb = mix(Albedo.rgb, aerochrome_color, strength); } #ifdef AEROCHROME_WOOL_ENABLED - else if(blockID == 200) { + else if(blockID == BLOCK_SSS_WEAK_2) { // Wool Albedo.rgb = mix(Albedo.rgb, aerochrome_color, 0.3); } #endif - else if(blockID == 8 || blockID == 10002) + else if(blockID == BLOCK_WATER || (blockID >= 300 && blockID < 400)) { // IR Absorbsive? Dark. Albedo.rgb = mix(Albedo.rgb, vec3(0.01, 0.08, 0.15), 0.5); @@ -458,10 +447,14 @@ void main() { if (Albedo.a > 0.1){ Albedo.a = 0.75; gl_FragData[4].a = 0.0; - } else Albedo.a = 1.0; - + } else { + Albedo.a = 1.0; + } #endif + #ifdef ENTITIES + gl_FragData[4].a = 0.0; + #endif //////////////////////////////// //////////////////////////////// //////////////////////////////// NORMAL //////////////////////////////// @@ -479,15 +472,14 @@ void main() { NormalTex.xy = NormalTex.xy * 2.0-1.0; NormalTex.z = sqrt(max(1.0 - dot(NormalTex.xy, NormalTex.xy), 0.0)); - #if defined HEIGTHMAP_DEPTH_OFFSET && !defined HAND - gl_FragDepth = gl_FragCoord.z; - vec3 truePos = fragpos; - truePos.z -= Heightmap * POM_DEPTH * (1.0 + ld(truePos.z)); + // #if defined HEIGTHMAP_DEPTH_OFFSET && !defined HAND + // gl_FragDepth = gl_FragCoord.z; + // vec3 truePos = fragpos; + // truePos.z -= Heightmap * POM_DEPTH * (1.0 + ld(truePos.z)); - gl_FragDepth = toClipSpace3(truePos).z; - #endif + // gl_FragDepth = toClipSpace3(truePos).z; + // #endif - normal = applyBump(tbnMatrix, NormalTex.xyz, mix(1.0,1-Puddle_shape,rainfall) ); // normal = applyBump(tbnMatrix, NormalTex.xyz, 0.0); #endif @@ -568,10 +560,6 @@ void main() { // apply noise to lightmaps to reduce banding. vec2 PackLightmaps = vec2(torchlightmap, lmtexcoord.w); - #if !defined ENTITIES && !defined HAND - // PackLightmaps = clamp(PackLightmaps*blueNoise()*0.05 + PackLightmaps,0.0,1.0); - #endif - vec4 data1 = clamp( encode(viewToWorld(normal), PackLightmaps), 0.0, 1.0); // gl_FragData[0] = vec4(.0); gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w,Albedo.w)); diff --git a/shaders/dimensions/all_solid.vsh b/shaders/dimensions/all_solid.vsh index d4a4f85..29fce04 100644 --- a/shaders/dimensions/all_solid.vsh +++ b/shaders/dimensions/all_solid.vsh @@ -2,6 +2,9 @@ #include "/lib/settings.glsl" #include "/lib/res_params.glsl" #include "/lib/bokeh.glsl" +#include "/lib/blocks.glsl" +#include "/lib/entities.glsl" +#include "/lib/items.glsl" /* !! DO NOT REMOVE !! @@ -182,26 +185,18 @@ float luma(vec3 color) { //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// - -varying vec3 pos; void main() { gl_Position = ftransform(); - vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; - pos = position; - /////// ----- 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 ----- /////// // gl_TextureMatrix[0] for animated things like charged creepers lmtexcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; @@ -214,7 +209,8 @@ void main() { vtexcoord.xy = sign(texcoordminusmid)*0.5+0.5; // #endif - vec2 lmcoord = gl_MultiTexCoord1.xy / 255.0; // is this even correct? lol' + + vec2 lmcoord = gl_MultiTexCoord1.xy / 240.0; lmtexcoord.zw = lmcoord; @@ -229,17 +225,16 @@ void main() { blockID = mc_Entity.x; // velocity = at_velocity; - if(mc_Entity.x == 10009) normalMat.a = 0.60; + if(mc_Entity.x == BLOCK_GROUND_WAVING_VERTICAL || mc_Entity.x == BLOCK_GRASS_SHORT) normalMat.a = 0.60; PORTAL = 0; SIGN = 0; #ifdef WORLD - // disallow POM to work on signs. - if(blockEntityId == 2200) SIGN = 1; + if(blockEntityId == BLOCK_SIGN) SIGN = 1; - if(blockEntityId == 2100) PORTAL = 1; + if(blockEntityId == BLOCK_END_PORTAL) PORTAL = 1; #endif NameTags = 0; @@ -247,71 +242,79 @@ void main() { #ifdef ENTITIES // disallow POM to work on item frames. - if(entityId == 2300) SIGN = 1; + if(entityId == ENTITY_ITEM_FRAME) SIGN = 1; // try and single out nametag text and then discard nametag background // if( dot(gl_Color.rgb, vec3(1.0/3.0)) < 1.0) NameTags = 1; // if(gl_Color.a < 1.0) NameTags = 1; // if(gl_Color.a >= 0.24 && gl_Color.a <= 0.25 ) gl_Position = vec4(10,10,10,1); - - if(entityId == 1100 || entityId == 1200 || entityId == 2468) normalMat.a = 0.45; + if(entityId == ENTITY_SSS_MEDIUM || entityId == ENTITY_SSS_WEAK || entityId == ENTITY_PLAYER || entityId == 2468) normalMat.a = 0.45; #endif - if(mc_Entity.x == 10003) normalMat.a = 0.55; + if(mc_Entity.x == BLOCK_AIR_WAVING) normalMat.a = 0.55; /////// ----- EMISSIVE STUFF ----- /////// - EMISSIVE = 0.0; - LIGHTNING = 0; + EMISSIVE = 0.0; + LIGHTNING = 0; // if(NameTags > 0) EMISSIVE = 0.9; // normal block lightsources - if(mc_Entity.x == 10005) EMISSIVE = 0.5; + if(mc_Entity.x >= 100 && mc_Entity.x < 300) EMISSIVE = 0.5; // special cases light lightning and beacon beams... #ifdef ENTITIES - if(entityId == 12345){ + if(entityId == ENTITY_LIGHTNING){ LIGHTNING = 1; normalMat.a = 0.50; } #endif /////// ----- SSS STUFF ----- /////// - SSSAMOUNT = 0.0; + SSSAMOUNT = 0.0; HELD_ITEM_BRIGHTNESS = 0.0; #ifdef Hand_Held_lights - if(heldItemId == 100 || heldItemId2 == 100) HELD_ITEM_BRIGHTNESS = 0.9; +if(heldItemId == ITEM_LIGHT_SOURCES || heldItemId2 == ITEM_LIGHT_SOURCES) HELD_ITEM_BRIGHTNESS = 0.9; #endif #ifdef WORLD - - /////// ----- SSS ON BLOCKS ----- /////// // strong - if(mc_Entity.x == 10001 || mc_Entity.x == 10003 || mc_Entity.x == 10004 || mc_Entity.x == 10009) SSSAMOUNT = 1.0; - + if ( + mc_Entity.x == BLOCK_GROUND_WAVING || mc_Entity.x == BLOCK_GROUND_WAVING_VERTICAL || mc_Entity.x == BLOCK_AIR_WAVING || + mc_Entity.x == BLOCK_GRASS_SHORT || mc_Entity.x == BLOCK_GRASS_TALL_UPPER || mc_Entity.x == BLOCK_GRASS_TALL_LOWER || + mc_Entity.x == BLOCK_SSS_STRONG || mc_Entity.x == BLOCK_SAPLING + ) { + SSSAMOUNT = 1.0; + } + // medium - if(mc_Entity.x == 10006 || mc_Entity.x == 200) SSSAMOUNT = 0.75; - + if ( + mc_Entity.x == BLOCK_SSS_WEAK || mc_Entity.x == BLOCK_SSS_WEAK_2 || + mc_Entity.x == BLOCK_AMETHYST_BUD_MEDIUM || mc_Entity.x == BLOCK_AMETHYST_BUD_LARGE || mc_Entity.x == BLOCK_AMETHYST_CLUSTER || + mc_Entity.x == BLOCK_BAMBOO || mc_Entity.x == BLOCK_SAPLING || mc_Entity.x == BLOCK_VINE + ) { + SSSAMOUNT = 0.75; + } // low #ifdef MISC_BLOCK_SSS - if(mc_Entity.x == 10007 || mc_Entity.x == 10008) SSSAMOUNT = 0.5; // weird SSS on blocks like grass and stuff + if(mc_Entity.x == BLOCK_SSS_WEIRD || mc_Entity.x == BLOCK_GRASS) SSSAMOUNT = 0.5; // weird SSS on blocks like grass and stuff #endif #ifdef ENTITIES #ifdef MOB_SSS /////// ----- SSS ON MOBS----- /////// // strong - if(entityId == 1100) SSSAMOUNT = 0.75; + if(entityId == ENTITY_SSS_MEDIUM) SSSAMOUNT = 0.75; // medium // low - if(entityId == 1200) SSSAMOUNT = 0.3; + if(entityId == ENTITY_SSS_WEAK || entityId == ENTITY_PLAYER) SSSAMOUNT = 0.3; #endif #endif @@ -320,7 +323,7 @@ void main() { // strong // medium - if(blockEntityId == 10010) SSSAMOUNT = 0.4; + if(blockEntityId == BLOCK_SSS_WEAK_3) SSSAMOUNT = 0.4; // low @@ -330,21 +333,25 @@ void main() { #ifdef WAVY_PLANTS bool istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t; - if ((mc_Entity.x == 10001 || mc_Entity.x == 10009) && istopv && abs(position.z) < 64.0) { - vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz + cameraPosition; + if ( + ( + mc_Entity.x == BLOCK_GROUND_WAVING || mc_Entity.x == BLOCK_GROUND_WAVING_VERTICAL || + mc_Entity.x == BLOCK_GRASS_SHORT || mc_Entity.x == BLOCK_GRASS_TALL_UPPER || + mc_Entity.x == BLOCK_SAPLING + ) && istopv && abs(position.z) < 64.0 + ) { + vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz + cameraPosition; worldpos.xyz += calcMovePlants(worldpos.xyz)*lmtexcoord.w - cameraPosition; position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz; } - if (mc_Entity.x == 10003 && abs(position.z) < 64.0) { + if (mc_Entity.x == BLOCK_AIR_WAVING && abs(position.z) < 64.0) { vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz + cameraPosition; worldpos.xyz += calcMoveLeaves(worldpos.xyz, 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))*lmtexcoord.w - cameraPosition; position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz; } #endif - gl_Position = toClipSpace3(position); - #endif #if defined Seasons && defined WORLD && !defined ENTITIES && !defined BLOCKENTITIES && !defined HAND diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index 1e8a449..c1087fd 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -1,8 +1,14 @@ #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; varying vec4 color; +uniform vec4 entityColor; #ifdef OVERWORLD_SHADER const bool shadowHardwareFiltering = true; @@ -21,14 +27,7 @@ varying vec4 color; flat varying vec4 lightCol; #endif -#ifdef BLOCKENTITIES - #undef WATER_REFLECTIONS -#endif -#ifdef ENTITIES - #undef WATER_BACKGROUND_SPECULAR - #undef SCREENSPACE_REFLECTIONS -#endif flat varying float HELD_ITEM_BRIGHTNESS; @@ -36,21 +35,31 @@ const bool colortex4MipmapEnabled = true; uniform sampler2D noisetex; uniform sampler2D depthtex1; uniform sampler2D depthtex0; +#ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex1; +#endif +uniform sampler2D colortex7; uniform sampler2D colortex12; uniform sampler2D colortex14; uniform sampler2D colortex5; +uniform sampler2D colortex6; uniform sampler2D texture; uniform sampler2D specular; uniform sampler2D normals; +#ifdef IS_LPV_ENABLED + uniform sampler3D texLpv1; + uniform sampler3D texLpv2; +#endif + varying vec4 tangent; varying vec4 normalMat; varying vec3 binormal; varying vec3 flatnormal; +flat varying float exposure; uniform vec3 sunVec; @@ -97,27 +106,29 @@ uniform vec3 nsunColor; #include "/lib/end_fog.glsl" #endif -#include "/lib/diffuse_lighting.glsl" +#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(){ return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); } -float R2_dither(){ - vec2 alpha = vec2(0.75487765, 0.56984026); - return fract(alpha.x * gl_FragCoord.x + alpha.y * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter) ; +float interleaved_gradientNoise_temporal(){ + return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521); } float interleaved_gradientNoise(){ - vec2 coord = gl_FragCoord.xy + (frameCounter%40000); - // vec2 coord = gl_FragCoord.xy + frameTimeCounter; - // vec2 coord = gl_FragCoord.xy; - float noise = fract( 52.9829189 * fract( (coord.x * 0.06711056) + (coord.y * 0.00583715)) ); - return noise ; -} -float interleaved_gradientNoise(float temporal){ vec2 coord = gl_FragCoord.xy; - float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y)+temporal); + float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y)); return noise; } +float R2_dither(){ + vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; + vec2 alpha = vec2(0.75487765, 0.56984026); + return fract(alpha.x * coord.x + alpha.y * coord.y ) ; +} const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), vec2(-1.,3.)/8., @@ -134,35 +145,26 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), -#define PW_DEPTH 1.0 //[0.5 1.0 1.5 2.0 2.5 3.0] -#define PW_POINTS 1 //[2 4 6 8 16 32] +#define PW_DEPTH 1.5 //[0.5 1.0 1.5 2.0 2.5 3.0] +#define PW_POINTS 2 //[2 4 6 8 16 32] varying vec3 viewVector; vec3 getParallaxDisplacement(vec3 posxz) { vec3 parallaxPos = posxz; - vec2 vec = viewVector.xy * (1.0 / float(PW_POINTS)) * 22.0; - float waterHeight = getWaterHeightmap(posxz.xz); - parallaxPos.xz += waterHeight * vec; + vec2 vec = viewVector.xy * (1.0 / float(PW_POINTS)) * 22.0 * PW_DEPTH; + // float waterHeight = (1.0 - (getWaterHeightmap(posxz.xz)*0.5+0.5)) * 2.0 - 1.0; + float waterHeight = getWaterHeightmap(posxz.xz) * 2.0; + parallaxPos.xz -= waterHeight * vec; return parallaxPos; } -// vec3 getParallaxDisplacement(vec3 posxz,float bumpmult,vec3 viewVec) { - -// vec3 parallaxPos = posxz; -// vec2 vec = viewVector.xy * (1.0 / float(PW_POINTS)) * 22.0 * PW_DEPTH; -// float waterHeight = getWaterHeightmap(posxz.xz) ; - -// parallaxPos.xz += waterHeight * vec; - -// return parallaxPos; - -// } vec3 applyBump(mat3 tbnMatrix, vec3 bump, float puddle_values){ - float bumpmult = 1; + float bumpmult = puddle_values; bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult); + // return normalize(bump*tbnMatrix); } @@ -259,12 +261,8 @@ vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater) // decode depth buffer // float sp = sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4),0).w/65000.0); - #ifdef HAND - vec2 testthing = spos.xy*texelSize; // fix for ssr on hand - #else - vec2 testthing = spos.xy/texelSize/4.0; - #endif - float sp = sqrt((texelFetch2D(colortex4,ivec2(testthing),0).a)/65000.0); + + float sp = sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4.0),0).a/65000.0); sp = invLinZ(sp); if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy/RENDER_SCALE,sp); @@ -283,8 +281,8 @@ vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater) return vec3(1.1); } -vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) { - r = pow(r,2.5); +float GGX(vec3 n, vec3 v, vec3 l, float r, float f0) { + r = max(pow(r,2.5), 0.0001); vec3 h = l + v; float hn = inversesqrt(dot(h, h)); @@ -294,94 +292,202 @@ vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) { float dotNL = clamp(dot(n,l),0.,1.); float dotNHsq = dotNH*dotNH; - float denom = dotNHsq * r - dotNHsq + 1.0; + float denom = dotNHsq * r - dotNHsq + 1.; float D = r / (3.141592653589793 * denom * denom); - vec3 F = 0.2 + (1. - F0) * exp2((-5.55473*dotLH-6.98316)*dotLH); + + float F = f0 + (1. - f0) * exp2((-5.55473*dotLH-6.98316)*dotLH); float k2 = .25 * r; return dotNL * D * F / (dotLH*dotLH*(1.0-k2)+k2); } + uniform float dhFarPlane; #include "/lib/DistantHorizons_projections.glsl" -//////////////////////////////VOID MAIN////////////////////////////// -//////////////////////////////VOID MAIN////////////////////////////// -//////////////////////////////VOID MAIN////////////////////////////// -//////////////////////////////VOID MAIN////////////////////////////// -//////////////////////////////VOID MAIN////////////////////////////// -float darkSpecularHighlight(vec3 playerPos, vec3 normal, float roughness, float f0){ - roughness = max(pow(1.0 - roughness, 2.0),0.002); - float distanceFalloff = clamp( exp(-7.0 * (length(playerPos) / 16.0)) ,0.0,1.0); - float NdotP = clamp(1.0 + dot(normal, normalize(playerPos)),0.0,1.0); +// #undef BASIC_SHADOW_FILTER - float specularHighlight = exp( -(1.0 / roughness) * NdotP ) * f0; +#ifdef OVERWORLD_SHADER +float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDistFade, float noise){ - return specularHighlight * distanceFalloff; + if(maxDistFade <= 0.0) return 1.0; + + // setup shadow projection + vec3 projectedShadowPosition = mat3(shadowModelView) * playerPos + shadowModelView[3].xyz; + projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; + + // un-distort + #ifdef DISTORT_SHADOWMAP + float distortFactor = calcDistort(projectedShadowPosition.xy); + projectedShadowPosition.xy *= distortFactor; + #else + float distortFactor = 1.0; + #endif + + // hamburger + projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5); + + float shadowmap = 0.0; + vec3 translucentTint = vec3(0.0); + + #ifndef HAND + projectedShadowPosition.z -= 0.0001; + #endif + + #if defined ENTITIES + projectedShadowPosition.z -= 0.0002; + #endif + + #ifdef BASIC_SHADOW_FILTER + int samples = int(SHADOW_FILTER_SAMPLE_COUNT * 0.5); + float rdMul = 14.0*distortFactor*d0*k/shadowMapResolution; + + for(int i = 0; i < samples; i++){ + vec2 offsetS = tapLocation_simple(i, 7, 9, noise) *0.5; + projectedShadowPosition.xy += rdMul*offsetS; + #else + int samples = 1; + #endif + + + #ifdef TRANSLUCENT_COLORED_SHADOWS + + // determine when opaque shadows are overlapping translucent shadows by getting the difference of opaque depth and translucent depth + float shadowDepthDiff = pow(clamp((shadow2D(shadowtex1, projectedShadowPosition).x - projectedShadowPosition.z) * 2.0,0.0,1.0),2.0); + + // get opaque shadow data to get opaque data from translucent shadows. + float opaqueShadow = shadow2D(shadowtex0, projectedShadowPosition).x; + shadowmap += max(opaqueShadow, shadowDepthDiff); + + // get translucent shadow data + vec4 translucentShadow = texture2D(shadowcolor0, projectedShadowPosition.xy); + + // this curve simply looked the nicest. it has no other meaning. + float shadowAlpha = pow(1.0 - pow(translucentShadow.a,5.0),0.2); + + // normalize the color to remove luminance, and keep the hue. remove all opaque color. + // mulitply shadow alpha to shadow color, but only on surfaces facing the lightsource. this is a tradeoff to protect subsurface scattering's colored shadow tint from shadow bias on the back of the caster. + translucentShadow.rgb = max(normalize(translucentShadow.rgb + 0.0001), max(opaqueShadow, 1.0-shadowAlpha)) * shadowAlpha; + + // make it such that full alpha areas that arent in a shadow have a value of 1.0 instead of 0.0 + translucentTint += mix(translucentShadow.rgb, vec3(1.0), opaqueShadow*shadowDepthDiff); + + #else + shadowmap += shadow2D(shadow, projectedShadowPosition).x; + #endif + + #ifdef BASIC_SHADOW_FILTER + } + #endif + + #ifdef TRANSLUCENT_COLORED_SHADOWS + // tint the lightsource color with the translucent shadow color + directLightColor *= mix(vec3(1.0), translucentTint.rgb / samples, maxDistFade); + #endif + + return mix(1.0, shadowmap / samples, maxDistFade); } +#endif + +void convertHandDepth(inout float depth) { + float ndcDepth = depth * 2.0 - 1.0; + ndcDepth /= MC_HAND_DEPTH; + depth = ndcDepth * 0.5 + 0.5; +} +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// -uniform vec4 entityColor; /* RENDERTARGETS:2,7,11,14 */ + + void main() { if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) { + vec3 FragCoord = gl_FragCoord.xyz; + + #ifdef HAND + convertHandDepth(FragCoord.z); + #endif + vec2 tempOffset = offsets[framemod8]; + + vec3 viewPos = toScreenSpace(FragCoord*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5, 0.0)); + + vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos; - vec3 viewPos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0)); - - vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////// MATERIAL MASKS //////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// + float MATERIALS = normalMat.w; - //////////////////////////////// - //////////////////////////////// ALBEDO - //////////////////////////////// + // 1.0 = water mask + // 0.9 = entity mask + // 0.8 = reflective entities + // 0.7 = reflective blocks + // 0.1 = hand mask + #ifdef HAND + MATERIALS = 0.1; + #endif + // bool isHand = abs(MATERIALS - 0.1) < 0.01; + bool isWater = MATERIALS > 0.99; + bool isReflectiveEntity = abs(MATERIALS - 0.8) < 0.01; + bool isReflective = abs(MATERIALS - 0.7) < 0.01 || isWater || isReflectiveEntity; + bool isEntity = abs(MATERIALS - 0.9) < 0.01 || isReflectiveEntity; + +//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////// ALBEDO ///////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// gl_FragData[0] = texture2D(texture, lmtexcoord.xy, Texture_MipMap_Bias) * color; - - - vec3 Albedo = toLinear(gl_FragData[0].rgb); float UnchangedAlpha = gl_FragData[0].a; - - float iswater = normalMat.w; - - #ifdef HAND - iswater = 0.1; + + #ifdef WhiteWorld + gl_FragData[0].rgb = vec3(0.5); + gl_FragData[0].a = 1.0; #endif - #ifdef Vanilla_like_water - if (iswater > 0.95){ - Albedo *= sqrt(luma(Albedo)); - // Albedo = toLinear( gl_FragData[0].rgb * sqrt(luma(gl_FragData[0].rgb))); - } - #else - if (iswater > 0.95){ - Albedo = vec3(0.0); - gl_FragData[0].a = 1.0/255.0; - } + vec3 Albedo = toLinear(gl_FragData[0].rgb); + + #ifndef WhiteWorld + #ifdef Vanilla_like_water + if (isWater) Albedo *= sqrt(luma(Albedo)); + #else + if (isWater){ + Albedo = vec3(0.0); + gl_FragData[0].a = 1.0/255.0; + } + #endif #endif + #ifdef ENTITIES + Albedo.rgb = mix(Albedo.rgb, entityColor.rgb, clamp(entityColor.a*1.5,0,1)); + #endif - vec4 COLORTEST = vec4(Albedo, UnchangedAlpha); + vec4 GLASS_TINT_COLORS = vec4(Albedo, UnchangedAlpha); #ifdef BIOME_TINT_WATER - if (iswater > 0.95) COLORTEST.rgb = color.rgb; + if (isWater) GLASS_TINT_COLORS.rgb = toLinear(color.rgb); #endif +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////// NORMALS /////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// - //////////////////////////////// - //////////////////////////////// NORMAL - //////////////////////////////// - - vec3 normal = normalMat.xyz; + vec3 normal = normalMat.xyz; // in viewSpace + vec3 worldSpaceNormal = viewToWorld(normal).xyz; vec2 TangentNormal = vec2(0); // for refractions vec3 tangent2 = normalize(cross(tangent.rgb,normal)*tangent.w); @@ -389,40 +495,44 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) tangent.y, tangent2.y, normal.y, tangent.z, tangent2.z, normal.z); - vec4 NormalTex = texture2D(normals, lmtexcoord.xy, Texture_MipMap_Bias).rgba; - + vec3 NormalTex = vec3(texture2D(normals, lmtexcoord.xy, Texture_MipMap_Bias).xy,0.0); NormalTex.xy = NormalTex.xy*2.0-1.0; NormalTex.z = clamp(sqrt(1.0 - dot(NormalTex.xy, NormalTex.xy)),0.0,1.0) ; + + // tangent space normals for refraction TangentNormal = NormalTex.xy*0.5+0.5; - - normal = applyBump(tbnMatrix, NormalTex.xyz, 1.0); - #ifndef HAND - if (iswater > 0.95){ - vec3 posxz = feetPlayerPos + cameraPosition; + if (isWater){ + vec3 posxz = (mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz) + cameraPosition; + + // make the waves flow in the direction the water faces, except for perfectly up facing parts. + if(abs(worldSpaceNormal.y) < 0.9995) posxz.xz -= (posxz.y + frameTimeCounter*3 * WATER_WAVE_SPEED) * normalize(worldSpaceNormal.xz) ; - float bumpmult = 1.0; - - posxz.xyz = getParallaxDisplacement(posxz) ; - + posxz.xyz = getParallaxDisplacement(posxz); vec3 bump = normalize(getWaveNormal(posxz, false)); - TangentNormal = (bump.xy/3.0)*0.5+0.5; // tangent space normals for refraction - + float bumpmult = 10.0 * WATER_WAVE_STRENGTH; bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult); - normal = normalize(bump * tbnMatrix); + + NormalTex.xyz = bump; + + // tangent space normals for refraction + TangentNormal = (bump.xy/3.0)*0.5+0.5; } #endif - gl_FragData[2] = vec4(encodeVec2(TangentNormal), encodeVec2(COLORTEST.rg), encodeVec2(COLORTEST.ba), UnchangedAlpha); + normal = applyBump(tbnMatrix, NormalTex.xyz, 1.0); - vec3 WS_normal = viewToWorld(normal); - //////////////////////////////// - //////////////////////////////// DIFFUSE LIGHTING - //////////////////////////////// + gl_FragData[2] = vec4(encodeVec2(TangentNormal), encodeVec2(GLASS_TINT_COLORS.rg), encodeVec2(GLASS_TINT_COLORS.ba), 1.0); + +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////// DIFFUSE LIGHTING ////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// vec2 lightmap = lmtexcoord.zw; + + // lightmap.y = 1.0; #ifndef OVERWORLD_SHADER lightmap.y = 1.0; @@ -435,127 +545,62 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) vec3 Indirect_lighting = vec3(0.0); vec3 MinimumLightColor = vec3(1.0); if(isEyeInWater == 1) MinimumLightColor = vec3(10.0); + vec3 Direct_lighting = vec3(0.0); #ifdef OVERWORLD_SHADER + vec3 DirectLightColor = lightCol.rgb/80.0; float NdotL = clamp(dot(normal, normalize(WsunVec*mat3(gbufferModelViewInverse))),0.0,1.0); NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0); - vec3 Shadows = vec3(0.0); - bool inShadowmapBounds = false; + float Shadows = 1.0; - vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; + float shadowMapFalloff = smoothstep(0.0, 1.0, min(max(1.0 - length(feetPlayerPos) / (shadowDistance+16),0.0)*5.0,1.0)); + float shadowMapFalloff2 = smoothstep(0.0, 1.0, min(max(1.0 - length(feetPlayerPos) / shadowDistance,0.0)*5.0,1.0)); - // mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir); - // vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos_shadow + Custom_ViewMatrix[3].xyz; - vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz; - projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; + float LM_shadowMapFallback = min(max(lightmap.y-0.8, 0.0) * 25,1.0); - //apply distortion - #ifdef DISTORT_SHADOWMAP - float distortFactor = calcDistort(projectedShadowPosition.xy); - projectedShadowPosition.xy *= distortFactor; - #else - float distortFactor = 1.0; - #endif - - bool ShadowBounds = false; - if(shadowDistanceRenderMul > 0.0) ShadowBounds = length(feetPlayerPos_shadow) < max(shadowDistance - 20,0.0); - - if(shadowDistanceRenderMul < 0.0) ShadowBounds = abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0; + vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; - // sample shadows only if on shadow map - if(ShadowBounds){ - if (NdotL > 0.0){ - Shadows = vec3(0.0); - projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5); + Shadows = ComputeShadowMap(DirectLightColor, shadowPlayerPos, shadowMapFalloff, blueNoise()); - #ifndef HAND - #ifdef BASIC_SHADOW_FILTER - const float threshMul = max(2048.0/shadowMapResolution*shadowDistance/128.0,0.95); - float distortThresh = (sqrt(1.0-NdotL*NdotL)/NdotL+0.7)/distortFactor; - float diffthresh = distortThresh/6000.0*threshMul; + Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2); - float rdMul = 4.0/shadowMapResolution; - float noise = blueNoise(); + Shadows *= pow(GetCloudShadow(feetPlayerPos),3); - int SampleCount = 7; - for(int i = 0; i < SampleCount; i++){ - vec2 offsetS = tapLocation_simple(i, 7, 9, noise) * 0.5; - float weight = 1.0+(i+noise)*rdMul/9.0*shadowMapResolution; - - #ifdef TRANSLUCENT_COLORED_SHADOWS - vec3 shadowProjOffsets = projectedShadowPosition + vec3(rdMul*offsetS, -diffthresh*weight); - - float opaqueShadow = shadow2D(shadowtex0, shadowProjOffsets).x; - Shadows += vec3(opaqueShadow/SampleCount); - - if(shadow2D(shadowtex1, shadowProjOffsets).x > shadowProjOffsets.z){ - vec4 translucentShadow = texture2D(shadowcolor0, shadowProjOffsets.xy); - if(translucentShadow.a < 0.9) Shadows += (normalize(translucentShadow.rgb+0.0001) * clamp(1.0-opaqueShadow,0.0,1.0)) / SampleCount; - } - - #else - Shadows += vec3(shadow2D(shadow, projectedShadowPosition + vec3(rdMul*offsetS, -diffthresh*weight)).x / SampleCount); - #endif - - } - #else - - #ifdef TRANSLUCENT_COLORED_SHADOWS - projectedShadowPosition -= vec3(0.0,0.0,0.0001); - Shadows = vec3(shadow2D(shadowtex0, projectedShadowPosition ).x); - - if(shadow2D(shadowtex1, projectedShadowPosition).x > projectedShadowPosition.z){ - vec4 shadowLightColor = texture2D(shadowcolor0, projectedShadowPosition.xy); - if(shadowLightColor.a < 0.9) Shadows += normalize(shadowLightColor.rgb+0.0001); - } - #else - Shadows = vec3(shadow2D(shadow, projectedShadowPosition - vec3(0.0,0.0,0.0001)).x); - #endif - - #endif - - - - - #else - Shadows = vec3(shadow2D(shadow, projectedShadowPosition - vec3(0.0,0.0,0.0005)).x); - #endif - } - inShadowmapBounds = true; - } - - if(!inShadowmapBounds) Shadows = vec3(1.0); - - Shadows *= GetCloudShadow(feetPlayerPos); - - Direct_lighting = (lightCol.rgb/80.0) * NdotL * Shadows; + Direct_lighting = DirectLightColor * NdotL * Shadows; vec3 AmbientLightColor = averageSkyCol_Clouds/30.0; - vec3 ambientcoefs = WS_normal / dot(abs(WS_normal), vec3(1)); + + + // vec3 ambientcoefs = slopednormal / dot(abs(slopednormal), vec3(1.0)); + + // float SkylightDir = ambientcoefs.y*1.5; + // if(isGrass) SkylightDir = 1.25; + + // float skylight = max(pow(viewToWorld(FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.2 + (1.0-lightmap.y)*0.8) ; + + + vec3 ambientcoefs = worldSpaceNormal / dot(abs(worldSpaceNormal), vec3(1.0)); float SkylightDir = ambientcoefs.y*1.5; - float skylight = max(pow(viewToWorld(flatnormal).y*0.5+0.5,0.1) + SkylightDir, 0.25); + float skylight = max(pow(viewToWorld(flatnormal).y*0.5+0.5,0.1) + SkylightDir, 0.2); AmbientLightColor *= skylight; #endif #ifdef NETHER_SHADER - // vec3 AmbientLightColor = skyCloudsFromTexLOD2(WS_normal, colortex4, 6).rgb / 15.0; + // vec3 AmbientLightColor = skyCloudsFromTexLOD2(worldSpaceNormal, colortex4, 6).rgb / 15.0; // vec3 up = skyCloudsFromTexLOD2(vec3( 0, 1, 0), colortex4, 6).rgb/ 30.0; // vec3 down = skyCloudsFromTexLOD2(vec3( 0,-1, 0), colortex4, 6).rgb/ 30.0; - // up *= pow( max( WS_normal.y, 0), 2); - // down *= pow( max(-WS_normal.y, 0), 2); + // up *= pow( max( worldSpaceNormal.y, 0), 2); + // down *= pow( max(-worldSpaceNormal.y, 0), 2); // AmbientLightColor += up + down; vec3 AmbientLightColor = vec3(0.1); - #endif #ifdef END_SHADER - - float vortexBounds = clamp(vortexBoundRange - length(feetPlayerPos+cameraPosition), 0.0,1.0); vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition,vortexBounds); @@ -563,56 +608,91 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0; vec3 lightColors = LightSourceColors(vortexBounds, lightningflash); - float NdotL = clamp(dot(WS_normal, normalize(-lightPos))*0.5+0.5,0.0,1.0); + float NdotL = clamp(dot(worldSpaceNormal, normalize(-lightPos))*0.5+0.5,0.0,1.0); + NdotL *= NdotL; Direct_lighting = lightColors * endFogPhase(lightPos) * NdotL; vec3 AmbientLightColor = vec3(0.5,0.75,1.0) * 0.9 + 0.1; - 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); - - #ifdef ENTITIES - Albedo.rgb = mix(Albedo.rgb, entityColor.rgb, clamp(entityColor.a*1.5,0,1)); + AmbientLightColor *= clamp(1.5 + dot(worldSpaceNormal, normalize(feetPlayerPos))*0.5,0,2); #endif + #ifdef IS_LPV_ENABLED + vec3 lpvPos = GetLpvPosition(feetPlayerPos); + + #ifdef LPV_NORMAL_OFFSET + lpvPos += -0.5*worldSpaceNormal + viewToWorld(normal); + #else + lpvPos += 0.5*worldSpaceNormal; + #endif + #else + const vec3 lpvPos = vec3(0.0); + #endif + + Indirect_lighting = DoAmbientLightColor(lpvPos, AmbientLightColor, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy, exposure); + vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo; - - // #ifdef Glass_Tint - // FinalColor *= min(pow(gl_FragData[0].a,2.0),1.0); - // #endif - //////////////////////////////// - //////////////////////////////// SPECULAR - //////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////// SPECULAR LIGHTING ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////// + #ifdef DAMAGE_BLOCK_EFFECT #undef WATER_REFLECTIONS #endif + // #ifdef ENTITIES + // #undef WATER_BACKGROUND_SPECULAR + // #endif + + #ifndef OVERWORLD_SHADER + #undef WATER_SUN_SPECULAR + #endif + #ifdef WATER_REFLECTIONS vec2 SpecularTex = texture2D(specular, lmtexcoord.xy, Texture_MipMap_Bias).rg; - SpecularTex = (iswater > 0.0 && iswater < 0.9) && SpecularTex.r > 0.0 && SpecularTex.g < 0.9 ? SpecularTex : vec2(1.0,0.02); - - float roughness = max(pow(1.0-SpecularTex.r,2.0),0.05); - float f0 = SpecularTex.g; + // if nothing is chosen, no smoothness and no reflectance + vec2 specularValues = vec2(1.0, 0.0); - // roughness = 0.1; - // f0 = 0.1; + // hardcode specular values for select blocks like glass, water, and slime + if(isReflective) specularValues = vec2(1.0, 0.02); + + // detect if the specular texture is used, if it is, overwrite hardcoded values + if(SpecularTex.r > 0.0 && SpecularTex.g <= 1.0) specularValues = SpecularTex; + + float roughness = pow(1.0-specularValues.r,2.0); + float f0 = isReflective ? max(specularValues.g, 0.02) : specularValues.g; + + + #ifdef HAND + f0 = max(specularValues.g, 0.02); + #endif + + // specularValues = SpecularTex; + // f0 = 0.9; + // roughness = 0.0; + + vec3 Metals = f0 > 229.5/255.0 ? normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3) : vec3(1.0); + + // make sure zero alpha is not forced to be full alpha by fresnel on items with funny normal padding + if(UnchangedAlpha <= 0.0 && !isReflective) f0 = 0.0; + + + if (f0 > 0.0){ + + if(isReflective) f0 = max(f0, 0.02); - if (iswater > 0.0 && gl_FragData[0].a < 0.9999999){ vec3 Reflections_Final = vec3(0.0); vec4 Reflections = vec4(0.0); - vec3 SkyReflection = vec3(0.0); + vec3 BackgroundReflection = FinalColor; vec3 SunReflection = vec3(0.0); - - float indoors = clamp((lightmap.y-0.6)*5.0, 0.0,1.0); - - vec3 reflectedVector = reflect(normalize(viewPos), normal); + float indoors = pow(1.0-pow(1.0-min(max(lightmap.y-0.6,0.0)*3.0,1.0),0.5),2.0); + vec3 reflectedVector = reflect(normalize(viewPos), normal); float normalDotEye = dot(normal, normalize(viewPos)); + float fresnel = pow(clamp(1.0 + normalDotEye, 0.0, 1.0),5.0); #ifdef SNELLS_WINDOW @@ -622,90 +702,80 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) fresnel = mix(f0, 1.0, fresnel); - vec3 Metals = f0 > 229.5/255.0 ? normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3) : vec3(1.0); - - // Sun, Sky, and screen-space reflections #ifdef OVERWORLD_SHADER #ifdef WATER_SUN_SPECULAR - SunReflection = Direct_lighting * GGX(normal, -normalize(viewPos), WsunVec*mat3(gbufferModelViewInverse), roughness, vec3(f0)) ; + SunReflection = Direct_lighting * GGX(normal, -normalize(viewPos), WsunVec*mat3(gbufferModelViewInverse), max(roughness,0.035), f0) * Metals; #endif #ifdef WATER_BACKGROUND_SPECULAR - if(isEyeInWater == 0) SkyReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0 ; + if(isEyeInWater == 0 && !isReflectiveEntity) BackgroundReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0 * Metals; #endif + + if(isEyeInWater == 1 && isWater) BackgroundReflection.rgb = exp(-8.0 * vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B)) * clamp(WsunVec.y*lightCol.a,0,1); #else #ifdef WATER_BACKGROUND_SPECULAR - if(isEyeInWater == 0) SkyReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0 ; + if(isEyeInWater == 0) BackgroundReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0 * Metals; #endif #endif #ifdef SCREENSPACE_REFLECTIONS - if(iswater > 0.0){ - vec3 rtPos = rayTrace(reflectedVector, viewPos.xyz, interleaved_gradientNoise(), fresnel, isEyeInWater == 1); - if (rtPos.z < 1.){ - vec3 previousPosition = mat3(gbufferModelViewInverse) * toScreenSpace(rtPos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition; - previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz; - previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5; - if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) { - Reflections.a = 1.0; - Reflections.rgb = texture2D(colortex5,previousPosition.xy).rgb ; - } + vec3 rtPos = rayTrace(reflectedVector, viewPos.xyz, interleaved_gradientNoise_temporal(), fresnel, isEyeInWater == 1); + if (rtPos.z < 1.){ + vec3 previousPosition = mat3(gbufferModelViewInverse) * toScreenSpace(rtPos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition; + previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz; + previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5; + if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) { + Reflections.a = 1.0; + Reflections.rgb = texture2D(colortex5,previousPosition.xy).rgb * Metals; } } #endif - #ifdef OVERWORLD_SHADER - if(isEyeInWater == 1 && iswater > 0.9){ - SkyReflection.rgb = exp(-8.0 * vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B)) * clamp(WsunVec.y*lightCol.a,0,1); - } - - // if(iswater > 0.9) SkyReflection.rgb = mix(vec3(CaveFogColor_R, CaveFogColor_G, CaveFogColor_B)*0.1, SkyReflection.rgb*indoors, clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0),0.0,1.0)); - #endif - float visibilityFactor = clamp(exp2((pow(roughness,3.0) / f0) * -4),0,1); - #ifdef ENTITIES - Reflections_Final = FinalColor; - #else - Reflections_Final = mix(SkyReflection*indoors, Reflections.rgb, Reflections.a); - Reflections_Final = mix(FinalColor, Reflections_Final * Metals, fresnel); - #endif - - Reflections_Final += SunReflection * Metals; + Reflections_Final = mix(mix(FinalColor, BackgroundReflection, indoors), Reflections.rgb, Reflections.a) * fresnel * visibilityFactor; + Reflections_Final += SunReflection; - // Reflections_Final += vec3(CaveFogColor_R, CaveFogColor_G, CaveFogColor_B)*0.1 * darkSpecularHighlight(feetPlayerPos, viewToWorld(normal), 0.9, 0.1); - - gl_FragData[0].rgb = Reflections_Final ; - - #ifndef ENTITIES - //correct alpha channel with fresnel - gl_FragData[0].a = mix(gl_FragData[0].a, 1.0, fresnel); - #endif + //correct alpha channel with fresnel + float alpha0 = gl_FragData[0].a; + + gl_FragData[0].a = -gl_FragData[0].a * fresnel + gl_FragData[0].a + fresnel; + + // prevent reflections from being darkened by buffer blending + gl_FragData[0].rgb = clamp(FinalColor / gl_FragData[0].a*alpha0*(1.0-fresnel) * 0.1 + Reflections_Final / gl_FragData[0].a * 0.1,0.0,65100.0); + + if (gl_FragData[0].r > 65000.) gl_FragData[0].rgba = vec4(0.0); - } else { - - gl_FragData[0].rgb = FinalColor; + gl_FragData[0].rgb = FinalColor*0.1; } #else - gl_FragData[0].rgb = FinalColor; + gl_FragData[0].rgb = FinalColor*0.1; #endif - // gl_FragData[0].rgb = vec3(1) * (texelFetch2D(depthtex0,ivec2(gl_FragCoord.xy),0).x - texelFetch2D(dhDepthTex1,ivec2(gl_FragCoord.xy),0).x); + #if defined DISTANT_HORIZONS && defined DH_OVERDRAW_PREVENTION && !defined HAND + bool WATER = texture2D(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > far-16*4 && texture2D(depthtex1, gl_FragCoord.xy*texelSize).x >= 1.0; - - #if defined DISTANT_HORIZONS && defined DH_OVERDRAW_PREVENTION - gl_FragData[0].a = mix(gl_FragData[0].a, 0.0, 1.0-min(max(1.0 - length(feetPlayerPos.xz)/max(far,0.0),0.0)*2.0,1.0) ); + if(WATER) gl_FragData[0].a = 0.0; #endif #ifndef HAND - gl_FragData[1] = vec4(Albedo, iswater); + gl_FragData[1] = vec4(Albedo, MATERIALS); #endif #if DEBUG_VIEW == debug_DH_WATER_BLENDING if(gl_FragCoord.x*texelSize.x < 0.47) gl_FragData[0] = vec4(0.0); #endif + #if DEBUG_VIEW == debug_NORMALS + gl_FragData[0].rgb = normal.xyz * 0.1 * vec3(0,0,1); + #endif + #if DEBUG_VIEW == debug_INDIRECT + gl_FragData[0].rgb = Indirect_lighting* 0.1; + #endif + #if DEBUG_VIEW == debug_DIRECT + gl_FragData[0].rgb = Direct_lighting * 0.1; + #endif - gl_FragData[3].a = lmtexcoord.w; + gl_FragData[3].a = encodeVec2(lightmap); } } \ No newline at end of file diff --git a/shaders/dimensions/all_translucent.vsh b/shaders/dimensions/all_translucent.vsh index 729b430..ebc63ae 100644 --- a/shaders/dimensions/all_translucent.vsh +++ b/shaders/dimensions/all_translucent.vsh @@ -1,6 +1,7 @@ #include "/lib/settings.glsl" #include "/lib/res_params.glsl" #include "/lib/bokeh.glsl" +#include "/lib/items.glsl" uniform float frameTimeCounter; #include "/lib/Shadow_Params.glsl" @@ -15,6 +16,9 @@ Read the terms of modification and sharing before changing something below pleas varying vec4 lmtexcoord; varying vec4 color; +uniform sampler2D colortex4; +flat varying float exposure; + #ifdef OVERWORLD_SHADER flat varying vec3 averageSkyCol_Clouds; flat varying vec4 lightCol; @@ -34,7 +38,6 @@ flat varying int glass; attribute vec4 at_tangent; attribute vec4 mc_Entity; -uniform sampler2D colortex4; uniform vec3 sunPosition; uniform float sunElevation; @@ -72,7 +75,6 @@ vec4 toClipSpace3(vec3 viewSpacePosition) { return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),-viewSpacePosition.z); } -varying vec4 pos; //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// @@ -81,36 +83,44 @@ varying vec4 pos; void main() { - lmtexcoord.xy = (gl_MultiTexCoord0).xy; - vec2 lmcoord = gl_MultiTexCoord1.xy / 240.0; // is this even correct? lol + // lmtexcoord.xy = (gl_MultiTexCoord0).xy; + lmtexcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + vec2 lmcoord = gl_MultiTexCoord1.xy / 240.0; lmtexcoord.zw = lmcoord; vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; + gl_Position = toClipSpace3(position); - pos = vec4(position,1); HELD_ITEM_BRIGHTNESS = 0.0; #ifdef Hand_Held_lights - if(heldItemId == 100 || heldItemId2 == 100) HELD_ITEM_BRIGHTNESS = 0.9; + if(heldItemId == ITEM_LIGHT_SOURCES || heldItemId2 == ITEM_LIGHT_SOURCES) HELD_ITEM_BRIGHTNESS = 0.9; #endif + + + // 1.0 = water mask + // 0.9 = entity mask + // 0.8 = reflective entities + // 0.7 = reflective blocks float mat = 0.0; - + + // water mask if(mc_Entity.x == 8.0) { mat = 1.0; - gl_Position.z -= 1e-4; } - if (mc_Entity.x == 10002) mat = 0.2; - if (mc_Entity.x == 72) mat = 0.5; - + // translucent entities #if defined ENTITIES || defined BLOCKENTITIES - mat = 0.1; + mat = 0.9; + if (entityId == 1403) mat = 0.8; #endif + // translucent blocks + if (mc_Entity.x >= 301 && mc_Entity.x <= 321) mat = 0.7; tangent = vec4(normalize(gl_NormalMatrix *at_tangent.rgb),at_tangent.w); @@ -131,6 +141,7 @@ void main() { color = vec4(gl_Color.rgb, 1.0); + exposure = texelFetch2D(colortex4,ivec2(10,37),0).r; #ifdef OVERWORLD_SHADER lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb; @@ -142,8 +153,6 @@ void main() { // WsunVec = normalize(LightDir); #endif - - #ifdef TAA_UPSCALING gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w; #endif diff --git a/shaders/dimensions/all_vanilla_emissives.fsh b/shaders/dimensions/all_vanilla_emissives.fsh index cb94bc7..dd4fcd8 100644 --- a/shaders/dimensions/all_vanilla_emissives.fsh +++ b/shaders/dimensions/all_vanilla_emissives.fsh @@ -1,10 +1,19 @@ +#include "/lib/settings.glsl" + varying vec4 color; varying vec2 texcoord; uniform sampler2D texture; +uniform sampler2D normals; +uniform sampler2D noisetex; flat varying float exposure; +varying vec4 tangent; +varying vec4 normalMat; +attribute vec4 at_tangent; +uniform float frameTimeCounter; + //faster and actually more precise than pow 2.2 vec3 toLinear(vec3 sRGB){ return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878); @@ -28,42 +37,51 @@ float encodeVec2(float x,float y){ return encodeVec2(vec2(x,y)); } -//////////////////////////////VOID MAIN////////////////////////////// -//////////////////////////////VOID MAIN////////////////////////////// -//////////////////////////////VOID MAIN////////////////////////////// -//////////////////////////////VOID MAIN////////////////////////////// -//////////////////////////////VOID MAIN////////////////////////////// -#if defined SPIDER_EYES || defined BEACON_BEAM || defined GLOWING - /* DRAWBUFFERS:1 */ -#endif +uniform mat4 gbufferModelViewInverse; -#ifdef ENCHANT_GLINT - /* DRAWBUFFERS:2 */ -#endif +vec3 viewToWorld(vec3 viewPos) { + vec4 pos; + pos.xyz = viewPos; + pos.w = 0.0; + pos = gbufferModelViewInverse * pos; + return pos.xyz; +} + +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// + +/* DRAWBUFFERS:2 */ void main() { vec4 Albedo = texture2D(texture, texcoord); + Albedo.rgb = toLinear(Albedo.rgb); #if defined SPIDER_EYES || defined BEACON_BEAM || defined GLOWING - vec4 data1 = vec4(1.0); float materialMask = 1.0; - #if defined SPIDER_EYES || defined GLOWING - if(Albedo.a < 0.1) discard; - Albedo.rgb *= color.a; - #endif + if(Albedo.a < 0.102) { discard; return; } + + float minimumBrightness = 0.5; #ifdef BEACON_BEAM - Albedo.rgb = Albedo.rgb * color.rgb; - materialMask = 0.75; + minimumBrightness = 10.0; #endif - gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w, materialMask)); + float autoBrightnessAdjust = mix(minimumBrightness, 100.0, clamp(exp(-10.0*exposure),0.0,1.0)); + + vec3 emissiveColor = Albedo.rgb * color.a * autoBrightnessAdjust; + + gl_FragData[0] = vec4(emissiveColor*0.1, Albedo.a * sqrt(color.a)); #endif #ifdef ENCHANT_GLINT - vec3 GlintColor = toLinear(Albedo.rgb * color.rgb) / clamp(exposure,0.01,1.0); + float autoBrightnessAdjust = mix(0.1, 100.0, clamp(exp(-10.0*exposure),0.0,1.0)); - gl_FragData[0] = vec4(GlintColor , Albedo.a * 0.1); + vec3 GlintColor = Albedo.rgb * autoBrightnessAdjust * Emissive_Brightness; + + gl_FragData[0] = vec4(GlintColor*0.1, dot(Albedo.rgb,vec3(0.333)) * Albedo.a ); #endif } \ No newline at end of file diff --git a/shaders/dimensions/all_vanilla_emissives.vsh b/shaders/dimensions/all_vanilla_emissives.vsh index 68d78f7..663d868 100644 --- a/shaders/dimensions/all_vanilla_emissives.vsh +++ b/shaders/dimensions/all_vanilla_emissives.vsh @@ -11,6 +11,11 @@ Read the terms of modification and sharing before changing something below pleas varying vec4 color; varying vec2 texcoord; +varying vec4 tangent; +varying vec4 normalMat; +attribute vec4 at_tangent; + + uniform vec2 texelSize; uniform int framemod8; const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), @@ -40,13 +45,9 @@ flat varying float exposure; void main() { color = gl_Color; - #ifdef ENCHANT_GLINT - texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st; - #else - texcoord = (gl_MultiTexCoord0).xy; - #endif + texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st; - #if defined ENCHANT_GLINT || defined SPIDER_EYES + #if defined ENCHANT_GLINT || defined SPIDER_EYES || defined BEACON_BEAM exposure = texelFetch2D(colortex4,ivec2(10,37),0).r; vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; @@ -60,6 +61,11 @@ void main() { if(gl_Color.a < 1.0) gl_Position = vec4(10,10,10,0); #endif + #ifdef ENCHANT_GLINT + tangent = vec4(normalize(gl_NormalMatrix * at_tangent.rgb), at_tangent.w); + + normalMat = vec4(normalize(gl_NormalMatrix * gl_Normal), 1.0); + #endif #ifdef TAA_UPSCALING gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w; diff --git a/shaders/dimensions/composite.fsh b/shaders/dimensions/composite.fsh index 09e9e2d..ef4a460 100644 --- a/shaders/dimensions/composite.fsh +++ b/shaders/dimensions/composite.fsh @@ -6,14 +6,19 @@ flat varying vec2 TAA_Offset; #include "/lib/res_params.glsl" +uniform sampler2D depthtex0; uniform sampler2D depthtex1; +#ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex; uniform sampler2D dhDepthTex1; +#endif uniform sampler2D colortex1; +uniform sampler2D colortex3; // Noise uniform sampler2D colortex6; // Noise uniform sampler2D colortex8; // Noise uniform sampler2D colortex14; // Noise +uniform sampler2D colortex12; // Noise uniform sampler2D colortex15; // Noise uniform sampler2D shadow; @@ -31,14 +36,22 @@ uniform vec2 texelSize; uniform float frameTimeCounter; uniform float rainStrength; uniform int frameCounter; -uniform mat4 gbufferProjection; -uniform mat4 gbufferProjectionInverse; + + uniform mat4 gbufferModelViewInverse; uniform mat4 gbufferModelView; + +uniform vec3 cameraPosition; +uniform mat4 gbufferProjection; +uniform mat4 gbufferProjectionInverse; + +uniform vec3 previousCameraPosition; +uniform mat4 gbufferPreviousProjection; +uniform mat4 gbufferPreviousModelView; + uniform mat4 shadowModelView; uniform mat4 shadowProjection; -uniform vec3 cameraPosition; uniform float viewWidth; uniform float aspectRatio; uniform float viewHeight; @@ -117,11 +130,11 @@ float interleaved_gradientNoise(){ // return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+ 1.0/1.6180339887 * frameCounter); // } float R2_dither(){ - #ifdef TAA + // #ifdef TAA vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; - #else - vec2 coord = gl_FragCoord.xy; - #endif + // #else + // vec2 coord = gl_FragCoord.xy; + // #endif vec2 alpha = vec2(0.75487765, 0.56984026); return fract(alpha.x * coord.x + alpha.y * coord.y ) ; } @@ -242,12 +255,13 @@ vec2 SSAO( #endif vec2 acc = -(TAA_Offset*(texelSize/2.0))*RENDER_SCALE ; - + + vec2 BLUENOISE = blueNoise(gl_FragCoord.xy).rg; int n = 0; for (int i = 0; i < samples; i++) { - vec2 sampleOffset = SpiralSample(i, 7, 8, noise) * clamp(0.05 + i*0.095, 0.0,0.3) * mulfov2; + vec2 sampleOffset = SpiralSample(i, 7, 8, noise) * mulfov2 * clamp(0.05 + i*0.095, 0.0,0.3) ; ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio)*RENDER_SCALE); @@ -300,13 +314,56 @@ float encodeVec2(vec2 a){ float encodeVec2(float x,float y){ return encodeVec2(vec2(x,y)); } + // #include "/lib/indirect_lighting_effects.glsl" -#ifdef DENOISE_SSS_AND_SSAO - /* RENDERTARGETS:3,14,12*/ -#else - /* RENDERTARGETS:3*/ -#endif +vec3 toClipSpace3Prev(vec3 viewSpacePosition) { + return projMAD(gbufferPreviousProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5; +} + +vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth, bool hand) +{ + vec2 du = vec2(texelSize.x*2., 0.0); + vec2 dv = vec2(0.0, texelSize.y*2.); + + vec3 dtl = vec3(texcoord,0.) + vec3(-texelSize, texture2D(depth, texcoord - dv - du).x); + vec3 dtr = vec3(texcoord,0.) + vec3( texelSize.x, -texelSize.y, texture2D(depth, texcoord - dv + du).x); + vec3 dmc = vec3(texcoord,0.) + vec3( 0.0, 0.0, texture2D(depth, texcoord).x); + vec3 dbl = vec3(texcoord,0.) + vec3(-texelSize.x, texelSize.y, texture2D(depth, texcoord + dv - du).x); + vec3 dbr = vec3(texcoord,0.) + vec3( texelSize.x, texelSize.y, texture2D(depth, texcoord + dv + du).x); + + if(hand){ + convertHandDepth(dtl.z); + convertHandDepth(dtr.z); + convertHandDepth(dmc.z); + convertHandDepth(dbl.z); + convertHandDepth(dbr.z); + } + + vec3 dmin = dmc; + dmin = dmin.z > dtr.z ? dtr : dmin; + dmin = dmin.z > dtl.z ? dtl : dmin; + dmin = dmin.z > dbl.z ? dbl : dmin; + dmin = dmin.z > dbr.z ? dbr : dmin; + + #ifdef TAA_UPSCALING + dmin.xy = dmin.xy/RENDER_SCALE; + #endif + + return dmin; +} + +float ld(float dist) { + return (2.0 * near) / (far + near - dist * (far - near)); +} +float sampleDepth(sampler2D depthTex, vec2 texcoord, bool hand){ + // return texture2D(depthTex, texcoord).r; + return convertHandDepth_2(texture2D(depthTex, texcoord).r, hand); +} + + + +/* RENDERTARGETS:3,14,12*/ void main() { @@ -315,10 +372,16 @@ void main() { vec2 texcoord = gl_FragCoord.xy*texelSize; float z = texture2D(depthtex1,texcoord).x; + #ifdef DISTANT_HORIZONS float DH_depth1 = texture2D(dhDepthTex1,texcoord).x; + float swappedDepth = z >= 1.0 ? DH_depth1 : z; + #else + float DH_depth1 = 1.0; + float swappedDepth = z; + #endif - + vec4 SHADOWDATA = vec4(0.0); vec4 data = texture2D(colortex1,texcoord); vec4 dataUnpacked0 = vec4(decodeVec2(data.x),decodeVec2(data.y)); @@ -327,6 +390,7 @@ void main() { vec2 lightmap = dataUnpacked1.yz; + gl_FragData[1] = vec4(0.0,0.0,0.0, texture2D(colortex14,texcoord).a ); // bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01; @@ -338,11 +402,12 @@ void main() { // bool blocklights = abs(dataUnpacked1.w-0.8) <0.01; - if(hand) convertHandDepth(z); + if(hand){ + convertHandDepth(z); + } vec3 viewPos = toScreenSpace_DH(texcoord/RENDER_SCALE - TAA_Offset*texelSize*0.5, z, DH_depth1); - gl_FragData[1] = vec4(0.0,0.0,0.0,texture2D(colortex14,texcoord).a); #if defined DENOISE_SSS_AND_SSAO && indirect_effect == 1 float depth = z; @@ -366,15 +431,22 @@ void main() { gl_FragData[2] = vec4(vec3(0.0), 65000.0); - vec3 FlatNormals = texture2D(colortex15,texcoord).rgb * 2.0 - 1.0; - + vec3 FlatNormals = texture2D(colortex15,texcoord).rgb * 2.0 - 1.0; + if(z >= 1.0){ FlatNormals = worldToView(normal); } - gl_FragData[1].xy = SSAO(viewPos, FlatNormals, hand, isLeaf, noise); + vec2 SSAO_SSS = SSAO(viewPos, FlatNormals, hand, isLeaf, noise); + + if(swappedDepth >= 1.0) SSAO_SSS = vec2(1.0,0.0); + + gl_FragData[1].xy = SSAO_SSS; + #else + vec2 SSAO_SSS = vec2(1.0,0.0); #endif + #ifdef OVERWORLD_SHADER float SpecularTex = texture2D(colortex8,texcoord).z; float LabSSS = clamp((-64.0 + SpecularTex * 255.0) / 191.0 ,0.0,1.0); @@ -385,31 +457,25 @@ void main() { float minshadowfilt = Min_Shadow_Filter_Radius; float maxshadowfilt = Max_Shadow_Filter_Radius; - if(lightmap.y < 0.1 && !entities){ - // minshadowfilt *= vanillAO; - maxshadowfilt = mix(minshadowfilt, maxshadowfilt, vanillAO); - } + // if(lightmap.y < 0.1 && !entities){ + // maxshadowfilt = mix(minshadowfilt, maxshadowfilt, vanillAO); + // } - #ifndef Variable_Penumbra_Shadows - if (LabSSS > 0.0 && NdotL < 0.001) minshadowfilt += 50; + #ifdef BASIC_SHADOW_FILTER + if (LabSSS > 0.0 && NdotL < 0.001){ + minshadowfilt = 50; + // maxshadowfilt = 50; + } #endif if (z < 1.0){ gl_FragData[0] = vec4(minshadowfilt, 0.1, 0.0, 0.0); - gl_FragData[0].a = 0; - - // vec3 viewPos = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z)); - #ifdef Variable_Penumbra_Shadows - if (LabSSS > -1) { - vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; - - vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos + shadowModelView[3].xyz; projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; @@ -420,8 +486,9 @@ void main() { #else float distortFactor = 1.0; #endif + //do shadows only if on shadow map - if (abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0 || length(feetPlayerPos) < far){ + // if (abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0 || length(feetPlayerPos) < far){ const float threshMul = max(2048.0/shadowMapResolution*shadowDistance/128.0,0.95); float distortThresh = (sqrt(1.0-NdotL*NdotL)/NdotL+0.7)/distortFactor; float diffthresh = distortThresh/6000.0*threshMul; @@ -435,24 +502,23 @@ void main() { float diffthreshM = diffthresh*mult*d0*k/20.; float avgDepth = 0.0; + vec2 BLUENOISE = blueNoise(gl_FragCoord.xy).rg; for(int i = 0; i < VPS_Search_Samples; i++){ vec2 offsetS = SpiralSample(i, 7, 8, noise) * 0.5; - - float weight = 3.0 + (i+noise) *rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution*distortFactor/2.7; - // float d = texelFetch2D( shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x; - float d = texelFetch2D(shadowtex1, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x; - - + + float d = texelFetch2D(shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x; float b = smoothstep(weight*diffthresh/2.0, weight*diffthresh, projectedShadowPosition.z - d); blockerCount += b; + #ifdef DISTANT_HORIZONS_SHADOWMAP avgDepth += max(projectedShadowPosition.z - d, 0.0)*10000.0; #else avgDepth += max(projectedShadowPosition.z - d, 0.0)*1000.0; #endif + avgBlockerDepth += d * b; } @@ -464,7 +530,7 @@ void main() { float ssample = max(projectedShadowPosition.z - avgBlockerDepth,0.0)*1500.0; gl_FragData[0].r = clamp(ssample, scales.x, scales.y)/(scales.y)*(mult-minshadowfilt)+minshadowfilt; } - } + // } } #endif } diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index cfb441f..40b037d 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -1,17 +1,12 @@ #include "/lib/settings.glsl" + +#ifdef IS_LPV_ENABLED + #extension GL_EXT_shader_image_load_store: enable +#endif + #include "/lib/res_params.glsl" -vec3 saturation(inout vec3 color, float saturation){ - - - float luminance = dot(color, vec3(0.21, 0.72, 0.07)); - - vec3 difference = color - luminance; - - return color = color + difference*saturation; -} - const bool colortex5MipmapEnabled = true; #ifdef OVERWORLD_SHADER @@ -36,7 +31,6 @@ const bool colortex5MipmapEnabled = true; #endif #ifdef NETHER_SHADER - uniform float nightVision; uniform sampler2D colortex4; const bool colortex4MipmapEnabled = true; @@ -59,10 +53,10 @@ uniform sampler2D depthtex0; uniform sampler2D depthtex1; uniform sampler2D depthtex2; -// #ifdef DISTANT_HORIZONS +#ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex; uniform sampler2D dhDepthTex1; -// #endif +#endif uniform sampler2D colortex0; //clouds uniform sampler2D colortex1; //albedo(rgb),material(alpha) RGBA16 @@ -81,6 +75,10 @@ uniform sampler2D colortex13; uniform sampler2D colortex14; uniform sampler2D colortex15; // flat normals(rgb), vanillaAO(alpha) +#ifdef IS_LPV_ENABLED + uniform sampler3D texLpv1; + uniform sampler3D texLpv2; +#endif uniform mat4 shadowModelView; @@ -122,7 +120,8 @@ uniform ivec2 eyeBrightnessSmooth; uniform vec3 sunVec; flat varying vec3 WsunVec; -// flat varying vec3 unsigned_WsunVec; +flat varying vec3 unsigned_WsunVec; +flat varying float exposure; #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) @@ -162,12 +161,32 @@ 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) { return (2.0 * near) / (far + near - dist * (far - near)); } +vec3 decode (vec2 encn){ + vec3 n = vec3(0.0); + encn = encn * 2.0 - 1.0; + n.xy = abs(encn); + n.z = 1.0 - n.x - n.y; + n.xy = n.z <= 0.0 ? (1.0 - n.yx) * sign(encn) : encn; + return clamp(normalize(n.xyz),-1.0,1.0); +} +vec2 decodeVec2(float a){ + const vec2 constant1 = 65535. / vec2( 256., 65536.); + const float constant2 = 256. / 255.; + return fract( a * constant1 ) * constant2 ; +} + #include "/lib/end_fog.glsl" #include "/lib/specular.glsl" @@ -218,20 +237,6 @@ float facos(float sx){ float x = clamp(abs( sx ),0.,1.); return sqrt( 1. - x ) * ( -0.16882 * x + 1.56734 ); } -vec3 decode (vec2 encn){ - vec3 n = vec3(0.0); - encn = encn * 2.0 - 1.0; - n.xy = abs(encn); - n.z = 1.0 - n.x - n.y; - n.xy = n.z <= 0.0 ? (1.0 - n.yx) * sign(encn) : encn; - return clamp(normalize(n.xyz),-1.0,1.0); -} -vec2 decodeVec2(float a){ - const vec2 constant1 = 65535. / vec2( 256., 65536.); - const float constant2 = 256. / 255.; - return fract( a * constant1 ) * constant2 ; -} - vec2 tapLocation(int sampleNumber,int nb, float nbRot,float jitter,float distort) { @@ -460,6 +465,9 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo float Stepmult = depthCheck ? (isSSS ? 0.5 : 6.0) : (isSSS ? 1.0 : 3.0); + // Stepmult = depthCheck ? 0.5 : 1.0; + + vec3 rayDir = direction * Stepmult * vec3(RENDER_SCALE,1.0); vec3 screenPos = clipPosition * vec3(RENDER_SCALE,1.0) + rayDir*noise; @@ -468,7 +476,8 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo for (int i = 0; i < int(steps); i++) { screenPos += rayDir; - + + float samplePos = convertHandDepth_2(texture2D(depthtex1, screenPos.xy).x, hand); #ifdef DISTANT_HORIZONS @@ -492,118 +501,20 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo return vec2(Shadow, SSS); } -float CustomPhase(float LightPos){ - - float PhaseCurve = 1.0 - LightPos; - float Final = exp2(sqrt(PhaseCurve) * -25.0); - Final += exp(PhaseCurve * -10.0)*0.5; - - return Final; -} - -vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, float lightPos){ - - float labcurve = pow(Density, LabSSS_Curve); - - float density = 15.0 - labcurve*10.0; - - vec3 absorbed = max(1.0 - albedo,0.0); - - vec3 scatter = exp(Scattering * absorbed * -5.0) * exp(Scattering * -density); - - scatter *= labcurve; - - scatter *= 1.0 + CustomPhase(lightPos)*6.0; // ~10x brighter at the peak - - return scatter; -} - -vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){ - - vec3 absorbColor = max(1.0 - albedo,0.0); - - vec3 scatter = vec3(1)*exp(-3.0 * (Scattering*Scattering)); - - scatter *= clamp(1.0 - exp(Density * -10.0),0.0,1.0); - - return scatter; -} void Emission( inout vec3 Lighting, vec3 Albedo, - float Emission + float Emission, + float exposure ){ - // if( Emission < 235.0/255.0 ) Lighting = mix(Lighting, Albedo * Emissive_Brightness, pow(Emission, Emissive_Curve)); // old method.... idk why - if( Emission < 255.0/255.0 ) Lighting += (Albedo * Emissive_Brightness) * pow(Emission, Emissive_Curve); + float autoBrightnessAdjust = mix(5.0, 100.0, clamp(exp(-10.0*exposure),0.0,1.0)); + if( Emission < 254.5/255.0) Lighting = mix(Lighting, Albedo * Emissive_Brightness * autoBrightnessAdjust, pow(Emission, Emissive_Curve)); // old method.... idk why + // if( Emission < 254.5/255.0 ) Lighting += (Albedo * Emissive_Brightness) * pow(Emission, Emissive_Curve); } #include "/lib/indirect_lighting_effects.glsl" #include "/lib/PhotonGTAO.glsl" -// vec4 renderInfiniteWaterPlane( -// vec3 FragPosition, inout vec3 oceanNormals -// ){ - -// float planeHeight = 20 + 0.50; -// float total_extinction = 1.0; -// vec3 color = vec3(0.0); - -// //project pixel position into projected shadowmap space -// vec4 viewPos = normalize(gbufferModelViewInverse * vec4(FragPosition,1.0) ); -// vec3 dV_view = normalize(viewPos.xyz); dV_view *= 1.0/abs(dV_view.y); - -// float mult = length(dV_view); - -// float startFlip = mix(max(cameraPosition.y - planeHeight,0.0), max(planeHeight - cameraPosition.y,0), clamp(dV_view.y,0,1)); -// float signFlip = mix(-1.0, 1.0, clamp(cameraPosition.y - planeHeight,0.0,1.0)); -// if(max(signFlip * normalize(dV_view).y,0.0) > 0.0) return vec4(0,0,0,1); - -// vec3 progress_view = vec3(0,cameraPosition.y,0) + dV_view/abs(dV_view.y) * startFlip; - -// oceanNormals = normalize(getWaveHeight((progress_view+cameraPosition).xz,1)); - -// vec3 Lighting = vec3(1); -// float object = 1; - -// color += max(Lighting - Lighting*exp(-mult*object),0.0) * total_extinction; -// total_extinction *= max(exp(-mult*object),0.0); - -// return vec4(color, total_extinction); -// } - - -// uniform float viewWidth; -// uniform float viewHeight; - -// uniform sampler2D depthtex0; -// uniform sampler2D dhDepthTex; - -// uniform mat4 gbufferProjectionInverse; -// uniform mat4 dhProjectionInverse; - -// vec3 getViewPos() { -// ivec2 uv = ivec2(gl_FragCoord.xy); -// vec2 viewSize = vec2(viewWidth, viewHeight); -// vec2 texcoord = gl_FragCoord.xy / viewSize; - -// vec4 viewPos = vec4(0.0); - -// float depth = texelFetch(depthtex0, uv, 0).r; - -// if (depth < 1.0) { -// vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0; -// viewPos = gbufferProjectionInverse * ndcPos; -// viewPos.xyz /= viewPos.w; -// } else { -// depth = texelFetch(dhDepthTex, ivec2(gl_FragCoord.xy), 0).r; - -// vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0; -// viewPos = dhProjectionInverse * ndcPos; -// viewPos.xyz /= viewPos.w; -// } - -// return viewPos.xyz; -// } vec4 BilateralUpscale(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth){ @@ -684,7 +595,7 @@ vec4 BilateralUpscale_DH(sampler2D tex, sampler2D depth, vec2 coord, float refer } -void BilateralUpscale_REUSE_Z(sampler2D tex1, sampler2D tex2, sampler2D depth, vec2 coord, float referenceDepth, inout vec2 ambientEffects, inout vec3 filteredShadow){ +void BilateralUpscale_REUSE_Z(sampler2D tex1, sampler2D tex2, sampler2D depth, vec2 coord, float referenceDepth, inout vec2 ambientEffects, inout vec3 filteredShadow, bool hand){ ivec2 scaling = ivec2(1.0); ivec2 posDepth = ivec2(coord) * scaling; ivec2 posColor = ivec2(coord); @@ -736,32 +647,117 @@ void BilateralUpscale_REUSE_Z(sampler2D tex1, sampler2D tex2, sampler2D depth, v ambientEffects = ssao_RESULT/SUM; #endif } -vec3 ColorBoost(vec3 COLOR, float saturation){ - float luminance = luma(COLOR); +#ifdef OVERWORLD_SHADER +float ComputeShadowMap(in vec3 projectedShadowPosition, float distortFactor, float noise, float shadowBlockerDepth, float NdotL, float maxDistFade, inout vec3 directLightColor, inout float FUNNYSHADOW, bool isSSS){ - COLOR = normalize(COLOR+0.0001); + if(maxDistFade <= 0.0) return 1.0; + float backface = NdotL <= 0.0 ? 1.0 : 0.0; - vec3 difference = COLOR - luminance; + float shadowmap = 0.0; + vec3 translucentTint = vec3(0.0); - return COLOR + difference*(-luminance + saturation); + #ifdef BASIC_SHADOW_FILTER + int samples = SHADOW_FILTER_SAMPLE_COUNT; + float rdMul = shadowBlockerDepth*distortFactor*d0*k/shadowMapResolution; + + for(int i = 0; i < samples; i++){ + vec2 offsetS = tapLocation_simple(i, 7, 9, noise) * 0.5; + projectedShadowPosition.xy += rdMul*offsetS; + #else + int samples = 1; + #endif + #ifdef TRANSLUCENT_COLORED_SHADOWS + // determine when opaque shadows are overlapping translucent shadows by getting the difference of opaque depth and translucent depth + float shadowDepthDiff = pow(clamp((shadow2D(shadowtex1, projectedShadowPosition).x - projectedShadowPosition.z*0.6)*2.0,0.0,1.0),2.0); + + // get opaque shadow data to get opaque data from translucent shadows. + float opaqueShadow = shadow2D(shadowtex0, projectedShadowPosition).x; + shadowmap += max(opaqueShadow, shadowDepthDiff); + + // get translucent shadow data + vec4 translucentShadow = texture2D(shadowcolor0, projectedShadowPosition.xy); + + // this curve simply looked the nicest. it has no other meaning. + float shadowAlpha = pow(1.0 - pow(translucentShadow.a,5.0),0.2); + + FUNNYSHADOW = shadowAlpha; + + // normalize the color to remove luminance, and keep the hue. remove all opaque color. + // mulitply shadow alpha to shadow color, but only on surfaces facing the lightsource. this is a tradeoff to protect subsurface scattering's colored shadow tint from shadow bias on the back of the caster. + translucentShadow.rgb = max(normalize(translucentShadow.rgb + 0.0001), max(opaqueShadow, 1.0-shadowAlpha)) * max(shadowAlpha, backface * (1.0 - shadowDepthDiff)); + + float translucentMask = 1 - max(shadowDepthDiff-opaqueShadow, 0); + // make it such that full alpha areas that arent in a shadow have a value of 1.0 instead of 0.0 + translucentTint += mix(translucentShadow.rgb, vec3(1.0), opaqueShadow*shadowDepthDiff); + #else + shadowmap += shadow2D(shadow, projectedShadowPosition).x; + #endif + #ifdef BASIC_SHADOW_FILTER + } + #endif + + #ifdef TRANSLUCENT_COLORED_SHADOWS + // tint the lightsource color with the translucent shadow color + directLightColor *= mix(vec3(1.0), translucentTint.rgb / samples, maxDistFade); + #endif + + // return maxDistFade; + + return mix(1.0, shadowmap / samples, maxDistFade); + +} +#endif + +float CustomPhase(float LightPos){ + + float PhaseCurve = 1.0 - LightPos; + float Final = exp2(sqrt(PhaseCurve) * -25.0); + Final += exp(PhaseCurve * -10.0)*0.5; + + return Final; } -float darkSpecularHighlight(vec3 playerPos, vec3 normal, float roughness, float f0){ +vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, float lightPos, float shadows){ + + Scattering *= sss_density_multiplier; - roughness = max(pow(1.0 - roughness, 2.0),0.002); + float density = 0.0001 + Density*1.5; - float distanceFalloff = clamp( exp(-7.0 * (length(playerPos) / 16.0)) ,0.0,1.0); + density = 1.0; + float scatterDepth = max(1.0 - Scattering/density,0.0); + scatterDepth = exp((1.0-scatterDepth) * -7.0); - float NdotP = clamp(1.0 + dot(normal, normalize(playerPos)),0.0,1.0); + // this is for SSS when there is no shadow blocker depth + #if defined BASIC_SHADOW_FILTER && defined Variable_Penumbra_Shadows + scatterDepth = max(scatterDepth, shadows * min(2.0-sss_density_multiplier,1.0)); + #else + scatterDepth = exp(-7.0 * pow(1.0-shadows,3.0))*min(2.0-sss_density_multiplier,1.0); + #endif - float specularHighlight = exp( -(1.0 / roughness) * NdotP ) * f0; - return specularHighlight * distanceFalloff; + // PBR at its finest :clueless: + vec3 absorbColor = exp(max(luma(albedo) - albedo, 0.0) * -(20.0 - 19*scatterDepth) * sss_absorbance_multiplier); + + vec3 scatter = scatterDepth * absorbColor * pow(Density, LabSSS_Curve); + + scatter *= 1.0 + CustomPhase(lightPos)*6.0; // ~10x brighter at the peak + + return scatter; } +vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){ + + float labcurve = clamp(1.0 - exp(Density * -10.0),0.0,1.0); + float density = sqrt(Density) * 4.0 + 1.0; + float scatterDepth = exp(pow(Scattering, 5) * -5.0); + vec3 absorbColor = exp(max(luma(albedo)-albedo, 0.0) * -(20.0 - 19.0*scatterDepth) * sss_absorbance_multiplier); + vec3 scatter = scatterDepth * absorbColor * labcurve; + + return scatter; +} void main() { @@ -818,7 +814,8 @@ void main() { vec3 albedo = toLinear(vec3(dataUnpacked0.xz,dataUnpacked1.x)); vec3 normal = decode(dataUnpacked0.yw); - vec2 lightmap = dataUnpacked1.yz; + vec2 lightmap = dataUnpacked1.yz;//min(max(dataUnpacked1.yz - 0.05,0.0)*1.06,1.0);// small offset to hide flickering from precision error in the encoding/decoding on values close to 1.0 or 0.0 + #if defined END_SHADER || defined NETHER_SHADER lightmap.y = 1.0; @@ -835,13 +832,6 @@ void main() { vec3 FlatNormals = normalAndAO.rgb * 2.0 - 1.0; vec3 slopednormal = normal; - #ifdef POM - #ifdef Horrible_slope_normals - vec3 ApproximatedFlatNormal = normalize(cross(dFdx(feetPlayerPos), dFdy(feetPlayerPos))); // it uses depth that has POM written to it. - slopednormal = normalize(clamp(normal, ApproximatedFlatNormal*2.0 - 1.0, ApproximatedFlatNormal*2.0 + 1.0) ); - #endif - #endif - float vanilla_AO = z < 1.0 ? clamp(normalAndAO.a,0,1) : 0.0; normalAndAO.a = clamp(pow(normalAndAO.a*5,4),0,1); @@ -852,23 +842,37 @@ void main() { ////// --------------- MASKS/BOOLEANS --------------- ////// + // 1.0-0.8 ??? + // 0.75 = hand mask + // 0.60 = grass mask + // 0.55 = leaf mask (for ssao-sss) + // 0.50 = lightning bolt mask + // 0.45 = entity mask + float opaqueMasks = dataUnpacked1.w; + // 1.0 = water mask + // 0.9 = entity mask + // 0.8 = reflective entities + // 0.7 = reflective blocks + float translucentMasks = texture2D(colortex7, texcoord).a; - float translucent_alpha = texture2D(colortex7,texcoord).a; - bool iswater = translucent_alpha > 0.99; - bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01; - bool isLeaf = abs(dataUnpacked1.w-0.55) <0.01; - bool entities = abs(dataUnpacked1.w-0.45) < 0.01; - // bool isBoss = abs(dataUnpacked1.w-0.60) < 0.01; - bool isGrass = abs(dataUnpacked1.w-0.60) < 0.01; - bool hand = abs(dataUnpacked1.w-0.75) < 0.01 && z < 1.0; - // bool blocklights = abs(dataUnpacked1.w-0.8) <0.01; + bool isWater = translucentMasks > 0.99; + // bool isReflectiveEntity = abs(translucentMasks - 0.8) < 0.01; + // bool isReflective = abs(translucentMasks - 0.7) < 0.01 || isWater || isReflectiveEntity; + // bool isEntity = abs(translucentMasks - 0.9) < 0.01 || isReflectiveEntity; + + bool lightningBolt = abs(opaqueMasks-0.5) <0.01; + bool isLeaf = abs(opaqueMasks-0.55) <0.01; + bool entities = abs(opaqueMasks-0.45) < 0.01; + bool isGrass = abs(opaqueMasks-0.60) < 0.01; + bool hand = abs(opaqueMasks-0.75) < 0.01 && z < 1.0; + // bool blocklights = abs(opaqueMasks-0.8) <0.01; if(hand){ convertHandDepth(z); convertHandDepth(z0); } - + #ifdef DISTANT_HORIZONS vec3 viewPos = toScreenSpace_DH(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5, z, DH_depth1); #else @@ -878,6 +882,12 @@ void main() { vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos; vec3 feetPlayerPos_normalized = normVec(feetPlayerPos); + #ifdef POM + #ifdef Horrible_slope_normals + vec3 ApproximatedFlatNormal = normalize(cross(dFdx(feetPlayerPos), dFdy(feetPlayerPos))); // it uses depth that has POM written to it. + slopednormal = normalize(clamp(normal, ApproximatedFlatNormal*2.0 - 1.0, ApproximatedFlatNormal*2.0 + 1.0) ); + #endif + #endif ////// --------------- COLORS --------------- ////// float dirtAmount = Dirt_Amount + 0.01; @@ -888,7 +898,7 @@ void main() { #ifdef BIOME_TINT_WATER // yoink the biome tint written in this buffer for water only. - if(iswater){ + if(isWater){ vec2 translucentdata = texture2D(colortex11,texcoord).gb; vec3 wateralbedo = vec3(decodeVec2(translucentdata.x),decodeVec2(translucentdata.y).x); scatterCoef = dirtAmount * wateralbedo / 3.14; @@ -904,21 +914,18 @@ void main() { vec3 Direct_lighting = vec3(0.0); vec3 Direct_SSS = vec3(0.0); float cloudShadow = 1.0; - vec3 Shadows = vec3(1.0); + float Shadows = 1.0; float NdotL = 1.0; + float lightLeakFix = clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); + // #ifdef DISTANT_HORIZONS_SHADOWMAP + // float shadowMapFalloff = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance, dhFarPlane),0.0)*5.0,1.0),2.0),2.0); + // #else + // float shadowMapFalloff = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / shadowDistance,0.0)*5.0,1.0),2.0),2.0); + // #endif + // float shadowMapFalloff2 = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance,far),0.0)*5.0,1.0),2.0),2.0); - vec3 shadowMap = vec3(1.0); - #ifdef DISTANT_HORIZONS_SHADOWMAP - float shadowMapFalloff = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance, dhFarPlane),0.0)*5.0,1.0),2.0),2.0); - #else - float shadowMapFalloff = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / shadowDistance,0.0)*5.0,1.0),2.0),2.0); - #endif - float shadowMapFalloff2 = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance,far),0.0)*5.0,1.0),2.0),2.0); - // shadowMapFalloff = 0; - // shadowMapFalloff2 = 0; - float LM_shadowMapFallback = min(max(lightmap.y-0.8, 0.0) * 25,1.0); #ifdef OVERWORLD_SHADER DirectLightColor = lightCol.rgb / 80.0; @@ -950,14 +957,19 @@ void main() { vec2 SSAO_SSS = vec2(1.0); #ifdef DISTANT_HORIZONS - BilateralUpscale_REUSE_Z(colortex3, colortex14, colortex12, gl_FragCoord.xy, DH_mixedLinearZ, SSAO_SSS, filteredShadow); + BilateralUpscale_REUSE_Z(colortex3, colortex14, colortex12, gl_FragCoord.xy, DH_mixedLinearZ, SSAO_SSS, filteredShadow, hand); #else - BilateralUpscale_REUSE_Z(colortex3, colortex14, depthtex0, gl_FragCoord.xy, ld(z0), SSAO_SSS, filteredShadow); + BilateralUpscale_REUSE_Z(colortex3, colortex14, depthtex0, gl_FragCoord.xy, ld(z0), SSAO_SSS, filteredShadow, hand); #endif + // SSAO_SSS = texture2D(colortex14,texcoord).xy; + // filteredShadow = texture2D(colortex3,texcoord).xyz; + // filteredShadow.rgb = vec3(filteredShadow.x, temporallyReprojectedData.gb); + // SSAO_SSS.x = temporallyReprojectedData.a; + float ShadowBlockerDepth = filteredShadow.y; - Shadows = vec3(clamp(1.0 - filteredShadow.b,0.0,1.0)); - shadowMap = vec3(Shadows); + // Shadows = vec3(clamp(1.0-filteredShadow.b,0.0,1.0)); + // shadowMap = vec3(Shadows); //////////////////////////////////////////////////////////////////////////////////////////// @@ -966,11 +978,18 @@ void main() { if (swappedDepth >= 1.0) { #ifdef OVERWORLD_SHADER vec3 Background = vec3(0.0); - #if RESOURCEPACK_SKY == 1 || RESOURCEPACK_SKY == 0 - vec3 orbitstar = vec3(feetPlayerPos_normalized.x,abs(feetPlayerPos_normalized.y),feetPlayerPos_normalized.z); orbitstar.x -= WsunVec.x*0.2; - Background += stars(orbitstar) * 10.0; + // vec3 orbitstar = vec3(feetPlayerPos_normalized.x,abs(feetPlayerPos_normalized.y),feetPlayerPos_normalized.z); orbitstar.x -= WsunVec.x*0.2; + + vec3 orbitstar = normalize(mat3(gbufferModelViewInverse) * toScreenSpace(vec3(texcoord,1.0))); + float radiance = 2.39996 - (worldTime + worldDay*24000.0) / 24000.0; + // float radiance = 2.39996 + frameTimeCounter; + mat2 rotationMatrix = mat2(vec2(cos(radiance), -sin(radiance)), vec2(sin(radiance), cos(radiance))); + + orbitstar.xy *= rotationMatrix; + + Background += stars(orbitstar) * 10.0 * clamp(-unsigned_WsunVec.y*2.0,0.0,1.0); #endif #if RESOURCEPACK_SKY == 2 @@ -1015,23 +1034,39 @@ void main() { //////////////////////////////////////////////////////////////////////////////////// #ifdef OVERWORLD_SHADER + float LM_shadowMapFallback = min(max(lightmap.y-0.8, 0.0) * 25,1.0); + float LightningPhase = 0.0; vec3 LightningFlashLighting = Iris_Lightningflash(feetPlayerPos, lightningBoltPosition.xyz, slopednormal, LightningPhase) * pow(lightmap.y,10); - #endif - - #ifdef OVERWORLD_SHADER NdotL = clamp((-15 + dot(slopednormal, WsunVec)*255.0) / 240.0 ,0.0,1.0); - - vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; + // NdotL = 1; + float flatNormNdotL = clamp((-15 + dot(viewToWorld(FlatNormals), WsunVec)*255.0) / 240.0 ,0.0,1.0); - // if(!entities) if(!hand) + // setup shadow projection + vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; if(!hand) GriAndEminShadowFix(shadowPlayerPos, viewToWorld(FlatNormals), vanilla_AO, lightmap.y); - + vec3 projectedShadowPosition = mat3(shadowModelView) * shadowPlayerPos + shadowModelView[3].xyz; projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; - //apply distortion + #if OPTIMIZED_SHADOW_DISTANCE > 0.0 + float shadowMapFalloff = smoothstep(0.0, 1.0, min(max(1.0 - length(feetPlayerPos) / (shadowDistance+16),0.0)*5.0,1.0)); + float shadowMapFalloff2 = smoothstep(0.0, 1.0, min(max(1.0 - length(feetPlayerPos) / shadowDistance,0.0)*5.0,1.0)); + #else + vec3 shadowEdgePos = projectedShadowPosition * vec3(0.4,0.4,0.5/6.0) + vec3(0.5,0.5,0.12); + float fadeLength = max((shadowDistance/256)*30,10.0); + + vec3 cubicRadius = clamp( min((1.0-shadowEdgePos)*fadeLength, shadowEdgePos*fadeLength),0.0,1.0); + float shadowmapFade = cubicRadius.x*cubicRadius.y*cubicRadius.z; + + shadowmapFade = 1.0 - pow(1.0-pow(shadowmapFade,1.5),3.0); // make it nice and soft :) + + float shadowMapFalloff = shadowmapFade; + float shadowMapFalloff2 = shadowmapFade; + #endif + + // un-distort #ifdef DISTORT_SHADOWMAP float distortFactor = calcDistort(projectedShadowPosition.xy); projectedShadowPosition.xy *= distortFactor; @@ -1039,83 +1074,22 @@ void main() { float distortFactor = 1.0; #endif - if(shadowDistanceRenderMul < 0.0) shadowMapFalloff = abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0 ? 1.0 : 0.0; + projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5,0.5,0.5) ; - if(shadowMapFalloff > 0.0){ - shadowMap = vec3(0.0); - vec3 ShadowColor = vec3(0.0); + float ShadowAlpha = 0.0; // this is for subsurface scattering later. + Shadows = ComputeShadowMap(projectedShadowPosition, distortFactor, noise_2, filteredShadow.x, flatNormNdotL, shadowMapFalloff, DirectLightColor, ShadowAlpha, LabSSS > 0.0); - projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5); - - float biasOffset = 0.0; - - #ifdef BASIC_SHADOW_FILTER - float rdMul = filteredShadow.x*distortFactor*d0*k/shadowMapResolution; - - for(int i = 0; i < SHADOW_FILTER_SAMPLE_COUNT; i++){ - vec2 offsetS = tapLocation_simple(i, 7, 9, noise_2) * 0.5; - - projectedShadowPosition += vec3(rdMul*offsetS, biasOffset); - - #ifdef TRANSLUCENT_COLORED_SHADOWS - float opaqueShadow = shadow2D(shadowtex0, projectedShadowPosition).x; - shadowMap += opaqueShadow / SHADOW_FILTER_SAMPLE_COUNT; - - vec4 translucentShadow = texture2D(shadowcolor0, projectedShadowPosition.xy); - float shadowAlpha = clamp(1.0 - pow(translucentShadow.a,5.0),0.0,1.0); - - #if SSS_TYPE != 0 - if(LabSSS > 0.0) ShadowColor += (DirectLightColor * clamp(pow(1.0-shadowAlpha,5.0),0.0,1.0) + DirectLightColor * translucentShadow.rgb * shadowAlpha * (1.0 - opaqueShadow)) / SHADOW_FILTER_SAMPLE_COUNT; - else ShadowColor = DirectLightColor; - #endif - - if(shadow2D(shadowtex1, projectedShadowPosition).x > projectedShadowPosition.z) shadowMap += (translucentShadow.rgb * shadowAlpha * (1.0 - opaqueShadow)) / SHADOW_FILTER_SAMPLE_COUNT; - - #else - shadowMap += vec3(shadow2D(shadow, projectedShadowPosition).x / SHADOW_FILTER_SAMPLE_COUNT); - #endif - } - - #else - - #ifdef TRANSLUCENT_COLORED_SHADOWS - float opaqueShadow = shadow2D(shadowtex0, projectedShadowPosition).x; - shadowMap += opaqueShadow; - - vec4 translucentShadow = texture2D(shadowcolor0, projectedShadowPosition.xy); - translucentShadow.rgb = normalize(translucentShadow.rgb + 0.0001); - float shadowAlpha = clamp(1.0 - pow(translucentShadow.a,5.0),0.0,1.0); - - #if SSS_TYPE != 0 - if(LabSSS > 0.0) ShadowColor += DirectLightColor * (1.0 - shadowAlpha) + DirectLightColor * translucentShadow.rgb * shadowAlpha * (1.0 - opaqueShadow); - else ShadowColor = DirectLightColor; - #endif - - if(shadow2D(shadowtex1, projectedShadowPosition).x > projectedShadowPosition.z) shadowMap += translucentShadow.rgb * shadowAlpha * (1.0 - opaqueShadow); - - #else - shadowMap += shadow2D(shadow, projectedShadowPosition).x; - #endif - #endif - - #ifdef TRANSLUCENT_COLORED_SHADOWS - DirectLightColor = ShadowColor; - #endif - - Shadows = shadowMap; - } - - if(!iswater) Shadows = mix(vec3(LM_shadowMapFallback), Shadows, shadowMapFalloff2); + if(!isWater) Shadows *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff2); #ifdef OLD_LIGHTLEAK_FIX - if (isEyeInWater == 0) Shadows *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix + if (isEyeInWater == 0) Shadows *= lightLeakFix; // light leak fix #endif - + #endif //////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////// UNDER WATER SHADING //////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////// - if ((isEyeInWater == 0 && iswater) || (isEyeInWater == 1 && !iswater)){ + /////////////////////////////////////////////////////////////////////////////////////////////// + if ((isEyeInWater == 0 && isWater) || (isEyeInWater == 1 && !isWater)){ #ifdef DISTANT_HORIZONS vec3 viewPos0 = toScreenSpace_DH(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5, z0, DH_depth0); #else @@ -1137,63 +1111,12 @@ void main() { float estimatedSunDepth = Vdiff; //assuming water plane Absorbtion = mix(exp(-2.0 * totEpsilon * estimatedDepth), exp(-8.0 * totEpsilon), depthfalloff); - DirectLightColor *= Absorbtion; + // DirectLightColor *= Absorbtion; // apply caustics to the lighting, and make sure they dont look weird DirectLightColor *= mix(1.0, waterCaustics(feetPlayerPos + cameraPosition, WsunVec)*WATER_CAUSTICS_BRIGHTNESS + 0.25, clamp(estimatedDepth,0,1)); } - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////// SUN SSS //////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - - #if SSS_TYPE != 0 - - - #ifdef DISTANT_HORIZONS - shadowMapFalloff = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance, max(far-32,0.0)),0.0)*5.0,1.0),2.0),2.0); - #endif - - #if defined DISTANT_HORIZONS_SHADOWMAP && defined Variable_Penumbra_Shadows - ShadowBlockerDepth = mix(pow(1.0 - Shadows.x,2.0), ShadowBlockerDepth, shadowMapFalloff); - #endif - - #if !defined Variable_Penumbra_Shadows - ShadowBlockerDepth = pow(1.0 - clamp(Shadows.x,0,1),2.0); - #endif - - - float sunSSS_density = LabSSS; - - #ifndef RENDER_ENTITY_SHADOWS - if(entities) sunSSS_density = 0.0; - #endif - - // if (!hand){ - #ifdef SCREENSPACE_CONTACT_SHADOWS - - vec2 SS_directLight = SSRT_Shadows(toScreenSpace_DH(texcoord/RENDER_SCALE, z, DH_depth1), isDHrange, normalize(WsunVec*mat3(gbufferModelViewInverse)), interleaved_gradientNoise(), sunSSS_density > 0.0, hand); - - Shadows = min(Shadows, SS_directLight.r); - ShadowBlockerDepth = mix(SS_directLight.g, ShadowBlockerDepth, shadowMapFalloff); - - #else - ShadowBlockerDepth = mix(1.0, ShadowBlockerDepth, shadowMapFalloff); - #endif - - Direct_SSS = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0)); - - Direct_SSS *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff); - if (isEyeInWater == 0) Direct_SSS *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix - // } - #endif - - #ifdef CLOUDS_SHADOWS - cloudShadow = GetCloudShadow(feetPlayerPos); - Shadows *= cloudShadow; - Direct_SSS *= cloudShadow; - #endif - #endif #ifdef END_SHADER float vortexBounds = clamp(vortexBoundRange - length(feetPlayerPos+cameraPosition), 0.0,1.0); @@ -1210,8 +1133,6 @@ void main() { Direct_lighting += lightColors * endPhase * end_NdotL * fogShadow; AmbientLightColor += lightColors * (endPhase*endPhase) * (1.0-exp(vec3(0.6,2.0,2) * -(endPhase*0.1))) ; - - Direct_lighting *= Absorbtion; #endif ///////////////////////////////////////////////////////////////////////////////// @@ -1219,20 +1140,19 @@ void main() { ///////////////////////////////////////////////////////////////////////////////// #if defined OVERWORLD_SHADER && (indirect_effect == 0 || indirect_effect == 1) - - vec3 ambientcoefs = slopednormal / dot(abs(slopednormal), vec3(1)); - + float allDirections = dot(abs(slopednormal),vec3(1.0)); + vec3 ambientcoefs = slopednormal / allDirections; float SkylightDir = ambientcoefs.y*1.5; + if(isGrass) SkylightDir = 1.25; - float skylight = max(pow(viewToWorld(FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.2 + (1.0-lightmap.y)*0.8) ; - + float skylight = max(pow(viewToWorld(FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.2 + (1-lightmap.y)*0.8) ; + #if indirect_effect == 1 - skylight = min(skylight, (SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x) * 2.5); + skylight = min(skylight, mix(0.95, 2.5, pow(1-pow(1-SSAO_SSS.x, 0.5),2.0) )); #endif Indirect_lighting = AmbientLightColor * skylight; - #endif #ifdef NETHER_SHADER @@ -1245,20 +1165,29 @@ void main() { // down *= pow( max(-slopednormal.y, 0), 2); // Indirect_lighting += up + down; - Indirect_lighting = vec3(0.1); - + Indirect_lighting = vec3(0.05); #endif #ifdef END_SHADER Indirect_lighting += (vec3(0.5,0.75,1.0) * 0.9 + 0.1) * 0.1; Indirect_lighting *= clamp(1.5 + dot(normal, feetPlayerPos_normalized)*0.5,0,2); - #endif - Indirect_lighting = DoAmbientLightColor(Indirect_lighting, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy); + #ifdef IS_LPV_ENABLED + vec3 lpvPos = GetLpvPosition(feetPlayerPos); + + #ifdef LPV_NORMAL_OFFSET + lpvPos += -0.5*viewToWorld(FlatNormals) + slopednormal; + #else + lpvPos += 0.5*viewToWorld(FlatNormals); + #endif + #else + const vec3 lpvPos = vec3(0.0); + #endif + + Indirect_lighting = DoAmbientLightColor(lpvPos, Indirect_lighting, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B) , lightmap.xy, exposure); - Indirect_lighting *= Absorbtion; #ifdef OVERWORLD_SHADER Indirect_lighting += LightningFlashLighting; #endif @@ -1266,6 +1195,7 @@ void main() { #ifdef SSS_view Indirect_lighting = vec3(3.0); #endif + ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////// EFFECTS FOR INDIRECT ///////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// @@ -1273,78 +1203,117 @@ void main() { float SkySSS = 1.0; vec3 AO = vec3(1.0); - #if indirect_effect == 0 - AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ; + AO = pow(1.0 - vanilla_AO*vanilla_AO,5.0) * vec3(1.0); Indirect_lighting *= AO; #endif #if indirect_effect == 1 - AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) ); - - AO *= SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x; - // AO *= exp((1-SSAO_SSS.x) * -5); - SkySSS = SSAO_SSS.y; + float vanillaAO_curve = pow(1.0 - vanilla_AO*vanilla_AO,5.0); + float SSAO_curve = pow(SSAO_SSS.x,6); + + // use the min of vanilla ao so they dont overdarken eachother + AO = vec3( min(vanillaAO_curve, SSAO_curve) ); + Indirect_lighting *= AO; #endif // GTAO #if indirect_effect == 2 - vec2 r2 = fract(R2_samples((frameCounter%40000) + frameCounter*2) + bnoise); - if(!hand){ - Indirect_lighting = AmbientLightColor/2.5; - AO = ambient_occlusion(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z), viewPos, worldToView(slopednormal), r2) * vec3(1.0); - } + Indirect_lighting = AmbientLightColor/2.5; + + AO = ambient_occlusion(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z), viewPos, worldToView(slopednormal), r2) * vec3(1.0); + Indirect_lighting *= AO; #endif // RTAO and/or SSGI #if indirect_effect == 3 || indirect_effect == 4 - if(!hand){ - Indirect_lighting = AmbientLightColor; - ApplySSRT(Indirect_lighting, viewPos, normal, vec3(bnoise, noise_2), lightmap.xy, AmbientLightColor*2.5, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass, hand); - } + Indirect_lighting = AmbientLightColor; + ApplySSRT(Indirect_lighting, viewPos, normal, vec3(bnoise, noise_2), lightmap.xy, AmbientLightColor*2.5, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass, hand); #endif #if defined END_SHADER Direct_lighting *= AO; #endif - + //////////////////////////////////////////////////////////////////////////////// + ///////////////////////// SUB SURFACE SCATTERING //////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ///////////////////////////// SKY SSS ///////////////////////////// - #if defined Ambient_SSS && defined OVERWORLD_SHADER && indirect_effect == 1 if (!hand){ - vec3 ambientColor = AmbientLightColor * 2.5 * ambient_brightness; // x2.5 to match the brightness of upfacing skylight - float skylightmap = pow(lightmap.y, 3.0); + vec3 ambientColor = (AmbientLightColor*2.5) * ambient_brightness * 0.7; // x2.5 to match the brightness of upfacing skylight Indirect_SSS = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS); - Indirect_SSS *= ambientColor; - Indirect_SSS *= skylightmap; + Indirect_SSS *= lightmap.y*lightmap.y*lightmap.y; Indirect_SSS *= AO; // apply to ambient light. - Indirect_lighting = max(Indirect_lighting, Indirect_SSS * ambientsss_brightness ); + // if(texcoord.x>0.5) + Indirect_lighting = max(Indirect_lighting, ambientColor * Indirect_SSS * ambientsss_brightness); - #ifdef OVERWORLD_SHADER - if(LabSSS > 0.0) Indirect_lighting += (1.0-SkySSS) * LightningPhase * lightningEffect * pow(lightmap.y,10); - #endif + // #ifdef OVERWORLD_SHADER + // if(LabSSS > 0.0) Indirect_lighting += (1.0-SkySSS) * LightningPhase * lightningEffect * pow(lightmap.y,10); + // #endif } #endif + //////////////////////////////// SUN SSS //////////////////////////////// + #if SSS_TYPE != 0 && defined OVERWORLD_SHADER + + float sunSSS_density = LabSSS; + float SSS_shadow = ShadowAlpha * Shadows; + // #ifdef DISTANT_HORIZONS_SHADOWMAP + // shadowMapFalloff2 = smoothstep(0.0, 1.0, min(max(1.0 - length(feetPlayerPos) / min(shadowDistance,far),0.0)*5.0,1.0)); + // #endif + + #ifndef RENDER_ENTITY_SHADOWS + if(entities) sunSSS_density = 0.0; + #endif + + + #ifdef SCREENSPACE_CONTACT_SHADOWS + vec2 SS_directLight = SSRT_Shadows(toScreenSpace_DH(texcoord/RENDER_SCALE, z, DH_depth1), isDHrange, normalize(WsunVec*mat3(gbufferModelViewInverse)), interleaved_gradientNoise(), sunSSS_density > 0.0 && shadowMapFalloff2 < 1.0, hand); + + // combine shadowmap with a minumum shadow determined by the screenspace shadows. + Shadows = min(Shadows, SS_directLight.r); + + // combine shadowmap blocker depth with a minumum determined by the screenspace shadows, starting after the shadowmap ends + ShadowBlockerDepth = mix(SS_directLight.g, ShadowBlockerDepth, shadowMapFalloff2); + #endif + + Direct_SSS = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), SSS_shadow); + // Direct_SSS *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff2); + if (isEyeInWater == 0) Direct_SSS *= lightLeakFix; + + #ifndef SCREENSPACE_CONTACT_SHADOWS + Direct_SSS = mix(vec3(0.0), Direct_SSS, shadowMapFalloff2); + #endif + + #ifdef CLOUDS_SHADOWS + cloudShadow = GetCloudShadow(feetPlayerPos); + Shadows *= cloudShadow; + Direct_SSS *= cloudShadow; + #endif + + #endif ///////////////////////////////////////////////////////////////////////// ///////////////////////////// FINALIZE ///////////////////////////// ///////////////////////////////////////////////////////////////////////// + + #ifdef SSS_view albedo = vec3(1); + NdotL = 0; #endif #ifdef OVERWORLD_SHADER - // do these here so it gets underwater absorbtion. Direct_lighting = max(DirectLightColor * NdotL * Shadows, DirectLightColor * Direct_SSS); #endif @@ -1355,17 +1324,15 @@ void main() { DoSpecularReflections(gl_FragData[0].rgb, viewPos, feetPlayerPos_normalized, WsunVec, specularNoises, normal, SpecularTex.r, SpecularTex.g, albedo, DirectLightColor*Shadows*NdotL, lightmap.y, hand); #endif - // gl_FragData[0].rgb += vec3(CaveFogColor_R, CaveFogColor_G, CaveFogColor_B)*0.1 * darkSpecularHighlight(feetPlayerPos, normal, SpecularTex.r, SpecularTex.g); - - Emission(gl_FragData[0].rgb, albedo, SpecularTex.a); + Emission(gl_FragData[0].rgb, albedo, SpecularTex.a, exposure); if(lightningBolt) gl_FragData[0].rgb = vec3(77.0, 153.0, 255.0); + gl_FragData[0].rgb *= Absorbtion; } - - if(translucent_alpha > 0.0 ){ + if(translucentMasks > 0.0){ #ifdef DISTANT_HORIZONS vec4 vlBehingTranslucents = BilateralUpscale_DH(colortex13, colortex12, gl_FragCoord.xy, sqrt(texture2D(colortex12,texcoord).a/65000.0)); #else @@ -1375,22 +1342,28 @@ void main() { gl_FragData[0].rgb = gl_FragData[0].rgb * vlBehingTranslucents.a + vlBehingTranslucents.rgb; } + // gl_FragData[0].rgb = vec3(1.0) * clamp(1.0 - filteredShadow.y/1,0,1); + // if(hideGUI > 0) gl_FragData[0].rgb = vec3(1.0) * Shadows; ////// DEBUG VIEW STUFF - #if DEBUG_VIEW == debug_SHADOWMAP - vec3 OutsideShadowMap_and_DH_shadow = (shadowMapFalloff > 0.0 && z >= 1.0) ? vec3(0.25,1.0,0.25) : vec3(1.0,0.25,0.25); - vec3 Normal_Shadowmap = z < 1.0 ? vec3(1.0,1.0,1.0) : OutsideShadowMap_and_DH_shadow; - gl_FragData[0].rgb = mix(vec3(0.1) * (normal.y * 0.1 +0.9), Normal_Shadowmap, shadowMap) * 30.0; - #endif + // #if DEBUG_VIEW == debug_SHADOWMAP + // vec3 OutsideShadowMap_and_DH_shadow = (shadowMapFalloff > 0.0 && z >= 1.0) ? vec3(0.25,1.0,0.25) : vec3(1.0,0.25,0.25); + // vec3 Normal_Shadowmap = z < 1.0 ? vec3(1.0,1.0,1.0) : OutsideShadowMap_and_DH_shadow; + // gl_FragData[0].rgb = mix(vec3(0.1) * (normal.y * 0.1 +0.9), Normal_Shadowmap, shadowMap) * 30.0; + // #endif #if DEBUG_VIEW == debug_NORMALS - gl_FragData[0].rgb = FlatNormals; + if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0); + gl_FragData[0].rgb = worldToView(normal); #endif #if DEBUG_VIEW == debug_SPECULAR + if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0); gl_FragData[0].rgb = SpecularTex.rgb; #endif #if DEBUG_VIEW == debug_INDIRECT + if(swappedDepth >= 1.0) Direct_lighting = vec3(5.0); gl_FragData[0].rgb = Indirect_lighting; #endif #if DEBUG_VIEW == debug_DIRECT + if(swappedDepth >= 1.0) Direct_lighting = vec3(15.0); gl_FragData[0].rgb = Direct_lighting; #endif #if DEBUG_VIEW == debug_VIEW_POSITION @@ -1398,14 +1371,34 @@ void main() { #endif #if DEBUG_VIEW == debug_FILTERED_STUFF vec3 FilteredDebug = vec3(15.0) * exp(-7.0 * vec3(1.0,0.5,1.0) * filteredShadow.y); - // FilteredDebug += vec3(15.0) * exp(-7.0 * vec3(1.0,1.0,0.5) * pow(SSAO_SSS.x,2)); - // FilteredDebug += vec3(15.0) * exp(-7.0 * vec3(0.5,1.0,1.0) * pow(SSAO_SSS.y,2)); + FilteredDebug += vec3(15.0) * exp(-7.0 * vec3(1.0,1.0,0.5) * pow(SSAO_SSS.x,2)); + FilteredDebug += vec3(15.0) * exp(-7.0 * vec3(0.5,1.0,1.0) * pow(SSAO_SSS.y,2)); gl_FragData[0].rgb = FilteredDebug; #endif + #if DEBUG_VIEW == debug_TEMPORAL_REPROJECTION + vec3 color = vec3(1.0); + // vec4 reprojectedBuffer0 = texture2D(colortex12, texcoord); + vec4 reprojectedBuffer = texture2D(colortex14, texcoord); + + vec3 Indirect = vec3(1.0) * pow(reprojectedBuffer.x,6.0) + vec3(0,25,0) * ( 1.0 - reprojectedBuffer.y ); + // vec3 Direct = vec3(15.0) * exp(-3*reprojectedBuffer1.y); + color += Indirect; + // color += Direct; + // color *= albedo; + + // color *= dot(vec3(reprojectedBuffer.a)*2-1, worldToView(normal)); + + color *= reprojectedBuffer.a; + if(swappedDepth >= 1.0) color = vec3(1.0); + gl_FragData[0].rgb = color; + #endif + + // float shadew = clamp(1.0 - filteredShadow.y/1,0.0,1.0); + // gl_FragData[0].rgb = vec3(1) * exp( (1-shadew) * -7); #ifdef CLOUDS_INFRONT_OF_WORLD gl_FragData[1] = texture2D(colortex2, texcoord); diff --git a/shaders/dimensions/composite1.vsh b/shaders/dimensions/composite1.vsh index db4a63b..15fecc7 100644 --- a/shaders/dimensions/composite1.vsh +++ b/shaders/dimensions/composite1.vsh @@ -6,10 +6,12 @@ #endif flat varying vec3 WsunVec; -// flat varying vec3 unsigned_WsunVec; +flat varying vec3 unsigned_WsunVec; flat varying vec3 averageSkyCol_Clouds; flat varying vec4 lightCol; +flat varying float exposure; + flat varying vec2 TAA_Offset; flat varying vec3 zMults; uniform sampler2D colortex4; @@ -53,8 +55,9 @@ void main() { averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb; WsunVec = lightCol.a*normalize(mat3(gbufferModelViewInverse) * sunPosition); - // unsigned_WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition); + unsigned_WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition); + exposure = texelFetch2D(colortex4,ivec2(10,37),0).r; #ifdef TAA TAA_Offset = offsets[framemod8]; diff --git a/shaders/dimensions/composite10.fsh b/shaders/dimensions/composite10.fsh index f81059a..8e5c48b 100644 --- a/shaders/dimensions/composite10.fsh +++ b/shaders/dimensions/composite10.fsh @@ -1,3 +1,5 @@ +#include "/lib/settings.glsl" + uniform sampler2D colortex3; uniform sampler2D colortex6; @@ -79,24 +81,33 @@ vec4 texture2D_bicubic(sampler2D tex, vec2 uv) void main() { /* DRAWBUFFERS:3 */ vec2 resScale = vec2(1920.,1080.)/max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.)); -vec2 texcoord = ((gl_FragCoord.xy)*2.+0.5)*texelSize; -vec3 bloom = texture2D_bicubic(colortex3,texcoord/2.0).rgb; //1/4 res +vec2 texcoord = ((gl_FragCoord.xy)*2.0 + 0.5)*texelSize; -bloom += texture2D_bicubic(colortex6,texcoord/4.).rgb; //1/8 res +#ifdef OLD_BLOOM + vec3 bloom = texture2D_bicubic(colortex3,texcoord/2.).rgb; //1/4 res + bloom += texture2D_bicubic(colortex6,texcoord/4.).rgb; //1/8 res + bloom += texture2D_bicubic(colortex6,texcoord/8.+vec2(0.25*resScale.x+2.5*texelSize.x,.0)).rgb; //1/16 res + bloom += texture2D_bicubic(colortex6,texcoord/16.+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb; //1/32 res + bloom += texture2D_bicubic(colortex6,texcoord/32.+vec2(0.4375*resScale.x+6.5*texelSize.x,.0)).rgb; //1/64 res + bloom += texture2D_bicubic(colortex6,texcoord/64.+vec2(0.46875*resScale.x+8.5*texelSize.x,.0)).rgb; //1/128 res + bloom += texture2D_bicubic(colortex6,texcoord/128.+vec2(0.484375*resScale.x+10.5*texelSize.x,.0)).rgb; //1/256 res -bloom += texture2D_bicubic(colortex6,texcoord/8.+vec2(0.25*resScale.x+2.5*texelSize.x,.0)).rgb; //1/16 res + gl_FragData[0].rgb = bloom * 2.0; +#else -bloom += texture2D_bicubic(colortex6,texcoord/16.+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb; //1/32 res + float weights[7] = float[]( 1.0, 1.0/2.0, 1.0/3.0, 1.0/5.5, 1.0/8.0, 1.0/10.0, 1.0/12.0 ); + // float weights[7] = float[]( 0.7, pow(0.5,2), pow(0.5,3), pow(0.5,4), pow(0.5,5), pow(0.5,6), pow(0.5,7) ); -bloom += texture2D_bicubic(colortex6,texcoord/32.+vec2(0.4375*resScale.x+6.5*texelSize.x,.0)).rgb*1.0; //1/64 res + vec3 bloom = texture2D_bicubic(colortex3,texcoord/2.).rgb * weights[0]; //1/4 res + bloom += texture2D_bicubic(colortex6,texcoord/4.).rgb * weights[1]; //1/8 res + bloom += texture2D_bicubic(colortex6,texcoord/8.+vec2(0.25*resScale.x+2.5*texelSize.x,.0)).rgb * weights[2]; //1/16 res + bloom += texture2D_bicubic(colortex6,texcoord/16.+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb * weights[3]; //1/32 res + bloom += texture2D_bicubic(colortex6,texcoord/32.+vec2(0.4375*resScale.x+6.5*texelSize.x,.0)).rgb * weights[4]; //1/64 res + bloom += texture2D_bicubic(colortex6,texcoord/64.+vec2(0.46875*resScale.x+8.5*texelSize.x,.0)).rgb * weights[5]; //1/128 res + bloom += texture2D_bicubic(colortex6,texcoord/128.+vec2(0.484375*resScale.x+10.5*texelSize.x,.0)).rgb * weights[6]; //1/256 res -bloom += texture2D_bicubic(colortex6,texcoord/64.+vec2(0.46875*resScale.x+8.5*texelSize.x,.0)).rgb*1.0; //1/128 res - -bloom += texture2D_bicubic(colortex6,texcoord/128.+vec2(0.484375*resScale.x+10.5*texelSize.x,.0)).rgb*1.0; //1/256 res - -//bloom = texture2D_bicubic(colortex6,texcoord).rgb*6.; //1/8 res - -gl_FragData[0].rgb = bloom*2.; + gl_FragData[0].rgb = bloom * 3.0; +#endif gl_FragData[0].rgb = clamp(gl_FragData[0].rgb,0.0,65000.); } diff --git a/shaders/dimensions/composite11.fsh b/shaders/dimensions/composite11.fsh index 72284b5..b2f3548 100644 --- a/shaders/dimensions/composite11.fsh +++ b/shaders/dimensions/composite11.fsh @@ -67,57 +67,39 @@ float ld(float depth) { // uniform float viewHeight; // uniform sampler2D depthtex0; + +#ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex; +#endif uniform float dhNearPlane; uniform float dhFarPlane; -// uniform mat4 gbufferProjectionInverse; -uniform mat4 dhProjectionInverse; - -vec3 getViewPos() { - ivec2 uv = ivec2(gl_FragCoord.xy); - vec2 viewSize = vec2(viewWidth, viewHeight); - vec2 texcoord = gl_FragCoord.xy / viewSize; - - vec4 viewPos = vec4(0.0); - - float depth = texelFetch(depthtex0, uv, 0).r; - - if (depth < 1.0) { - vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0; - viewPos = gbufferProjectionInverse * ndcPos; - viewPos.xyz /= viewPos.w; - } else { - depth = texelFetch(dhDepthTex, ivec2(gl_FragCoord.xy), 0).r; - - vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0; - viewPos = dhProjectionInverse * ndcPos; - viewPos.xyz /= viewPos.w; - } - - return viewPos.xyz; -} - -vec3 ACESFilm2(vec3 x){ -// float a = 2.51f; -// float b = 0.03f; -// float c = 2.43f; -// float d = 0.59f; -// float e = 0.14f; - - float a = 2.51f; // brightests - float b = 0.53f; // lower midtones - float c = 2.43f; // upper midtones - float d = 0.59f; // upper midtones - float e = 0.54f; // lowest tones - return clamp((x*(a*x+b))/(x*(c*x+d)+e),0.0,1.0); -} - float linearizeDepthFast(const in float depth, const in float near, const in float far) { return (near * far) / (depth * (near - far) + far); } + + + + + + +float bloomWeight(){ + + float weights[7] = float[]( 1.0, 1.0/2.0, 1.0/3.0, 1.0/5.5, 1.0/8.0, 1.0/10.0, 1.0/12.0 ); + // float weights[7] = float[]( 0.7, pow(0.5,2), pow(0.5,3), pow(0.5,4), pow(0.5,5), pow(0.5,6), pow(0.5,7) ); + + float result = 0.0; + + for ( int i = 0; i < 7; i++) { + result += weights[i]; + } + + return result; +} + #define linear_to_srgb(x) (pow(x, vec3(1.0/2.2))) + void main() { /* DRAWBUFFERS:7 */ float vignette = (1.5-dot(texcoord-0.5,texcoord-0.5)*2.); @@ -157,15 +139,15 @@ void main() { vec2 clampedRes = max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.)); + #ifdef OLD_BLOOM + vec3 bloom = texture2D(colortex3,texcoord/clampedRes*vec2(1920.,1080.)*BLOOM_QUALITY).rgb / 2.0 / 7.0; + float lightScat = clamp((BLOOM_STRENGTH+3) * 0.05 * pow(exposure.a, 0.2) ,0.0,1.0) * vignette; + #else + vec3 bloom = texture2D(colortex3,texcoord/clampedRes*vec2(1920.,1080.)*BLOOM_QUALITY).rgb / 3.0 / bloomWeight(); + float lightScat = clamp(BLOOM_STRENGTH * 0.5 * pow(exposure.a, 0.2) ,0.0,1.0) * vignette; + #endif - vec3 bloom = (texture2D(colortex3,texcoord/clampedRes*vec2(1920.,1080.)*BLOOM_QUALITY).rgb)/2./7.0; - - // vec3 bloom = texture2D(colortex3, texcoord/clampedRes*vec2(1920.,1080.)*BLOOM_QUALITY).rgb / 2.0 / 7.0; - - float lightScat = clamp(BLOOM_STRENGTH * 0.05 * pow(exposure.a, 0.2) ,0.0,1.0)*vignette; - - float VL_abs = texture2D(colortex7,texcoord*RENDER_SCALE).r; - + float VL_abs = texture2D(colortex7, texcoord*RENDER_SCALE).r; #ifdef AUTO_EXPOSURE float purkinje = clamp(exposure.a*exposure.a,0.0,1.0) * clamp(rodExposureDepth.x/(1.0+rodExposureDepth.x)*Purkinje_strength,0,1); @@ -174,8 +156,10 @@ void main() { #endif VL_abs = clamp((1.0-VL_abs)*BLOOMY_FOG*0.75*(1.0+rainStrength) * (1.0-purkinje*0.3),0.0,1.0)*clamp(1.0-pow(cdist(texcoord.xy),15.0),0.0,1.0); - + col = (mix(col, bloom, VL_abs) + bloom * lightScat) * exposure.rgb; + + // if(hideGUI > 0) col = bloom * lightScat* exposure.rgb; float lum = dot(col, vec3(0.15,0.3,0.55)); float lum2 = dot(col, vec3(0.85,0.7,0.45)); @@ -184,12 +168,6 @@ void main() { col = mix(lum * vec3(Purkinje_R, Purkinje_G, Purkinje_B) * Purkinje_Multiplier, col, rodCurve); - - - // gl_FragColor = vec4(getViewPos() * 0.001,1.0); - // gl_FragColor.rgb = linear_to_srgb(gl_FragColor.rgb); - - #ifndef USE_ACES_COLORSPACE_APPROXIMATION col = LinearTosRGB(TONEMAP(col)); #else diff --git a/shaders/dimensions/composite2.fsh b/shaders/dimensions/composite2.fsh index 1b109d7..8af94e0 100644 --- a/shaders/dimensions/composite2.fsh +++ b/shaders/dimensions/composite2.fsh @@ -7,8 +7,11 @@ flat varying vec3 averageSkyCol_Clouds; uniform sampler2D noisetex; uniform sampler2D depthtex0; uniform sampler2D depthtex1; + +#ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex; uniform sampler2D dhDepthTex1; +#endif uniform sampler2D colortex2; uniform sampler2D colortex3; @@ -366,7 +369,11 @@ void main() { #endif float z = texture2D(depthtex1,tc).x; - float DH_z = texture2D(dhDepthTex1,tc).x; + #ifdef DISTANT_HORIZONS + float DH_z = texture2D(dhDepthTex1,tc).x; + #else + float DH_z = 0.0; + #endif vec3 viewPos1 = toScreenSpace_DH(tc/RENDER_SCALE, z, DH_z); vec3 viewPos0 = toScreenSpace_DH(tc/RENDER_SCALE, z0, DH_z0); @@ -418,4 +425,6 @@ void main() { gl_FragData[0] = clamp(vec4(vl,1.0),0.000001,65000.); } + + // gl_FragData[0] = clamp(vec4(vl,1.0),0.000001,65000.); } \ No newline at end of file diff --git a/shaders/dimensions/composite3.fsh b/shaders/dimensions/composite3.fsh index 3c1e6f9..fe30b5a 100644 --- a/shaders/dimensions/composite3.fsh +++ b/shaders/dimensions/composite3.fsh @@ -8,9 +8,11 @@ flat varying vec3 skyGroundColor; uniform sampler2D noisetex; uniform sampler2D depthtex0; uniform sampler2D depthtex1; + +#ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex; uniform sampler2D dhDepthTex1; - +#endif uniform sampler2D colortex0; uniform sampler2D colortex1; @@ -197,23 +199,24 @@ void applyContrast(inout vec3 color, float contrast){ color = ((color - 0.5) * max(contrast, 0.0)) + 0.5; } -void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, float lineardistance, bool isEntity){ +void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, float lineardistance, bool isTranslucentEntity){ vec2 UnalteredTexcoord = Texcoord; - float refractionStrength = isEntity ? 0.5 : 1.0; + float refractionStrength = isTranslucentEntity ? 0.25 : 1.0 ; // Texcoord = abs(Texcoord + (TangentNormals * clamp((ld(depths.x) - ld(depths.y)) * 0.5,0.0,0.15)) * RENDER_SCALE * refractionStrength ); Texcoord = abs(Texcoord + (TangentNormals * mix(0.01, 0.1, pow(clamp(1.0-lineardistance/(32*4),0.0,1.0),2))) * RENDER_SCALE * refractionStrength ); float DistortedAlpha = decodeVec2(texture2D(colortex11,Texcoord).b).g; + // float DistortedAlpha = decodeVec2(texelFetch2D(colortex11,ivec2(Texcoord/texelSize),0).b).g; + // float DistortedAlpha = texelFetch2D(colortex2,ivec2(Texcoord/texelSize),0).a; - if(DistortedAlpha < 0.1) Texcoord = UnalteredTexcoord; // remove distortion on non-translucents + Texcoord = mix(Texcoord, UnalteredTexcoord, min(max(0.1-DistortedAlpha,0.0) * 1000.0,1.0)); // remove distortion on non-translucents } -uniform float dhRenderDistance; +uniform int dhRenderDistance; uniform float eyeAltitude; - void main() { /* DRAWBUFFERS:73 */ @@ -257,25 +260,27 @@ void main() { float lightleakfixfast = clamp(eyeBrightness.y/240.,0.0,1.0); ////// --------------- UNPACK TRANSLUCENT GBUFFERS --------------- ////// - vec3 data = texture2D(colortex11,texcoord).rgb; + vec4 data = texture2D(colortex11,texcoord).rgba; vec4 unpack0 = vec4(decodeVec2(data.r),decodeVec2(data.g)) ; vec4 unpack1 = vec4(decodeVec2(data.b),0,0) ; vec4 albedo = vec4(unpack0.ba,unpack1.rg); vec2 tangentNormals = unpack0.xy*2.0-1.0; - if(albedo.a < 0.01) tangentNormals = vec2(0.0); vec4 TranslucentShader = texture2D(colortex2, texcoord); ////// --------------- UNPACK MISC --------------- ////// - float trpData = texture2D(colortex7, texcoord).a; - - ////// --------------- MASKS/BOOLEANS --------------- ////// - bool iswater = trpData > 0.99; - bool isTranslucentEntity = abs(trpData-0.1) < 0.01; - float translucentAlpha = trpData; + // 1.0 = water mask + // 0.9 = entity mask + // 0.8 = reflective entities + // 0.7 = reflective blocks + float translucentMasks = texture2D(colortex7, texcoord).a; + bool isWater = translucentMasks > 0.99; + bool isReflectiveEntity = abs(translucentMasks - 0.8) < 0.01; + bool isReflective = abs(translucentMasks - 0.7) < 0.01 || isWater || isReflectiveEntity; + bool isEntity = abs(translucentMasks - 0.9) < 0.01 || isReflectiveEntity; ////// --------------- get volumetrics @@ -293,26 +298,29 @@ void main() { ////// --------------- distort texcoords as a refraction effect vec2 refractedCoord = texcoord; + #ifdef Refraction - ApplyDistortion(refractedCoord, tangentNormals, linearDistance, isTranslucentEntity); + ApplyDistortion(refractedCoord, tangentNormals, linearDistance, isEntity); #endif ////// --------------- MAIN COLOR BUFFER vec3 color = texture2D(colortex3, refractedCoord).rgb; + // apply block breaking effect. + if(albedo.a > 0.01 && !isWater && TranslucentShader.a <= 0.0) color = mix(color*6.0, color, luma(albedo.rgb)) * albedo.rgb; ////// --------------- BLEND TRANSLUCENT GBUFFERS //////////// and do border fog on opaque and translucents #if defined BorderFog - #ifdef DISTANT_HORIZONS - float fog = 1.0 - pow(1.0-pow(1.0-min(max(1.0 - linearDistance_cylinder / dhFarPlane,0.0)*3.0,1.0),2.0),2.0); + float fog = smoothstep(1.0, 0.0, min(max(1.0 - linearDistance_cylinder / dhRenderDistance,0.0)*3.0,1.0) ); #else - float fog = 1.0 - pow(1.0-pow(1.0-min(max(1.0 - linearDistance_cylinder / far,0.0)*5.0,1.0),2.0),2.0); + float fog = smoothstep(1.0, 0.0, min(max(1.0 - linearDistance_cylinder / far,0.0)*3.0,1.0) ); #endif fog *= exp(-10.0 * pow(clamp(np3.y,0.0,1.0)*4.0,2.0)); + if(swappedDepth >= 1.0 || isEyeInWater != 0) fog = 0.0; if(lightleakfixfast < 1.0) fog *= lightleakfix; @@ -320,27 +328,24 @@ void main() { #ifdef SKY_GROUND vec3 borderFogColor = skyGroundColor; #else - vec3 borderFogColor = skyFromTex(np3, colortex4)/30.0; + vec3 borderFogColor = skyFromTex(np3, colortex4)/30.0; #endif color.rgb = mix(color.rgb, borderFogColor, fog); + #else + float fog = 0.0; #endif - - if (albedo.a > 0.0 || TranslucentShader.a > 0.0){ - + if (TranslucentShader.a > 0.0){ #ifdef Glass_Tint - if(!iswater && TranslucentShader.a > 0.0) color *= normalize(albedo.rgb+0.0001)*0.9+0.1; + if(!isWater) color *= mix(normalize(albedo.rgb+0.0001)*0.9+0.1, vec3(1.0), max(fog, min(max(0.1-albedo.a,0.0) * 1000.0,1.0))) ; #endif - // block breaking effect. - if(!iswater && TranslucentShader.a <= 0.0) color *= albedo.rgb; - - color = color*(1.0-TranslucentShader.a) + TranslucentShader.rgb; - #ifdef BorderFog - color.rgb = mix(color.rgb, borderFogColor, fog); + TranslucentShader = mix(TranslucentShader, vec4(0.0), fog); #endif + + color = color*(1.0-TranslucentShader.a) + TranslucentShader.rgb*10.0; } ////// --------------- VARIOUS FOG EFFECTS (behind volumetric fog) @@ -361,7 +366,7 @@ void main() { BiomeFogColor(cavefogCol); #endif - color.rgb = mix(color.rgb, cavefogCol, cavefog * (1-lightleakfix)); + color.rgb = mix(color.rgb, cavefogCol, cavefog * lightleakfix); } #endif @@ -442,13 +447,13 @@ void main() { vl.a = 1.0; } #endif -// color.rgb = vec3(1) * sqrt(texture2D(colortex12,texcoord).a/65000.0); gl_FragData[0].r = bloomyFogMult; // pass fog alpha so bloom can do bloomy fog gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0); + + // gl_FragData[1].rgb = vec3(1.0) * ld( (data.a > 0.0 ? data.a : texture2D(depthtex0, texcoord).x ) ) ; + // gl_FragData[1].rgb = gl_FragData[1].rgb * (1.0-TranslucentShader.a) + TranslucentShader.rgb*10.0; + // gl_FragData[1].rgb = 1-(texcoord.x > 0.5 ? vec3(TranslucentShader.a) : vec3(data.a)); - // gl_FragData[1].rgb = vec3(1) * sqrt(texelFetch2D(colortex12,ivec2(gl_FragCoord.xy),0).a/65000.0); - - // gl_FragData[1].rgb = vl.rgb; } \ No newline at end of file diff --git a/shaders/dimensions/composite5.fsh b/shaders/dimensions/composite5.fsh index 00e1a12..03a044b 100644 --- a/shaders/dimensions/composite5.fsh +++ b/shaders/dimensions/composite5.fsh @@ -16,7 +16,7 @@ const int colortex11Format = RGBA16; // unchanged translucents albedo, alpha const int colortex12Format = RGBA16F; // DISTANT HORIZONS + VANILLA MIXED DEPTHs const int colortex13Format = RGBA16F; // low res VL (composite5->composite15) -const int colortex14Format = RGBA8; // rg = SSAO and SS-SSS. a = skylightmap for translucents. +const int colortex14Format = RGBA16; // rg = SSAO and SS-SSS. a = skylightmap for translucents. const int colortex15Format = RGBA8; // flat normals and vanilla AO */ @@ -59,6 +59,7 @@ uniform sampler2D colortex5; uniform sampler2D colortex6; uniform sampler2D colortex10; uniform sampler2D colortex12; +uniform sampler2D colortex14; uniform sampler2D depthtex0; uniform sampler2D depthtex1; @@ -249,13 +250,20 @@ vec3 closestToCamera5taps_DH(vec2 texcoord, sampler2D depth, sampler2D dhDepth, } +#ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex; +#endif +uniform float near; uniform float far; uniform float dhFarPlane; uniform float dhNearPlane; #include "/lib/DistantHorizons_projections.glsl" + +float ld(float dist) { + return (2.0 * near) / (far + near - dist * (far - near)); +} float DH_ld(float dist) { return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane)); } @@ -332,7 +340,7 @@ vec4 TAA_hq(bool hand){ //use velocity from the nearest texel from camera in a 3x3 box in order to improve edge quality in motion #ifdef CLOSEST_VELOCITY #ifdef DISTANT_HORIZONS - vec3 closestToCamera = closestToCamera5taps_DH(adjTC, depthtex0, dhDepthTex, depthCheck, hand); + vec3 closestToCamera = closestToCamera5taps_DH(adjTC, depthtex0, dhDepthTex, depthCheck, hand); #else vec3 closestToCamera = closestToCamera5taps(adjTC,depthtex0, hand); #endif @@ -384,16 +392,20 @@ vec4 TAA_hq(bool hand){ #endif #ifndef SCREENSHOT_MODE + vec3 albedoPrev = max(FastCatmulRom(colortex5, previousPosition.xy,vec4(texelSize, 1.0/texelSize), 0.75).xyz, 0.0); vec3 finalcAcc = clamp(albedoPrev, cMin, cMax); //Increases blending factor when far from AABB and in motion, reduces ghosting float isclamped = distance(albedoPrev,finalcAcc)/luma(albedoPrev) * 0.5; - float movementRejection = (0.12+isclamped)*clamp(length(velocity/texelSize),0.0,1.0); - if(hand) movementRejection *= 5.0; + + float depthDiff = texture2D(colortex14, previousPosition.xy).a; + // movementRejection = mix( 0.0, 1.0, depthDiff); + if(hand) movementRejection *= 5.0; + //Blend current pixel with clamped history, apply fast tonemap beforehand to reduce flickering vec4 supersampled = vec4(invTonemap(mix(tonemap(finalcAcc), tonemap(albedoCurrent0), clamp(BLEND_FACTOR + movementRejection, 0.0,1.0))), 1.0); @@ -422,15 +434,16 @@ void main() { gl_FragData[0].a = 1.0; - #ifdef TAA - - float dataUnpacked = decodeVec2(texture2D(colortex1,texcoord).w).y; bool hand = abs(dataUnpacked-0.75) < 0.01 && texture2D(depthtex1,texcoord).x < 1.0; vec4 color = TAA_hq(hand); + #if DEBUG_VIEW == debug_TEMPORAL_REPROJECTION + color.rgb = texture2D(colortex3, texcoord).rgb; + #endif + #ifdef SCREENSHOT_MODE gl_FragData[0] = clamp(color, 0.0, 65000.0); #else diff --git a/shaders/dimensions/deferred.fsh b/shaders/dimensions/deferred.fsh index 3cd8416..1f0cbe5 100644 --- a/shaders/dimensions/deferred.fsh +++ b/shaders/dimensions/deferred.fsh @@ -383,6 +383,7 @@ vec3 temp = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy),0).rgb; vec3 curr = gl_FragData[0].rgb*150.; if(accumuteSpeed < 1.0) mixhistory = 1.0; + gl_FragData[0].rgb = clamp(mix(temp, curr, mixhistory),0.0,65000.); diff --git a/shaders/dimensions/deferred.vsh b/shaders/dimensions/deferred.vsh index ef07d8a..02b4c0f 100644 --- a/shaders/dimensions/deferred.vsh +++ b/shaders/dimensions/deferred.vsh @@ -142,7 +142,7 @@ void main() { // maximum control of color and luminance vec3 minimumlight = vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.003 + nightVision); - averageSkyCol_Clouds = max( normalize(averageSkyCol_Clouds) * min(luma(averageSkyCol_Clouds) * 3.0,3.0), minimumlight); + averageSkyCol_Clouds = max( normalize(averageSkyCol_Clouds) * min(luma(averageSkyCol_Clouds) * 3.0,2.5), minimumlight); averageSkyCol = max(averageSkyCol * PLANET_GROUND_BRIGHTNESS, minimumlight); //////////////////////////////////////// diff --git a/shaders/dimensions/deferred1.fsh b/shaders/dimensions/deferred1.fsh index 0a07d53..97baa78 100644 --- a/shaders/dimensions/deferred1.fsh +++ b/shaders/dimensions/deferred1.fsh @@ -7,9 +7,10 @@ uniform vec2 texelSize; uniform sampler2D depthtex0; uniform sampler2D depthtex1; +#ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex; uniform sampler2D dhDepthTex1; - +#endif uniform float near; uniform float far; @@ -44,7 +45,9 @@ void main() { #ifdef DISTANT_HORIZONS float QuarterResDepth = texelFetch2D(dhDepthTex, ivec2(gl_FragCoord.xy*4), 0).x; - if(newTex >= 1.0) newTex = QuarterResDepth; + if(newTex >= 1.0) newTex = sqrt(QuarterResDepth);// + 0.0001; + + gl_FragData[1].a = DH_ld(QuarterResDepth)*DH_ld(QuarterResDepth)*65000.0; #endif if (newTex < 1.0) @@ -52,28 +55,27 @@ void main() { else gl_FragData[0] = vec4(oldTex, 2.0); - float depth = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x; - - #ifdef DISTANT_HORIZONS - float _near = near; - float _far = far*4.0; - if (depth >= 1.0) { - depth = texelFetch2D(dhDepthTex1, ivec2(gl_FragCoord.xy*4), 0).x; - _near = dhNearPlane; - _far = dhFarPlane; - } - - depth = linearizeDepthFast(depth, _near, _far); - depth = depth / dhFarPlane; - #endif - - if(depth < 1.0) - gl_FragData[1] = vec4(vec3(0.0), depth * depth * 65000.0); - else - gl_FragData[1] = vec4(vec3(0.0), 65000.0); - #ifdef DISTANT_HORIZONS - gl_FragData[1].a = DH_ld(QuarterResDepth)*DH_ld(QuarterResDepth)*65000.0; - #endif + // float depth = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x; + + // #ifdef DISTANT_HORIZONS + // float _near = near; + // float _far = far*4.0; + // if (depth >= 1.0) { + // depth = texelFetch2D(dhDepthTex1, ivec2(gl_FragCoord.xy*4), 0).x; + // _near = dhNearPlane; + // _far = dhFarPlane; + // } + + // depth = linearizeDepthFast(depth, _near, _far); + // depth = depth / dhFarPlane; + // #endif + + // if(depth < 1.0) + // gl_FragData[1] = vec4(vec3(0.0), depth * depth * 65000.0); + // else + // gl_FragData[1] = vec4(vec3(0.0), 65000.0); + + } \ No newline at end of file diff --git a/shaders/dimensions/deferred2.fsh b/shaders/dimensions/deferred2.fsh index 41c6eef..8385302 100644 --- a/shaders/dimensions/deferred2.fsh +++ b/shaders/dimensions/deferred2.fsh @@ -16,7 +16,10 @@ flat varying float tempOffsets; // uniform float far; uniform float near; uniform sampler2D depthtex0; + +#ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex; +#endif // uniform sampler2D colortex4; uniform sampler2D noisetex; @@ -111,8 +114,6 @@ void main() { // gl_FragData[0] = vec4(0.0,0.0,0.0,1.0); gl_FragData[0] = VolumetricClouds; - - #else gl_FragData[0] = vec4(0.0,0.0,0.0,1.0); #endif diff --git a/shaders/dimensions/final.fsh b/shaders/dimensions/final.fsh index 5c3adc9..b5463e7 100644 --- a/shaders/dimensions/final.fsh +++ b/shaders/dimensions/final.fsh @@ -3,6 +3,8 @@ varying vec2 texcoord; uniform sampler2D colortex7; +uniform sampler2D colortex14; +uniform sampler2D depthtex0; uniform vec2 texelSize; uniform float frameTimeCounter; @@ -17,6 +19,7 @@ uniform sampler2D shadowtex1; #include "/lib/res_params.glsl" #include "/lib/gameplay_effects.glsl" +uniform int hideGUI; vec4 SampleTextureCatmullRom(sampler2D tex, vec2 uv, vec2 texSize ) { @@ -90,7 +93,7 @@ vec3 toneCurve(vec3 color){ vec3 colorGrading(vec3 color) { float grade_luma = dot(color, vec3(1.0 / 3.0)); - float shadows_amount = saturate(-6.0 * grade_luma + 2.75); + float shadows_amount = saturate(-6.0 * grade_luma + 2.75); float mids_amount = saturate(-abs(6.0 * grade_luma - 3.0) + 1.25); float highlights_amount = saturate(6.0 * grade_luma - 3.25); @@ -101,31 +104,13 @@ vec3 colorGrading(vec3 color) { return saturate(graded_shadows * shadows_amount + graded_mids * mids_amount + graded_highlights * highlights_amount); } -// #ifdef HURT_AND_DEATH_EFFECT -// uniform float hurt; -// uniform float dying; -// uniform float dead; - -// void PlayerDamagedEffect(inout vec3 outColor){ - -// if(dying > 0){ - -// float vignette2 = clamp(1.0 - exp(-(sin(frameTimeCounter*7)*15+50) * dot(texcoord-0.5,texcoord-0.5)),0.0,1.0); - -// outColor = mix(outColor, vec3(0.0), min(dying,1.0)*vignette2); -// outColor = mix(outColor, vec3(0.0), dead); - -// }else{ - -// float vignette = clamp(1.0 - exp(-5 * dot(texcoord-0.5,texcoord-0.5)),0.0,1.0); - -// outColor = mix(outColor, vec3(0.3,0.0,0.0), vignette*sqrt(hurt)); - -// } -// } -// #endif +float interleaved_gradientNoise(){ + vec2 coord = gl_FragCoord.xy; + float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y)); + return noise; +} + -uniform int hideGUI; void main() { #ifdef BICUBIC_UPSCALING vec3 col = SampleTextureCatmullRom(colortex7,texcoord,1.0/texelSize).rgb; @@ -168,12 +153,19 @@ void main() { applyContrast(FINAL_COLOR, CONTRAST); // for fun - applyGameplayEffects_FRAGMENT(FINAL_COLOR, texcoord); // for making the fun, more fun - + applyGameplayEffects_FRAGMENT(FINAL_COLOR, texcoord, interleaved_gradientNoise()); // for making the fun, more fun + + + + + // float reprojectedBuffer = texture2D(colortex14, texcoord).a; + + // gl_FragColor.rgb = vec3(1.0) * reprojectedBuffer; + gl_FragColor.rgb = FINAL_COLOR; #if DEBUG_VIEW == debug_SHADOWMAP - if(texcoord.x < 0.25 && texcoord.y < 0.5) gl_FragColor.rgb = texture2D(shadowcolor0, (texcoord * vec2(2.0, 1.0) * 2 - vec2(0.0, 0.0)) ).rgb * vec3(1.0); + if(texcoord.x < 0.25 && texcoord.y < 0.5) gl_FragColor.rgb = texture2D(shadowcolor0, (texcoord * vec2(2.0, 1.0) * 2 - vec2(0.0, 0.0)) ).rgb; #endif } diff --git a/shaders/dimensions/fogBehindTranslucent_pass.fsh b/shaders/dimensions/fogBehindTranslucent_pass.fsh index 5672ffa..647dc5a 100644 --- a/shaders/dimensions/fogBehindTranslucent_pass.fsh +++ b/shaders/dimensions/fogBehindTranslucent_pass.fsh @@ -3,12 +3,15 @@ flat varying vec4 lightCol; flat varying vec3 averageSkyCol; flat varying vec3 averageSkyCol_Clouds; +flat varying float exposure; uniform sampler2D noisetex; uniform sampler2D depthtex0; uniform sampler2D depthtex1; +#ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex; uniform sampler2D dhDepthTex1; +#endif uniform sampler2D colortex2; uniform sampler2D colortex3; @@ -198,7 +201,7 @@ vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float vec3 absorbance = vec3(1.0); vec3 vL = vec3(0.0); - ambient = max(ambient* (normalize(wpos).y*0.3+0.7),0.0); + ambient = max(ambient * (normalize(wpos).y*0.3+0.7),0.0); float expFactor = 11.0; for (int i=0;i 0.0 || iswater){ #ifdef OVERWORLD_SHADER - float lightmap = texture2D(colortex14,tc).a; - if(z >= 1.0) lightmap = 1.0; + vec2 lightmap = decodeVec2(texture2D(colortex14, tc).a); + if(z >= 1.0) lightmap.y = 0.99; #else - float lightmap = 1.0; + vec2 lightmap = decodeVec2(texture2D(colortex14, tc).a); + lightmap.y = 1.0; #endif + + indirectLightColor_dynamic = indirectLightColor_dynamic * ambient_brightness * pow(1.0-pow(1.0-lightmap.y,0.5),3.0) ; + + float TorchBrightness_autoAdjust = mix(1.0, 30.0, clamp(exp(-10.0*exposure),0.0,1.0)) ; + // indirectLightColor_dynamic += vec3(TORCH_R,TORCH_G,TORCH_B) * TorchBrightness_autoAdjust * pow(1.0-sqrt(1.0-clamp(lightmap.x,0.0,1.0)),2.0) * 2.0; + float Vdiff = distance(viewPos1, viewPos0) * 2.0; float VdotU = playerPos.y; float estimatedDepth = Vdiff * abs(VdotU) ; //assuming water plane @@ -326,7 +345,7 @@ void main() { #endif vec4 underwaterVlFog = vec4(0,0,0,1); - if(iswater) underwaterVlFog = waterVolumetrics_test(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic * max(lightmap,0.0), directLightColor, dot(normalize(viewPos1), normalize(sunVec*lightCol.a)) ); + if(iswater) underwaterVlFog = waterVolumetrics_test(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos1), normalize(sunVec*lightCol.a)) ); vec4 fogFinal = vec4(underwaterVlFog.rgb * VolumetricFog2.a + VolumetricFog2.rgb, VolumetricFog2.a * underwaterVlFog.a); diff --git a/shaders/dimensions/fogBehindTranslucent_pass.vsh b/shaders/dimensions/fogBehindTranslucent_pass.vsh index 03a577d..7f835f1 100644 --- a/shaders/dimensions/fogBehindTranslucent_pass.vsh +++ b/shaders/dimensions/fogBehindTranslucent_pass.vsh @@ -12,6 +12,7 @@ flat varying vec3 refractedSunVec; flat varying float tempOffsets; uniform sampler2D colortex4; +flat varying float exposure; uniform float sunElevation; uniform vec2 texelSize; @@ -53,13 +54,13 @@ void main() { #ifdef NETHER_SHADER lightCol.rgb = vec3(0.0); averageSkyCol = vec3(0.0); - averageSkyCol_Clouds = vec3(2.0, 1.0, 0.5) * 10.0; + averageSkyCol_Clouds = vec3(2.0, 1.0, 0.5) * 5.0; #endif #ifdef END_SHADER lightCol.rgb = vec3(0.0); averageSkyCol = vec3(0.0); - averageSkyCol_Clouds = vec3(5.0); + averageSkyCol_Clouds = vec3(15); #endif @@ -68,4 +69,6 @@ void main() { // WsunVec = normalize(LightDir); refractedSunVec = refract(WsunVec, -vec3(0.0,1.0,0.0), 1.0/1.33333); + + exposure = texelFetch2D(colortex4,ivec2(10,37),0).r; } diff --git a/shaders/dimensions/setup.csh b/shaders/dimensions/setup.csh new file mode 100644 index 0000000..b4d9541 --- /dev/null +++ b/shaders/dimensions/setup.csh @@ -0,0 +1,967 @@ +layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +const ivec3 workGroups = ivec3(6, 6, 1); + +#ifdef IS_LPV_ENABLED + #include "/lib/blocks.glsl" + #include "/lib/lpv_blocks.glsl" + + const vec3 LightColor_Amethyst = vec3(0.464, 0.227, 0.788); + const vec3 LightColor_Candles = vec3(1.0, 0.4, 0.1); + const vec3 LightColor_CopperBulb = vec3(1.0); + const vec3 LightColor_LightBlock = vec3(1.0); + const vec3 LightColor_RedstoneTorch = vec3(0.939, 0.305, 0.164); + const vec3 LightColor_SeaPickle = vec3(0.283, 0.394, 0.212); + + #ifdef LPV_COLORED_CANDLES + const vec3 LightColor_Candles_Black = vec3(0.200); + const vec3 LightColor_Candles_Blue = vec3(0.000, 0.259, 1.000); + const vec3 LightColor_Candles_Brown = vec3(0.459, 0.263, 0.149); + const vec3 LightColor_Candles_Cyan = vec3(0.000, 0.839, 0.839); + const vec3 LightColor_Candles_Gray = vec3(0.329, 0.357, 0.388); + const vec3 LightColor_Candles_Green = vec3(0.263, 0.451, 0.000); + const vec3 LightColor_Candles_LightBlue = vec3(0.153, 0.686, 1.000); + const vec3 LightColor_Candles_LightGray = vec3(0.631, 0.627, 0.624); + const vec3 LightColor_Candles_Lime = vec3(0.439, 0.890, 0.000); + const vec3 LightColor_Candles_Magenta = vec3(0.757, 0.098, 0.812); + const vec3 LightColor_Candles_Orange = vec3(1.000, 0.459, 0.000); + const vec3 LightColor_Candles_Pink = vec3(1.000, 0.553, 0.718); + const vec3 LightColor_Candles_Purple = vec3(0.569, 0.000, 1.000); + const vec3 LightColor_Candles_Red = vec3(0.859, 0.000, 0.000); + const vec3 LightColor_Candles_White = vec3(1.000); + const vec3 LightColor_Candles_Yellow = vec3(1.000, 0.878, 0.000); + #endif + + uint BuildLpvMask(const in uint north, const in uint east, const in uint south, const in uint west, const in uint up, const in uint down) { + return east | (west << 1) | (down << 2) | (up << 3) | (south << 4) | (north << 5); + } +#endif + + +void main() { + #ifdef IS_LPV_ENABLED + uint blockId = uint(gl_GlobalInvocationID.x + gl_GlobalInvocationID.y * 32); + if (blockId >= 2000) return; + + vec3 lightColor = vec3(0.0); + float lightRange = 0.0; + float mixWeight = 0.0; + uint mixMask = 0xFFFF; + vec3 tintColor = vec3(1.0); + + switch (blockId) { + case BLOCK_WATER: + mixWeight = 0.8; + break; + + case BLOCK_BAMBOO: + mixWeight = 0.8; + break; + + case BLOCK_GRASS_SHORT: + case BLOCK_GRASS_TALL_UPPER: + case BLOCK_GRASS_TALL_LOWER: + mixWeight = 0.85; + break; + + case BLOCK_GROUND_WAVING: + case BLOCK_GROUND_WAVING_VERTICAL: + case BLOCK_AIR_WAVING: + mixWeight = 0.9; + break; + + case BLOCK_SAPLING: + mixWeight = 0.9; + break; + + // lightsources + + case BLOCK_AMETHYST_BUD_LARGE: + lightColor = LightColor_Amethyst; + lightRange = 4.0; + mixWeight = 0.6; + break; + case BLOCK_AMETHYST_BUD_MEDIUM: + lightColor = LightColor_Amethyst; + lightRange = 2.0; + mixWeight = 0.8; + break; + case BLOCK_AMETHYST_CLUSTER: + lightColor = LightColor_Amethyst; + lightRange = 5.0; + mixWeight = 0.4; + break; + case BLOCK_BEACON: + lightColor = vec3(1.0); + lightRange = 15.0; + break; + case BLOCK_BREWING_STAND: + lightColor = vec3(0.636, 0.509, 0.179); + lightRange = 1.0; + mixWeight = 0.8; + break; + + #ifdef LPV_COLORED_CANDLES + case BLOCK_CANDLES_PLAIN_LIT_1: + lightColor = LightColor_Candles; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_PLAIN_LIT_2: + lightColor = LightColor_Candles; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_PLAIN_LIT_3: + lightColor = LightColor_Candles; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_PLAIN_LIT_4: + lightColor = LightColor_Candles; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_BLACK_LIT_1: + lightColor = LightColor_Candles_Black; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_BLACK_LIT_2: + lightColor = LightColor_Candles_Black; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_BLACK_LIT_3: + lightColor = LightColor_Candles_Black; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_BLACK_LIT_4: + lightColor = LightColor_Candles_Black; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_BLUE_LIT_1: + lightColor = LightColor_Candles_Blue; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_BLUE_LIT_2: + lightColor = LightColor_Candles_Blue; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_BLUE_LIT_3: + lightColor = LightColor_Candles_Blue; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_BLUE_LIT_4: + lightColor = LightColor_Candles_Blue; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_BROWN_LIT_1: + lightColor = LightColor_Candles_Brown; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_BROWN_LIT_2: + lightColor = LightColor_Candles_Brown; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_BROWN_LIT_3: + lightColor = LightColor_Candles_Brown; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_BROWN_LIT_4: + lightColor = LightColor_Candles_Brown; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_CYAN_LIT_1: + lightColor = LightColor_Candles_Cyan; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_CYAN_LIT_2: + lightColor = LightColor_Candles_Cyan; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_CYAN_LIT_3: + lightColor = LightColor_Candles_Cyan; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_CYAN_LIT_4: + lightColor = LightColor_Candles_Cyan; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_GRAY_LIT_1: + lightColor = LightColor_Candles_Gray; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_GRAY_LIT_2: + lightColor = LightColor_Candles_Gray; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_GRAY_LIT_3: + lightColor = LightColor_Candles_Gray; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_GRAY_LIT_4: + lightColor = LightColor_Candles_Gray; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_GREEN_LIT_1: + lightColor = LightColor_Candles_Green; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_GREEN_LIT_2: + lightColor = LightColor_Candles_Green; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_GREEN_LIT_3: + lightColor = LightColor_Candles_Green; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_GREEN_LIT_4: + lightColor = LightColor_Candles_Green; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_LIGHT_BLUE_LIT_1: + lightColor = LightColor_Candles_LightBlue; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIGHT_BLUE_LIT_2: + lightColor = LightColor_Candles_LightBlue; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIGHT_BLUE_LIT_3: + lightColor = LightColor_Candles_LightBlue; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIGHT_BLUE_LIT_4: + lightColor = LightColor_Candles_LightBlue; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_LIGHT_GRAY_LIT_1: + lightColor = LightColor_Candles_LightGray; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIGHT_GRAY_LIT_2: + lightColor = LightColor_Candles_LightGray; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIGHT_GRAY_LIT_3: + lightColor = LightColor_Candles_LightGray; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIGHT_GRAY_LIT_4: + lightColor = LightColor_Candles_LightGray; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_LIME_LIT_1: + lightColor = LightColor_Candles_Lime; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIME_LIT_2: + lightColor = LightColor_Candles_Lime; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIME_LIT_3: + lightColor = LightColor_Candles_Lime; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIME_LIT_4: + lightColor = LightColor_Candles_Lime; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_MAGENTA_LIT_1: + lightColor = LightColor_Candles_Magenta; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_MAGENTA_LIT_2: + lightColor = LightColor_Candles_Magenta; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_MAGENTA_LIT_3: + lightColor = LightColor_Candles_Magenta; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_MAGENTA_LIT_4: + lightColor = LightColor_Candles_Magenta; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_ORANGE_LIT_1: + lightColor = LightColor_Candles_Orange; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_ORANGE_LIT_2: + lightColor = LightColor_Candles_Orange; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_ORANGE_LIT_3: + lightColor = LightColor_Candles_Orange; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_ORANGE_LIT_4: + lightColor = LightColor_Candles_Orange; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_PINK_LIT_1: + lightColor = LightColor_Candles_Pink; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_PINK_LIT_2: + lightColor = LightColor_Candles_Pink; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_PINK_LIT_3: + lightColor = LightColor_Candles_Pink; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_PINK_LIT_4: + lightColor = LightColor_Candles_Pink; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_PURPLE_LIT_1: + lightColor = LightColor_Candles_Purple; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_PURPLE_LIT_2: + lightColor = LightColor_Candles_Purple; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_PURPLE_LIT_3: + lightColor = LightColor_Candles_Purple; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_PURPLE_LIT_4: + lightColor = LightColor_Candles_Purple; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_RED_LIT_1: + lightColor = LightColor_Candles_Red; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_RED_LIT_2: + lightColor = LightColor_Candles_Red; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_RED_LIT_3: + lightColor = LightColor_Candles_Red; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_RED_LIT_4: + lightColor = LightColor_Candles_Red; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_WHITE_LIT_1: + lightColor = LightColor_Candles_White; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_WHITE_LIT_2: + lightColor = LightColor_Candles_White; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_WHITE_LIT_3: + lightColor = LightColor_Candles_White; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_WHITE_LIT_4: + lightColor = LightColor_Candles_White; + lightRange = 12.0; + mixWeight = 1.0; + break; + + case BLOCK_CANDLES_YELLOW_LIT_1: + lightColor = LightColor_Candles_Yellow; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_YELLOW_LIT_2: + lightColor = LightColor_Candles_Yellow; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_YELLOW_LIT_3: + lightColor = LightColor_Candles_Yellow; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_YELLOW_LIT_4: + lightColor = LightColor_Candles_Yellow; + lightRange = 12.0; + mixWeight = 1.0; + break; + #else + case BLOCK_CANDLES_LIT_1: + lightColor = LightColor_Candles; + lightRange = 3.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIT_2: + lightColor = LightColor_Candles; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIT_3: + lightColor = LightColor_Candles; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_CANDLES_LIT_4: + lightColor = LightColor_Candles; + lightRange = 12.0; + mixWeight = 1.0; + break; + #endif + + case BLOCK_CAVE_VINE_BERRIES: + lightColor = vec3(0.651, 0.369, 0.157); + lightRange = 14.0; + mixWeight = 1.0; + break; + + #ifdef LPV_REDSTONE_LIGHTS + case BLOCK_COMPARATOR_LIT: + lightColor = LightColor_RedstoneTorch; + lightRange = 4.0; + break; + #endif + + case BLOCK_COPPER_BULB_LIT: + lightColor = LightColor_CopperBulb; + lightRange = 15.0; + break; + case BLOCK_COPPER_BULB_EXPOSED_LIT: + lightColor = LightColor_CopperBulb; + lightRange = 12.0; + break; + case BLOCK_COPPER_BULB_OXIDIZED_LIT: + lightColor = LightColor_CopperBulb; + lightRange = 4.0; + break; + case BLOCK_COPPER_BULB_WEATHERED_LIT: + lightColor = LightColor_CopperBulb; + lightRange = 8.0; + break; + case BLOCK_CONDUIT: + lightColor = vec3(1.0); + lightRange = 15.0; + break; + case BLOCK_CRYING_OBSIDIAN: + lightColor = vec3(0.390, 0.065, 0.646); + lightRange = 10.0; + break; + case BLOCK_END_GATEWAY: + lightColor = vec3(1.0); + lightRange = 15.0; + break; + case BLOCK_END_ROD: + lightColor = vec3(0.957, 0.929, 0.875); + lightRange = 14.0; + break; + case BLOCK_FIRE: + lightColor = vec3(0.864, 0.598, 0.348); + lightRange = 15.0; + mixWeight = 1.0; + break; + case BLOCK_FROGLIGHT_OCHRE: + lightColor = vec3(0.768, 0.648, 0.108); + lightRange = 15.0; + break; + case BLOCK_FROGLIGHT_PEARLESCENT: + lightColor = vec3(0.737, 0.435, 0.658); + lightRange = 15.0; + break; + case BLOCK_FROGLIGHT_VERDANT: + lightColor = vec3(0.463, 0.763, 0.409); + lightRange = 15.0; + break; + case BLOCK_GLOW_LICHEN: + lightColor = vec3(0.092, 0.217, 0.126); + lightRange = 7.0; + break; + case BLOCK_GLOWSTONE: + lightColor = vec3(0.747, 0.594, 0.326); + lightRange = 15.0; + break; + case BLOCK_JACK_O_LANTERN: + lightColor = vec3(0.864, 0.598, 0.348); + lightRange = 15.0; + break; + case BLOCK_LANTERN: + lightColor = vec3(0.839, 0.541, 0.2); + lightRange = 15.0; + mixWeight = 0.8; + break; + case BLOCK_LAVA: + lightColor = vec3(0.659, 0.302, 0.106); + lightRange = 15.0; + break; + + case BLOCK_LIGHT_1: + lightColor = LightColor_LightBlock; + lightRange = 1; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_2: + lightColor = LightColor_LightBlock; + lightRange = 2; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_3: + lightColor = LightColor_LightBlock; + lightRange = 3; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_4: + lightColor = LightColor_LightBlock; + lightRange = 4; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_5: + lightColor = LightColor_LightBlock; + lightRange = 5; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_6: + lightColor = LightColor_LightBlock; + lightRange = 6; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_7: + lightColor = LightColor_LightBlock; + lightRange = 7; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_8: + lightColor = LightColor_LightBlock; + lightRange = 8; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_9: + lightColor = LightColor_LightBlock; + lightRange = 9; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_10: + lightColor = LightColor_LightBlock; + lightRange = 10; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_11: + lightColor = LightColor_LightBlock; + lightRange = 11; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_12: + lightColor = LightColor_LightBlock; + lightRange = 12; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_13: + lightColor = LightColor_LightBlock; + lightRange = 13; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_14: + lightColor = LightColor_LightBlock; + lightRange = 14; + mixWeight = 1.0; + break; + case BLOCK_LIGHT_15: + lightColor = LightColor_LightBlock; + lightRange = 15; + mixWeight = 1.0; + break; + + case BLOCK_MAGMA: + lightColor = vec3(0.747, 0.323, 0.110); + lightRange = 3.0; + break; + case BLOCK_REDSTONE_LAMP_LIT: + lightColor = vec3(0.953, 0.796, 0.496); + lightRange = 15.0; + break; + case BLOCK_REDSTONE_TORCH_LIT: + lightColor = LightColor_RedstoneTorch; + lightRange = 7.0; + break; + + #ifdef LPV_REDSTONE_LIGHTS + case BLOCK_REDSTONE_WIRE_1: + lightColor = LightColor_RedstoneTorch; + lightRange = 0.5; + break; + case BLOCK_REDSTONE_WIRE_2: + lightColor = LightColor_RedstoneTorch; + lightRange = 1.0; + break; + case BLOCK_REDSTONE_WIRE_3: + lightColor = LightColor_RedstoneTorch; + lightRange = 1.5; + break; + case BLOCK_REDSTONE_WIRE_4: + lightColor = LightColor_RedstoneTorch; + lightRange = 2.0; + break; + case BLOCK_REDSTONE_WIRE_5: + lightColor = LightColor_RedstoneTorch; + lightRange = 2.5; + break; + case BLOCK_REDSTONE_WIRE_6: + lightColor = LightColor_RedstoneTorch; + lightRange = 3.0; + break; + case BLOCK_REDSTONE_WIRE_7: + lightColor = LightColor_RedstoneTorch; + lightRange = 3.5; + break; + case BLOCK_REDSTONE_WIRE_8: + lightColor = LightColor_RedstoneTorch; + lightRange = 4.0; + break; + case BLOCK_REDSTONE_WIRE_9: + lightColor = LightColor_RedstoneTorch; + lightRange = 4.5; + break; + case BLOCK_REDSTONE_WIRE_10: + lightColor = LightColor_RedstoneTorch; + lightRange = 5.0; + break; + case BLOCK_REDSTONE_WIRE_11: + lightColor = LightColor_RedstoneTorch; + lightRange = 5.5; + break; + case BLOCK_REDSTONE_WIRE_12: + lightColor = LightColor_RedstoneTorch; + lightRange = 6.0; + break; + case BLOCK_REDSTONE_WIRE_13: + lightColor = LightColor_RedstoneTorch; + lightRange = 6.5; + break; + case BLOCK_REDSTONE_WIRE_14: + lightColor = LightColor_RedstoneTorch; + lightRange = 7.0; + break; + case BLOCK_REDSTONE_WIRE_15: + lightColor = LightColor_RedstoneTorch; + lightRange = 7.5; + break; + + case BLOCK_REPEATER_LIT: + lightColor = LightColor_RedstoneTorch; + lightRange = 4.0; + break; + #endif + + case BLOCK_RESPAWN_ANCHOR_4: + lightColor = vec3(1.0, 0.2, 1.0); + lightRange = 15.0; + break; + case BLOCK_SCULK_SENSOR_ACTIVE: + lightColor = vec3(0.1, 0.4, 1.0); + lightRange = 1.0; + break; + case BLOCK_SEA_PICKLE_WET_1: + lightColor = LightColor_SeaPickle; + lightRange = 6.0; + mixWeight = 1.0; + break; + case BLOCK_SEA_PICKLE_WET_2: + lightColor = LightColor_SeaPickle; + lightRange = 9.0; + mixWeight = 1.0; + break; + case BLOCK_SEA_PICKLE_WET_3: + lightColor = LightColor_SeaPickle; + lightRange = 12.0; + mixWeight = 1.0; + break; + case BLOCK_SEA_PICKLE_WET_4: + lightColor = LightColor_SeaPickle; + lightRange = 15.0; + mixWeight = 1.0; + break; + case BLOCK_SEA_LANTERN: + lightColor = vec3(0.553, 0.748, 0.859); + lightRange = 15.0; + break; + case BLOCK_SHROOMLIGHT: + lightColor = vec3(0.848, 0.469, 0.205); + lightRange = 15.0; + break; + case BLOCK_SMOKER_LIT: + lightColor = vec3(0.8, 0.7, 0.1); + lightRange = 13.0; + break; + case BLOCK_SOUL_FIRE: + lightColor = vec3(0.1, 0.6, 1.0); + lightRange = 10.0; + mixWeight = 1.0; + break; + case BLOCK_SOUL_LANTERN: + case BLOCK_SOUL_TORCH: + lightColor = vec3(0.1, 0.6, 1.0); + lightRange = 10.0; + mixWeight = 0.8; + break; + case BLOCK_TORCH: + lightColor = vec3(1.0, 0.6, 0.1); + lightRange = 14.0; + mixWeight = 0.8; + break; + + // reflective translucents / glass + + case BLOCK_HONEY: + tintColor = vec3(0.984, 0.733, 0.251); + mixWeight = 1.0; + break; + case BLOCK_NETHER_PORTAL: + lightColor = vec3(0.502, 0.165, 0.831); + tintColor = vec3(0.502, 0.165, 0.831); + lightRange = 11.0; + mixWeight = 1.0; + break; + case BLOCK_SLIME: + tintColor = vec3(0.408, 0.725, 0.329); + mixWeight = 1.0; + break; + case BLOCK_GLASS_BLACK: + tintColor = vec3(0.3); + mixWeight = 1.0; + break; + case BLOCK_GLASS_BLUE: + tintColor = vec3(0.1, 0.1, 0.98); + mixWeight = 1.0; + break; + case BLOCK_GLASS_BROWN: + tintColor = vec3(0.566, 0.388, 0.148); + mixWeight = 1.0; + break; + case BLOCK_GLASS_CYAN: + tintColor = vec3(0.082, 0.533, 0.763); + mixWeight = 1.0; + break; + case BLOCK_GLASS_GRAY: + tintColor = vec3(0.4, 0.4, 0.4); + mixWeight = 1.0; + break; + case BLOCK_GLASS_GREEN: + tintColor = vec3(0.125, 0.808, 0.081); + mixWeight = 1.0; + break; + case BLOCK_GLASS_LIGHT_BLUE: + tintColor = vec3(0.320, 0.685, 0.955); + mixWeight = 1.0; + break; + case BLOCK_GLASS_LIGHT_GRAY: + tintColor = vec3(0.7); + mixWeight = 1.0; + break; + case BLOCK_GLASS_LIME: + tintColor = vec3(0.633, 0.924, 0.124); + mixWeight = 1.0; + break; + case BLOCK_GLASS_MAGENTA: + tintColor = vec3(0.698, 0.298, 0.847); + mixWeight = 1.0; + break; + case BLOCK_GLASS_ORANGE: + tintColor = vec3(0.919, 0.586, 0.185); + mixWeight = 1.0; + break; + case BLOCK_GLASS_PINK: + tintColor = vec3(0.949, 0.274, 0.497); + mixWeight = 1.0; + break; + case BLOCK_GLASS_PURPLE: + tintColor = vec3(0.578, 0.170, 0.904); + mixWeight = 1.0; + break; + case BLOCK_GLASS_RED: + tintColor = vec3(0.999, 0.188, 0.188); + mixWeight = 1.0; + break; + case BLOCK_GLASS_WHITE: + tintColor = vec3(0.96, 0.96, 0.96); + mixWeight = 1.0; + break; + case BLOCK_GLASS_YELLOW: + tintColor = vec3(0.965, 0.965, 0.123); + mixWeight = 1.0; + break; + + // LPV shapes + + case BLOCK_BUTTON: + mixWeight = 0.9; + break; + case BLOCK_CANDLE: + mixWeight = 1.0; + break; + case BLOCK_CARPET: + mixMask = BuildLpvMask(1u, 1u, 1u, 1u, 1u, 0u); + mixWeight = 0.9; + break; + case BLOCK_CHAIN: + mixWeight = 1.0; + break; + + case BLOCK_DOOR_N: + mixMask = BuildLpvMask(0u, 1u, 1u, 1u, 1u, 1u); + mixWeight = 0.8; + break; + case BLOCK_DOOR_E: + mixMask = BuildLpvMask(1u, 0u, 1u, 1u, 1u, 1u); + mixWeight = 0.8; + break; + case BLOCK_DOOR_S: + mixMask = BuildLpvMask(1u, 1u, 0u, 1u, 1u, 1u); + mixWeight = 0.8; + break; + case BLOCK_DOOR_W: + mixMask = BuildLpvMask(1u, 1u, 1u, 0u, 1u, 1u); + mixWeight = 0.8; + break; + + case BLOCK_FENCE: + case BLOCK_FENCE_GATE: + mixWeight = 0.7; + break; + case BLOCK_FLOWER_POT: + mixWeight = 0.7; + break; + case BLOCK_IRON_BARS: + mixWeight = 0.6; + break; + case BLOCK_LADDER: + mixWeight = 0.7; + break; + case BLOCK_LEVER: + mixWeight = 0.8; + break; + case BLOCK_PRESSURE_PLATE: + mixMask = BuildLpvMask(1u, 1u, 1u, 1u, 1u, 0u); + mixWeight = 0.9; + break; + + case BLOCK_SLAB_TOP: + mixMask = BuildLpvMask(1u, 1u, 1u, 1u, 0u, 1u); + mixWeight = 0.5; + break; + case BLOCK_SLAB_BOTTOM: + mixMask = BuildLpvMask(1u, 1u, 1u, 1u, 1u, 0u); + mixWeight = 0.5; + break; + + case BLOCK_TRAPDOOR_BOTTOM: + mixMask = BuildLpvMask(1u, 1u, 1u, 1u, 1u, 0u); + mixWeight = 0.8; + break; + case BLOCK_TRAPDOOR_TOP: + mixMask = BuildLpvMask(1u, 1u, 1u, 1u, 0u, 1u); + mixWeight = 0.8; + break; + case BLOCK_TRAPDOOR_N: + mixMask = BuildLpvMask(0u, 1u, 1u, 1u, 1u, 1u); + mixWeight = 0.8; + break; + case BLOCK_TRAPDOOR_E: + mixMask = BuildLpvMask(1u, 0u, 1u, 1u, 1u, 1u); + mixWeight = 0.8; + break; + case BLOCK_TRAPDOOR_S: + mixMask = BuildLpvMask(1u, 1u, 0u, 1u, 1u, 1u); + mixWeight = 0.8; + break; + case BLOCK_TRAPDOOR_W: + mixMask = BuildLpvMask(1u, 1u, 1u, 0u, 1u, 1u); + mixWeight = 0.8; + break; + + // Misc + + case BLOCK_SIGN: + mixWeight = 0.9; + break; + } + + // hack to increase light (if set) + if (lightRange > 0.0) lightRange += 1.0; + + LpvBlockData block; + block.ColorRange = packUnorm4x8(vec4(lightColor, lightRange/255.0)); + block.MaskWeight = BuildBlockLpvData(mixMask, mixWeight); + block.Tint = packUnorm4x8(vec4(tintColor, 0.0)); + LpvBlockMap[blockId] = block; + #endif +} diff --git a/shaders/dimensions/shadowcomp.csh b/shaders/dimensions/shadowcomp.csh new file mode 100644 index 0000000..7648358 --- /dev/null +++ b/shaders/dimensions/shadowcomp.csh @@ -0,0 +1,160 @@ +#define RENDER_SHADOWCOMP + +layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in; + +#if LPV_SIZE == 8 + const ivec3 workGroups = ivec3(32, 32, 32); +#elif LPV_SIZE == 7 + const ivec3 workGroups = ivec3(16, 16, 16); +#elif LPV_SIZE == 6 + const ivec3 workGroups = ivec3(8, 8, 8); +#endif + +#ifdef IS_LPV_ENABLED + shared vec4 lpvSharedData[10*10*10]; + shared uint voxelSharedData[10*10*10]; + + const vec2 LpvBlockSkyFalloff = vec2(0.96, 0.96); + const ivec3 lpvFlatten = ivec3(1, 10, 100); + + #define EPSILON 1e-6 + + + uniform int frameCounter; + uniform vec3 cameraPosition; + uniform vec3 previousCameraPosition; + + #include "/lib/hsv.glsl" + #include "/lib/util.glsl" + #include "/lib/blocks.glsl" + #include "/lib/lpv_common.glsl" + #include "/lib/lpv_blocks.glsl" + #include "/lib/lpv_buffer.glsl" + #include "/lib/voxel_common.glsl" + + int sumOf(ivec3 vec) {return vec.x + vec.y + vec.z;} + + vec3 Lpv_RgbToHsv(const in vec3 lightColor, const in float lightRange) { + vec3 lightValue = RgbToHsv(lightColor); + lightValue.b = lightRange / LpvBlockSkyRange.x; + return lightValue; + } + + vec4 GetLpvValue(in ivec3 texCoord) { + if (clamp(texCoord, ivec3(0), ivec3(LpvSize) - 1) != texCoord) return vec4(0.0); + + vec4 lpvSample = (frameCounter % 2) == 0 + ? imageLoad(imgLpv2, texCoord) + : imageLoad(imgLpv1, texCoord); + + lpvSample.ba = exp2(lpvSample.ba * LpvBlockSkyRange) - 1.0; + lpvSample.rgb = HsvToRgb(lpvSample.rgb); + + return lpvSample; + } + + int getSharedIndex(ivec3 pos) { + return sumOf(pos * lpvFlatten); + } + + vec4 sampleShared(ivec3 pos, int mask_index) { + int shared_index = getSharedIndex(pos + 1); + + float mixWeight = 1.0; + uint mixMask = 0xFFFF; + uint blockId = voxelSharedData[shared_index]; + + if (blockId > 0 && blockId != BLOCK_EMPTY) + ParseBlockLpvData(LpvBlockMap[blockId].MaskWeight, mixMask, mixWeight); + + return lpvSharedData[shared_index] * ((mixMask >> mask_index) & 1u);// * mixWeight; + } + + vec4 mixNeighbours(const in ivec3 fragCoord, const in uint mask) { + vec4 nX1 = sampleShared(fragCoord + ivec3(-1, 0, 0), 1) * ((mask ) & 1u); + vec4 nX2 = sampleShared(fragCoord + ivec3( 1, 0, 0), 0) * ((mask >> 1) & 1u); + vec4 nY1 = sampleShared(fragCoord + ivec3( 0, -1, 0), 3) * ((mask >> 2) & 1u); + vec4 nY2 = sampleShared(fragCoord + ivec3( 0, 1, 0), 2) * ((mask >> 3) & 1u); + vec4 nZ1 = sampleShared(fragCoord + ivec3( 0, 0, -1), 5) * ((mask >> 4) & 1u); + vec4 nZ2 = sampleShared(fragCoord + ivec3( 0, 0, 1), 4) * ((mask >> 5) & 1u); + + const vec4 avgFalloff = (1.0/6.0) * LpvBlockSkyFalloff.xxxy; + return (nX1 + nX2 + nY1 + nY2 + nZ1 + nZ2) * avgFalloff; + } + + uint GetVoxelBlock(const in ivec3 voxelPos) { + if (clamp(voxelPos, ivec3(0), ivec3(VoxelSize3-1u)) != voxelPos) + return BLOCK_EMPTY; + + return imageLoad(imgVoxelMask, voxelPos).r; + } + + void PopulateSharedIndex(const in ivec3 imgCoordOffset, const in ivec3 workGroupOffset, const in uint i) { + ivec3 pos = workGroupOffset + ivec3(i / lpvFlatten) % 10; + + lpvSharedData[i] = GetLpvValue(imgCoordOffset + pos); + voxelSharedData[i] = GetVoxelBlock(pos); + } +#endif + + +////////////////////////////// VOID MAIN ////////////////////////////// + +void main() { + #ifdef IS_LPV_ENABLED + uvec3 chunkPos = gl_WorkGroupID * gl_WorkGroupSize; + if (any(greaterThanEqual(chunkPos, LpvSize3))) return; + + uint i = uint(gl_LocalInvocationIndex) * 2u; + if (i < 1000u) { + ivec3 imgCoordOffset = ivec3(floor(cameraPosition) - floor(previousCameraPosition)); + ivec3 workGroupOffset = ivec3(gl_WorkGroupID * gl_WorkGroupSize) - 1; + + PopulateSharedIndex(imgCoordOffset, workGroupOffset, i); + PopulateSharedIndex(imgCoordOffset, workGroupOffset, i + 1u); + } + + barrier(); + + ivec3 imgCoord = ivec3(gl_GlobalInvocationID); + if (any(greaterThanEqual(imgCoord, LpvSize3))) return; + + uint blockId = voxelSharedData[getSharedIndex(ivec3(gl_LocalInvocationID) + 1)]; + vec4 lightValue = vec4(0.0); + vec3 tintColor = vec3(1.0); + float mixWeight = 1.0; + uint mixMask = 0xFFFF; + + if (blockId > 0u) { + mixWeight = 0.0; + ParseBlockLpvData(LpvBlockMap[blockId].MaskWeight, mixMask, mixWeight); + + uint tintData = LpvBlockMap[blockId].Tint; + tintColor = unpackUnorm4x8(tintData).rgb; + } + + if (mixWeight > EPSILON) { + vec4 lightMixed = mixNeighbours(ivec3(gl_LocalInvocationID), mixMask); + lightMixed.rgb *= srgbToLinear(tintColor) * mixWeight; + lightValue += lightMixed; + } + + lightValue.rgb = RgbToHsv(lightValue.rgb); + lightValue.ba = log2(lightValue.ba + 1.0) / LpvBlockSkyRange; + + if (blockId > 0u) { + vec4 lightColorRange = unpackUnorm4x8(LpvBlockMap[blockId].ColorRange); + float lightRange = lightColorRange.a * 255.0; + + if (lightRange > EPSILON) { + vec3 lightColor = srgbToLinear(lightColorRange.rgb); + lightValue.rgb = Lpv_RgbToHsv(lightColor, lightRange); + } + } + + if (frameCounter % 2 == 0) + imageStore(imgLpv1, imgCoord, lightValue); + else + imageStore(imgLpv2, imgCoord, lightValue); + #endif +} diff --git a/shaders/entity.properties b/shaders/entity.properties index f29f666..79d75b1 100644 --- a/shaders/entity.properties +++ b/shaders/entity.properties @@ -1,20 +1,26 @@ -#if MC_VERSION >= 11300 +entity.1201= player -###### -###### all the different strengths of subsurface scattering and what entities to put them on. -###### - -## medium sss (same as strong sss for blocks) -entity.1100 = slime giant ghast elder_guardian - -## weak sss (same as weak sss for blocks) -entity.1200 = player sheep frog chicken 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 +entity.1202= minecraft:lightning_bolt weather2:lightning_bolt ## misc stuff -entity.1300 = ender_dragon wither +entity.1203= ender_dragon wither -entity.12345 = minecraft:lightning_bolt \ -weather2:lightning_bolt +entity.1301= item_frame item_display +entity.1302= spectral_arrow bigglobe:torch_arrow +entity.1303= tnt firework_rocket -# all of these get excluded from POM -entity.2300 = minecraft:item_frame minecraft:item_display \ No newline at end of file +################################################ +###### SUB-SURFACE SCATTERING +################################################ + +## medium sss (same as strong sss for blocks) +entity.1401 = giant ghast elder_guardian + +## weak sss (same as weak sss for blocks) +entity.1402 = furnace_minecart player 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 + +################################################ +###### REFLECTIVE TRANSLUCENTS +################################################ + +entity.1403 = slime \ No newline at end of file diff --git a/shaders/item.properties b/shaders/item.properties index f374576..76c1378 100644 --- a/shaders/item.properties +++ b/shaders/item.properties @@ -1,3 +1 @@ -item.100 = glow_berries soul_lantern soul_torch conduit beacon sea_pickle sea_lantern glowstone torch redstone_torch jack_o_lantern magma_block lantern shroomlight end_rod lava_bucket \ -\ -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:conquest:iron_candelabrum_1 conquest: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 \ No newline at end of file +item.1000 = glow_berries soul_lantern soul_torch conduit beacon sea_pickle sea_lantern glowstone torch redstone_torch jack_o_lantern magma_block lantern shroomlight end_rod lava_bucket 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:conquest:iron_candelabrum_1 conquest: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 diff --git a/shaders/lang/en_us.lang b/shaders/lang/en_us.lang index 9b985c4..bc98f7d 100644 --- a/shaders/lang/en_us.lang +++ b/shaders/lang/en_us.lang @@ -26,10 +26,13 @@ screen.Waving_Stuff = Waving Stuff screen.Direct_Light = Direct Light screen.Shadows = Shadows - option.SCREENSPACE_CONTACT_SHADOWS = Contact Shadows + option.TRANSLUCENT_COLORED_SHADOWS = Colored Shadows + option.SCREENSPACE_CONTACT_SHADOWS = Screen-space Shadows option.RENDER_ENTITY_SHADOWS = Shadows for Entities option.shadowMapResolution = Shadow Resolution option.shadowDistance = Shadow Distance + value.shadowDistance.32.0 = 2 Chunks + value.shadowDistance.48.0 = 3 Chunks value.shadowDistance.64.0 = 4 Chunks value.shadowDistance.80.0 = 5 Chunks value.shadowDistance.96.0 = 6 Chunks @@ -51,18 +54,34 @@ screen.Direct_Light = Direct Light value.shadowDistance.352.0 = 22 Chunks value.shadowDistance.368.0 = 23 Chunks value.shadowDistance.384.0 = 24 Chunks - value.shadowDistance.400.0 = 25 Chunks - value.shadowDistance.416.0 = 26 Chunks - value.shadowDistance.432.0 = 27 Chunks - value.shadowDistance.448.0 = 28 Chunks - value.shadowDistance.464.0 = 29 Chunks - value.shadowDistance.480.0 = 30 Chunks - value.shadowDistance.496.0 = 31 Chunks value.shadowDistance.512.0 = 32 Chunks - option.shadowDistanceRenderMul = Max Shadow Bounds - value.shadowDistanceRenderMul.-1.0 = Un-Optimized - value.shadowDistanceRenderMul.1.0 = Optimized + value.shadowDistance.768.0 = 48 Chunks + value.shadowDistance.1024.0 = 64 Chunks + value.shadowDistance.1536.0 = 96 Chunks + value.shadowDistance.2048.0 = 128 Chunks + value.shadowDistance.4096.0 = 256 Chunks + value.shadowDistance.8192.0 = 512 Chunks + + option.OPTIMIZED_SHADOW_DISTANCE = Max Shadow Bounds + value.OPTIMIZED_SHADOW_DISTANCE.-1.0 = Un-Optimized + value.OPTIMIZED_SHADOW_DISTANCE.1.0 = Optimized option.entityShadowDistanceMul = Entity Shadow Distance + value.entityShadowDistanceMul.0.01 = 1% of Shadow Distance + value.entityShadowDistanceMul.0.02 = 2% of Shadow Distance + value.entityShadowDistanceMul.0.03 = 3% of Shadow Distance + value.entityShadowDistanceMul.0.04 = 4% of Shadow Distance + value.entityShadowDistanceMul.0.05 = 5% of Shadow Distance + value.entityShadowDistanceMul.0.10 = 10% of Shadow Distance + value.entityShadowDistanceMul.0.15 = 15% of Shadow Distance + value.entityShadowDistanceMul.0.20 = 20% of Shadow Distance + value.entityShadowDistanceMul.0.25 = 25% of Shadow Distance + value.entityShadowDistanceMul.0.30 = 30% of Shadow Distance + value.entityShadowDistanceMul.0.35 = 35% of Shadow Distance + value.entityShadowDistanceMul.0.40 = 40% of Shadow Distance + value.entityShadowDistanceMul.0.45 = 45% of Shadow Distance + value.entityShadowDistanceMul.0.50 = 50% of Shadow Distance + value.entityShadowDistanceMul.0.75 = 75% of Shadow Distance + value.entityShadowDistanceMul.1.00 = 100% of Shadow Distance screen.Filtering = Shadow Filtering Settings option.SHADOW_FILTER_SAMPLE_COUNT = Basic Shadow Filter Samples @@ -71,7 +90,17 @@ screen.Direct_Light = Direct Light option.VPS_Search_Samples = VPS Filter Samples option.Max_Shadow_Filter_Radius = Maximum Shadow Filter Radius option.Max_Filter_Depth = Sun Size Factor - + + screen.LPV = FloodFill + option.LPV_ENABLED = Enabled + option.LPV_SIZE = Size + value.LPV_SIZE.6 = Small [64] + value.LPV_SIZE.7 = Medium [128] + value.LPV_SIZE.8 = Large [256] + option.LPV_NORMAL_OFFSET = Normal-Offset + option.LPV_ENTITY_LIGHTS = Entity Lights + option.LPV_REDSTONE_LIGHTS = Redstone Lights + option.LPV_COLORED_CANDLES = Colored Candles screen.Subsurface_Scattering = Sub-Surface Scattering option.LabSSS_Curve = LabSSS Curve @@ -479,11 +508,11 @@ option.moon_illuminance.comment = Configure the brightness of the moon screen.Direct_Light.comment = Configure settings related to the sun and shadows. screen.Shadows.comment = Configure the shadows from the sun to your liking. - option.SCREENSPACE_CONTACT_SHADOWS.comment = Screen-space contact shadows. §bWhat is this?§r These are small shadows for things that are far away, and on small details nearby. §aPERFORMANCE COST:§r low to medium; it is more expensive at higher resolutions. + option.SCREENSPACE_CONTACT_SHADOWS.comment = §bWhat is this?§r These are shadows for things that are far away, and on small details nearby. §aPERFORMANCE COST:§r low to medium; it is more expensive at higher resolutions. option.RENDER_ENTITY_SHADOWS.comment = §bWhat is this?§r Shadows on all types of entities, like mobs, chests, banners, or signs. §aPERFORMANCE COST:§r low to high; it is very expensive when there are many entities nearby. option.shadowMapResolution.comment = The quality of shadows from the sun casted by things in the world. §aPERFORMANCE COST:§r medium to very high; Shadows must render the 3D world a second time from the perspective of the sun, this is why it cuts performance in half. option.shadowDistance.comment = The maximum distance the shadowmap can render. The distance is not measured linearly in chunks when set to un-optimized. §aPERFORMANCE COST:§r medium to very high; If the chunk render distance is high, the shadows will become more expensive. - option.shadowDistanceRenderMul.comment = Render the shadows only in a sphere around you, limited to a max distance in chunks. Un-optimized does not render the shadows in a sphere and is not locked to chunks; it can cover alot more area with the same distance settings. The distance is not measured in chunks when set to un-optimized. §aPERFORMANCE COST:§r low to medium. Optimized is faster, and unoptimized is slower. + option.OPTIMIZED_SHADOW_DISTANCE.comment = Render the shadows only in a sphere around you, limited to a max distance in chunks. Un-optimized does not render the shadows in a sphere and is not locked to chunks; it can cover alot more area with the same distance settings. The distance is not measured in chunks when set to un-optimized. §aPERFORMANCE COST:§r low to medium. Optimized is faster, and unoptimized is slower. screen.Filtering.comment = Configure the filtering effects applied to the shadows. option.SHADOW_FILTER_SAMPLE_COUNT.comment = The quality of the basic shadow filter. This filter just softens the shadows. §aPERFORMANCE COST:§r low to medium; Increasing this should reduce some noise at the edge of shadows. option.Min_Shadow_Filter_Radius.comment = The maximum softness of the basic shadow filter. @@ -663,4 +692,6 @@ value.DH_KNOWN_ISSUES.1 = §a GTAO, RTAO, and SSGI break on LODs - DH support un option.DISTANT_HORIZONS_SHADOWMAP = §c(DO NOT USE IF YOU DO NOT KNOW WHAT THIS IS)§r DH shadowmap support option.DISTANT_HORIZONS_SHADOWMAP.comment = §cTHIS SETTING WILL DESTROY PERFORMANCE THIS WILL MAKE SHADOWS LOOK BLOCKY, FLICKERY, AND LOW DETAIL§r. set shadow distance to 32 chunks (or more). set shadow resolution to 4096 (or more) option.TOGGLE_VL_FOG = Toggle Volumetric Fog -option.TOGGLE_VL_FOG.comment = one big button to just turn all the fog off. \ No newline at end of file +option.TOGGLE_VL_FOG.comment = one big button to just turn all the fog off. + +option.TRANSLUCENT_COLORED_SHADOWS.comment = §bWhat is this?§r This effect allows translucent things like stained glass to color the sunlight as it passes through the it. §aPERFORMANCE COST:§r medium \ No newline at end of file diff --git a/shaders/lang/pt_br.lang b/shaders/lang/pt_br.lang index eceec17..6bc0e7b 100644 --- a/shaders/lang/pt_br.lang +++ b/shaders/lang/pt_br.lang @@ -61,9 +61,9 @@ screen.Direct_Light = Luz Direta value.shadowDistance.480.0 = 30 Chunks value.shadowDistance.496.0 = 31 Chunks value.shadowDistance.512.0 = 32 Chunks - option.shadowDistanceRenderMul = Limite Máximo da Sombra - value.shadowDistanceRenderMul.-1.0 = Não Otimizado - value.shadowDistanceRenderMul.1.0 = Otimizado + option.OPTIMIZED_SHADOW_DISTANCE = Limite Máximo da Sombra + value.OPTIMIZED_SHADOW_DISTANCE.-1.0 = Não Otimizado + value.OPTIMIZED_SHADOW_DISTANCE.1.0 = Otimizado screen.Filtering = Ajuste do Filtro de Sombras option.BASIC_SHADOW_FILTER = Filtro Básico de Sombra option.SHADOW_FILTER_SAMPLE_COUNT = Amostragem do Filtro Básico de Sombra @@ -347,7 +347,7 @@ screen.Shadows.comment = Ajuste as sombras do sol ao seu gosto. option.RENDER_ENTITY_SHADOWS.comment = §bO Que é Isso?§r São sombras em todos os tipos de entidades como: criaturas, baús, banners e placas. §aCUSTO DE DESEMPENHO:§r Baixo para Alto; pode ser mais pesado dependendo de quantas entidades estão por perto. option.shadowMapResolution.comment = Qualidade das sombras do sol projeta por coisas e objetos. §aCUSTO DE PERFORMANCE:§r Médio para Muito Alto; Renderizar as sombras requer renderizar o mundo uma outra vez, mas da perspectiva do sol, por isso elas reduzem a performance pela metade. option.shadowDistance.comment = Distância máxima que as sombras renderizam. Essa distância não é medida de forma linear em chunks quando colocada em Não Otimizado. §aCUSTO DE PERFORMANCE:§r Médio para Muito Alto; If the chunk render distance is high, the shadows will become more expensive Vai ser mais pesado se a distância de renderização dos chunks for alta. - option.shadowDistanceRenderMul.comment = Renderiza as sombras somente em uma esféra em volta de você, limitada à uma distância máxima de chunks. Se usado Não Otimizado ela não vai renderizar em uma esféra e também não vai ter limite por chunks; pode cobrir uma área muito maior com a mesma configuração de distância. A distância não é medida em chunks se usado Não Otimizado. §aCUSTO DE PERFORMANCE:§r Baixo para Médio. Otimizado é mais rápido e Não Otimizado é mais lento. + option.OPTIMIZED_SHADOW_DISTANCE.comment = Renderiza as sombras somente em uma esféra em volta de você, limitada à uma distância máxima de chunks. Se usado Não Otimizado ela não vai renderizar em uma esféra e também não vai ter limite por chunks; pode cobrir uma área muito maior com a mesma configuração de distância. A distância não é medida em chunks se usado Não Otimizado. §aCUSTO DE PERFORMANCE:§r Baixo para Médio. Otimizado é mais rápido e Não Otimizado é mais lento. screen.Filtering.comment = Ajuste o efeito de filtragem aplicado as sombras. option.BASIC_SHADOW_FILTER.comment = Filtro básico que suaviza as sombras. option.SHADOW_FILTER_SAMPLE_COUNT.comment = Qualidade do filtro básico das sombras. Esse filtro apenas suaviza as sombras. §aCUSTO DE PERFORMANCE:§r Baixo para Alto; Aumentar isso reduz um pouco do ruído presente nas bordas das sombras. diff --git a/shaders/lang/ru_RU.lang b/shaders/lang/ru_RU.lang index c414cd9..0c89593 100644 --- a/shaders/lang/ru_RU.lang +++ b/shaders/lang/ru_RU.lang @@ -73,9 +73,9 @@ screen.Direct_Light = Прямой свет value.shadowDistance.480.0 = 30 Чанков value.shadowDistance.496.0 = 31 Чанков value.shadowDistance.512.0 = 32 Чанков - option.shadowDistanceRenderMul = Границы теней - value.shadowDistanceRenderMul.-1.0 = Неоптимизированный - value.shadowDistanceRenderMul.1.0 = Оптимизированный + option.OPTIMIZED_SHADOW_DISTANCE = Границы теней + value.OPTIMIZED_SHADOW_DISTANCE.-1.0 = Неоптимизированный + value.OPTIMIZED_SHADOW_DISTANCE.1.0 = Оптимизированный option.entityShadowDistanceMul = Расстояние до тени объекта screen.Filtering = Параметры теневой фильтрации @@ -566,7 +566,7 @@ screen.Shadows.comment = Настройте тени от солнца по св option.RENDER_ENTITY_SHADOWS.comment = §bЧто это?§r Тени от всех типов сущностей, таких как мобы, сундуки, баннеры или таблички. §aНАГРУЗКА:§r от низкой до высокой; это очень нагружающе, когда поблизости много сущностей option.shadowMapResolution.comment = Качество теней от солнца, вызванное объектами в мире. §aНАГРУЗКА:§r от средней до очень высокой; Тени должны повторно отображать 3D мир с точки зрения солнца, вот почему это снижает производительность вдвое option.shadowDistance.comment = Максимальное расстояние, которое может отобразить теневая карта. Расстояние не измеряется линейно чанками, если установлено значение §b"неоптимизировано". §aНАГРУЗКА:§r от средней до очень высокой; Если расстояние - option.shadowDistanceRenderMul.comment = §b"Оптимизированный"§r тени только в сфере вокруг вас, ограничиваясь максимальным расстоянием в чанках. §b"Неоптимизированный"§r не отображает тени в сфере и не привязан к чанкам; он может охватывать гораздо большую площадь при тех же настройках дистанции. §aНАГРУЗКА:§r от низкой до средней; §b"Оптимизированный"§r работает быстрее, а §b"неоптимизированный"§r медленнее + option.OPTIMIZED_SHADOW_DISTANCE.comment = §b"Оптимизированный"§r тени только в сфере вокруг вас, ограничиваясь максимальным расстоянием в чанках. §b"Неоптимизированный"§r не отображает тени в сфере и не привязан к чанкам; он может охватывать гораздо большую площадь при тех же настройках дистанции. §aНАГРУЗКА:§r от низкой до средней; §b"Оптимизированный"§r работает быстрее, а §b"неоптимизированный"§r медленнее screen.Filtering.comment = Настройте эффекты фильтрации, применяемые к теням option.BASIC_SHADOW_FILTER.comment = Включает/Выключает теневой фильтр option.SHADOW_FILTER_SAMPLE_COUNT.comment = Этот фильтр просто смягчает тени. §aНАГРУЗКА:§r от низкой до средней; увеличение этого значения должно уменьшить некоторый шум на границе теней diff --git a/shaders/lang/zh_cn.lang b/shaders/lang/zh_cn.lang index 91ea122..0cbffd9 100644 --- a/shaders/lang/zh_cn.lang +++ b/shaders/lang/zh_cn.lang @@ -59,9 +59,9 @@ screen.Direct_Light = 直接照明 value.shadowDistance.480.0 = 30 区块 value.shadowDistance.496.0 = 31 区块 value.shadowDistance.512.0 = 32 区块 - option.shadowDistanceRenderMul = 最大阴影边界 - value.shadowDistanceRenderMul.-1.0 = 无优化 - value.shadowDistanceRenderMul.1.0 = 优化 + option.OPTIMIZED_SHADOW_DISTANCE = 最大阴影边界 + value.OPTIMIZED_SHADOW_DISTANCE.-1.0 = 无优化 + value.OPTIMIZED_SHADOW_DISTANCE.1.0 = 优化 option.entityShadowDistanceMul = 实体阴影距离 screen.Filtering = 阴影过滤设置 @@ -462,7 +462,7 @@ screen.Shadows.comment = 根据喜好配置阳光的阴影. option.RENDER_ENTITY_SHADOWS.comment = §b这啥?§r 所有类型实体的阴影, 例如怪物, 箱子, 旗帜, 或者告示牌. §a性能消耗水平:§r 低偏中; 在近处有特别多实体的时候消耗的性能会非常的恐怖. option.shadowMapResolution.comment = 在太阳照射下从世界上的事物投射出来阴影的质量. §a性能消耗水平:§r 中或更高; 阴影需要从太阳的角度进行第二次 3D 世界的渲染, 这就是为什么它会使性能减半. option.shadowDistance.comment = 阴影可渲染的最大距离 (这不是线性距离). 推荐保持默认, 因为接触阴影能解决远处阴影的渲染需求. §a性能消耗水平:§r 中或更高; 如果渲染距离非常大, 阴影的性能开销会很恐怖. - option.shadowDistanceRenderMul.comment = 仅在围绕以玩家为中心的球体中渲染的阴影, 最大渲染区块由渲染距离进行限制. 无优化选项不会以球体渲染阴影, 且不会被区块限制; 这意味着同样的渲染距离下阴影能覆盖更大的区域. 同样的, 设置为 无优化 时阴影距离不受区块限制. §a性能消耗水平:§r 低偏中. 优化选项更快, 无优化选项更慢. + option.OPTIMIZED_SHADOW_DISTANCE.comment = 仅在围绕以玩家为中心的球体中渲染的阴影, 最大渲染区块由渲染距离进行限制. 无优化选项不会以球体渲染阴影, 且不会被区块限制; 这意味着同样的渲染距离下阴影能覆盖更大的区域. 同样的, 设置为 无优化 时阴影距离不受区块限制. §a性能消耗水平:§r 低偏中. 优化选项更快, 无优化选项更慢. screen.Filtering.comment = 配置作用于阴影的过滤效果. option.SHADOW_FILTER_SAMPLE_COUNT.comment = 基础阴影过滤器质量. 过滤器仅用于软化阴影. §a性能消耗水平:§r 低偏中; 拉高本选项数值可以减少阴影边缘的噪点. option.Min_Shadow_Filter_Radius.comment = 基础阴影过滤器的最大软化程度. diff --git a/shaders/lib/Shadow_Params.glsl b/shaders/lib/Shadow_Params.glsl index 1e8930f..7e87e75 100644 --- a/shaders/lib/Shadow_Params.glsl +++ b/shaders/lib/Shadow_Params.glsl @@ -1,5 +1,5 @@ const float k = 1.8; -const float d0 = 0.04; +const float d0 = 0.04 + max(64.0 - shadowDistance, 0.0)/64.0 * 0.26; const float d1 = 0.61; float a = exp(d0); float b = (exp(d1)-a)*150./128.0; diff --git a/shaders/lib/Shadows.glsl b/shaders/lib/Shadows.glsl index e711680..dde76b3 100644 --- a/shaders/lib/Shadows.glsl +++ b/shaders/lib/Shadows.glsl @@ -8,8 +8,19 @@ void GriAndEminShadowFix( float SkyLightmap ){ + float minvalue = 0.007; + + #ifdef DISTANT_HORIZONS_SHADOWMAP + minvalue = 0.035; + #endif + // float DistanceOffset = clamp(0.17 + length(WorldPos) / (shadowMapResolution*0.20), 0.0,1.0) ; - float DistanceOffset = clamp(0.17 + length(WorldPos) / (shadowMapResolution*0.20), 0.0,1.0) ; + // float DistanceOffset = clamp(0.17 + length(WorldPos) / (shadowMapResolution*0.20), 0.0,1.0) ; + float shadowResScale = (2048.0/shadowMapResolution) / 4.0; + float DistanceOffset = (length(WorldPos)+4.0) * (minvalue + shadowResScale*0.015); + + + vec3 Bias = FlatNormal * DistanceOffset; // adjust the bias thingy's strength as it gets farther away. vec3 finalBias = Bias; diff --git a/shaders/lib/blocks.glsl b/shaders/lib/blocks.glsl new file mode 100644 index 0000000..000723a --- /dev/null +++ b/shaders/lib/blocks.glsl @@ -0,0 +1,205 @@ +#define BLOCK_WATER 8 +#define BLOCK_BAMBOO 11 +#define BLOCK_GRASS_SHORT 12 +#define BLOCK_GRASS_TALL_LOWER 13 +#define BLOCK_GRASS_TALL_UPPER 14 +#define BLOCK_SAPLING 15 +#define BLOCK_VINE 16 +#define BLOCK_GROUND_WAVING 60 +#define BLOCK_GROUND_WAVING_VERTICAL 61 +#define BLOCK_AIR_WAVING 62 +#define BLOCK_SSS_STRONG 80 +#define BLOCK_SSS_WEAK 81 +#define BLOCK_SSS_WEAK_2 82 +#define BLOCK_SSS_WEAK_3 83 +#define BLOCK_SSS_WEIRD 84 +#define BLOCK_GRASS 85 +#define BLOCK_AMETHYST_BUD_LARGE 101 +#define BLOCK_AMETHYST_BUD_MEDIUM 102 +#define BLOCK_AMETHYST_CLUSTER 103 +#define BLOCK_BEACON 104 +#define BLOCK_BREWING_STAND 105 +#define BLOCK_CANDLES_PLAIN_LIT_1 106 +#define BLOCK_CANDLES_PLAIN_LIT_2 107 +#define BLOCK_CANDLES_PLAIN_LIT_3 108 +#define BLOCK_CANDLES_PLAIN_LIT_4 109 +#define BLOCK_CANDLES_BLACK_LIT_1 110 +#define BLOCK_CANDLES_BLACK_LIT_2 111 +#define BLOCK_CANDLES_BLACK_LIT_3 112 +#define BLOCK_CANDLES_BLACK_LIT_4 113 +#define BLOCK_CANDLES_BLUE_LIT_1 114 +#define BLOCK_CANDLES_BLUE_LIT_2 115 +#define BLOCK_CANDLES_BLUE_LIT_3 116 +#define BLOCK_CANDLES_BLUE_LIT_4 117 +#define BLOCK_CANDLES_BROWN_LIT_1 118 +#define BLOCK_CANDLES_BROWN_LIT_2 119 +#define BLOCK_CANDLES_BROWN_LIT_3 120 +#define BLOCK_CANDLES_BROWN_LIT_4 121 +#define BLOCK_CANDLES_CYAN_LIT_1 122 +#define BLOCK_CANDLES_CYAN_LIT_2 123 +#define BLOCK_CANDLES_CYAN_LIT_3 124 +#define BLOCK_CANDLES_CYAN_LIT_4 125 +#define BLOCK_CANDLES_GRAY_LIT_1 126 +#define BLOCK_CANDLES_GRAY_LIT_2 127 +#define BLOCK_CANDLES_GRAY_LIT_3 128 +#define BLOCK_CANDLES_GRAY_LIT_4 129 +#define BLOCK_CANDLES_GREEN_LIT_1 130 +#define BLOCK_CANDLES_GREEN_LIT_2 131 +#define BLOCK_CANDLES_GREEN_LIT_3 132 +#define BLOCK_CANDLES_GREEN_LIT_4 133 +#define BLOCK_CANDLES_LIGHT_BLUE_LIT_1 134 +#define BLOCK_CANDLES_LIGHT_BLUE_LIT_2 135 +#define BLOCK_CANDLES_LIGHT_BLUE_LIT_3 136 +#define BLOCK_CANDLES_LIGHT_BLUE_LIT_4 137 +#define BLOCK_CANDLES_LIGHT_GRAY_LIT_1 138 +#define BLOCK_CANDLES_LIGHT_GRAY_LIT_2 139 +#define BLOCK_CANDLES_LIGHT_GRAY_LIT_3 140 +#define BLOCK_CANDLES_LIGHT_GRAY_LIT_4 141 +#define BLOCK_CANDLES_LIME_LIT_1 142 +#define BLOCK_CANDLES_LIME_LIT_2 143 +#define BLOCK_CANDLES_LIME_LIT_3 144 +#define BLOCK_CANDLES_LIME_LIT_4 145 +#define BLOCK_CANDLES_MAGENTA_LIT_1 146 +#define BLOCK_CANDLES_MAGENTA_LIT_2 147 +#define BLOCK_CANDLES_MAGENTA_LIT_3 148 +#define BLOCK_CANDLES_MAGENTA_LIT_4 149 +#define BLOCK_CANDLES_ORANGE_LIT_1 150 +#define BLOCK_CANDLES_ORANGE_LIT_2 151 +#define BLOCK_CANDLES_ORANGE_LIT_3 152 +#define BLOCK_CANDLES_ORANGE_LIT_4 153 +#define BLOCK_CANDLES_PINK_LIT_1 154 +#define BLOCK_CANDLES_PINK_LIT_2 155 +#define BLOCK_CANDLES_PINK_LIT_3 156 +#define BLOCK_CANDLES_PINK_LIT_4 157 +#define BLOCK_CANDLES_PURPLE_LIT_1 158 +#define BLOCK_CANDLES_PURPLE_LIT_2 159 +#define BLOCK_CANDLES_PURPLE_LIT_3 160 +#define BLOCK_CANDLES_PURPLE_LIT_4 161 +#define BLOCK_CANDLES_RED_LIT_1 162 +#define BLOCK_CANDLES_RED_LIT_2 163 +#define BLOCK_CANDLES_RED_LIT_3 164 +#define BLOCK_CANDLES_RED_LIT_4 165 +#define BLOCK_CANDLES_WHITE_LIT_1 166 +#define BLOCK_CANDLES_WHITE_LIT_2 167 +#define BLOCK_CANDLES_WHITE_LIT_3 168 +#define BLOCK_CANDLES_WHITE_LIT_4 169 +#define BLOCK_CANDLES_YELLOW_LIT_1 170 +#define BLOCK_CANDLES_YELLOW_LIT_2 171 +#define BLOCK_CANDLES_YELLOW_LIT_3 172 +#define BLOCK_CANDLES_YELLOW_LIT_4 173 +#define BLOCK_CANDLES_LIT_1 174 +#define BLOCK_CANDLES_LIT_2 175 +#define BLOCK_CANDLES_LIT_3 176 +#define BLOCK_CANDLES_LIT_4 177 +#define BLOCK_CAVE_VINE_BERRIES 178 +#define BLOCK_COMPARATOR_LIT 179 +#define BLOCK_COPPER_BULB_LIT 180 +#define BLOCK_COPPER_BULB_EXPOSED_LIT 181 +#define BLOCK_COPPER_BULB_OXIDIZED_LIT 182 +#define BLOCK_COPPER_BULB_WEATHERED_LIT 183 +#define BLOCK_CONDUIT 184 +#define BLOCK_CRYING_OBSIDIAN 185 +#define BLOCK_END_GATEWAY 186 +#define BLOCK_END_ROD 187 +#define BLOCK_FIRE 188 +#define BLOCK_FROGLIGHT_OCHRE 189 +#define BLOCK_FROGLIGHT_PEARLESCENT 190 +#define BLOCK_FROGLIGHT_VERDANT 191 +#define BLOCK_GLOW_LICHEN 192 +#define BLOCK_GLOWSTONE 193 +#define BLOCK_JACK_O_LANTERN 194 +#define BLOCK_LANTERN 195 +#define BLOCK_LAVA 196 +#define BLOCK_LIGHT_1 197 +#define BLOCK_LIGHT_2 198 +#define BLOCK_LIGHT_3 199 +#define BLOCK_LIGHT_4 200 +#define BLOCK_LIGHT_5 201 +#define BLOCK_LIGHT_6 202 +#define BLOCK_LIGHT_7 203 +#define BLOCK_LIGHT_8 204 +#define BLOCK_LIGHT_9 205 +#define BLOCK_LIGHT_10 206 +#define BLOCK_LIGHT_11 207 +#define BLOCK_LIGHT_12 208 +#define BLOCK_LIGHT_13 209 +#define BLOCK_LIGHT_14 210 +#define BLOCK_LIGHT_15 211 +#define BLOCK_MAGMA 212 +#define BLOCK_REDSTONE_LAMP_LIT 213 +#define BLOCK_REDSTONE_TORCH_LIT 214 +#define BLOCK_REDSTONE_WIRE_1 215 +#define BLOCK_REDSTONE_WIRE_2 216 +#define BLOCK_REDSTONE_WIRE_3 217 +#define BLOCK_REDSTONE_WIRE_4 218 +#define BLOCK_REDSTONE_WIRE_5 219 +#define BLOCK_REDSTONE_WIRE_6 220 +#define BLOCK_REDSTONE_WIRE_7 221 +#define BLOCK_REDSTONE_WIRE_8 222 +#define BLOCK_REDSTONE_WIRE_9 223 +#define BLOCK_REDSTONE_WIRE_10 224 +#define BLOCK_REDSTONE_WIRE_11 225 +#define BLOCK_REDSTONE_WIRE_12 226 +#define BLOCK_REDSTONE_WIRE_13 227 +#define BLOCK_REDSTONE_WIRE_14 228 +#define BLOCK_REDSTONE_WIRE_15 229 +#define BLOCK_REPEATER_LIT 230 +#define BLOCK_RESPAWN_ANCHOR_4 231 +#define BLOCK_SCULK_SENSOR_ACTIVE 232 +#define BLOCK_SEA_PICKLE_WET_1 233 +#define BLOCK_SEA_PICKLE_WET_2 234 +#define BLOCK_SEA_PICKLE_WET_3 235 +#define BLOCK_SEA_PICKLE_WET_4 236 +#define BLOCK_SEA_LANTERN 237 +#define BLOCK_SHROOMLIGHT 238 +#define BLOCK_SMOKER_LIT 239 +#define BLOCK_SOUL_FIRE 240 +#define BLOCK_SOUL_LANTERN 241 +#define BLOCK_SOUL_TORCH 242 +#define BLOCK_TORCH 243 +#define BLOCK_GLASS 301 +#define BLOCK_HONEY 302 +#define BLOCK_ICE 303 +#define BLOCK_NETHER_PORTAL 304 +#define BLOCK_SLIME 305 +#define BLOCK_GLASS_BLACK 306 +#define BLOCK_GLASS_BLUE 307 +#define BLOCK_GLASS_BROWN 308 +#define BLOCK_GLASS_CYAN 309 +#define BLOCK_GLASS_GRAY 310 +#define BLOCK_GLASS_GREEN 311 +#define BLOCK_GLASS_LIGHT_BLUE 312 +#define BLOCK_GLASS_LIGHT_GRAY 313 +#define BLOCK_GLASS_LIME 314 +#define BLOCK_GLASS_MAGENTA 315 +#define BLOCK_GLASS_ORANGE 316 +#define BLOCK_GLASS_PINK 317 +#define BLOCK_GLASS_PURPLE 318 +#define BLOCK_GLASS_RED 319 +#define BLOCK_GLASS_WHITE 320 +#define BLOCK_GLASS_YELLOW 321 +#define BLOCK_BUTTON 401 +#define BLOCK_CANDLE 402 +#define BLOCK_CARPET 403 +#define BLOCK_CHAIN 404 +#define BLOCK_DOOR_N 405 +#define BLOCK_DOOR_E 406 +#define BLOCK_DOOR_S 407 +#define BLOCK_DOOR_W 408 +#define BLOCK_FENCE 409 +#define BLOCK_FENCE_GATE 410 +#define BLOCK_FLOWER_POT 411 +#define BLOCK_IRON_BARS 412 +#define BLOCK_LADDER 413 +#define BLOCK_LEVER 414 +#define BLOCK_PRESSURE_PLATE 415 +#define BLOCK_SLAB_TOP 416 +#define BLOCK_SLAB_BOTTOM 417 +#define BLOCK_TRAPDOOR_BOTTOM 418 +#define BLOCK_TRAPDOOR_TOP 419 +#define BLOCK_TRAPDOOR_N 420 +#define BLOCK_TRAPDOOR_E 421 +#define BLOCK_TRAPDOOR_S 422 +#define BLOCK_TRAPDOOR_W 423 +#define BLOCK_END_PORTAL 500 +#define BLOCK_SIGN 501 diff --git a/shaders/lib/climate_settings.glsl b/shaders/lib/climate_settings.glsl index 87715de..4a89a47 100644 --- a/shaders/lib/climate_settings.glsl +++ b/shaders/lib/climate_settings.glsl @@ -32,7 +32,7 @@ SpringCol *= glcolor; // do leaf colors different because thats cool and i like it - if(mc_Entity.x == 10003){ + if(mc_Entity.x == BLOCK_AIR_WAVING){ SummerCol = vec3(Summer_Leaf_R, Summer_Leaf_G, Summer_Leaf_B); AutumnCol = vec3(Fall_Leaf_R, Fall_Leaf_G, Fall_Leaf_B); WinterCol = vec3(Winter_Leaf_R, Winter_Leaf_G, Winter_Leaf_B); diff --git a/shaders/lib/color_transforms.glsl b/shaders/lib/color_transforms.glsl index 9146226..07e6e8e 100644 --- a/shaders/lib/color_transforms.glsl +++ b/shaders/lib/color_transforms.glsl @@ -180,4 +180,96 @@ vec3 Full_Reinhard_Edit(vec3 C){ float lighten = 0.333; return (C * (1.0 + C / (whitepoint*whitepoint))) / (lighten + C); +} + + +/// from https://github.com/donmccurdy/three.js/blob/dev/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +// AgX Tone Mapping implementation based on Filament, which in turn is based +// on Blender's implementation using rec 2020 primaries +// https://github.com/google/filament/pull/7236 + +// Inputs and outputs are encoded as Linear-sRGB. +// https://iolite-engine.com/blog_posts/minimal_agx_implementation +// Mean error^2: 3.6705141e-06 +vec3 agxDefaultContrastApprox( vec3 x ) { + + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; + +} + +vec3 agxLook(vec3 val) { + const vec3 lw = vec3(0.2126, 0.7152, 0.0722); + float luma = dot(val, lw); + + // Default + vec3 offset = vec3(0.0); + vec3 slope = vec3(1.0); + vec3 power = vec3(1.0); + float sat = 1.25; + + // ASC CDL + val = pow(val * slope + offset, power); + return luma + sat * (val - luma); +} + +vec3 ToneMap_AgX( vec3 color ) { + + // AgX constants + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + + // explicit AgXOutsetMatrix generated from Filaments AgXOutsetMatrixInv + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + + // LOG2_MIN = -10.0 + // LOG2_MAX = +6.5 + // MIDDLE_GRAY = 0.18 + const float AgxMinEv = - 12.47393; // log2( pow( 2, LOG2_MIN ) * MIDDLE_GRAY ) + const float AgxMaxEv = 4.026069; // log2( pow( 2, LOG2_MAX ) * MIDDLE_GRAY ) + + // color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + + color = AgXInsetMatrix * color; + + // Log2 encoding + color = max( color, 1e-10 ); // avoid 0 or negative numbers for log2 + color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + + color = clamp( color, 0.0, 1.0 ); + + // Apply sigmoid + color = agxDefaultContrastApprox( color ); + + // Apply AgX look + color = agxLook(color); + + color = AgXOutsetMatrix * color; + + // Linearize + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + + // color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + + // Gamut mapping. Simple clamp for now. + color = clamp( color, 0.0, 1.0 ); + + return color; + } \ No newline at end of file diff --git a/shaders/lib/diffuse_lighting.glsl b/shaders/lib/diffuse_lighting.glsl index ee28b9f..c5904a1 100644 --- a/shaders/lib/diffuse_lighting.glsl +++ b/shaders/lib/diffuse_lighting.glsl @@ -1,24 +1,43 @@ vec3 DoAmbientLightColor( + vec3 lpvPos, vec3 SkyColor, vec3 MinimumColor, vec3 TorchColor, - vec2 Lightmap + vec2 Lightmap, + float Exposure ){ + // Lightmap = vec2(0.0,1.0); + float LightLevelZero = clamp(pow(eyeBrightnessSmooth.y/240. + Lightmap.y,2.0) ,0.0,1.0); // do sky lighting. float skyLM = (pow(Lightmap.y,15.0)*2.0 + pow(Lightmap.y,2.5))*0.5; vec3 MinimumLight = MinimumColor * (MIN_LIGHT_AMOUNT*0.01 + nightVision); - vec3 IndirectLight = max(SkyColor * ambient_brightness * skyLM, MinimumLight); + vec3 IndirectLight = max(SkyColor * ambient_brightness * skyLM * 0.7, MinimumLight); + + // do torch lighting + float TorchLM = pow(1.0-sqrt(1.0-clamp(Lightmap.x,0.0,1.0)),2.0) * 2.0; + float TorchBrightness_autoAdjust = mix(1.0, 30.0, clamp(exp(-10.0*Exposure),0.0,1.0)) ; + vec3 TorchLight = TorchColor * TorchLM * TORCH_AMOUNT ; + + #if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store + vec4 lpvSample = SampleLpvLinear(lpvPos); + vec3 LpvTorchLight = GetLpvBlockLight(lpvSample); - // 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; + // TODO: needs work, just binary transition for now + // float LpvFadeF = clamp(lpvPos, vec3(0.0), LpvSize3 - 1.0) == lpvPos ? 1.0 : 0.0; - 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))); + // i gotchu + float fadeLength = 10.0; // in blocks + vec3 cubicRadius = clamp( min(((LpvSize3-1.0) - lpvPos)/fadeLength, lpvPos/fadeLength) ,0.0,1.0); + float LpvFadeF = cubicRadius.x*cubicRadius.y*cubicRadius.z; - return IndirectLight + TorchLight; + LpvFadeF = 1.0 - pow(1.0-pow(LpvFadeF,1.5),3.0); // make it nice and soft :) + + TorchLight = mix(TorchLight,LpvTorchLight/5.0, LpvFadeF) ; + #endif + + return IndirectLight + TorchLight * TorchBrightness_autoAdjust; } vec4 RT_AmbientLight( diff --git a/shaders/lib/entities.glsl b/shaders/lib/entities.glsl new file mode 100644 index 0000000..141d86a --- /dev/null +++ b/shaders/lib/entities.glsl @@ -0,0 +1,10 @@ +#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_SSS_MEDIUM 1401 +#define ENTITY_SSS_WEAK 1402 diff --git a/shaders/lib/gameplay_effects.glsl b/shaders/lib/gameplay_effects.glsl index a1d76b6..f40eab2 100644 --- a/shaders/lib/gameplay_effects.glsl +++ b/shaders/lib/gameplay_effects.glsl @@ -28,7 +28,7 @@ uniform float hurt; // uniform bool isSpectator; -void applyGameplayEffects_FRAGMENT(inout vec3 color, in vec2 texcoord){ +void applyGameplayEffects_FRAGMENT(inout vec3 color, in vec2 texcoord, float noise){ #if defined LOW_HEALTH_EFFECT || defined DAMAGE_TAKEN_EFFECT // detect when health is zero @@ -46,7 +46,7 @@ void applyGameplayEffects_FRAGMENT(inout vec3 color, in vec2 texcoord){ float heartBeat = (pow(sin(frameTimeCounter * beatingRate)*0.5+0.5,2.0)*0.2 + 0.1); // scale UV to be more and more lower frequency towards the edges of the screen, to create a tunnel vision effect, - vec2 zoomUV = 0.5 + (texcoord - 0.5) * (1.0 - vignette * (isDead ? 0.7 : heartBeat * MOTION_AMOUNT)); + vec2 zoomUV = 0.5 + (texcoord - 0.5) * (1.0 - vignette * (isDead ? noise*0.7 : noise * heartBeat * MOTION_AMOUNT)); vec3 distortedScreen = vec3(1.0, 0.0, 0.0) * dot(texture2D(colortex7, zoomUV).rgb, vec3(0.21, 0.72, 0.07)); #ifdef LOW_HEALTH_EFFECT diff --git a/shaders/lib/hsv.glsl b/shaders/lib/hsv.glsl new file mode 100644 index 0000000..599aa90 --- /dev/null +++ b/shaders/lib/hsv.glsl @@ -0,0 +1,17 @@ +vec3 RgbToHsv(const in vec3 c) { + const vec4 K = vec4(0.0, -1.0, 2.0, -3.0) / 3.0; + const float e = 1.0e-10; + + vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); + vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); +} + +vec3 HsvToRgb(const in vec3 c) { + const vec4 K = vec4(3.0, 2.0, 1.0, 9.0) / 3.0; + + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, saturate(p - K.xxx), c.y); +} diff --git a/shaders/lib/indirect_lighting_effects.glsl b/shaders/lib/indirect_lighting_effects.glsl index 28952fc..0e20ef1 100644 --- a/shaders/lib/indirect_lighting_effects.glsl +++ b/shaders/lib/indirect_lighting_effects.glsl @@ -361,7 +361,8 @@ void ApplySSRT( previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5; if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0){ - radiance += (texture2D(colortex5,previousPosition.xy).rgb + skycontribution) * GI_Strength; + radiance += texture2D(colortex5, previousPosition.xy).rgb * GI_Strength + skycontribution; + } else{ radiance += skycontribution; } @@ -388,4 +389,6 @@ void ApplySSRT( #else lighting = max(radiance/nrays - occlusion/nrays, 0.0); #endif + + if(hand) lighting = skylightcolor/1.5; } \ No newline at end of file diff --git a/shaders/lib/items.glsl b/shaders/lib/items.glsl new file mode 100644 index 0000000..a9ef32b --- /dev/null +++ b/shaders/lib/items.glsl @@ -0,0 +1 @@ +#define ITEM_LIGHT_SOURCES 1000 diff --git a/shaders/lib/lpv_blocks.glsl b/shaders/lib/lpv_blocks.glsl new file mode 100644 index 0000000..daa9577 --- /dev/null +++ b/shaders/lib/lpv_blocks.glsl @@ -0,0 +1,28 @@ +struct LpvBlockData { // 12 x2000 =? + uint MaskWeight; // 4 + uint ColorRange; // 4 + uint Tint; // 4 +}; + +#ifdef RENDER_SETUP + layout(binding = 0) writeonly buffer lpvBlockData +#else + layout(binding = 0) readonly buffer lpvBlockData +#endif +{ + LpvBlockData LpvBlockMap[]; +}; + + +uint BuildBlockLpvData(uint mixMask, float mixWeight) { + uint data = uint(saturate(mixWeight) * 255.0); + + data = data | (mixMask << 8); + + return data; +} + +void ParseBlockLpvData(const in uint data, out uint mixMask, out float mixWeight) { + mixWeight = (data & 0xFF) / 255.0; + mixMask = (data >> 8) & 0xFF; +} diff --git a/shaders/lib/lpv_buffer.glsl b/shaders/lib/lpv_buffer.glsl new file mode 100644 index 0000000..7f544f4 --- /dev/null +++ b/shaders/lib/lpv_buffer.glsl @@ -0,0 +1,7 @@ +#ifdef RENDER_SHADOWCOMP + layout(rgba8) uniform restrict image3D imgLpv1; + layout(rgba8) uniform restrict image3D imgLpv2; +#else + layout(rgba8) uniform readonly image3D imgLpv1; + layout(rgba8) uniform readonly image3D imgLpv2; +#endif diff --git a/shaders/lib/lpv_common.glsl b/shaders/lib/lpv_common.glsl new file mode 100644 index 0000000..949bff3 --- /dev/null +++ b/shaders/lib/lpv_common.glsl @@ -0,0 +1,10 @@ +// How far light propagates (block, sky) +const vec2 LpvBlockSkyRange = vec2(15.0, 24.0); + +const uint LpvSize = uint(exp2(LPV_SIZE)); +const uvec3 LpvSize3 = uvec3(LpvSize); + +vec3 GetLpvPosition(const in vec3 playerPos) { + vec3 cameraOffset = fract(cameraPosition); + return playerPos + cameraOffset + LpvSize3/2u; +} diff --git a/shaders/lib/lpv_render.glsl b/shaders/lib/lpv_render.glsl new file mode 100644 index 0000000..471ed17 --- /dev/null +++ b/shaders/lib/lpv_render.glsl @@ -0,0 +1,53 @@ +// LPV falloff curve +const float LpvBlockPower = 4.0; + +// LPV block brightness scale +const float LpvBlockBrightness = 2.0; + + +vec4 SampleLpvNearest(const in ivec3 lpvPos) { + vec4 lpvSample = (frameCounter % 2) == 0 + ? texelFetch(texLpv1, lpvPos, 0) + : texelFetch(texLpv2, lpvPos, 0); + + lpvSample.b = pow(lpvSample.b, LpvBlockPower) * LpvBlockSkyRange.x; + lpvSample.rgb = HsvToRgb(lpvSample.rgb); + + return lpvSample; +} + +vec4 SampleLpvLinear(const in vec3 lpvPos) { + vec3 pos = lpvPos - 0.5; + ivec3 lpvCoord = ivec3(floor(pos)); + vec3 lpvF = fract(pos); + + vec4 sample_x1y1z1 = SampleLpvNearest(lpvCoord + ivec3(0, 0, 0)); + vec4 sample_x2y1z1 = SampleLpvNearest(lpvCoord + ivec3(1, 0, 0)); + vec4 sample_x1y2z1 = SampleLpvNearest(lpvCoord + ivec3(0, 1, 0)); + vec4 sample_x2y2z1 = SampleLpvNearest(lpvCoord + ivec3(1, 1, 0)); + + vec4 sample_x1y1z2 = SampleLpvNearest(lpvCoord + ivec3(0, 0, 1)); + vec4 sample_x2y1z2 = SampleLpvNearest(lpvCoord + ivec3(1, 0, 1)); + vec4 sample_x1y2z2 = SampleLpvNearest(lpvCoord + ivec3(0, 1, 1)); + vec4 sample_x2y2z2 = SampleLpvNearest(lpvCoord + ivec3(1, 1, 1)); + + vec4 sample_y1z1 = mix(sample_x1y1z1, sample_x2y1z1, lpvF.x); + vec4 sample_y2z1 = mix(sample_x1y2z1, sample_x2y2z1, lpvF.x); + + vec4 sample_y1z2 = mix(sample_x1y1z2, sample_x2y1z2, lpvF.x); + vec4 sample_y2z2 = mix(sample_x1y2z2, sample_x2y2z2, lpvF.x); + + vec4 sample_z1 = mix(sample_y1z1, sample_y2z1, lpvF.y); + vec4 sample_z2 = mix(sample_y1z2, sample_y2z2, lpvF.y); + + return mix(sample_z1, sample_z2, lpvF.z); +} + +vec3 GetLpvBlockLight(const in vec4 lpvSample) { + return LpvBlockBrightness * lpvSample.rgb; +} + +float GetLpvSkyLight(const in vec4 lpvSample) { + float skyLight = saturate(lpvSample.a); + return skyLight*skyLight; +} diff --git a/shaders/lib/overworld_fog.glsl b/shaders/lib/overworld_fog.glsl index 5a65a80..b2b0dbd 100644 --- a/shaders/lib/overworld_fog.glsl +++ b/shaders/lib/overworld_fog.glsl @@ -198,11 +198,11 @@ vec4 GetVolumetricFog( 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; + #ifdef TRANSLUCENT_COLORED_SHADOWS sh = vec3(shadow2D(shadowtex0, pos).x); if(shadow2D(shadowtex1, pos).x > pos.z && sh.x < 1.0){ - vec4 translucentShadow = texture2D(shadowcolor0, pos.xy); if(translucentShadow.a < 0.9) sh = normalize(translucentShadow.rgb+0.0001); } diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index da90382..5ce09b3 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -32,6 +32,7 @@ #define WATER_BACKGROUND_SPECULAR #define WATER_SUN_SPECULAR #define SCREENSPACE_REFLECTIONS +// #define WATER_HQ_SMOOTHNESS #define SNELLS_WINDOW @@ -121,11 +122,13 @@ const float ambientOcclusionLevel = 1.0; // this controls vanilla minecrafts amb const float sunPathRotation = -35; //[-90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -80 -79 -78 -77 -76 -75 -74 -73 -72 -71 -70 -69 -68 -67 -66 -65 -64 -63 -62 -61 -60 -59 -58 -57 -56 -55 -54 -53 -52 -51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 ] -const int shadowMapResolution = 2048; // [512 768 1024 1536 2048 3172 4096 8192 16384] -const float shadowDistance = 128.0; // [64.0 80.0 96.0 112.0 128.0 144.0 160.0 176.0 192.0 208.0 224.0 240.0 256.0 272.0 288.0 304.0 320.0 336.0 352.0 384.0 400.0 416.0 432.0 448.0 464.0 480.0 496.0 512.0 800.0 1000.0 2000.0 3000.0] +const int shadowMapResolution = 2048; // [512 768 1024 1536 2048 3172 4096 8192] +const float shadowDistance = 128.0; // [32.0 48.0 64.0 80.0 96.0 112.0 128.0 144.0 160.0 176.0 192.0 208.0 224.0 240.0 256.0 272.0 288.0 304.0 320.0 336.0 352.0 368.0 384.0 512.0 768.0 1024.0 1536.0 2048.0 4096.0 8192.0] -const float shadowDistanceRenderMul = 1.0; // [-1.0 1.0] -const float entityShadowDistanceMul = 1.0; // [0.05 0.10 1.50 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.0] +#define OPTIMIZED_SHADOW_DISTANCE -1.0 // [-1.0 1.0] + +const float shadowDistanceRenderMul = OPTIMIZED_SHADOW_DISTANCE; +const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.75 1.00] #define RENDER_ENTITY_SHADOWS @@ -142,9 +145,9 @@ const float entityShadowDistanceMul = 1.0; // [0.05 0.10 1.50 0.20 0.25 0.30 0.3 #define SHADOW_DISABLE_ALPHA_MIPMAPS #define Stochastic_Transparent_Shadows +#define Glass_Tint #define TRANSLUCENT_COLORED_SHADOWS #ifdef TRANSLUCENT_COLORED_SHADOWS - #define Glass_Tint #undef Stochastic_Transparent_Shadows #endif @@ -178,7 +181,7 @@ const float entityShadowDistanceMul = 1.0; // [0.05 0.10 1.50 0.20 0.25 0.30 0.3 #define RainFog_amount 3 // [0 1 2 3 4 5 6 7 8 9 10 15 20 25] #define BLOOMY_FOG 1.5 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 6.0 10.0 15.0 20.0] -#define BLOOM_STRENGTH 4.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 50.0 75.0 100.0] +#define BLOOM_STRENGTH 1.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 50.0 75.0 100.0] #define CAVE_FOG #ifdef CAVE_FOG @@ -253,8 +256,8 @@ const float entityShadowDistanceMul = 1.0; // [0.05 0.10 1.50 0.20 0.25 0.30 0.3 #define LIGHTSOURCE_REFLECTION #endif -#define EMISSIVE_TYPE 0 // [0 1 2 3] -#define Emissive_Brightness 10.0 // [1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 100.] +#define EMISSIVE_TYPE 1 // [0 1 2 3] +#define Emissive_Brightness 1.0 // [1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 100.] #define Emissive_Curve 2.0 // [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ] @@ -271,12 +274,14 @@ const float entityShadowDistanceMul = 1.0; // [0.05 0.10 1.50 0.20 0.25 0.30 0.3 #undef HEIGTHMAP_DEPTH_OFFSET #endif -#define SSS_TYPE 2 // [0 1 2 3] +#define SSS_TYPE 1 // [0 1 2 3] #define LabSSS_Curve 1.0 // [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ] // #define MOB_SSS // #define MISC_BLOCK_SSS #define Ambient_SSS #define ambientsss_brightness 1.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0] +#define sss_absorbance_multiplier 1.0 // [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0] +#define sss_density_multiplier 1.0 // [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0] // #define Porosity @@ -524,7 +529,7 @@ uniform int moonPhase; // ----- COLOR/POST PROCESSING RELATED SETTINGS ----- // //////////////////////////////////////////////////////// -#define TONEMAP ToneMap_Hejl2015 // [ToneMap_Hejl2015 Tonemap_Xonk Tonemap_Uchimura HableTonemap Full_Reinhard_Edit Tonemap_Full_Reinhard reinhard Tonemap_Lottes ACESFilm] +#define TONEMAP ToneMap_AgX // [ToneMap_AgX ToneMap_Hejl2015 Tonemap_Xonk Tonemap_Uchimura HableTonemap Full_Reinhard_Edit Tonemap_Full_Reinhard reinhard Tonemap_Lottes ACESFilm] //#define USE_ACES_COLORSPACE_APPROXIMATION #define CONTRAST_ADAPTATIVE_SHARPENING @@ -642,7 +647,9 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #define RESOURCEPACK_SKY 0 // [0 1 2] -#define TRANSLUCENT_ENTITIES +#ifdef IS_IRIS + #define TRANSLUCENT_ENTITIES +#endif #define WATER_CAUSTICS_BRIGHTNESS 1.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0] #define DENOISE_SSS_AND_SSAO @@ -660,7 +667,6 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) const float shadowNearPlane = -1.0; const float shadowFarPlane = -1.0; - #endif // #define DH_SHADOWPROJECTIONTWEAK @@ -669,6 +675,24 @@ 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] +/////////////////////////////////////////// +// ----- FLOODFILL [LPV] SETTINGS ----- // +/////////////////////////////////////////// + +//#define LPV_ENABLED +#define LPV_SIZE 7 // [6 7 8] +#define LPV_NORMAL_OFFSET +#define LPV_ENTITY_LIGHTS +#define LPV_REDSTONE_LIGHTS +//#define LPV_COLORED_CANDLES + +#ifdef LPV_ENABLED + #ifdef IRIS_FEATURE_CUSTOM_IMAGES + #define IS_LPV_ENABLED + #endif +#endif + + //////////////////////////////// // ----- DEBUG SETTINGS ----- // //////////////////////////////// @@ -683,17 +707,24 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #define debug_VIEW_POSITION 6 #define debug_DH_WATER_BLENDING 7 #define debug_FILTERED_STUFF 8 -#define DEBUG_VIEW debug_OFF // [debug_OFF debug_SHADOWMAP debug_NORMALS debug_SPECULAR debug_INDIRECT debug_DIRECT debug_VIEW_POSITION debug_DH_WATER_BLENDING debug_FILTERED_STUFF] +#define debug_TEMPORAL_REPROJECTION 9 +#define DEBUG_VIEW debug_OFF // [debug_OFF debug_SHADOWMAP debug_NORMALS debug_SPECULAR debug_INDIRECT debug_DIRECT debug_VIEW_POSITION debug_DH_WATER_BLENDING debug_FILTERED_STUFF debug_TEMPORAL_REPROJECTION] ///////////////////////////////// // ----- RANDOM SETTINGS ----- // ///////////////////////////////// +// #define OLD_BLOOM // #define BLOOMY_PARTICLES // #define ORIGINAL_CHOCAPIC_SKY // #define CLOUDS_INFRONT_OF_WORLD + // fix settings +#ifdef TRANSLUCENT_ENTITIES +#endif +#ifdef RENDER_ENTITY_SHADOWS +#endif #if RESOURCEPACK_SKY == 0 #endif #ifdef VANILLA_SUN_AND_MOON @@ -703,4 +734,4 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #if BLISS_SHADERS == 0 #endif #if DH_KNOWN_ISSUES == 0 -#endif \ No newline at end of file +#endif diff --git a/shaders/lib/specular.glsl b/shaders/lib/specular.glsl index 1ec0f69..74c70f7 100644 --- a/shaders/lib/specular.glsl +++ b/shaders/lib/specular.glsl @@ -191,7 +191,7 @@ void DoSpecularReflections( Roughness = 1.0 - Roughness; Roughness *= Roughness; F0 = F0 == 0.0 ? 0.02 : F0; - // Roughness = 0.0; + // Roughness = 0.1; // F0 = 0.9; mat3 Basis = CoordBase(Normal); @@ -220,8 +220,9 @@ void DoSpecularReflections( bool hasReflections = Roughness_Threshold == 1.0 ? true : F0 * (1.0 - Roughness * Roughness_Threshold) > 0.01; // mulitply all reflections by the albedo if it is a metal. - vec3 Metals = F0 > 229.5/255.0 ? lerp(normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3), vec3(1.0), Fresnel * pow(1.0-Roughness,25.0)) : vec3(1.0); - // vec3 Metals = F0 > 229.5/255.0 ? max(Albedo, Fresnel) : vec3(1.0); + // vec3 Metals = F0 > 229.5/255.0 ? lerp(normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3), vec3(1.0), Fresnel * pow(1.0-Roughness,25.0)) : vec3(1.0); + vec3 Metals = F0 > 229.5/255.0 ? normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3) : vec3(1.0); + // vec3 Metals = F0 > 229.5/255.0 ? Albedo : vec3(1.0); // --------------- BACKGROUND REFLECTIONS // apply background reflections to the final color. make sure it does not exist based on the lightmap @@ -271,11 +272,13 @@ void DoSpecularReflections( } #endif + // Final_Reflection = mix(mix(Output,Background_Reflection,Lightmap), SS_Reflections.rgb, SS_Reflections.a) * RayContribution; + // --------------- LIGHTSOURCE REFLECTIONS // slap the main lightsource reflections to the final color. #ifdef LIGHTSOURCE_REFLECTION Lightsource_Reflection = Diffuse * GGX(Normal, -WorldPos, LightPos, Roughness, F0) * Metals; - Final_Reflection += Lightsource_Reflection * Sun_specular_Strength; + Final_Reflection += Lightsource_Reflection * Sun_specular_Strength ; #endif Output = Final_Reflection; diff --git a/shaders/lib/stars.glsl b/shaders/lib/stars.glsl index 8b96837..e156d69 100644 --- a/shaders/lib/stars.glsl +++ b/shaders/lib/stars.glsl @@ -9,41 +9,48 @@ float hash12(vec2 p) p3 += dot(p3, p3.yzx + 19.19); return fract((p3.x + p3.y) * p3.z); } -// Convert Noise2d() into a "star field" by stomping everthing below fThreshhold to zero. -float NoisyStarField( in vec2 vSamplePos, float fThreshhold ) +// 1 out, 3 in... +float hash13(vec3 p3) { - float StarVal = hash12( vSamplePos ); - StarVal = clamp(StarVal/(1.0 - fThreshhold) - fThreshhold/(1.0 - fThreshhold),0.0,1.0); + p3 = fract(p3 * .1031); + p3 += dot(p3, p3.zyx + 31.32); + return fract((p3.x + p3.y) * p3.z); +} + +// Convert Noise2d() into a "star field" by stomping everthing below fThreshhold to zero. +float NoisyStarField( in vec3 vSamplePos, float fThreshhold ) +{ + float StarVal = hash13( vSamplePos ); + StarVal = clamp(StarVal/(1.0 - fThreshhold) - fThreshhold/(1.0 - fThreshhold),0.0,1.0); return StarVal; } // Stabilize NoisyStarField() by only sampling at integer values. -float StableStarField( in vec2 vSamplePos, float fThreshhold ) +float StableStarField( in vec3 vSamplePos, float fThreshhold ) { // Linear interpolation between four samples. // Note: This approach has some visual artifacts. // There must be a better way to "anti alias" the star field. float fractX = fract( vSamplePos.x ); float fractY = fract( vSamplePos.y ); - vec2 floorSample = floor( vSamplePos ); - float v1 = NoisyStarField( floorSample, fThreshhold ); - float v2 = NoisyStarField( floorSample + vec2( 0.0, 1.0 ), fThreshhold ); - float v3 = NoisyStarField( floorSample + vec2( 1.0, 0.0 ), fThreshhold ); - float v4 = NoisyStarField( floorSample + vec2( 1.0, 1.0 ), fThreshhold ); + vec3 floorSample = floor( vSamplePos.xyz ); + + float v1 = NoisyStarField( floorSample, fThreshhold); + float v2 = NoisyStarField( floorSample + vec3( 0.0, 1.0, 0.0), fThreshhold ); + float v3 = NoisyStarField( floorSample + vec3( 1.0, 0.0, 0.0), fThreshhold ); + float v4 = NoisyStarField( floorSample + vec3( 1.0, 1.0, 0.0), fThreshhold ); float StarVal = v1 * ( 1.0 - fractX ) * ( 1.0 - fractY ) + v2 * ( 1.0 - fractX ) * fractY + v3 * fractX * ( 1.0 - fractY ) + v4 * fractX * fractY; + return StarVal; } float stars(vec3 viewPos){ - float elevation = clamp(viewPos.y,0.,1.); - vec2 uv = viewPos.xz/(1.5+elevation); - - return exp((1.0-StableStarField(uv*1000.,0.999)) * -10) * 3; - // return StableStarField(uv*1000.,0.999)*0.5*0.3; + float stars = max(1.0 - StableStarField(viewPos*300.0 , 0.99),0.0); + return exp( stars * -20.0); } diff --git a/shaders/lib/voxel_common.glsl b/shaders/lib/voxel_common.glsl new file mode 100644 index 0000000..f548bc7 --- /dev/null +++ b/shaders/lib/voxel_common.glsl @@ -0,0 +1,12 @@ +#ifdef RENDER_SHADOW + layout(r16ui) uniform uimage3D imgVoxelMask; +#else + layout(r16ui) uniform readonly uimage3D imgVoxelMask; +#endif + +const uint VoxelSize = uint(exp2(LPV_SIZE)); +const uvec3 VoxelSize3 = uvec3(VoxelSize); + +const float voxelDistance = 64.0; + +#define BLOCK_EMPTY 0 diff --git a/shaders/lib/voxel_write.glsl b/shaders/lib/voxel_write.glsl new file mode 100644 index 0000000..ccd9ced --- /dev/null +++ b/shaders/lib/voxel_write.glsl @@ -0,0 +1,11 @@ +ivec3 GetVoxelIndex(const in vec3 playerPos) { + vec3 cameraOffset = fract(cameraPosition); + return ivec3(floor(playerPos + cameraOffset) + VoxelSize3/2u); +} + +void SetVoxelBlock(const in vec3 playerPos, const in uint blockId) { + ivec3 voxelPos = GetVoxelIndex(playerPos); + if (clamp(voxelPos, ivec3(0), ivec3(VoxelSize-1u)) != voxelPos) return; + + imageStore(imgVoxelMask, voxelPos, uvec4(blockId)); +} diff --git a/shaders/lib/waterBump.glsl b/shaders/lib/waterBump.glsl index f67b833..0810877 100644 --- a/shaders/lib/waterBump.glsl +++ b/shaders/lib/waterBump.glsl @@ -57,14 +57,17 @@ float getWaterHeightmap(vec2 posxz) { vec3 getWaveNormal(vec3 posxz, bool isLOD){ // vary the normal's "smooth" factor as distance changes, to avoid noise from too much details. - float range = pow(clamp(1.0 - length(posxz - cameraPosition)/(32*4),0.0,1.0),2.0); - float deltaPos = mix(0.5, 0.1, range); - float normalMult = 10.0 * WATER_WAVE_STRENGTH; + // float range = pow(clamp(1.0 - length(posxz - cameraPosition)/(32*4),0.0,1.0),2.0); + // float deltaPos = mix(0.5, 0.1, range); + + float range = min(length(posxz - cameraPosition) / (16*14.0), 3.0); + float deltaPos = range + 0.15; - if(isLOD){ - normalMult = mix(5.0, normalMult, range); - deltaPos = mix(0.9, deltaPos, range); - } + // float normalMult = 1.0 * WATER_WAVE_STRENGTH; + + // if(isLOD){ + // deltaPos = mix(0.9, deltaPos, range); + // } // added detail for snells window // if(isEyeInWater == 1) deltaPos = 0.025; @@ -72,17 +75,17 @@ vec3 getWaveNormal(vec3 posxz, bool isLOD){ deltaPos = 0.025; #endif - vec2 coord = posxz.xz;// - posxz.y; + vec2 coord = posxz.xz; float h0 = getWaterHeightmap(coord); float h1 = getWaterHeightmap(coord + vec2(deltaPos,0.0)); float h3 = getWaterHeightmap(coord + vec2(0.0,deltaPos)); - float xDelta = ((h1-h0)/deltaPos)*normalMult; - float yDelta = ((h3-h0)/deltaPos)*normalMult; + float xDelta = (h1-h0)/deltaPos; + float yDelta = (h3-h0)/deltaPos; - vec3 wave = normalize(vec3(xDelta,yDelta,1.0-pow(abs(xDelta+yDelta),2.0))); + vec3 wave = normalize(vec3(xDelta, yDelta, 1.0-pow(abs(xDelta+yDelta),2.0))); - return wave ; + return wave; } \ No newline at end of file diff --git a/shaders/shaders.properties b/shaders/shaders.properties index fa38741..7a852c1 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 SSBO + #if RESOURCEPACK_SKY == 2 sun=true moon=true @@ -16,25 +18,33 @@ beacon.beam.depth = true moon=false #endif +#ifdef LPV_ENABLED + # shadow.enabled = true + shadow.culling = reversed + voxelizeLightBlocks = true +#endif + #ifndef RENDER_ENTITY_SHADOWS shadowBlockEntities = false shadowEntities = false + shadowPlayer = true #endif -#if defined TRANSLUCENT_ENTITIES && defined IS_IRIS - separateEntityDraws = true - program.gbuffers_entities_translucent.enabled = true - program.gbuffers_block_translucent.enabled = true - - blend.gbuffers_entities_translucent = off - blend.gbuffers_block_translucent = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE +#ifdef TRANSLUCENT_ENTITIES + separateEntityDraws = true #else - separateEntityDraws = false - program.gbuffers_entities_translucent.enabled = IS_IRIS - program.gbuffers_block_translucent.enabled = IS_IRIS + separateEntityDraws = true #endif +program.world0/gbuffers_entities_translucent.enabled = TRANSLUCENT_ENTITIES +program.world0/gbuffers_block_translucent.enabled = TRANSLUCENT_ENTITIES +program.world-1/gbuffers_entities_translucent.enabled = TRANSLUCENT_ENTITIES +program.world-1/gbuffers_block_translucent.enabled = TRANSLUCENT_ENTITIES +program.world1/gbuffers_entities_translucent.enabled = TRANSLUCENT_ENTITIES +program.world1/gbuffers_block_translucent.enabled = TRANSLUCENT_ENTITIES + + #if defined DISTANT_HORIZONS && defined IS_IRIS #if defined DISTANT_HORIZONS_SHADOWMAP @@ -43,15 +53,15 @@ beacon.beam.depth = true dhShadow.enabled = false #endif - program.dh_terrain.enabled = true - program.dh_water.enabled = true + program.world0/dh_terrain.enabled = true + program.world0/dh_water.enabled = true blend.dh_terrain = off blend.dh_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE #else dhShadow.enabled = false - program.dh_terrain.enabled = false - program.dh_water.enabled = false + program.world0/dh_terrain.enabled = false + program.world0/dh_water.enabled = false #endif program.composite5.enabled = TAA_UPSCALING @@ -61,42 +71,46 @@ program.composite5.enabled = TAA_UPSCALING #Get the correct alpha value : S_A*(1-DST_A)+DST_A # terrible blending for shadows on purpose -blend.shadow = SRC_COLOR ZERO ONE ZERO blend.gbuffers_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE +blend.gbuffers_armor_glint = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE blend.gbuffers_hand_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE blend.gbuffers_textured = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE blend.gbuffers_textured_lit = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE -blend.gbuffers_spidereyes = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE blend.gbuffers_basic = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE blend.gbuffers_weather = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE -blend.gbuffers_armor_glint = ONE ONE ONE ZERO +blend.gbuffers_block_translucent = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE +blend.gbuffers_beaconbeam = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE +blend.gbuffers_entities_translucent = SRC_ALPHA ZERO ONE ZERO +blend.gbuffers_spidereyes = ONE ONE ONE ONE blend.gbuffers_skytextured = ONE ONE ONE ZERO -blend.gbuffers_damagedblock = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE +blend.shadow = SRC_COLOR ZERO ONE ZERO # Disable blending blend.gbuffers_terrain = off blend.gbuffers_hand = off blend.gbuffers_block = off blend.gbuffers_entities = off -blend.gbuffers_beaconbeam = off +blend.gbuffers_damagedblock = off + +# this is important for refraction and glass tint to work correctly blend.gbuffers_water.colortex11 = off +blend.gbuffers_hand_water.colortex11 = off +blend.gbuffers_entities_translucent.colortex11 = off + blend.composite.colortex12 = off blend.composite.colortex13 = off - +blend.composite.colortex14 = off # Alpha test -alphaTest.shadow = GREATER 0.1 -alphaTest.gbuffers_entities = GREATER 0.1 +alphaTest.gbuffers_terrain = GREATER 0.1 alphaTest.gbuffers_hand = GREATER 0.1 - -alphaTest.gbuffers_armor_glint=false -alphaTest.gbuffers_weather=false -alphaTest.gbuffers_water=false -alphaTest.gbuffers_skybasic=false -alphaTest.gbuffers_skytextured=false +alphaTest.gbuffers_weather = false +alphaTest.gbuffers_water = false +alphaTest.gbuffers_skybasic = false +alphaTest.gbuffers_skytextured = false -sliders = MOTION_AMOUNT TONEMAP WATER_WAVE_SPEED WATER_CAUSTICS_BRIGHTNESS DAY3_l0_coverage DAY3_l0_density DAY3_l1_coverage DAY3_l1_density DAY3_l2_coverage DAY3_l2_density DAY3_ufog_density DAY3_cfog_density DAY0_l0_coverage DAY0_l1_coverage DAY0_l2_coverage DAY0_ufog_density DAY0_l0_density DAY0_l1_density DAY0_l2_density DAY0_cfog_density DAY1_l0_coverage DAY1_l1_coverage DAY1_l2_coverage DAY1_ufog_density DAY1_l0_density DAY1_l1_density DAY1_l2_density DAY1_cfog_density DAY2_l0_coverage DAY2_l1_coverage DAY2_l2_coverage DAY2_ufog_density DAY2_l0_density DAY2_l1_density DAY2_l2_density DAY2_cfog_density DEBUG_VIEW entityShadowDistanceMul HANDHELD_LIGHT_RANGE CLOUD_SHADOW_STRENGTH CloudLayer0_coverage CloudLayer0_density CloudLayer0_height CloudLayer1_coverage CloudLayer1_density CloudLayer1_height CloudLayer2_coverage CloudLayer2_density CloudLayer2_height PLANET_GROUND_BRIGHTNESS FOG_START_HEIGHT WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B NETHER_PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE SCALE_FACTOR ambientsss_brightness SSS_TYPE Cloud_Speed ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH SHADOWS_GRADE_R MIDS_GRADE_R HIGHLIGHTS_GRADE_R SHADOWS_GRADE_G MIDS_GRADE_G HIGHLIGHTS_GRADE_G SHADOWS_GRADE_B MIDS_GRADE_B HIGHLIGHTS_GRADE_B SHADOWS_GRADE_MUL MIDS_GRADE_MUL HIGHLIGHTS_GRADE_MUL +sliders = sss_density_multiplier sss_absorbance_multiplier MOTION_AMOUNT TONEMAP WATER_WAVE_SPEED WATER_CAUSTICS_BRIGHTNESS DAY3_l0_coverage DAY3_l0_density DAY3_l1_coverage DAY3_l1_density DAY3_l2_coverage DAY3_l2_density DAY3_ufog_density DAY3_cfog_density DAY0_l0_coverage DAY0_l1_coverage DAY0_l2_coverage DAY0_ufog_density DAY0_l0_density DAY0_l1_density DAY0_l2_density DAY0_cfog_density DAY1_l0_coverage DAY1_l1_coverage DAY1_l2_coverage DAY1_ufog_density DAY1_l0_density DAY1_l1_density DAY1_l2_density DAY1_cfog_density DAY2_l0_coverage DAY2_l1_coverage DAY2_l2_coverage DAY2_ufog_density DAY2_l0_density DAY2_l1_density DAY2_l2_density DAY2_cfog_density DEBUG_VIEW entityShadowDistanceMul HANDHELD_LIGHT_RANGE CLOUD_SHADOW_STRENGTH CloudLayer0_coverage CloudLayer0_density CloudLayer0_height CloudLayer1_coverage CloudLayer1_density CloudLayer1_height CloudLayer2_coverage CloudLayer2_density CloudLayer2_height PLANET_GROUND_BRIGHTNESS FOG_START_HEIGHT WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B NETHER_PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE SCALE_FACTOR ambientsss_brightness SSS_TYPE Cloud_Speed ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH SHADOWS_GRADE_R MIDS_GRADE_R HIGHLIGHTS_GRADE_R SHADOWS_GRADE_G MIDS_GRADE_G HIGHLIGHTS_GRADE_G SHADOWS_GRADE_B MIDS_GRADE_B HIGHLIGHTS_GRADE_B SHADOWS_GRADE_MUL MIDS_GRADE_MUL HIGHLIGHTS_GRADE_MUL screen.columns=2 screen = \ @@ -118,13 +132,13 @@ BLISS_SHADERS \ ######## 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 = [Shadows] [Subsurface_Scattering] [Sun_and_Moon_Colors] OLD_LIGHTLEAK_FIX sunPathRotation sun_illuminance MOONPHASE_BASED_MOONLIGHT moon_illuminance screen.Shadows.columns=1 - screen.Shadows = SCREENSPACE_CONTACT_SHADOWS RENDER_ENTITY_SHADOWS entityShadowDistanceMul [Filtering] shadowMapResolution shadowDistance shadowDistanceRenderMul + screen.Shadows = TRANSLUCENT_COLORED_SHADOWS SCREENSPACE_CONTACT_SHADOWS RENDER_ENTITY_SHADOWS entityShadowDistanceMul [Filtering] shadowMapResolution shadowDistance OPTIMIZED_SHADOW_DISTANCE screen.Subsurface_Scattering.columns=1 - screen.Subsurface_Scattering = SSS_TYPE LabSSS_Curve MISC_BLOCK_SSS MOB_SSS Ambient_SSS ambientsss_brightness + screen.Subsurface_Scattering = SSS_TYPE sss_density_multiplier sss_absorbance_multiplier LabSSS_Curve MISC_BLOCK_SSS MOB_SSS Ambient_SSS ambientsss_brightness screen.Filtering.columns=1 screen.Filtering = BASIC_SHADOW_FILTER SHADOW_FILTER_SAMPLE_COUNT Min_Shadow_Filter_Radius Variable_Penumbra_Shadows VPS_Search_Samples Max_Shadow_Filter_Radius Max_Filter_Depth @@ -134,7 +148,7 @@ BLISS_SHADERS \ ### AMBIENT LIGHT screen.Ambient_light.columns=1 - screen.Ambient_light = [Torch_Colors] [Ambient_Colors] \ + screen.Ambient_light = [LPV] [Torch_Colors] [Ambient_Colors] \ MIN_LIGHT_AMOUNT indirect_effect \ \ AO_Strength GI_Strength \ @@ -158,6 +172,9 @@ BLISS_SHADERS \ screen.Porosity.columns = 1 screen.Porosity = Porosity Puddles Puddle_Size + ### FloodFill + screen.LPV.columns = 1 + screen.LPV = LPV_ENABLED LPV_SIZE LPV_NORMAL_OFFSET LPV_ENTITY_LIGHTS LPV_REDSTONE_LIGHTS LPV_COLORED_CANDLES ######## WORLD screen.World.columns=1 screen.World = [Water] [Waving_Stuff] [LabPBR] SKY_GROUND RESOURCEPACK_SKY AEROCHROME_MODE AEROCHROME_PINKNESS AEROCHROME_WOOL_ENABLED @@ -303,7 +320,7 @@ BLISS_SHADERS \ ######## MISC SETTINGS - screen.Misc_Settings = DEBUG_VIEW [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only LIGHTNING_FLASH LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER CLOUDS_INFRONT_OF_WORLD SELECT_BOX DENOISE_SSS_AND_SSAO WATER_CAUSTICS_BRIGHTNESS HYPER_DETAILED_WAVES + screen.Misc_Settings = DEBUG_VIEW [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only LIGHTNING_FLASH LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER CLOUDS_INFRONT_OF_WORLD SELECT_BOX DENOISE_SSS_AND_SSAO WATER_CAUSTICS_BRIGHTNESS HYPER_DETAILED_WAVES OLD_BLOOM screen.the_orb.columns = 1 screen.the_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B @@ -346,36 +363,19 @@ BLISS_SHADERS \ ######## weather profiles. -variable.int.maxDays = 2 -variable.int.DayCounter = worldDay - maxDays * floor(worldDay / maxDays) - # in seconds... variable.int.WeatherTransitionTime = 1 -variable.float.LAYER0_coverage = smooth(if( \ - DayCounter == 0, 0.5, \ - 1.3 ), WeatherTransitionTime, WeatherTransitionTime) - -variable.float.LAYER0_denisty = smooth(if( \ - DayCounter == 0, 0.5, \ - 0.5 ), WeatherTransitionTime, WeatherTransitionTime) - - -uniform.vec2.LAYER0_params = vec2(LAYER0_coverage, LAYER0_denisty) - -uniform.float.EXAMPLE = smooth(if(DayCounter == 0, 5.0, 0.0 ), 5, 5) - - uniform.float.Cumulus_Cov = smooth(if( \ - DayCounter == 0, 5.0, \ - DayCounter == 1, 0.0, \ - DayCounter == 2, 0.0, \ - DayCounter == 3, 0.0, \ - DayCounter == 4, 0.0, \ - DayCounter == 5, 0.0, \ - DayCounter == 6, 0.0, \ - DayCounter == 7, 0.0, \ - DayCounter == 9, 0.0, \ + moonPhase == 0, 5.0, \ + moonPhase == 1, 0.0, \ + moonPhase == 2, 0.0, \ + moonPhase == 3, 0.0, \ + moonPhase == 4, 0.0, \ + moonPhase == 5, 0.0, \ + moonPhase == 6, 0.0, \ + moonPhase == 7, 0.0, \ + moonPhase == 9, 0.0, \ 0.0 ), WeatherTransitionTime, WeatherTransitionTime) uniform.float.Alto_Cov = smooth(if( \ @@ -398,45 +398,6 @@ uniform.float.Alto_Den = smooth(if( \ moonPhase == 6, 0.05, \ 0.0 ), WeatherTransitionTime, WeatherTransitionTime) - - - - - - - - -# uniform.float.Cumulus_Cov = smooth(if( \ -# moonPhase == 0, 0.7, \ -# moonPhase == 1, 0.9, \ -# moonPhase == 2, 0.0, \ -# moonPhase == 3, 0.8, \ -# moonPhase == 4, 0.0, \ -# moonPhase == 5, 1.2, \ -# moonPhase == 6, 0.6, \ -# 0.0 ), WeatherTransitionTime, WeatherTransitionTime) - -# uniform.float.Alto_Cov = smooth(if( \ -# moonPhase == 0, 0.1, \ -# moonPhase == 1, 1.0, \ -# moonPhase == 2, 1.0, \ -# moonPhase == 3, 0.3, \ -# moonPhase == 4, 0.3, \ -# moonPhase == 5, 0.0, \ -# moonPhase == 6, 1.5, \ -# 0.0 ), WeatherTransitionTime, WeatherTransitionTime) - -# uniform.float.Alto_Den = smooth(if( \ -# moonPhase == 0, 0.1, \ -# moonPhase == 1, 0.25, \ -# moonPhase == 2, 0.1, \ -# moonPhase == 3, 0.7, \ -# moonPhase == 4, 0.7, \ -# moonPhase == 5, 0.0, \ -# moonPhase == 6, 0.05, \ -# 0.0 ), WeatherTransitionTime, WeatherTransitionTime) - - uniform.float.Uniform_Den = smooth(if( \ moonPhase == 0, 0, \ moonPhase == 1, 0, \ @@ -457,10 +418,6 @@ uniform.float.Cloudy_Den = smooth(if( \ moonPhase == 6, 50, \ 0 ), WeatherTransitionTime, WeatherTransitionTime) -# uniform.float.ifEndBoss = smooth(if(bossBattle == 2, 1, 0 ), 1, 1) -# uniform.float.EndSequence1 = smooth(if(hideGUI == 1, 1.0, 0.0), 30, 0) -# uniform.float.EndSequence2 = smooth(if(EndSequence1 > 0.95, 1.0, 0.0), 1.25, 0) - # thank you sixthsurge! #ifdef LIGHTNING_FLASH #ifdef IS_IRIS @@ -474,8 +431,6 @@ uniform.float.Cloudy_Den = smooth(if( \ uniform.vec3.lightningEffect = vec3(77.0 * lightningFlash, 153.0 * lightningFlash, 255.0 * lightningFlash) - - ################################### ####### BIOME RELATED STUFF ####### ################################### @@ -521,14 +476,6 @@ uniform.float.noPuddleAreas = smooth(if(in(biome, 3, 4, 16, 37, 39, 48, 49, 31, ####### RANDOM STUFF ####### ############################ - - # float Currenthealth = currentPlayerHealth * maxPlayerHealth; - # bool isDead = Currenthealth < 1 && currentPlayerHealth > -1; - # bool oneHeart = Currenthealth <= 2 && currentPlayerHealth > -1; - # bool threeHeart = Currenthealth <= 6 && currentPlayerHealth > -1; - - - #if defined LOW_HEALTH_EFFECT || defined DAMAGE_TAKEN_EFFECT #ifdef IS_IRIS variable.float.Currenthealth = currentPlayerHealth * maxPlayerHealth @@ -541,8 +488,6 @@ uniform.float.noPuddleAreas = smooth(if(in(biome, 3, 4, 16, 37, 39, 48, 49, 31, uniform.float.hurt = smooth(if(is_hurt,1,0),0.0,0.5) #endif -# uniform.vec3.CamPos = vec3(cameraPosition.x,cameraPosition.y,cameraPosition.z) - # photon stuff uniform.vec2.view_res = vec2(viewWidth, viewHeight) uniform.vec2.view_pixel_size = vec2(1.0 / viewWidth, 1.0 / viewHeight) @@ -602,4 +547,36 @@ 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 +#ifdef LPV_ENABLED + bufferObject.0=32000 + + #if LPV_SIZE == 8 + image.imgVoxelMask = none RED_INTEGER R16UI UNSIGNED_SHORT true false 256 256 256 + image.imgLpv1 = texLpv1 RGB RGBA8 BYTE false false 256 256 256 + image.imgLpv2 = texLpv2 RGB 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 = texLpv1 RGB RGBA8 BYTE false false 128 128 128 + image.imgLpv2 = texLpv2 RGB 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 = texLpv1 RGB RGBA8 BYTE false false 64 64 64 + image.imgLpv2 = texLpv2 RGB RGBA8 BYTE false false 64 64 64 + #endif +#else + program.world1/setup.enabled = false + program.world0/setup.enabled = false + program.world-1/setup.enabled = false + + program.world1/shadowcomp.enabled = false + program.world0/shadowcomp.enabled = false + program.world-1/shadowcomp.enabled = false +#endif \ No newline at end of file diff --git a/shaders/world-1/setup.csh b/shaders/world-1/setup.csh new file mode 100644 index 0000000..05c4315 --- /dev/null +++ b/shaders/world-1/setup.csh @@ -0,0 +1,7 @@ +#version 430 compatibility + +#define RENDER_SETUP + +#include "/lib/settings.glsl" + +#include "/dimensions/setup.csh" diff --git a/shaders/world-1/shadowcomp.csh b/shaders/world-1/shadowcomp.csh new file mode 100644 index 0000000..23b38a8 --- /dev/null +++ b/shaders/world-1/shadowcomp.csh @@ -0,0 +1,5 @@ +#version 430 compatibility + +#include "/lib/settings.glsl" + +#include "/dimensions/shadowcomp.csh" diff --git a/shaders/world0/gbuffers_damagedblock.fsh b/shaders/world0/gbuffers_damagedblock.fsh index 7c7bfb3..429a88a 100644 --- a/shaders/world0/gbuffers_damagedblock.fsh +++ b/shaders/world0/gbuffers_damagedblock.fsh @@ -1,6 +1,5 @@ #version 120 -#define OVERWORLD_SHADER #define DAMAGE_BLOCK_EFFECT #include "/dimensions/all_particles.fsh" \ No newline at end of file diff --git a/shaders/world0/gbuffers_damagedblock.vsh b/shaders/world0/gbuffers_damagedblock.vsh index e24e3e7..4afcdb8 100644 --- a/shaders/world0/gbuffers_damagedblock.vsh +++ b/shaders/world0/gbuffers_damagedblock.vsh @@ -1,6 +1,5 @@ #version 120 -#define OVERWORLD_SHADER #define DAMAGE_BLOCK_EFFECT #include "/dimensions/all_particles.vsh" \ No newline at end of file diff --git a/shaders/world0/setup.csh b/shaders/world0/setup.csh new file mode 100644 index 0000000..05c4315 --- /dev/null +++ b/shaders/world0/setup.csh @@ -0,0 +1,7 @@ +#version 430 compatibility + +#define RENDER_SETUP + +#include "/lib/settings.glsl" + +#include "/dimensions/setup.csh" diff --git a/shaders/world0/shadow.fsh b/shaders/world0/shadow.fsh index 1f76442..801129d 100644 --- a/shaders/world0/shadow.fsh +++ b/shaders/world0/shadow.fsh @@ -1,63 +1,28 @@ #version 120 -//#extension GL_ARB_shader_texture_lod : disable #include "/lib/settings.glsl" +varying vec4 color; varying vec2 texcoord; uniform sampler2D tex; uniform sampler2D noisetex; -uniform int frameCounter; -uniform float frameTimeCounter; -uniform vec3 cameraPosition; -varying vec4 color; -#include "/lib/waterBump.glsl" //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// -uniform mat4 gbufferProjectionInverse; -uniform mat4 gbufferModelViewInverse; -uniform mat4 gbufferModelView; -uniform mat4 shadowModelView; -uniform mat4 shadowModelViewInverse; -uniform mat4 shadowProjection; - -#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) - -vec3 toScreenSpace(vec3 p) { - vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw); - vec3 p3 = p * 2. - 1.; - vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3]; - return fragposition.xyz / fragposition.w; -} - float blueNoise(){ return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); } void main() { - gl_FragData[0] = texture2D(tex,texcoord.xy) * color; - - - - #ifdef SHADOW_DISABLE_ALPHA_MIPMAPS - gl_FragData[0].a = texture2DLod(tex, texcoord.xy, 0).a; - #endif + gl_FragData[0] = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); #ifdef Stochastic_Transparent_Shadows if(gl_FragData[0].a < blueNoise()) { discard; return;} #endif - - #ifdef RENDER_ENTITY_SHADOWS - #endif - - // if(materials > 0.95){ - // // gl_FragData[0] = vec4(0.3,0.8,1.0,0.1); - // gl_FragData[0] = vec4(1.0,1.0,1.0,0.1); - // } } diff --git a/shaders/world0/shadow.vsh b/shaders/world0/shadow.vsh index c8c26ef..fb171c0 100644 --- a/shaders/world0/shadow.vsh +++ b/shaders/world0/shadow.vsh @@ -1,6 +1,11 @@ #version 120 #include "/lib/settings.glsl" +#ifdef IS_LPV_ENABLED + #extension GL_ARB_explicit_attrib_location: enable + #extension GL_ARB_shader_image_load_store: enable +#endif +#define RENDER_SHADOW /* @@ -45,6 +50,17 @@ uniform int entityId; #include "/lib/Shadow_Params.glsl" #include "/lib/bokeh.glsl" +#include "/lib/blocks.glsl" +#include "/lib/entities.glsl" + +#ifdef IS_LPV_ENABLED + attribute vec3 at_midBlock; + uniform int currentRenderedItemId; + uniform int renderStage; + + #include "/lib/voxel_common.glsl" + #include "/lib/voxel_write.glsl" +#endif const float PI48 = 150.796447372*WAVY_SPEED; float pi2wt = PI48*frameTimeCounter; @@ -170,46 +186,81 @@ void main() { // } // #endif + 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 defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store + 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 = uint(BLOCK_EMPTY); + + if (currentRenderedItemId > 0) { + 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 + #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 == BLOCK_GROUND_WAVING || blockId == BLOCK_GROUND_WAVING_VERTICAL || + blockId == BLOCK_GRASS_SHORT || (blockId == BLOCK_GRASS_TALL_UPPER && istopv) || + blockId == BLOCK_SAPLING + ) && 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 == BLOCK_AIR_WAVING && 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 #ifdef DISTORT_SHADOWMAP + if(entityId == 1100) position.xyz = position.xyz - normalize(gl_NormalMatrix * gl_Normal) * 0.25; + gl_Position = BiasShadowProjection(toClipSpace3(position)); #else gl_Position = toClipSpace3(position); #endif - - - if(mc_Entity.x == 8 ) gl_Position.w = -1.0; - // color.a = 1.0; - // if(mc_Entity.x != 10002) color.a = 0.0; - - - // materials = 0.0; - // if(mc_Entity.x == 8) materials = 1.0; + if (blockId == BLOCK_WATER) gl_Position.w = -1.0; - /// this is to ease the shadow acne on big fat entities like ghasts. - float bias = 6.0; - if(entityId == 1100){ - // increase bias on parts facing the sun - vec3 FlatNormals = normalize(gl_NormalMatrix * gl_Normal); - vec3 WsunVec = (float(sunElevation > 1e-5)*2-1.)*normalize(mat3(shadowModelViewInverse) * sunPosition); - - bias = 6.0 + (1-clamp(dot(WsunVec,FlatNormals),0,1))*0.3; - } - gl_Position.z /= bias; + gl_Position.z /= 6.0; } \ No newline at end of file diff --git a/shaders/world0/shadowcomp.csh b/shaders/world0/shadowcomp.csh new file mode 100644 index 0000000..23b38a8 --- /dev/null +++ b/shaders/world0/shadowcomp.csh @@ -0,0 +1,5 @@ +#version 430 compatibility + +#include "/lib/settings.glsl" + +#include "/dimensions/shadowcomp.csh" diff --git a/shaders/world1/gbuffers_basic.fsh b/shaders/world1/gbuffers_basic.fsh index 02977d0..c43da69 100644 --- a/shaders/world1/gbuffers_basic.fsh +++ b/shaders/world1/gbuffers_basic.fsh @@ -3,4 +3,4 @@ #define LINES #define END_SHADER -#include "/dimensions/all_solid.fsh" \ No newline at end of file +#include "/dimensions/all_particles.fsh" \ No newline at end of file diff --git a/shaders/world1/gbuffers_basic.vsh b/shaders/world1/gbuffers_basic.vsh index 033d48b..773a71d 100644 --- a/shaders/world1/gbuffers_basic.vsh +++ b/shaders/world1/gbuffers_basic.vsh @@ -3,4 +3,4 @@ #define LINES #define END_SHADER -#include "/dimensions/all_solid.vsh" \ No newline at end of file +#include "/dimensions/all_particles.vsh" \ No newline at end of file diff --git a/shaders/world1/setup.csh b/shaders/world1/setup.csh new file mode 100644 index 0000000..05c4315 --- /dev/null +++ b/shaders/world1/setup.csh @@ -0,0 +1,7 @@ +#version 430 compatibility + +#define RENDER_SETUP + +#include "/lib/settings.glsl" + +#include "/dimensions/setup.csh" diff --git a/shaders/world1/shadowcomp.csh b/shaders/world1/shadowcomp.csh new file mode 100644 index 0000000..23b38a8 --- /dev/null +++ b/shaders/world1/shadowcomp.csh @@ -0,0 +1,5 @@ +#version 430 compatibility + +#include "/lib/settings.glsl" + +#include "/dimensions/shadowcomp.csh"