tweaks to subsurface scattering, improve SSS in the distance. make screenspace shadows have consistent step length across all window resolutions. tweak torch lighting (make it slightly brighter and a warmer color). tweak TAA handling of the hand. tweak specular reflection handling of the hand to be slightly more stable. make the shader use moonPosition instead of inverted sunPosition for moon related code. add support for Caelium moon positions. improve water parallax. remove some unused code improve specular handling of translucent entities with inside faces (slimes). add settings for refraction effects. re-enable block breaking effect and glass tint (it was off accidentally lol)

This commit is contained in:
Xonk 2025-01-28 23:19:33 -05:00
parent 6c41c008c0
commit a58cdfb9e9
24 changed files with 298 additions and 949 deletions

View File

@ -85,7 +85,7 @@ block.54=minecraft:melon_stem minecraft:pumpkin_stem minecraft:flowering_azalea
## 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.55 = minecraft:closed_eyeblossom minecraft:open_eyeblossom minecraft:fern \
biomesoplenty:bush \
conquest:warped_fungus 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: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 \
conquest:red_clover_flowers conquest:warped_fungus 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: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 \
flying_stuff:blow_flower flying_stuff:fiery_short_grass flying_stuff:fiery_grass flying_stuff:small_arid_bush flying_stuff:metallic_shorter_grass flying_stuff:firey_tree_sapling flying_stuff:abyss_grass flying_stuff:arid_grass flying_stuff:fiery_tree_sapling flying_stuff:lavic_tree_sapling flying_stuff:short_lavic_grass flying_stuff:warmth_radish_plant \
meadow:eriophorum meadow:pine_sapling meadow:alpine_poppy meadow:delphinium meadow:saxifrage meadow:enzian meadow:fire_lily
@ -110,7 +110,7 @@ block.56= minecraft:pale_hanging_moss minecraft:pale_oak_leaves minecraft:azalea
####### ----- blocks with SSS ----- #######
## strong sss
block.80=minecraft:kelp_plant minecraft:peony minecraft:rose_bush minecraft:lilac minecraft:packed_ice minecraft:blue_ice minecraft:attached_melon_stem minecraft:attached_pumpkin_stem \
block.80= minecraft:kelp_plant minecraft:peony minecraft:rose_bush minecraft:lilac minecraft:packed_ice minecraft:blue_ice minecraft:attached_melon_stem minecraft:attached_pumpkin_stem \
aquamirae:elodea \
beachparty:lounge_chair beachparty:chair beachparty:table beachparty:beach_chair beachparty:deck_chair beachparty:hammock beachparty:tiki_chair beachparty:beach_towel \
biomesoplenty:high_grass_plant biomesoplenty:red_maple_leaf_pile biomesoplenty:orange_maple_leaf_pile biomesoplenty:yellow_maple_leaf_pile biomesoplenty:clover biomesoplenty:flesh biomesoplenty:porous_flesh biomesoplenty:flesh_tendons biomesoplenty:pus_bubble biomesoplenty:spanish_moss biomesoplenty:willow_vine \
@ -123,7 +123,7 @@ block.80=minecraft:kelp_plant minecraft:peony minecraft:rose_bush minecraft:lila
nethervinery:crimson_grape_bush nethervinery:warped_grape_bush \
oceansdelight:guardian_soup \
vinery:jungle_grape_bush_white vinery:jungle_grape_bush_red \
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
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
#ifdef BOES_EARTH_BLOCKSTATES
@ -145,9 +145,10 @@ block.81=minecraft:amethyst_block minecraft:budding_amethyst minecraft:small_ame
savethehotbar:sack savethehotbar:skeleton_head_grave savethehotbar:zombie_head_grave
## 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 \
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 \
meadow:warped_wool meadow:flecked_wool meadow:highland_wool meadow:inky_wool meadow:patched_wool meadow:rocky_wool meadow:umbra_wool \
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
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 \
conquest:yellow_thatch conquest:yellow_thatch_stairs conquest:yellow_thatch_slab conquest:yellow_thatch_quarter_slab conquest:yellow_thatch_corner_slab conquest:yellow_thatch_eighth_slab conquest:yellow_thatch_vertical_corner_slab conquest:yellow_thatch_vertical_slab conquest:yellow_thatch_vertical_corner conquest:yellow_thatch_vertical_quarter conquest:dark_yellow_thatch conquest:dark_yellow_thatch_stairs conquest:dark_yellow_thatch_slab conquest:dark_yellow_thatch_quarter_slab conquest:dark_yellow_thatch_corner_slab conquest:dark_yellow_thatch_eighth_slab conquest:dark_yellow_thatch_vertical_corner_slab conquest:dark_yellow_thatch_vertical_slab conquest:dark_yellow_thatch_vertical_corner conquest:dark_yellow_thatch_vertical_quarter conquest:brown_thatch conquest:brown_thatch_stairs conquest:brown_thatch_slab conquest:brown_thatch_quarter_slab conquest:brown_thatch_corner_slab conquest:brown_thatch_eighth_slab conquest:brown_thatch_vertical_corner_slab conquest:brown_thatch_vertical_slab conquest:brown_thatch_vertical_corner conquest:brown_thatch_vertical_quarter conquest:dark_brown_thatch conquest:dark_brown_thatch_stairs conquest:dark_brown_thatch_slab conquest:dark_brown_thatch_quarter_slab conquest:dark_brown_thatch_corner_slab conquest:dark_brown_thatch_eighth_slab conquest:dark_brown_thatch_vertical_corner_slab conquest:dark_brown_thatch_vertical_slab conquest:dark_brown_thatch_vertical_corner conquest:dark_brown_thatch_vertical_quarter conquest:mossy_brown_thatch conquest:mossy_brown_thatch_stairs conquest:mossy_brown_thatch_slab conquest:mossy_brown_thatch_quarter_slab conquest:mossy_brown_thatch_corner_slab conquest:mossy_brown_thatch_eighth_slab conquest:mossy_brown_thatch_vertical_corner_slab conquest:mossy_brown_thatch_vertical_slab conquest:mossy_brown_thatch_vertical_corner conquest:mossy_brown_thatch_vertical_quarter
## 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 \
@ -157,7 +158,7 @@ block.83=minecraft:white_wall_banner minecraft:orange_wall_banner minecraft:mage
block.84=minecraft:sand minecraft:red_sand
## grass uwu
block.85=minecraft:grass_block:snowy=false
block.85= minecraft:grass_block:snowy=false
####### ----- lightsources ----- #######

View File

@ -296,9 +296,9 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 waterNormals = worldSpaceNormals;
if(iswater && abs(worldSpaceNormals.y) > 0.1){
vec3 posxz = playerPos+cameraPosition;
vec3 waterPos = (playerPos+cameraPosition).xzy;
vec3 bump = normalize(getWaveNormal(posxz, true));
vec3 bump = normalize(getWaveNormal(waterPos, playerPos, true));
float bumpmult = 10.0 * WATER_WAVE_STRENGTH;

View File

@ -294,6 +294,7 @@ void main() {
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
/*|| (mc_Entity.x >= 410 && mc_Entity.x <= 415) || (mc_Entity.x >= 402 && mc_Entity.x <= 405) THIS IS FOR MCME NEW TREES.*/
) {
SSSAMOUNT = 1.0;
}
@ -307,9 +308,10 @@ void main() {
) {
SSSAMOUNT = 0.5;
}
// low
#ifdef MISC_BLOCK_SSS
if(mc_Entity.x == BLOCK_SSS_WEIRD || mc_Entity.x == BLOCK_GRASS) 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.25;
#endif
#ifdef ENTITIES

View File

@ -89,7 +89,6 @@ uniform float skyIntensity;
uniform ivec2 eyeBrightnessSmooth;
uniform float nightVision;
uniform int frameCounter;
uniform float frameTimeCounter;
uniform vec2 texelSize;
@ -100,7 +99,6 @@ uniform float viewHeight;
uniform mat4 gbufferPreviousModelView;
uniform vec3 previousCameraPosition;
uniform float moonIntensity;
uniform float sunIntensity;
uniform vec3 sunColor;
@ -115,7 +113,6 @@ uniform float waterEnteredAltitude;
#include "/lib/sky_gradient.glsl"
#include "/lib/waterBump.glsl"
#ifdef OVERWORLD_SHADER
flat varying float Flashing;
#include "/lib/lightning_stuff.glsl"
@ -155,11 +152,13 @@ float interleaved_gradientNoise_temporal(){
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887);
#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;
}
float R2_dither(){
vec2 coord = gl_FragCoord.xy ;
@ -170,6 +169,7 @@ float R2_dither(){
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
}
float blueNoise(){
#ifdef TAA
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
@ -178,29 +178,23 @@ float blueNoise(){
#endif
}
#include "/lib/TAA_jitter.glsl"
#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 playerPos) {
vec3 getParallaxDisplacement(vec3 waterPos, vec3 playerPos) {
float waterHeight = getWaterHeightmap(-playerPos.xz) ;
float waterHeight = getWaterHeightmap(waterPos.xy) ;
waterHeight = exp(-20*sqrt(waterHeight));
// waterHeight *= 2.0;
// waterHeight *= 5.0;
vec3 parallaxPos = playerPos;
vec3 parallaxPos = waterPos;
parallaxPos.xz += (viewVector.xy / -viewVector.z) * waterHeight;
// parallaxPos.xz -= (viewVec.xy / viewVec.z) * waterHeight * 0.5;
parallaxPos.xy += (viewVector.xy / -viewVector.z) * waterHeight;
// parallaxPos.xz -= (viewVector.xy / viewVector.z) * waterHeight;
return parallaxPos;
}
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);
@ -244,6 +238,7 @@ vec3 worldToView(vec3 worldPos) {
pos = gbufferModelView * pos;
return pos.xyz;
}
vec4 encode (vec3 n, vec2 lightmaps){
n.xy = n.xy / dot(abs(n), vec3(1.0));
n.xy = n.z <= 0.0 ? (1.0 - abs(n.yx)) * sign(n.xy) : n.xy;
@ -258,11 +253,11 @@ float encodeVec2(vec2 a){
vec2 temp = floor( a * 255. );
return temp.x*constant1.x+temp.y*constant1.y;
}
float encodeVec2(float x,float y){
return encodeVec2(vec2(x,y));
}
float ld(float dist) {
return (2.0 * near) / (far + near - dist * (far - near));
}
@ -397,7 +392,6 @@ uniform vec3 eyePosition;
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
/* RENDERTARGETS:2,7,11,14 */
@ -426,10 +420,10 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
// 0.9 = entity mask
// 0.8 = reflective entities
// 0.7 = reflective blocks
// 0.1 = hand mask
// 0.3 = hand mask
#ifdef HAND
MATERIALS = 0.1;
MATERIALS = 0.3;
#endif
// bool isHand = abs(MATERIALS - 0.1) < 0.01;
@ -504,13 +498,22 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#ifndef HAND
if (isWater){
vec3 posxz = (mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz) + cameraPosition;
vec3 playerPos = (mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz);
vec3 waterPos = playerPos;
vec3 flowDir = normalize(worldSpaceNormal*10.0) * frameTimeCounter * 2.0 * WATER_WAVE_SPEED;
vec2 newPos = playerPos.xy + cameraPosition.xy + abs(flowDir.xz);
newPos = mix(newPos, playerPos.zy + cameraPosition.zy + abs(flowDir.zx), clamp(abs(worldSpaceNormal.x),0,1));
newPos = mix(newPos, playerPos.xz + cameraPosition.xz, clamp(abs(worldSpaceNormal.y),0,1));
waterPos.xy = newPos;
// 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 + normalize(worldSpaceNormal.xz*10.0) * frameTimeCounter * 3.0 * WATER_WAVE_SPEED;
// if(abs(worldSpaceNormal.y) < 0.9995) posxz.xz -= posxz.y + normalize(worldSpaceNormal.xz*10.0) * frameTimeCounter * 3.0 * WATER_WAVE_SPEED;
posxz.xyz = getParallaxDisplacement(posxz);
vec3 bump = normalize(getWaveNormal(posxz, false));
waterPos.xyz = getParallaxDisplacement(waterPos, playerPos);
vec3 bump = normalize(getWaveNormal(waterPos, playerPos, false));
float bumpmult = 10.0 * WATER_WAVE_STRENGTH;
bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult);
@ -601,10 +604,10 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 AmbientLightColor = averageSkyCol_Clouds/900.0;
vec3 ambientcoefs = worldSpaceNormal / dot(abs(worldSpaceNormal), vec3(1.0));
float SkylightDir = ambientcoefs.y*1.5;
vec3 indirectNormal = worldSpaceNormal / dot(abs(worldSpaceNormal),vec3(1.0));
float SkylightDir = clamp(indirectNormal.y*0.7+0.3,0.0,1.0);
float skylight = max(pow(viewToWorld(flatnormal).y*0.5+0.5,0.1) + SkylightDir, 0.2);
float skylight = mix(0.2 + 2.3*(1.0-lightmap.y), 2.5, SkylightDir);
AmbientLightColor *= skylight;
Indirect_lighting = doIndirectLighting(AmbientLightColor, MinimumLightColor, lightmap.y);
@ -659,17 +662,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
// vec4 vlBehingTranslucents = texture2D(colortex13, gl_FragCoord.xy*texelSize * VL_RENDER_RESOLUTION).rgba;
// vec3 totEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);// dirtEpsilon*dirtAmount + waterEpsilon;
// vec3 scatterCoef = Dirt_Amount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14;
// vec3 transmittance = exp(-totEpsilon * vlBehingTranslucents.a*50);
// FinalColor *= transmittance;
// FinalColor = FinalColor * vlBehingTranslucents.a +vlBehingTranslucents.rgb ;
#if EMISSIVE_TYPE == 2 || EMISSIVE_TYPE == 3
Emission(FinalColor, Albedo, SpecularTex.b, exposure);
#endif
@ -696,8 +688,11 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
if(SpecularTex.r > 0.0 && SpecularTex.g <= 1.0) specularValues = SpecularTex.rg;
float f0 = isReflective ? max(specularValues.g, harcodedF0) : specularValues.g;
bool isHand = false;
#ifdef HAND
isHand = true;
f0 = max(specularValues.g, harcodedF0);
#endif
@ -711,13 +706,13 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float reflectance = 0.0;
#if !defined OVERWORLD_SHADER
vec3 WsunVec = vec3(0.0);
vec3 DirectLightColor = WsunVec;
float Shadows = 0.0;
#endif
vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(blueNoise(), vec2(interleaved_gradientNoise_temporal())), viewToWorld(normal), roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows, lightmap.y, false, reflectance);
vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(blueNoise(), vec2(interleaved_gradientNoise_temporal())), viewToWorld(normal), roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows, lightmap.y, isHand, reflectance);
gl_FragData[0].a = gl_FragData[0].a + (1.0-gl_FragData[0].a) * reflectance;
@ -731,7 +726,13 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
gl_FragData[0].rgb = FinalColor*0.1;
#endif
#if defined ENTITIES
// do not allow specular to be very visible in these regions on entities
// this helps with specular on slimes, and entities with skin overlays like piglins/players
if (!gl_FrontFacing) {
gl_FragData[0] = vec4(FinalColor*0.1, UnchangedAlpha);
}
#endif
#if defined DISTANT_HORIZONS && defined DH_OVERDRAW_PREVENTION && !defined HAND
#if OVERDRAW_MAX_DISTANCE == 0
@ -745,9 +746,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
if(WATER) gl_FragData[0].a = 0.0;
#endif
#ifndef HAND
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
@ -762,8 +762,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
gl_FragData[0].rgb = Direct_lighting * 0.1;
#endif
// gl_FragData[0] = vec4(tbnMatrix * viewPos,1);
gl_FragData[3] = vec4(encodeVec2(lightmap.x, lightmap.y), 1, 1, 1);
#if defined ENTITIES && defined IS_IRIS

View File

@ -55,6 +55,7 @@ attribute vec4 mc_Entity;
uniform vec3 sunPosition;
uniform vec3 moonPosition;
uniform vec3 cameraPosition;
uniform float sunElevation;
@ -207,8 +208,15 @@ void main() {
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
// WsunVec = normalize(LightDir);
// WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
vec3 moonVec = normalize(mat3(gbufferModelViewInverse) * moonPosition);
vec3 WmoonVec = moonVec;
if(dot(-moonVec, WsunVec) < 0.9999) WmoonVec = -moonVec;
WsunVec = mix(WmoonVec, WsunVec, clamp(lightCol.a,0,1));
#if defined Daily_Weather
dailyWeatherParams0 = vec4(texelFetch2D(colortex4,ivec2(1,1),0).rgb / 1500.0, 0.0);

View File

@ -253,7 +253,7 @@ float convertHandDepth_2(in float depth, bool hand) {
vec2 SSAO(
vec3 viewPos, vec3 normal, vec3 flatnormal, bool hand, bool leaves, float noise
){
int samples = 14;
int samples = 7;
float occlusion = 0.0;
float sss = 0.0;
float THING = 0.0;
@ -265,8 +265,6 @@ vec2 SSAO(
float distanceScale = hand ? 30.0 : mix(40.0, 10.0, pow(clamp(1.0 - linearViewDistance/50.0,0.0,1.0),2.0));
float depthCancelation = (linearViewDistance*linearViewDistance) / distanceScale ;
// float leaf = leaves ? -0.5 : 0.0;
int n = 0;
for (int i = 0; i < samples; i++) {
@ -299,141 +297,19 @@ vec2 SSAO(
#ifdef OLD_INDIRECT_SSS
sss += clamp(-dot(normalize(viewPosDiff), flatnormal),0.0,1.0) * exp(-10*occlusion);
#else
sss += clamp(-dot(normalize(viewPosDiff), flatnormal) - occlusion/n,0.0,1.0) * 0.25
+ min(-normalize(mat3(gbufferModelViewInverse) * viewPosDiff).y - occlusion/n,1.0) * threshHold;
// + min(-dot(normalize(mat3(gbufferModelViewInverse) * viewPosDiff),clamp(normalize(WsunVec),-vec3(0.35,1.0,0.35),vec3(0.35,1.0,0.35))) - occlusion/n,1.0) * threshHold;
sss += clamp(-dot(normalize(viewPosDiff), flatnormal) - occlusion/n,0.0,1.0) * 0.25 + (normalize(mat3(gbufferModelViewInverse) * -viewPosDiff).y - occlusion/n) * threshHold;
#endif
#endif
}
}
}
float finaalAO = max(1.0 - occlusion*AO_Strength/n, 0.0);
float finalSSS = sss/n;
return vec2(finaalAO, finalSSS);
}
float ScreenSpace_SSS(
vec3 viewPos, vec3 normal, bool hand, bool leaves, float noise
){
int samples = 7;
float occlusion = 0.0;
float sss = 0.0;
vec3 normalizedNormals = normalize(normal);
vec2 jitterOffsets = TAA_Offset*texelSize*0.5 * RENDER_SCALE - texelSize*0.5;
// scale the offset radius down as distance increases.
float linearViewDistance = length(viewPos);
float distanceScale = hand ? 30.0 : mix(40.0, 10.0, pow(clamp(1.0 - linearViewDistance/50.0,0.0,1.0),2.0));
float leaf = leaves ? -0.5 : 0.0;
int n = 0;
for (int i = 0; i < samples; i++) {
vec2 offsets = CleanSample(i, samples - 1, noise) / distanceScale;
ivec2 offsetUV = ivec2(gl_FragCoord.xy + offsets*vec2(viewWidth, viewHeight*aspectRatio)*RENDER_SCALE);
if (offsetUV.x >= 0 && offsetUV.y >= 0 && offsetUV.x < viewWidth*RENDER_SCALE.x && offsetUV.y < viewHeight*RENDER_SCALE.y ) {
float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand);
#ifdef DISTANT_HORIZONS
float sampleDHDepth = texelFetch2D(dhDepthTex1, offsetUV, 0).x;
vec3 offsetViewPos = toScreenSpace_DH((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth, sampleDHDepth);
#else
vec3 offsetViewPos = toScreenSpace(vec3((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth));
#endif
vec3 viewPosDiff = offsetViewPos - viewPos;
float viewPosDiffSquared = dot(viewPosDiff, viewPosDiff);
if (viewPosDiffSquared > 1e-5){
sss += clamp(leaf - dot(viewPosDiff, normalizedNormals),0.0,1.0);
// sss += -(normalize(mat3(gbufferModelViewInverse)*viewPosDiff) + occlusion/n) * threshHold;
n += 1;
}
}
}
return max(1.0 - sss/n, 0.0);
}
vec2 spiralSampling(
int samples, float totalSamples, float noise
){
// this will be used to make 1 full rotation of the spiral. the mulitplication is so it does nearly a single rotation, instead of going past where it started
float variance = noise * 0.897;
// for every sample input, it will have variance applied to it.
float variedSamples = float(samples) + variance;
// for every sample, the sample position must change its distance from the origin.
// otherwise, you will just have a circle.
float spiralShape = variedSamples / (totalSamples + variance);
float shape = 2.26;
float theta = variedSamples * (PI * shape);
float x = cos(theta) * spiralShape;
float y = sin(theta) * spiralShape;
return vec2(x, y);
}
// vec3 getViewPos(in vec2 uv, in float depth, in mat4 inverseProj ){
// }
float getNoise(in vec2 fragCoord){
return fract(0.75487765 * fragCoord.x + 0.56984026 * fragCoord.y);
}
float calculateSSAO(
vec2 fragCoord, vec2 uv, vec3 viewPos, vec3 normal, in mat4 inverseProj
){
// SETTINGS
int SAMPLES = 50;
float RADIUS = 0.0005;
vec2 SCALE_RADIUS = vec2(1280.0, 720.0 * aspectRatio);
float linearViewDistance = length(viewPos);
float distanceScale = mix(40.0, 1.0, pow(clamp(1.0 - linearViewDistance/50.0,0.0,1.0),2.0));
float depthCancelation = (linearViewDistance*linearViewDistance) / distanceScale;
float noise = getNoise(fragCoord);
float average = 0.0;
float occlusion = 0.0;
for (int i = 0; i < SAMPLES; i++) {
vec2 offsets = (spiralSampling(i, float(SAMPLES - 1), noise) / distanceScale) * RADIUS * SCALE_RADIUS;
vec2 offsetUV = uv + offsets;
if (offsetUV.x >= 0 && offsetUV.y >= 0 && offsetUV.x <= 1.0 && offsetUV.y <= 1.0 ) {
float sampleDepth = texture(depthtex0, offsetUV).x;
// vec3 offsetViewPos = getViewPos(offsetUV, sampleDepth, inverseProj);
vec3 offsetViewPos = toScreenSpace(vec3(offsetUV, sampleDepth));
vec3 viewPosDiff = offsetViewPos - viewPos;
float viewPosDiffSquared = dot(viewPosDiff, viewPosDiff);
float threshHold = max(1.0 - viewPosDiffSquared/depthCancelation, 0.0);
if (viewPosDiffSquared > 1e-5){
occlusion += max(0.0, dot(normalize(viewPosDiff), normal)) * threshHold;
average += 1.0;
}
}
}
float finalAO = max(1.0 - occlusion / average, 0.0);
finalAO = finalAO*finalAO*finalAO*finalAO;
return finalAO;
}
vec4 encode (vec3 n, vec2 lightmaps){
n.xy = n.xy / dot(abs(n), vec3(1.0));
n.xy = n.z <= 0.0 ? (1.0 - abs(n.yx)) * sign(n.xy) : n.xy;
@ -448,100 +324,14 @@ float encodeVec2(vec2 a){
vec2 temp = floor( a * 255. );
return temp.x*constant1.x+temp.y*constant1.y;
}
float encodeVec2(float x,float y){
return encodeVec2(vec2(x,y));
}
// #include "/lib/indirect_lighting_effects.glsl"
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);
}
flat varying vec3 zMults;
vec4 BilateralUpscale_VLFOG(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth){
ivec2 scaling = ivec2(1.0/VL_RENDER_RESOLUTION);
ivec2 posDepth = ivec2(coord*VL_RENDER_RESOLUTION) * scaling;
ivec2 posColor = ivec2(coord*VL_RENDER_RESOLUTION);
ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1);
ivec2 getRadius[5] = ivec2[](
ivec2(-1,-1),
ivec2( 1, 1),
ivec2(-1, 1),
ivec2( 1,-1),
ivec2( 0, 0)
);
#ifdef DISTANT_HORIZONS
float diffThreshold = 0.01;
#else
float diffThreshold = zMults.x;
#endif
vec4 RESULT = vec4(0.0);
float SUM = 0.0;
for (int i = 0; i < 4; i++) {
ivec2 radius = getRadius[i];
#ifdef DISTANT_HORIZONS
float offsetDepth = sqrt(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling,0).a/65000.0);
#else
float offsetDepth = ld(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling, 0).r);
#endif
float EDGES = abs(offsetDepth - referenceDepth) < diffThreshold ? 1.0 : 1e-5;
RESULT += texelFetch2D(tex, posColor + radius + pos, 0) * EDGES;
SUM += EDGES;
}
return RESULT / SUM;
}
#include "/lib/sky_gradient.glsl"

View File

@ -9,11 +9,9 @@
#extension GL_ARB_shading_language_packing: enable
#endif
#include "/lib/util.glsl"
#include "/lib/res_params.glsl"
#define diagonal3_old(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD_old(m, v) (diagonal3_old(m) * (v) + (m)[3].xyz)
@ -32,6 +30,7 @@ uniform float nightVision;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
flat varying vec3 moonCol;
#if Sun_specular_Strength != 0
#define LIGHTSOURCE_REFLECTION
@ -87,16 +86,6 @@ uniform sampler2D colortex15; // flat normals(rgb), vanillaAO(alpha)
uniform sampler3D texLpv2;
#endif
// uniform mat4 shadowModelView;
// uniform mat4 shadowModelViewInverse;
// uniform mat4 shadowProjection;
// uniform mat4 shadowProjectionInverse;
// uniform mat4 gbufferProjection;
// uniform mat4 gbufferProjectionInverse;
// uniform mat4 gbufferModelView;
// uniform mat4 gbufferModelViewInverse;
// uniform mat4 gbufferPreviousProjection;
uniform mat4 gbufferPreviousModelView;
// uniform vec3 cameraPosition;
@ -129,20 +118,22 @@ uniform ivec2 eyeBrightnessSmooth;
uniform vec3 sunVec;
flat varying vec3 WsunVec;
flat varying vec3 unsigned_WsunVec;
flat varying vec3 WmoonVec;
flat varying float exposure;
#ifdef IS_LPV_ENABLED
uniform int heldItemId;
uniform int heldItemId2;
#endif
uniform float waterEnteredAltitude;
uniform float waterEnteredAltitude;
void convertHandDepth(inout float depth) {
float ndcDepth = depth * 2.0 - 1.0;
ndcDepth /= MC_HAND_DEPTH;
depth = ndcDepth * 0.5 + 0.5;
}
float convertHandDepth_2(in float depth, bool hand) {
if(!hand) return depth;
@ -153,15 +144,6 @@ float convertHandDepth_2(in float depth, bool hand) {
#include "/lib/projections.glsl"
// vec3 toScreenSpace(vec3 p) {
// vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
// vec3 feetPlayerPos = p * 2. - 1.;
// vec4 viewPos = iProjDiag * feetPlayerPos.xyzz + gbufferProjectionInverse[3];
// return viewPos.xyz / viewPos.w;
// }
#define TESTTHINGYG
#include "/lib/color_transforms.glsl"
@ -186,7 +168,6 @@ float convertHandDepth_2(in float depth, bool hand) {
#define CLOUDS_INTERSECT_TERRAIN
#endif
#ifdef IS_LPV_ENABLED
#include "/lib/hsv.glsl"
#include "/lib/lpv_common.glsl"
@ -200,6 +181,7 @@ float ld(float dist) {
}
#include "/lib/sky_gradient.glsl"
vec3 decode (vec2 encn){
vec3 n = vec3(0.0);
encn = encn * 2.0 - 1.0;
@ -208,17 +190,16 @@ vec3 decode (vec2 encn){
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"
#define DEFERRED_SPECULAR
// #define DEFERRED_SPECULAR
#define DEFERRED_ENVIORNMENT_REFLECTION
#define DEFERRED_BACKGROUND_REFLECTION
#define DEFERRED_ROUGH_REFLECTION
@ -233,14 +214,12 @@ vec2 decodeVec2(float a){
#endif
#include "/lib/specular.glsl"
#include "/lib/DistantHorizons_projections.glsl"
float DH_ld(float dist) {
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
}
float DH_inv_ld (float lindepth){
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
}
@ -249,20 +228,12 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
return (near * far) / (depth * (near - far) + far);
// return (2.0 * near) / (far + near - depth * (far - near));
}
float invertlinearDepthFast(const in float depth, const in float near, const in float far) {
return ((2.0*near/depth)-far-near)/(far-near);
}
vec3 normVec (vec3 vec){
return vec*inversesqrt(dot(vec,vec));
}
float lengthVec (vec3 vec){
return sqrt(dot(vec,vec));
}
// #define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.)
float triangularize(float dither)
{
float center = dither*2.0-1.0;
@ -276,34 +247,6 @@ vec3 fp10Dither(vec3 color,float dither){
return color + dither*exp2(-mantissaBits)*exp2(exponent);
}
// float facos(float sx){
// float x = clamp(abs( sx ),0.,1.);
// return sqrt( 1. - x ) * ( -0.16882 * x + 1.56734 );
// }
vec2 tapLocation(int sampleNumber,int nb, float nbRot,float jitter,float distort)
{
float alpha0 = sampleNumber/nb;
float alpha = (sampleNumber+jitter)/nb;
float angle = jitter*6.28 + alpha * 4.0 * 6.28;
float sin_v, cos_v;
sin_v = sin(angle);
cos_v = cos(angle);
return vec2(cos_v, sin_v)*sqrt(alpha);
}
vec3 BilateralFiltering(sampler2D tex, sampler2D depth,vec2 coord,float frDepth,float maxZ){
vec4 sampled = vec4(texelFetch2D(tex,ivec2(coord),0).rgb,1.0);
return vec3(sampled.x,sampled.yz/sampled.w);
}
float interleaved_gradientNoise_temporal(){
#ifdef TAA
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887 * frameCounter);
@ -311,11 +254,13 @@ float interleaved_gradientNoise_temporal(){
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887);
#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;
}
float R2_dither(){
vec2 coord = gl_FragCoord.xy ;
@ -326,6 +271,7 @@ float R2_dither(){
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
}
float R2_dither2(){
vec2 coord = gl_FragCoord.xy ;
@ -336,6 +282,7 @@ float R2_dither2(){
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
}
float blueNoise(){
#ifdef TAA
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
@ -343,45 +290,10 @@ float blueNoise(){
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887);
#endif
}
vec4 blueNoise(vec2 coord){
return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ;
}
// vec3 toShadowSpaceProjected(vec3 feetPlayerPos){
// mat4 DH_shadowProjection = DH_shadowProjectionTweak(shadowProjection);
// feetPlayerPos = mat3(gbufferModelViewInverse) * feetPlayerPos + gbufferModelViewInverse[3].xyz;
// feetPlayerPos = mat3(shadowModelView) * feetPlayerPos + shadowModelView[3].xyz;
// feetPlayerPos = diagonal3_old(DH_shadowProjection) * feetPlayerPos + DH_shadowProjection[3].xyz;
// return feetPlayerPos;
// }
vec2 tapLocation(int sampleNumber, float spinAngle,int nb, float nbRot,float r0)
{
float alpha = (float(sampleNumber*1.0f + r0) * (1.0 / (nb)));
float angle = alpha * (nbRot * 6.28) + spinAngle*6.28;
float ssR = alpha;
float sin_v, cos_v;
sin_v = sin(angle);
cos_v = cos(angle);
return vec2(cos_v, sin_v)*ssR;
}
vec2 tapLocation_simple(
int samples, int totalSamples, float rotation, float rng
){
const float PI = 3.141592653589793238462643383279502884197169;
float alpha = float(samples + rng) * (1.0 / float(totalSamples));
float angle = alpha * (rotation * PI);
float sin_v = sin(angle);
float cos_v = cos(angle);
return vec2(cos_v, sin_v) * sqrt(alpha);
}
vec2 CleanSample(
int samples, float totalSamples, float noise
@ -405,6 +317,7 @@ vec2 CleanSample(
return vec2(x, y);
}
vec3 viewToWorld(vec3 viewPos) {
vec4 pos;
pos.xyz = viewPos;
@ -412,11 +325,13 @@ vec3 viewToWorld(vec3 viewPos) {
pos = gbufferModelViewInverse * pos;
return pos.xyz;
}
vec3 worldToView(vec3 worldPos) {
vec4 pos = vec4(worldPos, 0.0);
pos = gbufferModelView * pos;
return pos.xyz;
}
float swapperlinZ(float depth, float _near, float _far) {
return (2.0 * _near) / (_far + _near - depth * (_far - _near));
// l = (2*n)/(f+n-d(f-n))
@ -434,6 +349,7 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo
float steps = 16.0;
float Shadow = 1.0;
float SSS = 0.0;
// isSSS = true;
float _near = near; float _far = far*4.0;
@ -442,26 +358,28 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo
_far = dhFarPlane;
}
vec3 worldpos = mat3(gbufferModelViewInverse) * viewPos ;
float dist = 1.0 + length(worldpos)/(_far/2.0); // step length as distance increases
vec3 clipPosition = toClipSpace3_DH(viewPos, depthCheck);
vec3 clipPosition = toClipSpace3_DH(viewPos, depthCheck);
//prevents the ray from going behind the camera
float rayLength = ((viewPos.z + lightDir.z * _far*sqrt(3.)) > -_near) ?
(-_near -viewPos.z) / lightDir.z : _far*sqrt(3.);
vec3 direction = toClipSpace3_DH(viewPos + lightDir*rayLength, depthCheck) - clipPosition; //convert to clip space
direction.xyz = direction.xyz / max(abs(direction.x)/texelSize.x, abs(direction.y)/texelSize.y); //fixed step size
float Stepmult = depthCheck ? (isSSS ? 1.0 : 6.0) : (isSSS ? 1.0 : 3.0);
direction.xyz = direction.xyz / max(abs(direction.x)/0.0005, abs(direction.y)/0.0005); //fixed step size
vec3 rayDir = direction * Stepmult * vec3(RENDER_SCALE,1.0) ;
// float Stepmult = depthCheck ? (isSSS ? 1.0 : 3.0) : (isSSS ? 1.0 : 3.0);
float Stepmult = isSSS ? 3.0 : 6.0;
vec3 screenPos = clipPosition * vec3(RENDER_SCALE,1.0) + rayDir * noise;
vec3 rayDir = direction * Stepmult * vec3(RENDER_SCALE,1.0);
vec3 screenPos = clipPosition * vec3(RENDER_SCALE,1.0) + rayDir*noise - (isSSS ? rayDir*0.9 : vec3(0.0));
float minZ = screenPos.z;
float maxZ = screenPos.z;
// as distance increases, add larger values to the SSS value. this scales the "density" with distance, as far things should appear denser.
float dist = 1.0 + length(mat3(gbufferModelViewInverse) * viewPos) / 500.0;
for (int i = 0; i < int(steps); i++) {
float samplePos = convertHandDepth_2(texture2D(depthtex1, screenPos.xy).x, hand);
@ -471,13 +389,11 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo
#endif
if(samplePos < screenPos.z && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){
vec2 linearZ = vec2(swapperlinZ(screenPos.z, _near, _far), swapperlinZ(samplePos, _near, _far));
float calcthreshold = abs(linearZ.x - linearZ.y) / linearZ.x;
if (calcthreshold < 0.035) Shadow = 0.0;
SSS += 1.0/steps;
SSS += dist;
}
minZ = maxZ - (isSSS ? 1.0 : 0.0001) / swapperlinZ(samplePos, _near, _far);
@ -485,9 +401,9 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo
screenPos += rayDir;
}
return vec2(Shadow, SSS);
}
return vec2(Shadow, SSS / steps);
}
void Emission(
inout vec3 Lighting,
@ -503,91 +419,6 @@ void Emission(
#include "/lib/indirect_lighting_effects.glsl"
#include "/lib/PhotonGTAO.glsl"
vec4 BilateralUpscale(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth){
const ivec2 scaling = ivec2(1.0/VL_RENDER_RESOLUTION);
ivec2 posDepth = ivec2(coord*VL_RENDER_RESOLUTION) * scaling;
ivec2 posColor = ivec2(coord*VL_RENDER_RESOLUTION);
ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1);
ivec2 getRadius[4] = ivec2[](
ivec2(-2,-2),
ivec2(-2, 0),
ivec2( 0, 0),
ivec2( 0,-2)
);
float diffThreshold = zMults.x;
vec4 RESULT = vec4(0.0);
float SUM = 0.0;
for (int i = 0; i < 4; i++) {
ivec2 radius = getRadius[i];
float offsetDepth = ld(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling, 0).r);
float EDGES = abs(offsetDepth - referenceDepth) < diffThreshold ? 1.0 : 1e-5;
RESULT += texelFetch2D(tex, posColor + radius + pos, 0) * EDGES;
SUM += EDGES;
}
// return vec4(0,0,0,1) * SUM;
return RESULT / SUM;
}
vec4 BilateralUpscale_DH(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth){
ivec2 scaling = ivec2(1.0/VL_RENDER_RESOLUTION);
ivec2 posDepth = ivec2(coord*VL_RENDER_RESOLUTION) * scaling;
ivec2 posColor = ivec2(coord*VL_RENDER_RESOLUTION);
ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1);
ivec2 getRadius[4] = ivec2[](
ivec2(-2,-2),
ivec2(-2, 0),
ivec2( 0, 0),
ivec2( 0,-2)
// ivec2(-1,-1),
// ivec2( 1, 1),
// ivec2(-1, 1),
// ivec2( 1,-1)
);
#ifdef DISTANT_HORIZONS
float diffThreshold = 0.01;
#else
float diffThreshold = zMults.x;
#endif
vec4 RESULT = vec4(0.0);
float SUM = 0.0;
RESULT += texelFetch2D(tex, posColor + pos, 0);
for (int i = 0; i < 4; i++) {
ivec2 radius = getRadius[i] ;
#ifdef DISTANT_HORIZONS
float offsetDepth = sqrt(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling,0).a/65000.0);
#else
float offsetDepth = ld(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling, 0).r);
#endif
float EDGES = abs(offsetDepth - referenceDepth) < diffThreshold ? 1.0 : 1e-5;
RESULT += texelFetch2D(tex, posColor + radius + pos, 0) * EDGES;
SUM += EDGES;
}
// return vec4(1) * SUM;
return RESULT / SUM;
}
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;
@ -695,68 +526,8 @@ vec4 BilateralUpscale_VLFOG(sampler2D tex, sampler2D depth, vec2 coord, float re
}
#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){
if(maxDistFade <= 0.0) return 1.0;
float backface = NdotL <= 0.0 ? 1.0 : 0.0;
float shadowmap = 0.0;
vec3 translucentTint = vec3(0.0);
#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;
vec2 offsetS = CleanSample(i, samples - 1, noise) * 0.3;
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 shadowmap / samples;
// return mix(1.0, shadowmap / samples, maxDistFade);
}
vec3 ComputeShadowMap_COLOR(in vec3 projectedShadowPosition, float distortFactor, float noise, float shadowBlockerDepth, float NdotL, float maxDistFade, vec3 directLightColor, inout float FUNNYSHADOW, inout vec3 tintedSunlight, bool isSSS){
vec3 ComputeShadowMap_COLOR(in vec3 projectedShadowPosition, float distortFactor, float noise, float shadowBlockerDepth, float NdotL, float maxDistFade, vec3 directLightColor, inout float FUNNYSHADOW, inout vec3 tintedSunlight, bool isSSS ,inout float shadowDebug){
// if(maxDistFade <= 0.0) return 1.0;
float backface = NdotL <= 0.0 ? 1.0 : 0.0;
@ -793,10 +564,14 @@ vec3 ComputeShadowMap_COLOR(in vec3 projectedShadowPosition, float distortFactor
shadowColor += directLightColor * shadow2D(shadow, projectedShadowPosition).x;
#endif
#ifdef BASIC_SHADOW_FILTER
}
#endif
#ifdef debug_SHADOWMAP
shadowDebug = shadow2D(shadow, projectedShadowPosition).x;
#endif
// #ifdef TRANSLUCENT_COLORED_SHADOWS
// directLightColor *= mix(vec3(1.0), translucentTint.rgb / samples, maxDistFade);
tintedSunlight *= translucentTint.rgb / samples;
@ -820,50 +595,17 @@ float CustomPhase(float LightPos){
vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, float lightPos, float shadows, float distantSSS){
// Scattering *= sss_density_multiplier;
// float density = 0.0001 + Density*2.0;
// float scatterDepth = max(1.0 - Scattering/density,0.0);
// scatterDepth = exp((1.0-scatterDepth) * -7.0);
// // this is for SSS when there is no shadow blocker depth
// #if defined BASIC_SHADOW_FILTER && defined Variable_Penumbra_Shadows
// scatterDepth = max(scatterDepth, pow(shadows, 0.5 + (1.0-Density) * 2.0) );
// #else
// scatterDepth = exp(-7.0 * pow(1.0-shadows,3.0))*min(2.0-sss_density_multiplier,1.0);
// #endif
// // PBR at its finest :clueless:
// vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 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;
// Scattering *= sss_density_multiplier;
// Density = 1.0;
Scattering *= sss_density_multiplier;
float density = 1e-6 + Density * 2.0;
// float scatterDepth = Scattering;//max(1.0 - Scattering/density,0.0);
float scatterDepth = max(1.0 - Scattering/density, 0.0);
scatterDepth = mix(exp(Scattering * -10.0), scatterDepth, distantSSS);
scatterDepth *= exp(-7.0 * (1.0-scatterDepth));
// vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -(20.0 - 19*scatterDepth) * sss_absorbance_multiplier);
// scatterDepth = mix(exp(Scattering * -10.0), scatterDepth, distantSSS);
// vec3 scatter = scatterDepth * absorbColor * pow(Density, LabSSS_Curve);// * vec3(1.0);
vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -20.0);
vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * pow(Density, LabSSS_Curve);
vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -20.0 * sss_absorbance_multiplier);
vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * (1-min(max((1-Density)-0.9, 0.0)/(1.0-0.9),1.0));
scatter *= 1.0 + CustomPhase(lightPos)*6.0; // ~10x brighter at the peak
@ -871,43 +613,24 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa
}
vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
// Density = 1.0;
#ifdef OLD_INDIRECT_SSS
float scatterDepth = 1.0 - pow(1.0-Scattering, 0.5 + Density * 2.5);
vec3 absorbColor = vec3(1.0) * exp(-(15.0 - 10.0*scatterDepth) * sss_absorbance_multiplier * 0.01);
vec3 scatter = scatterDepth * absorbColor * pow(Density, LabSSS_Curve);
#else
float scatterDepth = pow(Scattering,4);
float scatterDepth = pow(Scattering,3.5);
scatterDepth = 1-pow(1-scatterDepth,5);
vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -1.0 * sss_absorbance_multiplier);
vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * pow(Density, LabSSS_Curve);
vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * (1-min(max((1-Density)-0.9, 0.0)/(1.0-0.9),1.0));// * pow(Density, LabSSS_Curve);
#endif
// scatter *= 1.0 + exp(-7.0*(-playerPosNormalized.y*0.5+0.5));
return scatter;
}
vec3 blurredAlbedo( float noise, float lineardistance){
int samples = 7;
vec3 blurredColor = vec3(0.0);
for (int i = 0; i < samples; i++) {
vec2 offsets = CleanSample(i, samples - 1, noise)*0.02 / lineardistance;
ivec2 offsetUV = ivec2(gl_FragCoord.xy + offsets*vec2(viewWidth, viewHeight*aspectRatio)*RENDER_SCALE);
vec3 SAMPLE = texelFetch2D(colortex1, offsetUV, 0).xyz;
blurredColor += toLinear(vec3(decodeVec2(SAMPLE.x).x, decodeVec2(SAMPLE.y).x, decodeVec2(SAMPLE.z).x));
}
return blurredColor/samples;
}
uniform float wetnessAmount;
uniform float wetness;
@ -920,8 +643,8 @@ void applyPuddles(
float halfWet = min(wetnessAmount,1.0);
float fullWet = clamp(wetnessAmount - 2.0,0.0,1.0);
// halfWet = 1.0;
// fullWet = 1.0;
// halfWet = 0.0;
// fullWet = 0.0;
float noise = texture2D(noisetex, worldPos.xz * 0.02).b;
@ -955,82 +678,6 @@ void applyPuddles(
// albedo = mix(albedo, vec3(1.0), snow);
}
vec2 smoothfilterUV(in vec2 uv)
{
vec2 textureResolution = vec2(viewWidth,viewHeight);
uv = uv*textureResolution + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
#ifndef SMOOTHESTSTEP_INTERPOLATION
uv = iuv + (fuv*fuv)*(3.0-2.0*fuv);
#endif
#ifdef SMOOTHESTSTEP_INTERPOLATION
uv = iuv + fuv*fuv*fuv*(fuv*(fuv*6.0-15.0)+10.0);
#endif
uv = (uv - 0.5)/textureResolution;
return uv;
}
float calculateSSAO(
vec3 viewPos, vec3 normal, float noise
){
int samples = 50;
float occlusion = 0.0;
float sss = 0.0;
vec2 jitterOffsets = TAA_Offset*texelSize * 0.5 * RENDER_SCALE - texelSize*0.5;
// scale the offset radius down as distance increases.
float linearViewDistance = length(viewPos);
float distanceScale = mix(40.0, 10.0, pow(clamp(1.0 - linearViewDistance/50.0,0.0,1.0),2.0));
float depthCancelation = (linearViewDistance*linearViewDistance) / distanceScale ;
int n = 0;
for (int i = 0; i < samples; i++) {
vec2 offsets = CleanSample(i, samples - 1, noise) / distanceScale;
ivec2 offsetUV = ivec2(gl_FragCoord.xy + offsets*vec2(viewWidth, viewHeight*aspectRatio)*RENDER_SCALE);
if (offsetUV.x >= 0 && offsetUV.y >= 0 && offsetUV.x < viewWidth*RENDER_SCALE.x && offsetUV.y < viewHeight*RENDER_SCALE.y ) {
float sampleDepth = texelFetch2D(depthtex1, offsetUV, 0).x;
vec2 scaledUV = (offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE);
vec3 offsetViewPos = toScreenSpace(vec3(scaledUV, sampleDepth));
vec3 viewPosDiff = offsetViewPos - viewPos;
vec3 viewPosDiff_world = mat3(gbufferModelViewInverse) * viewPosDiff;
float viewPosDiffSquared = dot(viewPosDiff, viewPosDiff);
float threshHold = clamp(1.0 - viewPosDiffSquared/depthCancelation, 0.0,1.0);
if (viewPosDiffSquared > 1e-5){
n += 1;
occlusion += max(0.0, dot(normalize(viewPosDiff), normal) - 0.5) * threshHold;
// vec3 dir = (-normalize(viewPosDiff_world) * threshHold + 0.5) * (1.0-occlusion/n);
vec3 dir = -(normalize(viewPosDiff_world) + occlusion/n) * threshHold;
sss += dir.y;
}
}
}
float finalAO = max(1.0 - occlusion / n, 0.0);
float finalSSS = sss/n;
finalAO = pow(finalAO,10);
return finalAO;
}
void main() {
vec3 DEBUG = vec3(1.0);
@ -1054,7 +701,6 @@ void main() {
float z0 = texelFetch2D(depthtex0, ivec2(gl_FragCoord.xy), 0).x;
float z = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy), 0).x;
float swappedDepth = z;
bool isDHrange = z >= 1.0;
@ -1083,9 +729,6 @@ void main() {
float DH_depth1 = 0.0;
#endif
////// --------------- UNPACK OPAQUE GBUFFERS --------------- //////
vec4 data = texelFetch2D(colortex1, ivec2(gl_FragCoord.xy), 0);
@ -1104,14 +747,11 @@ void main() {
lightmap.y = 1.0;
#endif
// lightmap.y = 0.0;
// if(isDHrange) lightmap.y = pow(lightmap.y,25);
// if(isEyeInWater == 1) lightmap.y = max(lightmap.y, 0.75);
////// --------------- UNPACK MISC --------------- //////
vec4 SpecularTex = texelFetch2D(colortex8, ivec2(gl_FragCoord.xy), 0);
float LabSSS = clamp((-65.0 + SpecularTex.z * 255.0) / 190.0 ,0.0,1.0);
// LabSSS = 1;
vec4 normalAndAO = texture2D(colortex15,texcoord);
vec3 FlatNormals = normalize(normalAndAO.rgb * 2.0 - 1.0);
@ -1150,9 +790,9 @@ void main() {
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 handwater = abs(translucentMasks-0.3) < 0.01 ;
// bool blocklights = abs(opaqueMasks-0.8) <0.01;
if(hand){
convertHandDepth(z);
convertHandDepth(z0);
@ -1165,7 +805,7 @@ void main() {
#endif
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos;
vec3 feetPlayerPos_normalized = normVec(feetPlayerPos);
vec3 feetPlayerPos_normalized = normalize(feetPlayerPos);
#ifdef POM
#ifdef Horrible_slope_normals
@ -1175,12 +815,9 @@ void main() {
#endif
////// --------------- COLORS --------------- //////
// float dirtAmount = Dirt_Amount;
// float dirtAmount = Dirt_Amount + 0.01;
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
vec3 totEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);//dirtEpsilon * dirtAmount + waterEpsilon;
vec3 totEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
vec3 scatterCoef = Dirt_Amount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14;
vec3 Absorbtion = vec3(1.0);
@ -1204,7 +841,7 @@ void main() {
float lightLeakFix = clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0);
#ifdef OVERWORLD_SHADER
DirectLightColor = lightCol.rgb / 2400.0;//mix(900.0, 2400.0, lightmap.y);
DirectLightColor = lightCol.rgb / 2400.0;
AmbientLightColor = averageSkyCol_Clouds / 900.0;
shadowColor = DirectLightColor;
@ -1223,12 +860,6 @@ void main() {
MinimumLightColor = MinimumLightColor + 0.7 * MinimumLightColor * dot(slopednormal, feetPlayerPos_normalized);
////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////// START DRAW ////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////// UNDER WATER SHADING ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
@ -1247,20 +878,14 @@ void main() {
float Vdiff = distance(feetPlayerPos, playerPos0);
float estimatedDepth = Vdiff * abs(feetPlayerPos_normalized.y);// assuming water plane
// float viewerWaterDepth = Vdiff;// * (1.0 - clamp(exp(-Vdiff),0.0,1.0));
// force the absorbance to start way closer to the water surface in low light areas, so the water is visible in caves and such.
#if MINIMUM_WATER_ABSORBANCE > -1
float minimumAbsorbance = MINIMUM_WATER_ABSORBANCE*0.1;
#else
float minimumAbsorbance = (1.0 - lightLeakFix);
#endif
// viewerWaterDepth += max(estimatedDepth - 1.0, minimumAbsorbance);
Absorbtion = exp(-totEpsilon * max(Vdiff, minimumAbsorbance));
// Absorbtion = exp( -2.0 * totEpsilon * viewerWaterDepth);
// brighten up the fully absorbed parts of water when night vision activates.
// if( nightVision > 0.0 ) Absorbtion += exp( -50.0 * totEpsilon) * 50.0 * 7.0 * nightVision;
@ -1367,8 +992,7 @@ void main() {
float ShadowAlpha = 0.0; // this is for subsurface scattering later.
vec3 tintedSunlight = DirectLightColor; // this is for subsurface scattering later.
shadowColor = ComputeShadowMap_COLOR(projectedShadowPosition, distortFactor, noise_2, filteredShadow.x, flatNormNdotL, shadowMapFalloff, DirectLightColor, ShadowAlpha, tintedSunlight, LabSSS > 0.0);
shadowColor = ComputeShadowMap_COLOR(projectedShadowPosition, distortFactor, noise_2, filteredShadow.x, flatNormNdotL, shadowMapFalloff, DirectLightColor, ShadowAlpha, tintedSunlight, LabSSS > 0.0,Shadows);
// transition to fallback lightmap shadow mask.
shadowColor *= mix(isWater ? lightLeakFix : LM_shadowMapFallback, 1.0, shadowMapFalloff2);
@ -1393,12 +1017,15 @@ void main() {
#ifdef SCREENSPACE_CONTACT_SHADOWS
vec2 SS_directLight = SSRT_Shadows(toScreenSpace_DH(texcoord/RENDER_SCALE, z, DH_depth1), isDHrange, normalize(WsunVec*mat3(gbufferModelViewInverse)), interleaved_gradientNoise_temporal(), sunSSS_density > 0.0 && shadowMapFalloff2 < 1.0, hand);
// Shadows = SS_directLight.r;
// combine shadowmap with a minumum shadow determined by the screenspace shadows.
shadowColor *= 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);
// shadowColor = vec3(SS_directLight.r*0 + 1);
// ShadowBlockerDepth = SS_directLight.g;
#endif
#ifdef TRANSLUCENT_COLORED_SHADOWS
SSSColor = tintedSunlight;
@ -1408,7 +1035,7 @@ void main() {
SSSColor *= SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), SSS_shadow, shadowMapFalloff2);
if(isEyeInWater != 1)SSSColor *= lightLeakFix;
if(isEyeInWater != 1) SSSColor *= lightLeakFix;
#ifndef SCREENSPACE_CONTACT_SHADOWS
SSSColor = mix(vec3(0.0), SSSColor, shadowMapFalloff2);
@ -1447,36 +1074,17 @@ void main() {
float skylight = 1.0;
#if indirect_effect == 0 || indirect_effect == 1 || indirect_effect == 2
// float SkylightDir = (slopednormal / dot(abs(slopednormal),vec3(1.0))).y *1.5;
// if(isGrass) SkylightDir = 1.5;
// skylight = max(pow((FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.2 + (1-lightmap.y)*0.8);
// #if indirect_effect == 1
// skylight = min(skylight, mix(0.95, 2.5, pow(1-pow(1-SSAO_SSS.x, 0.5),2.0) ));
// #endif
// vec3 lastLightPos = feetPlayerPos + (cameraPosition - lastKnownLightlevel);// - vec3(0,0,0);
// lastLightPos.y = min(lastLightPos.y,0.0);
vec3 indirectNormal = slopednormal / dot(abs(slopednormal),vec3(1.0));
//(slopednormal / dot(abs(slopednormal),vec3(1.0))).y;
float SkylightDir = indirectNormal.y;
if(isGrass) SkylightDir = 1.0;
SkylightDir = clamp(SkylightDir*0.7+0.3, 0.0, pow(1-pow(1-SSAO_SSS.x, 0.5),4.0) * 0.7 + 0.3);
// SkylightDir = SkylightDir*0.7+0.3;
// float indirectPointLight = clamp(dot(slopednormal, -normalize(lastLightPos)),0,1);
// float lightAttenuation = 1.0-clamp(1.0-length(lastLightPos)/16,0,1);
// SkylightDir = mix(mix(SkylightDir, indirectPointLight, updateFadeTime), SkylightDir, max(lightAttenuation,min(max(lightmap.y-0.9,0)/0.1,1)));
// skylight = mix(0.2, 2.5, SkylightDir);
skylight = mix(0.2 + 2.3*(1.0-lightmap.y), 2.5, SkylightDir);
// skylight = 2.5;
#endif
#if indirect_effect == 3 || indirect_effect == 4
@ -1575,14 +1183,20 @@ void main() {
///////////////////////////// SKY SSS /////////////////////////////
#if defined Ambient_SSS && defined OVERWORLD_SHADER && indirect_effect == 1
if (!hand){
vec3 ambientColor = AmbientLightColor * ambientsss_brightness * 3.0;//mix(0.2,2.5,lightmap.y*lightmap.y); // x2.5 to match the brightness of upfacing skylight
vec3 ambientColor = AmbientLightColor * ambientsss_brightness * ambient_brightness * 3.0;
Indirect_SSS = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS);
Indirect_SSS *= lightmap.y;
// if(texcoord.x>0.5) oIndirect_SSS *= 0.0;
// apply to ambient light.
Indirect_lighting = max(Indirect_lighting, Indirect_SSS * ambientColor );
float thingy = SkySSS;
thingy = pow(thingy,3.5);
thingy = 1-pow(1-thingy,5);
if(LabSSS > 0.0) Indirect_lighting = Indirect_lighting + Indirect_SSS * ambientColor;
// Indirect_lighting = max(Indirect_lighting, Indirect_SSS * ambientColor);
// Indirect_lighting += Indirect_SSS * ambientColor;
// #ifdef OVERWORLD_SHADER
@ -1658,8 +1272,12 @@ void main() {
Background += stars(orbitstar) * 10.0 * clamp(-unsigned_WsunVec.y*2.0,0.0,1.0);
#if !defined ambientLight_only && (RESOURCEPACK_SKY == 1 || RESOURCEPACK_SKY == 0)
Background += drawSun(dot(lightCol.a * WsunVec, feetPlayerPos_normalized),0, DirectLightColor,vec3(0.0));
Background += drawMoon(feetPlayerPos_normalized, lightCol.a * WsunVec, DirectLightColor, Background);
Background += drawSun(dot(unsigned_WsunVec, feetPlayerPos_normalized), 0, DirectLightColor,vec3(0.0));
vec3 moonLightCol = moonCol / 2400.0;
Background += drawMoon(feetPlayerPos_normalized, WmoonVec, moonLightCol, Background);
// Background += drawSun(dot(WmoonVec, feetPlayerPos_normalized),0, moonLightCol,vec3(0.0));
#endif
Background *= atmosphereGround;
@ -1702,7 +1320,10 @@ void main() {
////// DEBUG VIEW STUFF
#if DEBUG_VIEW == debug_SHADOWMAP
gl_FragData[0].rgb = vec3(0.5) + vec3(1.0) * Shadows * 30.0;
gl_FragData[0].rgb = vec3(1.0) * (Shadows * 0.9 + 0.1);
if(dot(feetPlayerPos_normalized, unsigned_WsunVec) > 0.999 ) gl_FragData[0].rgb = vec3(10,10,0);
if(dot(feetPlayerPos_normalized, -WmoonVec) > 0.999 ) gl_FragData[0].rgb = vec3(1,1,10);
#endif
#if DEBUG_VIEW == debug_NORMALS
if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0);
@ -1717,41 +1338,23 @@ void main() {
gl_FragData[0].rgb = Indirect_lighting;
#endif
#if DEBUG_VIEW == debug_DIRECT
if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0);
gl_FragData[0].rgb = Direct_lighting;
if(swappedDepth < 1.0) gl_FragData[0].rgb = vec3(NdotL);
#endif
#if DEBUG_VIEW == debug_VIEW_POSITION
gl_FragData[0].rgb = viewPos * 0.001;
#endif
#if DEBUG_VIEW == debug_FILTERED_STUFF
// if(hideGUI == 1){
// gl_FragData[0].rgb = texture2D(colortex14, texcoord).xyz;
// gl_FragData[0].rgb = vec3(1) * pow(1-texture2D(colortex14, texcoord).y,1);
// gl_FragData[0].rgb = vec3(1) * texture2D(colortex14, texcoord).x;
float value = SSAO_SSS.y;
if(hideGUI == 0){
value = pow(value,5);
value = pow(value,3.5);
value = 1-pow(1-value,5);
// value = calculateSSAO(viewPos,worldToView(testNorm),R2_dither());
if(hideGUI == 1) value = pow(SSAO_SSS.x,6);
gl_FragData[0].rgb = vec3(value);
if(swappedDepth >= 1.0) gl_FragData[0].rgb = vec3(1.0);
// }
// if(hideGUI == 0) gl_FragData[0].rgb = vec3(1) * exp(-10*filteredShadow.y);//exp(-7*(1-clamp(1.0 - filteredShadow.x,0.0,1.0)));
}
#endif
// gl_FragData[0].rgb = albedo*30;
// gl_FragData[0].rgb = vec3(1) * Shadows;
// if(swappedDepth >= 1.0) gl_FragData[0].rgb = vec3(0.1);
// gl_FragData[0].rgb = vec3(1) * ld(texture2D(depthtex1, texcoord).r);
// if(texcoord.x > 0.5 )
// gl_FragData[0].rgb = vec3(1) * filteredShadow.y;
// if(swappedDepth >= 1.0) gl_FragData[0].rgb += vec3(0.5);
/* RENDERTARGETS:3 */
}

View File

@ -12,9 +12,11 @@
flat varying vec3 WsunVec;
flat varying vec3 WmoonVec;
flat varying vec3 unsigned_WsunVec;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
flat varying vec3 moonCol;
flat varying float exposure;
@ -27,6 +29,8 @@ uniform float near;
uniform mat4 gbufferModelViewInverse;
uniform vec3 sunPosition;
uniform vec3 moonPosition;
uniform float rainStrength;
uniform float sunElevation;
uniform int frameCounter;
@ -52,10 +56,20 @@ void main() {
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
moonCol = texelFetch2D(colortex4,ivec2(9,37),0).rgb;
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
unsigned_WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
WsunVec = lightCol.a*unsigned_WsunVec;
vec3 moonVec = normalize(mat3(gbufferModelViewInverse) * moonPosition);
WmoonVec = moonVec;
if(dot(-moonVec, unsigned_WsunVec) < 0.9999) WmoonVec = -moonVec;
WsunVec = mix(WmoonVec, unsigned_WsunVec, clamp(lightCol.a,0,1));
exposure = texelFetch2D(colortex4,ivec2(10,37),0).r;

View File

@ -556,7 +556,7 @@ void main() {
float atmosphereAlpha = 1.0;
vec3 sceneColor = texelFetch2D(colortex3,ivec2(tc/texelSize),0).rgb * VolumetricClouds.a + VolumetricClouds.rgb;
vec4 VolumetricFog = GetVolumetricFog(viewPos0, BN, directLightColor, indirectLightColor, indirectLightColor_dynamic, atmosphereAlpha, VolumetricClouds.rgb);
vec4 VolumetricFog = GetVolumetricFog(viewPos0, WsunVec, BN, directLightColor, indirectLightColor, indirectLightColor_dynamic, atmosphereAlpha, VolumetricClouds.rgb);
#endif

View File

@ -27,6 +27,7 @@ uniform sampler2D colortex4;
uniform float sunElevation;
uniform vec3 sunPosition;
uniform vec3 moonPosition;
uniform mat4 gbufferModelViewInverse;
uniform int frameCounter;
@ -80,7 +81,13 @@ void main() {
#endif
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition) ;
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
vec3 moonVec = normalize(mat3(gbufferModelViewInverse) * moonPosition);
vec3 WmoonVec = moonVec;
if(dot(-moonVec, WsunVec) < 0.9999) WmoonVec = -moonVec;
WsunVec = mix(WmoonVec, WsunVec, clamp(lightCol.a,0,1));
refractedSunVec = refract(lightCol.a*WsunVec, -vec3(0.0,1.0,0.0), 1.0/1.33333);

View File

@ -249,7 +249,7 @@ void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, float lineardista
Texcoord = mix(Texcoord, UnalteredTexcoord, min(max(0.1-DistortedAlpha,0.0) * 1000.0,1.0)); // remove distortion on non-translucents
}
vec3 doRefractionEffect( inout vec2 texcoord, vec2 normal, float linearDistance){
vec3 doRefractionEffect( inout vec2 texcoord, vec2 normal, float linearDistance, bool isReflectiveEntity){
// make the tangent space normals match the directions of the texcoord UV, this greatly improves the refraction effect.
vec2 UVNormal = vec2(normal.x,-normal.y);
@ -258,6 +258,8 @@ vec3 doRefractionEffect( inout vec2 texcoord, vec2 normal, float linearDistance)
float diffractionMult = 0.035;
float smudgeMult = 1.0;
if(isReflectiveEntity) refractionMult *= 0.5;
// for diffraction, i wanted to know *when* normals were at an angle, not what the
float clampValue = 0.2;
vec2 abberationOffset = (clamp(UVNormal,-clampValue, clampValue)/clampValue) * diffractionMult;
@ -272,11 +274,18 @@ vec3 doRefractionEffect( inout vec2 texcoord, vec2 normal, float linearDistance)
vec2 refractedUV = texcoord - (UVNormal + directionalSmudge)*refractionMult;
#ifdef FAKE_DISPERSION_EFFECT
refractionMult *= min( decodeVec2(texelFetch2D(colortex11, ivec2((texcoord - ((UVNormal + abberationOffset) + directionalSmudge)*refractionMult)/texelSize),0).b).g,
decodeVec2(texelFetch2D(colortex11, ivec2((texcoord + ((UVNormal + abberationOffset) + directionalSmudge)*refractionMult)/texelSize),0).b).g ) > 0.0 ? 1.0 : 0.0;
#else
refractionMult *= decodeVec2(texelFetch2D(colortex11, ivec2(refractedUV/texelSize),0).b).g > 0.0 ? 1.0 : 0.0;
#endif
// a max bound around screen edges and edges of the refracted screen
vec2 vignetteSides = clamp(min((1.0 - refractedUV)/0.05, refractedUV/0.05)+0.5,0.0,1.0);
float vignette = vignetteSides.x*vignetteSides.y;
refractionMult *= decodeVec2(texelFetch2D(colortex11, ivec2(refractedUV/texelSize),0).b).g > 0.0 ? 1.0 : 0.0;
refractionMult *= vignette;
vec3 color = vec3(0.0);
@ -292,11 +301,12 @@ vec3 doRefractionEffect( inout vec2 texcoord, vec2 normal, float linearDistance)
color.b = texelFetch2D(colortex3, ivec2(refractedUV/texelSize),0).b;
#else
refractedUV = clamp(texcoord - UVNormal,0.0,1.0);
refractedUV = clamp(texcoord - (UVNormal + directionalSmudge)*refractionMult,0,1);
color = texture2D(colortex3, refractedUV).rgb;
#endif
// texcoord = texcoord - (UVNormal+directionalSmudge)*refractionMult*vignette;
texcoord = texcoord - (UVNormal + directionalSmudge)*refractionMult;
return color;
}
@ -526,7 +536,7 @@ void main() {
#ifdef FAKE_REFRACTION_EFFECT
// ApplyDistortion(refractedCoord, tangentNormals, linearDistance, isEntity);
// vec3 color = texture2D(colortex3, refractedCoord).rgb;
vec3 color = doRefractionEffect(refractedCoord, tangentNormals.xy, linearDistance);
vec3 color = doRefractionEffect(refractedCoord, tangentNormals.xy, linearDistance, isReflectiveEntity);
#else
// vec3 color = texture2D(colortex3, refractedCoord).rgb;
vec3 color = texelFetch2D(colortex3, ivec2(refractedCoord/texelSize),0).rgb;
@ -534,7 +544,7 @@ void main() {
vec4 TranslucentShader = texture2D(colortex2, texcoord);
// color = vec3(texcoord-0.5,0.0) * mat3(gbufferModelViewInverse);
// apply block breaking effect.
// if(albedo.a > 0.01 && !isWater && TranslucentShader.a <= 0.0 && !isEntity) color = mix(color*6.0, color, luma(albedo.rgb)) * albedo.rgb;
if(albedo.a > 0.01 && !isWater && TranslucentShader.a <= 0.0 && !isEntity) color = mix(color*6.0, color, luma(albedo.rgb)) * albedo.rgb;
////// --------------- BLEND TRANSLUCENT GBUFFERS
//////////// and do border fog on opaque and translucents
@ -563,17 +573,14 @@ void main() {
float fog = 0.0;
#endif
if (TranslucentShader.a > 0.0){
#ifdef Glass_Tint
// if(!isWater) color *= mix(normalize(albedo.rgb+1e-7), vec3(1.0), max(fog, min(max(0.1-albedo.a,0.0) * 10.0,1.0))) ;
if(!isWater) color *= mix(normalize(albedo.rgb+1e-7), vec3(1.0), max(fog, min(max(0.1-albedo.a,0.0) * 10.0,1.0))) ;
#endif
// #ifdef BorderFog
// TranslucentShader = mix(TranslucentShader, vec4(0.0), fog);
// #endif
#ifdef BorderFog
TranslucentShader = mix(TranslucentShader, vec4(0.0), fog);
#endif
color *= (1.0-TranslucentShader.a);
color += TranslucentShader.rgb*10.0 ;

View File

@ -57,9 +57,6 @@ uniform sampler2D colortex1;
uniform sampler2D colortex3;
uniform sampler2D colortex5;
uniform sampler2D colortex6;
uniform sampler2D colortex10;
uniform sampler2D colortex12;
uniform sampler2D colortex14;
uniform sampler2D depthtex0;
uniform sampler2D depthtex1;
@ -70,6 +67,7 @@ uniform float viewWidth;
uniform vec3 previousCameraPosition;
uniform mat4 gbufferPreviousModelView;
uniform mat4 gbufferPreviousModelViewInverse;
uniform int hideGUI;
@ -262,7 +260,7 @@ vec3 FastCatmulRom(sampler2D colorTex, vec2 texcoord, vec4 rtMetrics, float shar
}
vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth, bool hand)
vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth)
{
vec2 du = vec2(texelSize.x*2., 0.0);
vec2 dv = vec2(0.0, texelSize.y*2.);
@ -273,14 +271,6 @@ vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth, bool hand)
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;
@ -294,7 +284,7 @@ vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth, bool hand)
return dmin;
}
vec3 closestToCamera5taps_DH(vec2 texcoord, sampler2D depth, sampler2D dhDepth, bool depthCheck, bool hand)
vec3 closestToCamera5taps_DH(vec2 texcoord, sampler2D depth, sampler2D dhDepth, bool depthCheck)
{
vec2 du = vec2(texelSize.x*2., 0.0);
vec2 dv = vec2(0.0, texelSize.y*2.);
@ -311,14 +301,6 @@ vec3 closestToCamera5taps_DH(vec2 texcoord, sampler2D depth, sampler2D dhDepth,
dbl += vec3(-texelSize.x, texelSize.y, depthCheck ? texture2D(dhDepth, texcoord + dv - du).x : texture2D(depth, texcoord + dv - du).x);
dbr += vec3( texelSize.x, texelSize.y, depthCheck ? texture2D(dhDepth, texcoord + dv + du).x : 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;
@ -332,24 +314,6 @@ vec3 closestToCamera5taps_DH(vec2 texcoord, sampler2D depth, sampler2D dhDepth,
return dmin;
}
vec3 RGB2YCoCg(vec3 RGB)
{
vec3 o;
o.x = 0.25*RGB.r + 0.5*RGB.g + 0.25*RGB.b;
o.y = 0.5*RGB.r - 0.5*RGB.b;
o.z = -0.25*RGB.r + 0.5*RGB.g - 0.25*RGB.b;
return o;
}
vec3 YCoCg2RGB(vec3 YCoCg)
{
vec3 o;
o.r = YCoCg.x + YCoCg.y - YCoCg.z;
o.g = YCoCg.x + YCoCg.z;
o.b = YCoCg.x - YCoCg.y - YCoCg.z;
return o;
}
vec4 computeTAA(vec2 texcoord, bool hand){
vec2 jitter = offsets[framemod8]*texelSize*0.5;
@ -359,15 +323,16 @@ vec4 computeTAA(vec2 texcoord, bool hand){
//use velocity from the nearest texel from camera in a 3x3 box in order to improve edge quality in motion
#ifdef DISTANT_HORIZONS
bool depthCheck = texture2D(depthtex0,adjTC).x >= 1.0;
vec3 closestToCamera = closestToCamera5taps_DH(adjTC, depthtex0, dhDepthTex, depthCheck, hand);
vec3 closestToCamera = closestToCamera5taps_DH(adjTC, depthtex0, dhDepthTex, depthCheck);
vec3 viewPos = toScreenSpace_DH_special(closestToCamera, depthCheck);
#else
vec3 closestToCamera = closestToCamera5taps(adjTC, depthtex0, hand);
vec3 closestToCamera = closestToCamera5taps(adjTC, depthtex0);
vec3 viewPos = toScreenSpace(closestToCamera);
#endif
vec3 playerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz + (cameraPosition - previousCameraPosition);
vec3 previousPosition = mat3(gbufferPreviousModelView) * playerPos + gbufferPreviousModelView[3].xyz;
#ifdef DISTANT_HORIZONS
previousPosition = toClipSpace3Prev_DH(previousPosition, depthCheck);
#else
@ -375,7 +340,9 @@ vec4 computeTAA(vec2 texcoord, bool hand){
#endif
vec2 velocity = previousPosition.xy - closestToCamera.xy;
previousPosition.xy = texcoord + velocity;
previousPosition.xy = texcoord + (hand ? vec2(0.0) : velocity);
// sample current frame, and make sure it is de-jittered
// vec3 currentFrame = smoothfilter(colortex3, adjTC + jitter).rgb;
vec3 currentFrame = texelFetch2D(colortex3, ivec2((adjTC + jitter)/texelSize), 0).rgb;
@ -416,13 +383,12 @@ vec4 computeTAA(vec2 texcoord, bool hand){
vec3 clampedframeHistory = clamp(frameHistory, colMin, colMax);
float blendingFactor = BLEND_FACTOR;
if(hand) blendingFactor = clamp(length(velocity/texelSize),blendingFactor,1.0);
////// Increases blending factor when far from AABB, reduces ghosting
blendingFactor = clamp(blendingFactor + luma(abs(clampedframeHistory - frameHistory)/clampedframeHistory),0.0,1.0);
// if(luma(abs(clampedframeHistory - frameHistory)) > 0.01) blendingFactor = 1.0;
////// Blend current pixel with clamped history, apply fast tonemap beforehand to reduce flickering
vec3 finalResult = invTonemap(mix(tonemap(clampedframeHistory), tonemap(currentFrame), blendingFactor));
@ -451,14 +417,11 @@ void main() {
vec2 taauTC = clamp(texcoord*RENDER_SCALE, vec2(0.0), RENDER_SCALE - texelSize*2.0);
float dataUnpacked = decodeVec2(texelFetch2D(colortex1,ivec2(gl_FragCoord.xy*RENDER_SCALE),0).w).y;
bool hand = abs(dataUnpacked-0.75) < 0.01 && texture2D(depthtex1,taauTC).x < 1.0;
// vec4 color = TAA_hq(hand);
vec4 color = computeTAA(smoothfilterUV(texcoord), hand);
// gl_FragData[0] = clamp(color, 0.0, 65000.0);
#ifdef SCREENSHOT_MODE
gl_FragData[0] = clamp(color, 0.0, 65000.0);
#else

View File

@ -38,6 +38,7 @@ uniform mat4 gbufferPreviousProjection;
uniform mat4 gbufferModelViewInverse;
uniform mat4 gbufferModelView;
uniform mat4 shadowModelView;
uniform mat4 shadowModelViewI;
uniform mat4 shadowProjection;
uniform float sunElevation;
uniform vec3 sunPosition;
@ -314,7 +315,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
vec4 volumetricClouds = GetVolumetricClouds(viewPos, vec2(noise, 1.0-noise), WsunVec, suncol*2.5, skyGroundCol/30.0);
float atmosphereAlpha = 1.0;
vec4 volumetricFog = GetVolumetricFog(viewPos, vec2(noise, 1.0-noise), suncol*2.5, skyGroundCol/30.0, averageSkyCol_Clouds*5.0, atmosphereAlpha, volumetricClouds.rgb);
vec4 volumetricFog = GetVolumetricFog(viewPos, WsunVec, vec2(noise, 1.0-noise), suncol*2.5, skyGroundCol/30.0, averageSkyCol_Clouds*5.0, atmosphereAlpha, volumetricClouds.rgb);
sky = sky * volumetricClouds.a + volumetricClouds.rgb / 5.0;
sky = sky * volumetricFog.a + volumetricFog.rgb / 5.0;

View File

@ -1,6 +1,7 @@
#include "/lib/settings.glsl"
uniform sampler2D colortex4;
uniform sampler2D colortex1;
uniform sampler2D colortex12;
uniform vec2 texelSize;
@ -30,6 +31,17 @@ float DH_invLinZ (float lindepth){
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
return (near * far) / (depth * (near - far) + far);
}
void convertHandDepth(inout float depth) {
float ndcDepth = depth * 2.0 - 1.0;
ndcDepth /= MC_HAND_DEPTH;
depth = ndcDepth * 0.5 + 0.5;
}
vec2 decodeVec2(float a){
const vec2 constant1 = 65535. / vec2( 256., 65536.);
const float constant2 = 256. / 255.;
return fract( a * constant1 ) * constant2 ;
}
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@ -39,9 +51,13 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
void main() {
/* RENDERTARGETS:4,12 */
vec3 oldTex = texelFetch2D(colortex4, ivec2(gl_FragCoord.xy), 0).xyz;
float newTex = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x;
float dataUnpacked = decodeVec2(texelFetch2D(colortex1,ivec2(gl_FragCoord.xy*4),0).w).y;
bool hand = abs(dataUnpacked-0.75) < 0.01;
if(hand) convertHandDepth(newTex);
#ifdef DISTANT_HORIZONS
float QuarterResDepth = texelFetch2D(dhDepthTex, ivec2(gl_FragCoord.xy*4), 0).x;
if(newTex >= 1.0) newTex = sqrt(QuarterResDepth);

View File

@ -449,7 +449,7 @@ void main() {
vec4 VolumetricClouds = GetVolumetricClouds(viewPos1, vec2(noise_1, noise_2), WsunVec, directLightColor, indirectLightColor);
float atmosphereAlpha = 1.0;
vec4 VolumetricFog = GetVolumetricFog(viewPos1, vec2(noise_1, noise_2), directLightColor, indirectLightColor, indirectLightColor_dynamic, atmosphereAlpha, VolumetricClouds.rgb);
vec4 VolumetricFog = GetVolumetricFog(viewPos1, WsunVec, vec2(noise_1, noise_2), directLightColor, indirectLightColor, indirectLightColor_dynamic, atmosphereAlpha, VolumetricClouds.rgb);
finalVolumetrics.rgb += VolumetricClouds.rgb;
#endif

View File

@ -23,6 +23,7 @@ flat varying float exposure;
uniform float sunElevation;
uniform vec2 texelSize;
uniform vec3 sunPosition;
uniform vec3 moonPosition;
uniform mat4 gbufferModelViewInverse;
uniform int frameCounter;
@ -80,8 +81,13 @@ void main() {
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
// WsunVec = normalize(LightDir);
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
vec3 moonVec = normalize(mat3(gbufferModelViewInverse) * moonPosition);
vec3 WmoonVec = moonVec;
if(dot(-moonVec, WsunVec) < 0.9999) WmoonVec = -moonVec;
WsunVec = mix(WmoonVec, WsunVec, clamp(lightCol.a,0,1));
refractedSunVec = refract(WsunVec, -vec3(0.0,1.0,0.0), 1.0/1.33333);

View File

@ -33,15 +33,9 @@ vec3 doBlockLightLighting(
float lightmapLight = 1.0-sqrt(1.0-lightmap);
lightmapLight *= lightmapLight;
float lightmapCurve = mix(lightmapLight, 2.0, lightmapBrightspot);
float lightmapCurve = mix(lightmapLight, 2.5, lightmapBrightspot);
vec3 blockLight = lightmapCurve * lightColor;
// lightmapCurve = lightmap*lightmap;
// float lightmapCurve = (exp(-15.0 * (1.0-lightmap))*10.0 + lightmap*pow(1.0-pow(1.0-lightmap,2.0),2.0))*0.5;
// float lightmapCurve = (pow(min(max(lightmap-0.6, 0.0) * 2.5,1.0),4.0) * 10.0 + lightmap*pow(1.0-pow(1.0-lightmap,2.0),2.0))*0.5;
// float lightmapCurve = pow(1.0-pow(1.0-lightmap,2.0),2.0);
vec3 blockLight = lightColor * lightmapCurve;
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
vec4 lpvSample = SampleLpvLinear(lpvPos);

View File

@ -69,6 +69,7 @@ float phaseCloudFog(float x, float g){
uniform ivec2 eyeBrightness;
vec4 GetVolumetricFog(
in vec3 viewPosition,
in vec3 sunVector,
in vec2 dither,
in vec3 LightColor,
in vec3 AmbientColor,
@ -125,8 +126,7 @@ vec4 GetVolumetricFog(
// float atmosphereAbsorbance = 1.0;
vec3 atmosphereAbsorbance = vec3(1.0);
vec3 WsunVec = mat3(gbufferModelViewInverse) * sunVec;
float SdotV = dot(sunVec, normalize(viewPosition))*lightCol.a;
float SdotV = dot(mat3(gbufferModelView) * sunVector, normalize(viewPosition));
///// ----- fog lighting
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
@ -154,23 +154,6 @@ vec4 GetVolumetricFog(
float inBiome = BiomeVLFogColors(biomeDirect, biomeIndirect);
#endif
#ifdef RAYMARCH_CLOUDS_WITH_FOG
vec3 SkyLightColor = AmbientColor;
vec3 LightSourceColor = LightColor;
#ifdef ambientLight_only
LightSourceColor = vec3(0.0);
#endif
vec3 dV_Sun = WsunVec;
float mieDay = phaseg(SdotV, 0.85) + phaseg(SdotV, 0.75);
float mieDayMulti = (phaseg(SdotV, 0.35) + phaseg(-SdotV, 0.35) * 0.5);
vec3 directScattering = LightSourceColor * mieDay * 3.14;
vec3 directMultiScattering = LightSourceColor * mieDayMulti * 3.14 * 2.0;
#endif
#if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT
float TorchBrightness_autoAdjust = mix(1.0, 30.0, clamp(exp(-10.0*exposure),0.0,1.0)) / 5.0;
#endif
@ -219,7 +202,7 @@ vec4 GetVolumetricFog(
#endif
#ifdef VL_CLOUDS_SHADOWS
sh *= GetCloudShadow(progressW, WsunVec*lightCol.a);
sh *= GetCloudShadow(progressW, sunVector);
#endif
#ifdef PER_BIOME_ENVIRONMENT
@ -285,68 +268,6 @@ vec4 GetVolumetricFog(
#if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT
color += LPV_FOG_ILLUMINATION(progressW-cameraPosition, dd, dL) * totalAbsorbance;
#endif
//------------------------------------
//------ STUPID RENDER CLOUDS AS FOG EFFECT
//------------------------------------
#ifdef RAYMARCH_CLOUDS_WITH_FOG
float otherlayer = max(progressW.y - (CloudLayer0_height+99.5), 0.0) > 0.0 ? 0.0 : 1.0;
float DUAL_MIN_HEIGHT = otherlayer > 0.0 ? CloudLayer0_height : CloudLayer1_height;
float DUAL_MAX_HEIGHT = DUAL_MIN_HEIGHT + 100.0;
float DUAL_DENSITY = otherlayer > 0.0 ? CloudLayer0_density : CloudLayer1_density;
if(clamp(progressW.y - DUAL_MAX_HEIGHT,0.0,1.0) < 1.0 && clamp(progressW.y - DUAL_MIN_HEIGHT,0.0,1.0) > 0.0){
#if defined CloudLayer1 && defined CloudLayer0
float upperLayerOcclusion = otherlayer > 0.0 ? GetCumulusDensity(1, progressW + vec3(0.0,1.0,0.0) * max((LAYER1_minHEIGHT+30) - progressW.y,0.0), 0, LAYER1_minHEIGHT, LAYER1_maxHEIGHT) : 0.0;
float skylightOcclusion = mix(1.0, (1.0 - LAYER1_DENSITY)*0.8 + 0.2, (1.0 - exp2(-5.0 * (upperLayerOcclusion*upperLayerOcclusion))));
#else
float skylightOcclusion = 1.0;
#endif
float DUAL_MIN_HEIGHT_2 = otherlayer > 0.0 ? CloudLayer0_height : CloudLayer1_height;
float DUAL_MAX_HEIGHT_2 = DUAL_MIN_HEIGHT + 100.0;
float cumulus = GetCumulusDensity(-1, progressW, 1, CloudLayer0_height, CloudLayer1_height);
float fadedDensity = DUAL_DENSITY * pow(clamp((progressW.y - DUAL_MIN_HEIGHT_2)/25,0.0,1.0),2.0);
float muE = cumulus*fadedDensity;
float directLight = 0.0;
if(muE > 1e-5){
for (int j=0; j < 3; j++){
// vec3 shadowSamplePos = progressW + dV_Sun * (0.1 + j * (0.1 + dither.y*0.05));
vec3 shadowSamplePos = progressW + dV_Sun * (20.0 + j * (20.0 + dither.y*20.0));
float shadow = GetCumulusDensity(-1, shadowSamplePos, 0, DUAL_MIN_HEIGHT, DUAL_MAX_HEIGHT) * DUAL_DENSITY;
directLight += shadow;
}
/// shadows cast from one layer to another
/// large cumulus -> small cumulus
#if defined CloudLayer1 && defined CloudLayer0
if(otherlayer > 0.0) directLight += LAYER1_DENSITY * 2.0 * GetCumulusDensity(1, progressW + dV_Sun/abs(dV_Sun.y) * max((LAYER1_minHEIGHT+35) - progressW.y,0.0), 0, LAYER1_minHEIGHT, LAYER1_maxHEIGHT);
#endif
// altostratus -> cumulus
#ifdef CloudLayer2
vec3 HighAlt_shadowPos = progressW + dV_Sun/abs(dV_Sun.y) * max(LAYER2_HEIGHT - progressW.y,0.0);
float HighAlt_shadow = GetAltostratusDensity(HighAlt_shadowPos) * CloudLayer2_density * (1.0-abs(WsunVec.y));
directLight += HighAlt_shadow;
#endif
float skyScatter = clamp(((DUAL_MAX_HEIGHT - progressW.y) / 100.0),0.0,1.0); // linear gradient from bottom to top of cloud layer
float distantfade = 1- exp( -10*pow(clamp(1.0 - length(progressW - cameraPosition)/(32*65),0.0,1.0),2));
vec3 cloudlighting = DoCloudLighting(DUAL_DENSITY * cumulus, SkyLightColor*skylightOcclusion, skyScatter, directLight, directScattering*sh_forClouds, directMultiScattering*sh_forClouds, 1);
color += max(cloudlighting - cloudlighting*exp(-muE*dd*dL_alternate),0.0) * totalAbsorbance * lightLevelZero;
totalAbsorbance *= max(exp(-muE*dd*dL_alternate),1.0-lightLevelZero);
}
}
#else
// if (totalAbsorbance < 1e-5) break;
#endif
}
// sceneColor = finalsceneColor;

View File

@ -27,7 +27,7 @@
#define FAKE_REFRACTION_EFFECT
#define FAKE_DISPERSION_EFFECT
#define REFRACTION_SMUDGE
// #define REFRACTION_SMUDGE
#define SSR_STEPS 30 // [10 15 20 25 30 35 40 50 100 200 400]
#define USE_QUARTER_RES_DEPTH
@ -87,8 +87,8 @@
#define TORCH_AMOUNT 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 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 10.0]
#define TORCH_R 1.0 // [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0]
#define TORCH_G 0.75 // [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0]
#define TORCH_B 0.65 // [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0]
#define TORCH_G 0.5 // [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0]
#define TORCH_B 0.25 // [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0]
#define Hand_Held_lights
#define HANDHELD_LIGHT_RANGE 16 // [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200 205 210 215 220 225 230 235 240 245 250 255]

View File

@ -1,14 +1,21 @@
#define ffstep(x,y) clamp((y - x) * 1e35,0.0,1.0)
vec3 drawSun(float cosY, float sunInt,vec3 nsunlight,vec3 inColor){
return inColor+nsunlight/0.0008821203*pow(smoothstep(cos(0.0093084168595*3.2),cos(0.0093084168595*1.8),cosY),3.)*0.62;
vec3 drawSun(float cosY, float sunInt,vec3 nsunlight, vec3 inColor){
// return nsunlight * min(max(cosY-0.9994,0.0)/(1.0-0.9994),1.0) * 100.0;
return (inColor+nsunlight/0.0008821203*pow(smoothstep(cos(0.0093084168595*3.2),cos(0.0093084168595*1.8),cosY),3.)*0.62);
}
vec3 drawMoon(vec3 PlayerPos, vec3 WorldSunVec, vec3 Color, inout vec3 occludeStars){
float Shape = clamp((exp(1 + -1000 * dot(WorldSunVec+PlayerPos,PlayerPos)) - 1.5),0.0,25.0);
float Shape = min(max(dot(WorldSunVec,PlayerPos)-0.9994,0.0)/(1.0-0.9994),1.0);// * clamp(-dot(WorldSunVec,PlayerPos),0,1);
occludeStars *= max(1.0-Shape*5,0.0);
return Shape * Color * 40.0;
/*
float shape2 = pow(exp(Shape * -10),0.15) * 255.0;
vec3 sunNormal = vec3(dot(WorldSunVec+PlayerPos, vec3(shape2,0,0)), dot(PlayerPos+WorldSunVec, vec3(0,shape2,0)), -dot(WorldSunVec, PlayerPos) * 15.0);
@ -28,7 +35,9 @@ vec3 drawMoon(vec3 PlayerPos, vec3 WorldSunVec, vec3 Color, inout vec3 occludeSt
vec3 LightDir = phase[moonPhase];
return Shape * pow(clamp(dot(sunNormal,LightDir)/5,0.0,1.5),5) * Color * 10.0 + clamp(Shape * 4.0 * pow(shape2/200,2.0),0.0,1.0)*0.004;
*/
}
const float pi = 3.141592653589793238462643383279502884197169;

View File

@ -130,6 +130,8 @@ vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, boo
float sp = invLinZ(sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4.0),0).a/65000.0));
// if(hand) convertHandDepth(sp);
float currZ = linZ(spos.z);
float nextZ = linZ(sp);
@ -173,14 +175,15 @@ vec4 screenSpaceReflections(
float LOD = mix(0.0, 6.0*(1.0-exp(-15.0*sqrt(roughness))), 1.0-pow(1.0-reflectionLength,5.0));
// float LOD = mix(0.0, 6.0*pow(roughness,0.1), 1.0-pow(1.0-reflectionLength,5.0));
// float LOD = clamp(pow(reflectionLength, pow(1.0-sqrt(roughness),5.0) * 3.0) * 6.0, 0.0, 6.0*pow(roughness,0.1));
vec3 previousPosition = mat3(gbufferModelViewInverse) * toScreenSpace(raytracePos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition;
vec3 previousPosition = mat3(gbufferModelViewInverse) * toScreenSpace(raytracePos) + gbufferModelViewInverse[3].xyz + (cameraPosition - previousCameraPosition);
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5;
// fix UV pos dragging behind due to hand not having a good previous frame position.
previousPosition.xy = isHand ? raytracePos.xy : previousPosition.xy;
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) {
reflection.a = 1.0;
@ -297,9 +300,10 @@ vec3 specularReflections(
f0 = f0 == 0.0 ? 0.02 : f0;
// if(isHand){
// f0 = 0.9;
// roughness = 0.0;
// }
bool isMetal = f0 > 229.5/255.0;
// get reflected vector
@ -312,10 +316,12 @@ vec3 specularReflections(
// get reflectance and f0/HCM values
// float shlickFresnel = pow(clamp(1.0 + dot(-reflectedVector, samplePoints),0.0,1.0),5.0);
if(isHand) reflectedVector_L = reflect(playerPos, normal);
#else
vec3 reflectedVector_L = reflect(playerPos, normal);
#endif
float shlickFresnel = shlickFresnelRoughness(dot(-normalize(viewDir), vec3(0.0,0.0,1.0)), roughness);
#if defined FORWARD_SPECULAR && defined SNELLS_WINDOW
@ -342,6 +348,7 @@ vec3 specularReflections(
#if defined DEFERRED_BACKGROUND_REFLECTION || defined FORWARD_BACKGROUND_REFLECTION || defined DEFERRED_ENVIORNMENT_REFLECTION || defined FORWARD_ENVIORNMENT_REFLECTION
if(reflectionVisibilty < 1.0){
#if defined DEFERRED_BACKGROUND_REFLECTION || defined FORWARD_BACKGROUND_REFLECTION
#if !defined OVERWORLD_SHADER && !defined FORWARD_SPECULAR
vec3 backgroundReflection = volumetricsFromTex(reflectedVector_L, colortex4, roughness).rgb / 1200.0;
@ -363,7 +370,6 @@ vec3 specularReflections(
// composite all the different reflections together
#if defined DEFERRED_BACKGROUND_REFLECTION || defined FORWARD_BACKGROUND_REFLECTION
specularReflections = mix(DarkenedDiffuseLighting, backgroundReflection, lightmap);
#endif

View File

@ -186,6 +186,7 @@ float getCloudScattering(
}else{
shadowRayPosition = rayPosition + sunVector * (1.0 + i + dither)*20.0;
}
// float fadeddensity = density * pow(clamp((shadowRayPosition.y - minHeight)/(max(maxHeight-minHeight,1.0)*0.25),0.0,1.0),2.0);
shadow += getCloudShape(LayerIndex, LOD, shadowRayPosition, minHeight, maxHeight) * density;
@ -394,10 +395,10 @@ vec4 GetVolumetricClouds(
vec4 NormPlayerPos = normalize(gbufferModelViewInverse * vec4(viewPos, 1.0) + vec4(gbufferModelViewInverse[3].xyz,0.0));
vec3 signedSunVec = sunVector;
vec3 unignedSunVec = sunVector * (float(sunElevation > 1e-5)*2.0-1.0);
vec3 unignedSunVec = sunVector;// * (float(sunElevation > 1e-5)*2.0-1.0);
float SdotV = dot(unignedSunVec, NormPlayerPos.xyz);
NormPlayerPos.y += 0.025*heightRelativeToClouds;
// NormPlayerPos.y += 0.025*heightRelativeToClouds;
int maxSamples = 15;
int minSamples = 10;

View File

@ -54,15 +54,19 @@ float getWaterHeightmap(vec2 posxz) {
return (heightSum / 60.0) * WavesLarge;
}
vec3 getWaveNormal(vec3 posxz, bool isLOD){
vec3 getWaveNormal(vec3 waterPos, vec3 playerpos, 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 range = min(length(posxz - cameraPosition) / (16*14.0), 3.0);
float range = min(length(playerpos) / (16*12.0), 3.0) ;
float deltaPos = range + 0.15;
// float range = 1-max(1.0-length(playerpos) / (16.0*16.0) ,0.0) ;
// range = (1.0-pow(1.0-pow(range,2.0),2.0)) * 3.0;
// float deltaPos = range + 0.15;
// float normalMult = 1.0 * WATER_WAVE_STRENGTH;
// if(isLOD){
@ -75,7 +79,7 @@ vec3 getWaveNormal(vec3 posxz, bool isLOD){
deltaPos = 0.025;
#endif
vec2 coord = posxz.xz;
vec2 coord = waterPos.xy;
float h0 = getWaterHeightmap(coord);
float h1 = getWaterHeightmap(coord + vec2(deltaPos,0.0));

View File

@ -292,12 +292,10 @@ SHADER_VERSION_LABEL <empty> \
### WATER
screen.Water.columns=2
screen.Water = WATER_REFLECTIONS FAKE_REFRACTION_EFFECT \
WATER_SUN_SPECULAR Vanilla_like_water \
SCREENSPACE_REFLECTIONS SSR_STEPS \
WATER_BACKGROUND_SPECULAR Dirt_Amount \
MINIMUM_WATER_ABSORBANCE [Water_fog_color] \
Water_Top_Layer SNELLS_WINDOW \
screen.Water = FAKE_REFRACTION_EFFECT [Water_fog_color] \
FAKE_DISPERSION_EFFECT Dirt_Amount \
REFRACTION_SMUDGE MINIMUM_WATER_ABSORBANCE \
SNELLS_WINDOW Water_Top_Layer \
WATER_WAVE_STRENGTH WATER_WAVE_SPEED \
screen.Water_fog_color.columns=1