commit 0f859671ea7a7e59b13c68584dbec477e4516f9e Author: Rbanh Date: Sat Jun 22 15:15:55 2024 -0400 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..1b575c6 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Minecraft Shader pack based from BSL Shaders. \ No newline at end of file diff --git a/shaders/block.properties b/shaders/block.properties new file mode 100644 index 0000000..a9a73fc --- /dev/null +++ b/shaders/block.properties @@ -0,0 +1,238 @@ +#BSL Shaders v8 Series by Capt Tatsu +#https://bitslablab.com + +# Block ID Format +# block.A0BCC +# A - Namespace +# B - Category +# C - Subcategory + +# Namespaces +# 1 - Minecraft +# 2 - Mods included in BSLShadersMapping +# 3 - All other mods + +# Categories & Subcategories +# 1XX - Translucent +# 100 - Grass +# 101 - Flat Plants Single +# 102 - Flat Plants Lower +# 103 - Flat Plants Upper +# 104 - Crops +# 105 - Leaves +# 106 - Vines +# 107 - Plants +# 108 - Lilypad +# 109 - Normal Translucents + +# 2XX - Emissive +# 200 - Emissive Normal +# 201 - Emissive Recolored +# 202 - Furnace +# 203 - Lava +# 204 - Fire +# 205 - Beacon +# 206 - Lantern +# 207 - Plants +# 208 - Candle + +# 3XX - Semitransparent +# 300 - Water +# 301 - Glass +# 302 - Translucents +# 303 - Portal +# 304 - Modded Water + +# 4XX - Others +# 400 - Skip Parallax +# 401 - End Portal + +#if MC_VERSION >= 11300 + +#1.13+ Mapping + +block.10100= \ +minecraft:grass minecraft:short_grass minecraft:fern minecraft:seagrass \ +minecraft:crimson_roots minecraft:warped_roots minecraft:nether_sprouts +block.10101= \ +minecraft:poppy minecraft:dandelion minecraft:blue_orchid minecraft:allium minecraft:azure_bluet minecraft:red_tulip minecraft:orange_tulip minecraft:white_tulip minecraft:pink_tulip minecraft:oxeye_daisy minecraft:cornflower minecraft:lily_of_the_valley minecraft:wither_rose minecraft:sweet_berry_bush minecraft:pink_petals \ +minecraft:tube_coral minecraft:brain_coral minecraft:bubble_coral minecraft:fire_coral minecraft:horn_coral minecraft:dead_tube_coral minecraft:dead_brain_coral minecraft:dead_bubble_coral minecraft:dead_fire_coral minecraft:dead_horn_coral minecraft:tube_coral_fan minecraft:brain_coral_fan minecraft:bubble_coral_fan minecraft:fire_coral_fan minecraft:horn_coral_fan minecraft:dead_tube_coral_fan minecraft:dead_brain_coral_fan minecraft:dead_bubble_coral_fan minecraft:dead_fire_coral_fan minecraft:dead_horn_coral_fan +block.10102= \ +minecraft:sunflower:half=lower minecraft:lilac:half=lower minecraft:tall_grass:half=lower minecraft:large_fern:half=lower minecraft:rose_bush:half=lower minecraft:peony:half=lower minecraft:tall_seagrass:half=lower +block.10103= \ +minecraft:sunflower:half=upper minecraft:lilac:half=upper minecraft:tall_grass:half=upper minecraft:large_fern:half=upper minecraft:rose_bush:half=upper minecraft:peony:half=upper minecraft:tall_seagrass:half=upper +block.10104= \ +minecraft:wheat minecraft:carrots minecraft:potatoes minecraft:beetroots minecraft:pumpkin_stem minecraft:attached_pumpkin_stem minecraft:melon_stem minecraft:attached_melon_stem minecraft:torchflower +block.10105= \ +minecraft:oak_leaves minecraft:spruce_leaves minecraft:birch_leaves minecraft:jungle_leaves minecraft:acacia_leaves minecraft:dark_oak_leaves minecraft:azalea_leaves minecraft:flowering_azalea_leaves minecraft:mangrove_leaves minecraft:cherry_leaves +block.10106= \ +minecraft:vine minecraft:weeping_vines_plant minecraft:weeping_vines minecraft:twisting_vines_plant minecraft:twisting_vines +block.10107= \ +minecraft:kelp minecraft:kelp_plant \ +minecraft:azalea minecraft:flowering_azalea minecraft:big_dripleaf minecraft:big_dripleaf_stem minecraft:small_dripleaf minecraft:spore_blossom \ +minecraft:cave_vines_plant:berries=false minecraft:cave_vines:berries=false +block.10108= \ +minecraft:lily_pad +block.10109= \ +minecraft:oak_sapling minecraft:spruce_sapling minecraft:birch_sapling minecraft:jungle_sapling minecraft:acacia_sapling minecraft:dark_oak_sapling minecraft:mangrove_propagule minecraft:cherry_sapling \ +minecraft:dead_bush minecraft:sugar_cane minecraft:red_mushroom minecraft:brown_mushroom minecraft:cobweb minecraft:nether_wart minecraft:crimson_fungus minecraft:warped_fungus \ +minecraft:pitcher_plant minecraft:pitcher_crop + +block.10200= \ +minecraft:redstone_wire:power=1 minecraft:redstone_wire:power=2 minecraft:redstone_wire:power=3 minecraft:redstone_wire:power=4 minecraft:redstone_wire:power=5 minecraft:redstone_wire:power=6 minecraft:redstone_wire:power=7 minecraft:redstone_wire:power=8 minecraft:redstone_wire:power=9 minecraft:redstone_wire:power=10 minecraft:redstone_wire:power=11 minecraft:redstone_wire:power=12 minecraft:redstone_wire:power=13 minecraft:redstone_wire:power=14 minecraft:redstone_wire:power=15 \ +minecraft:repeater:powered=true minecraft:comparator:powered=true \ +minecraft:redstone_torch:lit=true minecraft:redstone_wall_torch:lit=true \ +minecraft:soul_torch minecraft:soul_wall_torch minecraft:soul_campfire:lit=true \ +minecraft:torch minecraft:wall_torch minecraft:end_rod \ +minecraft:jack_o_lantern minecraft:campfire:lit=true \ +minecraft:sea_pickle minecraft:glow_lichen \ +minecraft:small_amethyst_bud minecraft:medium_amethyst_bud minecraft:large_amethyst_bud minecraft:amethyst_cluster \ +minecraft:ochre_froglight minecraft:verdant_froglight minecraft:pearlescent_froglight \ +minecraft:sculk minecraft:sculk_vein minecraft:sculk_sensor minecraft:calibrated_sculk_sensor minecraft:sculk_catalyst minecraft:sculk_shrieker \ +minecraft:respawn_anchor:charges=1 minecraft:respawn_anchor:charges=2 minecraft:respawn_anchor:charges=3 minecraft:respawn_anchor:charges=4 \ +minecraft:copper_bulb:lit=true minecraft:exposed_copper_bulb:lit=true minecraft:weathered_copper_bulb:lit=true minecraft:oxidized_copper_bulb:lit=true minecraft:waxed_copper_bulb:lit=true minecraft:waxed_exposed_copper_bulb:lit=true minecraft:waxed_weathered_copper_bulb:lit=true minecraft:waxed_oxidized_copper_bulb:lit=true +block.10201= \ +minecraft:glowstone minecraft:shroomlight minecraft:redstone_lamp:lit=true minecraft:sea_lantern minecraft:lantern:hanging=false \ +minecraft:magma_block \ +minecraft:soul_lantern:hanging=false +block.10202= \ +minecraft:furnace:lit=true minecraft:blast_furnace:lit=true minecraft:smoker:lit=true +block.10203= \ +minecraft:lava minecraft:flowing_lava +block.10204= \ +minecraft:fire minecraft:soul_fire +block.10205= \ +minecraft:beacon +block.10206= \ +minecraft:lantern:hanging=true minecraft:soul_lantern:hanging=true +block.10207= \ +minecraft:cave_vines_plant:berries=true minecraft:cave_vines:berries=true +block.10208= \ +minecraft:candle:lit=true minecraft:white_candle:lit=true minecraft:orange_candle:lit=true minecraft:magenta_candle:lit=true minecraft:light_blue_candle:lit=true minecraft:yellow_candle:lit=true minecraft:lime_candle:lit=true minecraft:pink_candle:lit=true minecraft:gray_candle:lit=true minecraft:light_gray_candle:lit=true minecraft:cyan_candle:lit=true minecraft:purple_candle:lit=true minecraft:blue_candle:lit=true minecraft:brown_candle:lit=true minecraft:green_candle:lit=true minecraft:red_candle:lit=true minecraft:black_candle:lit=true + +block.10300= \ +minecraft:water minecraft:flowing_water +block.10301= \ +minecraft:glass minecraft:glass_pane \ +minecraft:white_stained_glass minecraft:orange_stained_glass minecraft:magenta_stained_glass minecraft:light_blue_stained_glass minecraft:yellow_stained_glass minecraft:lime_stained_glass minecraft:pink_stained_glass minecraft:gray_stained_glass minecraft:light_gray_stained_glass minecraft:cyan_stained_glass minecraft:purple_stained_glass minecraft:blue_stained_glass minecraft:brown_stained_glass minecraft:green_stained_glass minecraft:red_stained_glass minecraft:black_stained_glass minecraft:white_stained_glass_pane minecraft:orange_stained_glass_pane minecraft:magenta_stained_glass_pane minecraft:light_blue_stained_glass_pane minecraft:yellow_stained_glass_pane minecraft:lime_stained_glass_pane minecraft:pink_stained_glass_pane minecraft:gray_stained_glass_pane minecraft:light_gray_stained_glass_pane minecraft:cyan_stained_glass_pane minecraft:purple_stained_glass_pane minecraft:blue_stained_glass_pane minecraft:brown_stained_glass_pane minecraft:green_stained_glass_pane minecraft:red_stained_glass_pane minecraft:black_stained_glass_pane +block.10302= \ +minecraft:ice minecraft:slime_block minecraft:honey_block +block.10303= \ +minecraft:nether_portal + +block.10400= \ +minecraft:sign minecraft:oak_sign minecraft:spruce_sign minecraft:birch_sign minecraft:jungle_sign minecraft:acacia_sign minecraft:dark_oak_sign minecraft:mangrove_sign minecraft:cherry_sign minecraft:bamboo_sign minecraft:crimson_sign minecraft:warped_sign \ +minecraft:wall_sign minecraft:oak_wall_sign minecraft:spruce_wall_sign minecraft:birch_wall_sign minecraft:jungle_wall_sign minecraft:acacia_wall_sign minecraft:dark_oak_wall_sign minecraft:mangrove_wall_sign minecraft:cherry_wall_sign minecraft:bamboo_wall_sign minecraft:crimson_wall_sign minecraft:warped_wall_sign \ +minecraft:oak_hanging_sign minecraft:spruce_hanging_sign minecraft:birch_hanging_sign minecraft:jungle_hanging_sign minecraft:acacia_hanging_sign minecraft:dark_oak_hanging_sign minecraft:mangrove_hanging_sign minecraft:cherry_hanging_sign minecraft:bamboo_hanging_sign minecraft:crimson_hanging_sign minecraft:warped_hanging_sign +block.10401= \ +minecraft:end_portal minecraft:end_gateway + +#elif MC_VERSION >= 10800 + +#1.8-1.12 Mapping + +block.10100= \ +minecraft:tallgrass +block.10101= \ +minecraft:red_flower minecraft:yellow_flower +block.10102= \ +minecraft:double_plant:half=lower +block.10103= \ +minecraft:double_plant:half=upper +block.10104= \ +minecraft:wheat minecraft:carrots minecraft:potatoes minecraft:beetroots \ +minecraft:pumpkin_stem minecraft:melon_stem +block.10105= \ +minecraft:leaves minecraft:leaves2 +block.10106= \ +minecraft:vine +block.10108= \ +minecraft:waterlily +block.10109= \ +minecraft:sapling \ +minecraft:deadbush minecraft:reeds minecraft:red_mushroom minecraft:brown_mushroom minecraft:cobweb minecraft:nether_wart + +block.10200= \ +minecraft:redstone_wire minecraft:repeater:powered=true minecraft:comparator:powered=true \ +minecraft:lit_redstone_torch minecraft:ender_chest \ +minecraft:torch minecraft:end_rod \ +minecraft:lit_pumpkin +block.10201= \ +minecraft:magma \ +minecraft:glowstone minecraft:lit_redstone_lamp minecraft:sea_lantern +block.10202= \ +minecraft:lit_furnace +block.10203= \ +minecraft:lava minecraft:flowing_lava +block.10204= \ +minecraft:fire +block.10205= \ +minecraft:beacon + +block.10300= \ +minecraft:water minecraft:flowing_water +block.10301= \ +minecraft:stained_glass minecraft:stained_glass_pane minecraft:glass minecraft:glass_pane +block.10302= \ +minecraft:ice minecraft:slime +block.10303= \ +minecraft:nether_portal + +block.10400= \ +minecraft:sign minecraft:wall_sign +block.10401= \ +minecraft:end_portal minecraft:end_gateway + +#else + +#1.7 Mapping + +block.10100= \ +minecraft:tallgrass +block.10101= \ +minecraft:red_flower minecraft:yellow_flower +block.10103= \ +minecraft:double_plant +block.10104= \ +minecraft:wheat minecraft:carrots minecraft:potatoes minecraft:beetroots \ +minecraft:pumpkin_stem minecraft:melon_stem +block.10105= \ +minecraft:leaves minecraft:leaves2 +block.10106= \ +minecraft:vine +block.10108= \ +minecraft:waterlily +block.10109= \ +minecraft:sapling \ +minecraft:deadbush minecraft:reeds minecraft:red_mushroom minecraft:brown_mushroom minecraft:web minecraft:nether_wart + +block.10200= \ +minecraft:redstone_wire minecraft:powered_repeater minecraft:powered_comparator \ +minecraft:redstone_torch minecraft:ender_chest \ +minecraft:torch \ +minecraft:lit_pumpkin +block.10201= \ +minecraft:magma \ +minecraft:glowstone minecraft:lit_redstone_lamp minecraft:sea_lantern +block.10202= \ +minecraft:lit_furnace +block.10203= \ +minecraft:lava minecraft:flowing_lava +block.10204= \ +minecraft:fire +block.10205= \ +minecraft:beacon + +block.10300= \ +minecraft:water minecraft:flowing_water +block.10301= \ +minecraft:stained_glass minecraft:stained_glass_pane minecraft:glass minecraft:glass_pane +block.10302= \ +minecraft:ice minecraft:portal minecraft:slime + +block.10400= \ +minecraft:standing_sign minecraft:wall_sign +block.10401= \ +minecraft:end_portal minecraft:end_gateway + +#endif \ No newline at end of file diff --git a/shaders/entity.properties b/shaders/entity.properties new file mode 100644 index 0000000..788a82a --- /dev/null +++ b/shaders/entity.properties @@ -0,0 +1,13 @@ +#BSL Shaders Entity Mapping + +# 100 - Skip Normal & Parallax +# 101 - Lightning Bolt + +#if MC_VERSION >= 11300 + +#1.13+ Mapping + +entity.10100=minecraft:item_frame minecraft:painting minecraft:glow_item_frame +entity.10101=minecraft:lightning_bolt + +#endif \ No newline at end of file diff --git a/shaders/item.properties b/shaders/item.properties new file mode 100644 index 0000000..e9dc409 --- /dev/null +++ b/shaders/item.properties @@ -0,0 +1,26 @@ +#BSL Shaders Item Mapping + +#89 - Emissive Recolor + +#50 - Emissive + +#358 - Map + +#if MC_VERSION >= 11300 + +#1.13+ Mapping + +item.89= \ +minecraft:glowstone minecraft:beacon minecraft:sea_lantern minecraft:lantern minecraft:soul_lantern + +item.50= \ +minecraft:torch minecraft:end_rod minecraft:redstone_torch minecraft:jack_o_lantern minecraft:shroomlight minecraft:lava_bucket minecraft:glow_lichen minecraft:small_amethyst_bud minecraft:medium_amethyst_bud minecraft:large_amethyst_bud minecraft:amethyst_cluster minecraft:glow_berries minecraft:ochre_froglight minecraft:verdant_froglight minecraft:pearlescent_froglight \ +adorn:stone_torch adorn:wall_stone_torch adorn:white_table_lamp adorn:orange_table_lamp adorn:magenta_table_lamp adorn:light_blue_table_lamp adorn:yellow_table_lamp adorn:lime_table_lamp adorn:pink_table_lamp adorn:gray_table_lamp adorn:light_gray_table_lamp adorn:cyan_table_lamp adorn:purple_table_lamp adorn:blue_table_lamp adorn:brown_table_lamp adorn:green_table_lamp adorn:red_table_lamp adorn:black_table_lamp adorn:candlelit_lantern adorn:white_candlelit_lantern adorn:orange_candlelit_lantern adorn:magenta_candlelit_lantern adorn:light_blue_candlelit_lantern adorn:yellow_candlelit_lantern adorn:lime_candlelit_lantern adorn:pink_candlelit_lantern adorn:gray_candlelit_lantern adorn:light_gray_candlelit_lantern adorn:cyan_candlelit_lantern adorn:purple_candlelit_lantern adorn:blue_candlelit_lantern adorn:brown_candlelit_lantern adorn:green_candlelit_lantern adorn:red_candlelit_lantern adorn:black_candlelit_lantern + +item.213= \ +minecraft:magma_block + +item.358= \ +minecraft:filled_map + +#endif \ No newline at end of file diff --git a/shaders/lang/en_US.lang b/shaders/lang/en_US.lang new file mode 100644 index 0000000..40d513b --- /dev/null +++ b/shaders/lang/en_US.lang @@ -0,0 +1,983 @@ +#shaders/lang/en_us.lang + +#Profiles +profile.MINIMUM=Minimum +profile.LOW=Low +profile.MEDIUM=Medium +profile.HIGH=High +profile.ULTRA=Ultra +profile.comment=Minimum: no shadows, no extra effects. Low : low shadows, no extra effects. Medium : low-medium shadows, no extra effects. High : medium shadows, AO and light shafts. Ultra : high shadows, AO, and light shafts. + +#Screens +screen.LIGHTING=Lighting +screen.SHADOW_CONFIG=More Shadow Config +screen.MCBL=Colored Blocklight Config + +screen.MATERIAL=Material +screen.SPECULAR=Specular & Reflections +screen.NORMALS=Normals & Parallax + +screen.GENERATED_NORMAL_SETTINGS=Generated Normal Settings + +screen.ATMOSPHERICS=Atmospherics +screen.CLOUDS=Clouds +screen.FOG=Fog +screen.FOG_DENSITY=More Fog Density Config +screen.FOG_HEIGHT=Height Fog Config +screen.FOG_VANILLA=Far Vanilla Fog Config +screen.SKY=Sky +screen.SKYBOX=Skybox + +screen.WATER=Water + +screen.CAMERA=Camera + +screen.ANTIALIASING=Anti-aliasing + +screen.COLOR=Color +screen.LIGHT_COLOR=Lighting Color +screen.LIGHT_M=Light (Morning) +screen.AMBIENT_M=Ambient (Morning) +screen.LIGHT_D=Light (Day) +screen.AMBIENT_D=Ambient (Day) +screen.LIGHT_E=Light (Evening) +screen.AMBIENT_E=Ambient (Evening) +screen.LIGHT_N=Light (Night) +screen.AMBIENT_N=Ambient (Night) +screen.MINLIGHT=Minimum Light +screen.BLOCKLIGHT_COLOR=Blocklight Color +screen.SKY_COLOR=Sky Color +screen.WATER_COLOR=Water Color +screen.WEATHER_COLOR=Weather Color +screen.WEATHER_R=Rain (Normal) +screen.WEATHER_C=Snowfall +screen.WEATHER_D=Desert Sandstorm +screen.WEATHER_B=Mesa Sandstorm +screen.WEATHER_S=Swamp Rain +screen.WEATHER_M=Mushroom Island Rain +screen.WEATHER_V=Savanna Cloudy +screen.WEATHER_J=Jungle Rain +screen.AURORA_COLOR=Aurora Color +screen.AURORA_L=Low Section Color +screen.AURORA_H=High Section Color +screen.DIMENSION_COLOR=Dimension Color +screen.NETHER_COLOR=Nether Color +screen.NETHER_N=Nether Wastes +screen.NETHER_V=Soul Sand Valley +screen.NETHER_C=Crimson Forest +screen.NETHER_W=Warped Forest +screen.NETHER_B=Basalt Deltas +screen.END_COLOR=End Color + +screen.CGT=Color Grading & Tonemap +screen.EXPOSURE_CONFIG=More Exposure Config +screen.COLOR_GRADING_CONFIG=Color Grading Config +screen.CG_R=Red Channel +screen.CG_G=Green Channel +screen.CG_B=Blue Channel +screen.CG_T=Tint + +screen.EXTRAS=Extras + +screen.ANIMATION=Animations + +#Settings +option.ABOUT=BSL v8.2.09 +option.ABOUT.comment=by Capt Tatsu. bitslablab.com +value.ABOUT.0=by Capt Tatsu + +#Lighting +option.SHADOW=Realtime Shadows +option.SHADOW.comment=Enables realtime, dynamic shadow mapping. + +option.shadowMapResolution=Shadowmap Quality +option.shadowMapResolution.comment=Adjusts shadowmap size. §e[*]§rHigher resolution gives sharper shadows, but reduces performance. +value.shadowMapResolution.512=Very Low (512) +value.shadowMapResolution.1024=Low (1024) +value.shadowMapResolution.1536=Low Medium (1536) +value.shadowMapResolution.2048=Medium (2048) +value.shadowMapResolution.3072=High (3072) +value.shadowMapResolution.4096=Very High (4096) +value.shadowMapResolution.8192=Ultra High (8192) + +option.shadowDistance=Shadow Distance +option.shadowDistance.comment=Adjusts shadow distance. + +option.SHADOW_COLOR=Colored Shadow +option.SHADOW_COLOR.comment=Enables tinted shadow from translucents. §a[+]§rUsed for colored volumetric light shafts. §c[-]§rSlightly higher performance cost when using shadow filtering. + +option.SHADOW_FILTER=Shadow Filtering +option.SHADOW_FILTER.comment=Enables shadow filtering. + +option.AO=Ambient Occlusion +option.AO.comment=Adds soft shadows around surface contact or intersection. + +option.AO_STRENGTH=AO Strength +option.AO_STRENGTH.comment=Adjusts ambient occlusion strength. + +option.DESATURATION=Desaturation +option.DESATURATION.comment=Reduces saturation while adding some tint in darker areas. + +option.DESATURATION_FACTOR=Desaturation Factor +option.DESATURATION_FACTOR.comment=Adjusts the maximum amount of desaturation applied. +value.DESATURATION_FACTOR.2.0=Very Low +value.DESATURATION_FACTOR.1.5=Low +value.DESATURATION_FACTOR.1.0=Medium +value.DESATURATION_FACTOR.0.5=High +value.DESATURATION_FACTOR.0.0=Very High + +option.DYNAMIC_HANDLIGHT=Dynamic Handlight +option.DYNAMIC_HANDLIGHT.comment=Allows blocklight to be emitted from view when holding certain objects. + +option.MULTICOLORED_BLOCKLIGHT=Multi-Colored Blocklight +option.MULTICOLORED_BLOCKLIGHT.comment=Enables screen space multi-colored blocklight. §e[*]§rOnly works on 1.16.5 and above, non-Mac devices. + +option.WHITE_WORLD=White World +option.WHITE_WORLD.comment=Replaces textures with flat white color. + +#More Shadow Config +option.SHADOW_ENTITY=Entity Shadow +option.SHADOW_ENTITY.comment=Enables shadow on mobs. §e[*]§rDisable this when a huge amount of mobs are loaded. §e[*]§rOnly works on 1.16.5 and above. + +option.SHADOW_BLOCK_ENTITY=Block Entity Shadow +option.SHADOW_BLOCK_ENTITY.comment=Enables shadow on block entities. §e[*]§rDisable this when a huge amount of block entities are loaded. §e[*]§rOnly works on 1.16.5 and above. + +option.SHADOW_VEGETATION=Vegetation Shadow +option.SHADOW_VEGETATION.comment=Enables shadow on grass, crops, and most other plants. + +option.SHADOW_CLOUD=Cloud Shadow +option.SHADOW_CLOUD.comment=Enables shadow casted by clouds. + +option.sunPathRotation=Sun Path Rotation +option.sunPathRotation.comment=Adjusts sun angle. + +option.SHADOW_BIAS=Shadow Bias Mode +option.SHADOW_BIAS.comment=Determines how shadow mapping bias is done. Light direction mode preserves most shadow edges, but shadows look floaty at a distance. Surface normal mode preserves contact point, but shadows look shorter at a distance. +value.SHADOW_BIAS.0=Light Direction +value.SHADOW_BIAS.1=Surface Normal + +option.SHADOW_PIXEL=Pixel Locked Shadows +option.SHADOW_PIXEL.comment=Applies pixelation effect on shadows. +value.SHADOW_PIXEL.0=OFF + +#Colored Blocklight Config +option.MCBL_ANTI_BLEED=Anti Bleed +option.MCBL_ANTI_BLEED.comment=Reduce unwanted blocklight color spread. §c[-]§rMay cause undersampling artifact to be more noticeable. +option.MCBL_LEGACY_COLOR=Legacy Color +option.MCBL_LEGACY_COLOR.comment=Use the old method of calculating blocklight color. + +#Material +option.ADVANCED_MATERIALS=Advanced Materials +option.ADVANCED_MATERIALS.comment=Enables the use of specular and normal mapping which allows for more detail on various things. §e[*]§rThis option requires a resource pack which contains specular and/or normal maps, disable if none is currently used. §e[*]§rOptions which requires advanced materials are indicated by *, changing these options won't affect the visuals or performance while advanced materials is disabled. + +option.MATERIAL_FORMAT=Material Format* +option.MATERIAL_FORMAT.comment=Determines the specular and normal map format used by the resource pack. §e[*]§rTexture artists usually tell which format is used in their resource pack, using the wrong format may give weird results. +value.MATERIAL_FORMAT.0=SEUS/Old PBR +value.MATERIAL_FORMAT.1=labPBR 1.3 +value.MATERIAL_FORMAT.2=Generated + +option.SSS=Subsurface Scattering* +option.SSS.comment=Allows light to penetrate and scatter through blocks. §a[+]§rThis effect benefits from TAA. + +option.BASIC_SSS=Basic Scattering +option.BASIC_SSS.comment=Enables a simplified version of subsurface scattering to certain blocks. + +option.EMISSIVE=Emissive +option.EMISSIVE.comment=Allows certain surfaces to be brighter. +value.EMISSIVE.0=§cOFF +value.EMISSIVE.1=AdvMat Only* +value.EMISSIVE.2=Full + +option.REFRACTION=Refraction +option.REFRACTION.comment=Enables distortion behind normal mapped transparent surfaces. §c[-]§rThe transparent surface itself will be distorted. §c[-]§rSome other features may not work properly with this effect enabled. +value.REFRACTION.0=OFF +value.REFRACTION.1=Water Only +value.REFRACTION.2=Full + +option.ALBEDO_BALANCING=Albedo Balancing +option.ALBEDO_BALANCING.comment=Reduces brightness of very bright colored surfaces. + +option.ALPHA_BLEND=Alpha Blending +option.ALPHA_BLEND.comment=Determines how transparency blending is done. +value.ALPHA_BLEND.0=Gamma +value.ALPHA_BLEND.1=Linear + +option.ENTITY_FLASH=Entity Flash +option.ENTITY_FLASH.comment=Enables damaged entities and nearby creeper to flash. + +#Specular & Reflections +option.REFLECTION=Reflections +option.REFLECTION.comment=Enables reflections on water and translucents. +value.REFLECTION.0=§cOFF +value.REFLECTION.1=Sky & Specular Only +value.REFLECTION.2=Full + +option.REFLECTION_TRANSLUCENT=Translucent Reflections +option.REFLECTION_TRANSLUCENT.comment=Allows reflection to be rendered on translucent surfaces, such as stained glass, ice, slime blocks, and more. + +option.REFLECTION_SPECULAR=Specular Reflection* +option.REFLECTION_SPECULAR.comment=Enables reflection on smooth or metallic surfaces. + +option.REFLECTION_ROUGH=Rough Reflection* +option.REFLECTION_ROUGH.comment=Allows surfaces with lower smoothness to render blurry reflections. §c[-]§rMay contain minor artifacts. + +option.REFLECTION_RAIN=Rain Reflection* +option.REFLECTION_RAIN.comment=Allows surfaces to be wet while raining. §e[*]§rRequires specular reflection. + +option.REFLECTION_RAIN_AMOUNT=Puddle Amount +option.REFLECTION_RAIN_AMOUNT.comment=Adjusts the amount of puddles created while raining. +value.REFLECTION_RAIN_AMOUNT.0.4=Very Low +value.REFLECTION_RAIN_AMOUNT.0.5=Low +value.REFLECTION_RAIN_AMOUNT.0.6=Medium +value.REFLECTION_RAIN_AMOUNT.0.7=High +value.REFLECTION_RAIN_AMOUNT.1.0=Very High + +option.REFLECTION_PREVIOUS=Previous Frame Reflection +option.REFLECTION_PREVIOUS.comment=Allows translucents to be reflected by using previous frame information. §c[-]§rMay cause missing reflection on screenshot (caused by screenshot size setting). §c[-]§rIncompatible with some GPUs. §c[-]§rBugged in 1.7.10. + +option.SPECULAR_HIGHLIGHT_ROUGH=Rough Specular Highlight +option.SPECULAR_HIGHLIGHT_ROUGH.comment=Allows rough surfaces to have weak gloss. + +option.ALBEDO_METAL=Albedo Tinted Hardcoded Metal* +option.ALBEDO_METAL.comment=Applies base texture as tint on hardcoded metallic surfaces. §e[*]§rWorks on labPBR material format only. + +option.REFLECTION_MODE=Reflection Mode +option.REFLECTION_MODE.comment=Adjusts reflection behavior. +value.REFLECTION_MODE.0=Less Duplicates +value.REFLECTION_MODE.1=Balanced +value.REFLECTION_MODE.2=More Gap Filling + +option.REFLECTION_SKY_FALLOFF=Sky Reflection Falloff +option.REFLECTION_SKY_FALLOFF.comment=Adjusts how far sky reflection fades out under low skylight. +value.REFLECTION_SKY_FALLOFF.1=Very Weak +value.REFLECTION_SKY_FALLOFF.2=Weak +value.REFLECTION_SKY_FALLOFF.4=Balanced +value.REFLECTION_SKY_FALLOFF.8=Strong +value.REFLECTION_SKY_FALLOFF.16=Very Strong + +option.REFLECTION_SKYBOX=Reflect Skybox +option.REFLECTION_SKYBOX.comment=Allows resource pack skybox to be included in reflections. §c[-]§rSkybox is only applied to transparent surfaces. + +#Normals & Parallax +option.PARALLAX=Parallax Occlusion Mapping* +option.PARALLAX.comment=Adds displacement on a surface using height map. + +option.PARALLAX_DEPTH=Parallax Depth* +option.PARALLAX_DEPTH.comment=Adjusts parallax deepness. +value.PARALLAX_DEPTH.0.05=5 cm +value.PARALLAX_DEPTH.0.10=10 cm +value.PARALLAX_DEPTH.0.15=15 cm +value.PARALLAX_DEPTH.0.20=20 cm +value.PARALLAX_DEPTH.0.25=25 cm +value.PARALLAX_DEPTH.0.30=30 cm +value.PARALLAX_DEPTH.0.35=35 cm +value.PARALLAX_DEPTH.0.40=40 cm +value.PARALLAX_DEPTH.0.45=45 cm +value.PARALLAX_DEPTH.0.50=50 cm + +option.PARALLAX_QUALITY=Parallax Samples* +option.PARALLAX_QUALITY.comment=Adjusts the quality of parallax occlusion mapping. + +option.PARALLAX_DISTANCE=Parallax Distance* +option.PARALLAX_DISTANCE.comment=Adjusts how far parallax occlusion mapping and self shadows can be rendered. + +option.SELF_SHADOW=Self Shadows* +option.SELF_SHADOW.comment=Allows a surface to cast shadow to itself using heightmap. + +option.SELF_SHADOW_ANGLE=Self Shadows Angle* +option.SELF_SHADOW_ANGLE.comment=Adjusts the self shadowing angle, higher value allows the shadow to travel further. + +option.SELF_SHADOW_QUALITY=Self Shadows Samples* +option.SELF_SHADOW_QUALITY.comment=Adjusts the quality of self shadowing. + +option.SELF_SHADOW_STRENGTH=Self Shadows Strength* +option.SELF_SHADOW_STRENGTH.comment=Adjusts the intensity of self shadowing. + +option.DIRECTIONAL_LIGHTMAP=Directional Lightmap* +option.DIRECTIONAL_LIGHTMAP.comment=Adds normal mapping to vanilla lighting. §c[-]§rLightmap may glitch with this effect enabled. + +option.DIRECTIONAL_LIGHTMAP_STRENGTH=Dir. Lightmap Strength* +option.DIRECTIONAL_LIGHTMAP_STRENGTH.comment=Adjusts the intensity of Directional Lightmap. +value.DIRECTIONAL_LIGHTMAP_STRENGTH.2.0=Very Low +value.DIRECTIONAL_LIGHTMAP_STRENGTH.1.4=Low +value.DIRECTIONAL_LIGHTMAP_STRENGTH.1.0=Medium +value.DIRECTIONAL_LIGHTMAP_STRENGTH.0.7=High +value.DIRECTIONAL_LIGHTMAP_STRENGTH.0.5=Very High + +option.NORMAL_DAMPENING=Normal Dampening* +option.NORMAL_DAMPENING.comment=Reduces normal map strength to prevent reflections being too noisy. +option.GENERATED_NORMALS=Generated Normals +option.GENERATED_NORMALS.comment=Enables procedural-generated normal mapping for blocks. +option.GENERATED_NORMAL_MULT=Generated Normal Intensity +option.GENERATED_NORMAL_MULT.comment=Adjusts the intensity of generated normal mapping. +option.GENERATED_NORMAL_THRESHOLD=Generated Normal Threshold +option.GENERATED_NORMAL_THRESHOLD.comment=Adjusts the threshold of generated normal mapping. +option.GENERATED_NORMAL_CLAMP=Generated Normal Clamp +option.GENERATED_NORMAL_CLAMP.comment=Clamps the generated normal mapping to prevent overshading. +option.GENERATED_NORMAL_RESOLUTION=Generated Normal Resolution +option.GENERATED_NORMAL_RESOLUTION.comment=Adjusts the resolution of generated normal maps. + + +option.NORMAL_PLANTS=Up-facing Plants +option.NORMAL_PLANTS.comment=Adjusts plant shading. §e[*]§rDisable this if non-flat plant model is used or normal map applied on plants. + +#Atmospherics +option.LIGHT_SHAFT=Light Shafts +option.LIGHT_SHAFT.comment=Adds volumetric rays from sun / moon. §a[+]§rThis effect benefits from TAA. §e[*]§rRequires realtime shadows. §e[*]§rPerformance depends on Shadowmap Resolution. + +option.LIGHT_SHAFT_STRENGTH=Light Shaft Strength +option.LIGHT_SHAFT_STRENGTH.comment=Adjusts light shaft strength. + +option.WEATHER_PERBIOME=Per Biome Weather +option.WEATHER_PERBIOME.comment=Use varied weather color for different biomes. §c[-]§rMay not work under unknown conditions. + +option.WEATHER_OPACITY=Weather Opacity +option.WEATHER_OPACITY.comment=Adjusts weather opacity. + +#Sky +option.SKY_DENSITY_D=Day Density +option.SKY_EXPOSURE_D=Day Exposure +option.SKY_DENSITY_N=Night Density +option.SKY_EXPOSURE_N=Night Exposure +option.SKY_DENSITY_W=Weather Density +option.SKY_EXPOSURE_W=Weather Exposure +option.SKY_HORIZON_N=Near Horizon +option.SKY_HORIZON_F=Far Horizon + +option.SKY_DESATURATION=Sky Desaturation +option.SKY_DESATURATION.comment=Reduces saturation while adding some tint to the skybox at night + +option.SKY_GROUND=Sky Ground +option.SKY_GROUND.comment=Darkens the bottom part of the sky. §e[*]§rThis option is affected by fog density. +value.SKY_GROUND.0=§cOFF +value.SKY_GROUND.1=Reflections Only +value.SKY_GROUND.2=Full + +option.UNDERGROUND_SKY=Underground Sky Fix +option.UNDERGROUND_SKY.comment=Hides the sky when the player is in dark area and under sea level (Y: 62). §c[-]§rNot suitable for low superflat worlds. + +option.SHADER_END_SKY=Shader End Sky +option.SHADER_END_SKY.comment=Replaces vanilla/modded end skybox with shader based end skybox. + +option.SKY_DEFERRED=Deferred Sky +option.SKY_DEFERRED.comment=Renders sky after opaque surfaces are drawn instead of at the beginning. §e[*]§rThis affects resource pack sky rendering. + +#Cloud +option.CLOUDS=Clouds +option.CLOUDS.comment=Enables clouds. §a[+]§rSkybox and volumetric clouds benefit from TAA. §e[*]§rVanilla clouds requires vanilla cloud setting set to default or on. +value.CLOUDS.0=§cOFF +value.CLOUDS.1=Skybox +value.CLOUDS.2=Volumetric +value.CLOUDS.3=Vanilla + +option.CLOUD_BASE=Base Shape +option.CLOUD_BASE.comment=Determines which noise type used for the cloud's base shape. +value.CLOUD_BASE.0=Perlin +value.CLOUD_BASE.1=Worley + +option.CLOUD_DENSITY=Density +option.CLOUD_DENSITY.comment=Adjusts cloud density, higher density makes artifacts more visible. +value.CLOUD_DENSITY.1=Very Low +value.CLOUD_DENSITY.2=Low +value.CLOUD_DENSITY.4=Medium +value.CLOUD_DENSITY.6=High +value.CLOUD_DENSITY.8=Very High + +option.CLOUD_AMOUNT=Amount +option.CLOUD_AMOUNT.comment=Adjusts cloud amount. +value.CLOUD_AMOUNT.12.0=Very Low +value.CLOUD_AMOUNT.11.0=Low +value.CLOUD_AMOUNT.10.0=Medium +value.CLOUD_AMOUNT.9.0=High +value.CLOUD_AMOUNT.8.0=Very High + +option.CLOUD_HEIGHT=Height +option.CLOUD_HEIGHT.comment=Adjusts cloud height. +value.CLOUD_HEIGHT.5.0=Very Low +value.CLOUD_HEIGHT.7.5=Low +value.CLOUD_HEIGHT.10.0=Medium +value.CLOUD_HEIGHT.12.5=High +value.CLOUD_HEIGHT.15.0=Very High + +option.CLOUD_THICKNESS=Thickness +option.CLOUD_THICKNESS.comment=Adjusts cloud thickness. +value.CLOUD_THICKNESS.2=Very Low +value.CLOUD_THICKNESS.4=Low +value.CLOUD_THICKNESS.5=Medium +value.CLOUD_THICKNESS.7=High +value.CLOUD_THICKNESS.10=Very High + +option.CLOUD_DETAIL=Detail +option.CLOUD_DETAIL.comment=Adjusts cloud detail. +value.CLOUD_DETAIL.0.3=Very Low +value.CLOUD_DETAIL.0.7=Low +value.CLOUD_DETAIL.1.0=Medium +value.CLOUD_DETAIL.1.3=High +value.CLOUD_DETAIL.1.7=Very High + +option.CLOUD_SPEED=Speed +option.CLOUD_SPEED.comment=Adjusts cloud speed. + +option.CLOUD_OPACITY=Opacity +option.CLOUD_OPACITY.comment=Adjusts cloud opacity. + +option.CLOUD_BRIGHTNESS=Brightness +option.CLOUD_BRIGHTNESS.comment=Adjusts cloud brightness. + +option.CLOUD_VOLUMETRIC_SCALE=Volumetric Scale +option.CLOUD_VOLUMETRIC_SCALE.comment=Adjusts volumetric cloud altitude and size +value.CLOUD_VOLUMETRIC_SCALE.6.0=Old Vanilla +value.CLOUD_VOLUMETRIC_SCALE.12.4=Vanilla +value.CLOUD_VOLUMETRIC_SCALE.16.0=Original Skybox + +#Fog +option.FOG_DENSITY=Fog Density +option.FOG_DENSITY.comment=Adjusts fog density. §e[*]§rThis option is ignored in the nether. + +option.FOG_HEIGHT=Height Fog +option.FOG_HEIGHT.comment= Enables height fog, reducing fog amount based on height. + +option.FAR_VANILLA_FOG=Far Vanilla Fog +option.FAR_VANILLA_FOG.comment=Enables vanilla-like fog. §e[*]§rThis option is affected by fog density. +value.FAR_VANILLA_FOG.0=§cOFF +value.FAR_VANILLA_FOG.1=Overworld Only +value.FAR_VANILLA_FOG.2=Nether & End Only +value.FAR_VANILLA_FOG.3=Full + +#Fog Density +option.FOG_DENSITY_NIGHT=Night - Weather Density +option.FOG_DENSITY_NIGHT.comment=Adjusts fog density multiplier at night and while raining. + +option.FOG_DENSITY_WEATHER=Weather Density +option.FOG_DENSITY_WEATHER.comment=Adjusts fog density multiplier while raining. + +option.FOG_DENSITY_COLD=Cold Density +option.FOG_DENSITY_COLD.comment=Adjusts fog density multiplier while standing on cold biomes. Cold biomes include any biome where snow occurs. §e[*]§rRequires Per Biome Weather. + +option.FOG_DENSITY_DRY=Dry Density +option.FOG_DENSITY_DRY.comment=Adjusts fog density multiplier while standing on dry biomes. Dry biomes include desert, badlands/mesa, and savanna. §e[*]§rRequires Per Biome Weather. + +option.FOG_DENSITY_DAMP=Damp Density +option.FOG_DENSITY_DAMP.comment=Adjusts fog density multiplier while standing on damp biomes. Damp biomes include swamp, mushroom island, and jungle. §e[*]§rRequires Per Biome Weather. + +option.FOG_DENSITY_INDOOR=Indoor Density +option.FOG_DENSITY_INDOOR.comment=Adjusts fog density multiplier while indoors. + +option.FOG_DENSITY_DH=Distant Horizons Density +option.FOG_DENSITY_DH.comment=Adjusts overworld fog density multiplier while Distant Horizons is enabled. + +#Height Fog +option.FOG_HEIGHT_Y=Base Height +option.FOG_HEIGHT_Y.comment=Adjusts the height where height fog starts occuring. + +option.FOG_HEIGHT_FALLOFF=Height Falloff +option.FOG_HEIGHT_FALLOFF.comment=Adjusts height fog's size. + +#Far Vanilla Fog +option.FAR_VANILLA_FOG_STYLE=Far Vanilla Fog Style +option.FAR_VANILLA_FOG_STYLE.comment=Spherical works like vanilla fog. Cylindrical ignores Y axis. +value.FAR_VANILLA_FOG_STYLE.0=Spherical +value.FAR_VANILLA_FOG_STYLE.1=Cylindrical + +option.FOG_DENSITY_VANILLA=Vanilla Density +option.FOG_DENSITY_VANILLA.comment=Adjusts fog density for vanilla fog. + +option.FOG_VANILLA_CLOUD=Vanilla Cloud Fog +option.FOG_VANILLA_CLOUD.comment=Enables fog on vanilla cloud. +value.FOG_VANILLA_CLOUD.0=§cOFF +value.FOG_VANILLA_CLOUD.1=Minimal +value.FOG_VANILLA_CLOUD.2=Reduced +value.FOG_VANILLA_CLOUD.3=Full + +#Skybox +option.ROUND_SUN_MOON=Round Sun & Moon +option.ROUND_SUN_MOON.comment=Enables shader based sun & moon. §e[*]§rDisable vanilla sun & moon in Video Settings > Details > Sun & Moon on 1.16.4 or below. + +option.ROUND_SUN_MOON_SIZE=Sun & Moon Size +option.ROUND_SUN_MOON_SIZE.comment=Adjusts size for round sun & moon and specular highlight. + +option.STARS=Stars +option.STARS.comment=Enables stars. + +option.AURORA=Aurora +option.AURORA.comment=Enables aurora. §a[+]§rThis effect benefits from TAA. + +option.SKYBOX_INTENSITY=Skybox Intensity +option.SKYBOX_INTENSITY.comment=Adjusts skybox intensity. + +option.SKYBOX_OPACITY=Skybox Opacity +option.SKYBOX_OPACITY.comment=Adjusts skybox opacity. §c[-]§rOnly available for 1.16.5 or above. + +option.SUN_INTENSITY=Sun Intensity +option.SUN_INTENSITY.comment=Adjusts skybox sun intensity. §c[-]§rOnly available for 1.16.5 or above. + +option.MOON_INTENSITY=Moon Intensity +option.MOON_INTENSITY.comment=Adjusts skybox moon intensity. §c[-]§rOnly available for 1.16.5 or above. + +#Water +option.WATER_MODE=Water Texture Mode +option.WATER_MODE.comment=Determines whether vanilla water texture should be used. Default : shader's flat water color, no texture. Vanilla : vanilla texture. Tinted Vanilla : vanilla texture with shader's water color. Flat Vanilla : vanilla's flat water color. +value.WATER_MODE.0=Default +value.WATER_MODE.1=Vanilla +value.WATER_MODE.2=Tinted Vanilla +value.WATER_MODE.3=Flat Vanilla + +option.WATER_ALPHA_MODE=Water Alpha Mode +option.WATER_ALPHA_MODE.comment=Determines whether the water uses shader based or texture alpha value. §e[*]§rSome effect will keep using shader based alpha value. +value.WATER_ALPHA_MODE.0=Flat +value.WATER_ALPHA_MODE.1=Vanilla + +option.WATER_NORMALS=Normals +option.WATER_NORMALS.comment=Enables realtime-generated normal mapping for water. +value.WATER_NORMALS.0=§cOFF +value.WATER_NORMALS.1=Worley +value.WATER_NORMALS.2=Perlin + +option.WATER_PARALLAX=Parallax +option.WATER_PARALLAX.comment=Enables water displacement. + +option.WATER_SHADOW_COLOR=Water Colored Shadows +option.WATER_SHADOW_COLOR.comment=Determines whether water should cast colored shadows for tinting. §e[*]§rEnabling this will prevent transparent objects from casting colored shadows when submerged. + +option.WATER_CAUSTICS=Water Caustics +option.WATER_CAUSTICS.comment=Determines whether water should cast caustics. §e[*]§rEnabling this will prevent transparent objects from casting colored shadows when submerged. §e[*]§rRequires realtime shadows. + +option.WATER_DETAIL=Detail +option.WATER_DETAIL.comment=Adjusts the ratio between large and small water normals. +value.WATER_DETAIL.0.05=5% +value.WATER_DETAIL.0.10=10% +value.WATER_DETAIL.0.15=15% +value.WATER_DETAIL.0.20=20% +value.WATER_DETAIL.0.25=25% +value.WATER_DETAIL.0.30=30% +value.WATER_DETAIL.0.35=35% +value.WATER_DETAIL.0.40=40% +value.WATER_DETAIL.0.45=45% +value.WATER_DETAIL.0.50=50% + +option.WATER_BUMP=Bumpiness +option.WATER_BUMP.comment=Adjusts the intensity of water normals. + +option.WATER_SHARPNESS=Sharpness +option.WATER_SHARPNESS.comment=Adjusts the sharpness of water normals and the amount of caustics. +value.WATER_SHARPNESS.0.8=Low +value.WATER_SHARPNESS.0.5=Medium +value.WATER_SHARPNESS.0.2=High + +option.WATER_SPEED=Speed +option.WATER_SPEED.comment=Adjusts the noise speed for water normals. + +option.WATER_FOG=Water Fog +option.WATER_FOG.comment=Determines whether water fog is only visible while underwater or at all times. +value.WATER_FOG.0=Underwater Only +value.WATER_FOG.1=Full + +option.WATER_FOG_DENSITY=Water Fog Density +option.WATER_FOG_DENSITY.comment=Adjusts water fog density. + +option.WATER_CAUSTICS_STRENGTH=Caustics Strength +option.WATER_CAUSTICS_STRENGTH.comment=Adjusts water caustics strength. + +option.WATER_PIXEL=Pixel Lock +option.WATER_PIXEL.comment=Applies pixelation effect on water normals. +value.WATER_PIXEL.0=OFF + +#Camera +option.DOF=Depth of Field +option.DOF.comment=Enables camera focus effect. +option.DOF_STRENGTH=DoF Strength +option.DOF_STRENGTH.comment=Adjusts the focus strength, higher value blurs quicker. + +option.MOTION_BLUR=Motion Blur +option.MOTION_BLUR.comment=Enables camera motion based blurring. + +option.MOTION_BLUR_STRENGTH=Motion Blur Strength +option.MOTION_BLUR_STRENGTH.comment=Adjusts motion blur intensity. + +option.BLOOM=Bloom +option.BLOOM.comment=Allows bright areas to glow. + +option.BLOOM_STRENGTH=Bloom Strength +option.BLOOM_STRENGTH.comment=Adjusts bloom intensity. + +option.BLOOM_CONTRAST=Bloom Contrast +option.BLOOM_CONTRAST.comment=Adjusts whether the bloom should preserve color contrast or detail visibility. Higher value preserves color contrast while lower value preserves detail visibility. +value.BLOOM_CONTRAST.-4=-1.00 +value.BLOOM_CONTRAST.-3=-0.75 +value.BLOOM_CONTRAST.-2=-0.50 +value.BLOOM_CONTRAST.-1=-0.25 +value.BLOOM_CONTRAST.0=0.00 +value.BLOOM_CONTRAST.1=0.25 +value.BLOOM_CONTRAST.2=0.50 +value.BLOOM_CONTRAST.3=0.75 +value.BLOOM_CONTRAST.4=1.00 + +option.BLOOM_RADIUS=Bloom Radius +option.BLOOM_RADIUS.comment=Adjusts how far the glow spreads. +value.BLOOM_RADIUS.1=Minimum +value.BLOOM_RADIUS.2=Very Low +value.BLOOM_RADIUS.3=Low +value.BLOOM_RADIUS.4=Medium +value.BLOOM_RADIUS.5=High +value.BLOOM_RADIUS.6=Very High +value.BLOOM_RADIUS.7=Maximum + +option.LENS_FLARE=Lens Flare +option.LENS_FLARE.comment=Enables lens flare. + +option.LENS_FLARE_STRENGTH=Lens Flare Strength +option.LENS_FLARE_STRENGTH.comment=Adjusts lens flare intensity. + +option.VIGNETTE=Vignette +option.VIGNETTE.comment=Fades the edge of the screen to black. §e[*]§rDisable for 360 imaging. + +option.VIGNETTE_STRENGTH=Vignette Strength +option.VIGNETTE_STRENGTH.comment=Adjusts vignette intensity. +value.VIGNETTE_STRENGTH.0.26=0.1 +value.VIGNETTE_STRENGTH.0.51=0.2 +value.VIGNETTE_STRENGTH.0.72=0.3 +value.VIGNETTE_STRENGTH.0.91=0.4 +value.VIGNETTE_STRENGTH.1.06=0.5 +value.VIGNETTE_STRENGTH.1.19=0.6 +value.VIGNETTE_STRENGTH.1.28=0.7 +value.VIGNETTE_STRENGTH.1.36=0.8 +value.VIGNETTE_STRENGTH.1.40=0.9 +value.VIGNETTE_STRENGTH.1.41=1.0 + +option.DIRTY_LENS=Dirty Lens +option.DIRTY_LENS.comment=Adds dusty particle effect to bloom. §e[*]§rRequires bloom. + +option.CHROMATIC_ABERRATION=Chromatic Aberration +option.CHROMATIC_ABERRATION.comment=Adds color distortion around the borders. +value.CHROMATIC_ABERRATION.0=OFF +value.CHROMATIC_ABERRATION.1=Weak +value.CHROMATIC_ABERRATION.2=Strong + + +option.UNDERWATER_DISTORTION=Underwater Distortion +option.UNDERWATER_DISTORTION.comment=Applies screen distortion while underwater. + +#Anti-aliasing +option.FXAA=FXAA +option.FXAA.comment=Enables fast approximate anti-aliasing, done by smoothing out edges with minimal performance cost. §e[*]§rPlease disable Antialiasing in Shaders menu while this option is enabled. + +option.TAA=TAA +option.TAA.comment=Enables temporal anti-aliasing, done by smart frame blending which captures improves tiny details and some effects. §e[*]§rSharpening included. §e[*]§rPlease disable Antialiasing in Shaders menu while this option is enabled. + +option.FXAA_SUBPIXEL=FXAA Subpixel Smoothing +option.FXAA_SUBPIXEL.comment=Adjusts how much smoothing should FXAA apply to tiny details. +value.FXAA_SUBPIXEL.0.00=§cOFF +value.FXAA_SUBPIXEL.0.25=Low +value.FXAA_SUBPIXEL.0.50=Medium +value.FXAA_SUBPIXEL.0.75=High +value.FXAA_SUBPIXEL.1.00=Very High + +option.FXAA_EDGE_SENSITIVITY=FXAA Edge Sensitivity +option.FXAA_EDGE_SENSITIVITY.comment=Adjusts how much edge contrast and brightness required to apply FXAA. +value.FXAA_EDGE_SENSITIVITY.0=Low +value.FXAA_EDGE_SENSITIVITY.1=Medium +value.FXAA_EDGE_SENSITIVITY.2=High + +option.TAA_MODE=TAA Mode +option.TAA_MODE.comment=Determines how TAA should be done. Smooth allows some effects to look better at the cost of ghosting. Coarse have less ghosting but barely improves other effects. +value.TAA_MODE.0=Smooth +value.TAA_MODE.1=Coarse + +option.TAA_SELECTIVE=Selective TAA +option.TAA_SELECTIVE.comment=Exclude entities, particles, and hand from temporal anti aliasing to reduce ghosting. §c[-]§rExcluded objects will need to rely on FXAA. + +#Color +option.LIGHT_MR=Red +option.LIGHT_MG=Green +option.LIGHT_MB=Blue +option.LIGHT_MI=Intensity + +option.LIGHT_DR=Red +option.LIGHT_DG=Green +option.LIGHT_DB=Blue +option.LIGHT_DI=Intensity + +option.LIGHT_ER=Red +option.LIGHT_EG=Green +option.LIGHT_EB=Blue +option.LIGHT_EI=Intensity + +option.LIGHT_NR=Red +option.LIGHT_NG=Green +option.LIGHT_NB=Blue +option.LIGHT_NI=Intensity + +option.AMBIENT_MR=Red +option.AMBIENT_MG=Green +option.AMBIENT_MB=Blue +option.AMBIENT_MI=Intensity + +option.AMBIENT_DR=Red +option.AMBIENT_DG=Green +option.AMBIENT_DB=Blue +option.AMBIENT_DI=Intensity + +option.AMBIENT_ER=Red +option.AMBIENT_EG=Green +option.AMBIENT_EB=Blue +option.AMBIENT_EI=Intensity + +option.AMBIENT_NR=Red +option.AMBIENT_NG=Green +option.AMBIENT_NB=Blue +option.AMBIENT_NI=Intensity + +option.MINLIGHT_R=Red +option.MINLIGHT_G=Green +option.MINLIGHT_B=Blue +option.MINLIGHT_I=Intensity +value.MINLIGHT_I.0.30=0.30 (Moody) +value.MINLIGHT_I.0.50=0.50 (Default) +value.MINLIGHT_I.0.70=0.70 (Bright) + +option.BLOCKLIGHT_R=Red +option.BLOCKLIGHT_G=Green +option.BLOCKLIGHT_B=Blue +option.BLOCKLIGHT_I=Intensity + +option.SKY_R=Red +option.SKY_G=Green +option.SKY_B=Blue +option.SKY_I=Intensity + +option.WATER_R=Red +option.WATER_G=Green +option.WATER_B=Blue +option.WATER_I=Intensity +option.WATER_A=Alpha +option.WATER_F=Fog Intensity + +option.WEATHER_RR=Red +option.WEATHER_RG=Green +option.WEATHER_RB=Blue +option.WEATHER_RI=Intensity + +option.WEATHER_CR=Red +option.WEATHER_CG=Green +option.WEATHER_CB=Blue +option.WEATHER_CI=Intensity + +option.WEATHER_DR=Red +option.WEATHER_DG=Green +option.WEATHER_DB=Blue +option.WEATHER_DI=Intensity + +option.WEATHER_BR=Red +option.WEATHER_BG=Green +option.WEATHER_BB=Blue +option.WEATHER_BI=Intensity + +option.WEATHER_SR=Red +option.WEATHER_SG=Green +option.WEATHER_SB=Blue +option.WEATHER_SI=Intensity + +option.WEATHER_MR=Red +option.WEATHER_MG=Green +option.WEATHER_MB=Blue +option.WEATHER_MI=Intensity + +option.WEATHER_VR=Red +option.WEATHER_VG=Green +option.WEATHER_VB=Blue +option.WEATHER_VI=Intensity + +option.WEATHER_JR=Red +option.WEATHER_JG=Green +option.WEATHER_JB=Blue +option.WEATHER_JI=Intensity + +option.AURORA_LR=Red +option.AURORA_LG=Green +option.AURORA_LB=Blue +option.AURORA_LI=Intensity + +option.AURORA_HR=Red +option.AURORA_HG=Green +option.AURORA_HB=Blue +option.AURORA_HI=Intensity + +option.NETHER_NR=Red +option.NETHER_NG=Green +option.NETHER_NB=Blue +option.NETHER_NI=Intensity + +option.NETHER_VR=Red +option.NETHER_VG=Green +option.NETHER_VB=Blue +option.NETHER_VI=Intensity + +option.NETHER_CR=Red +option.NETHER_CG=Green +option.NETHER_CB=Blue +option.NETHER_CI=Intensity + +option.NETHER_WR=Red +option.NETHER_WG=Green +option.NETHER_WB=Blue +option.NETHER_WI=Intensity + +option.NETHER_BR=Red +option.NETHER_BG=Green +option.NETHER_BB=Blue +option.NETHER_BI=Intensity + +option.END_R=Red +option.END_G=Green +option.END_B=Blue +option.END_I=Intensity + +option.EMISSIVE_RECOLOR=Emissive Recolor +option.EMISSIVE_RECOLOR.comment=Tints certain emissive blocks with blocklight color. + +option.SKY_VANILLA=Vanilla Sky +option.SKY_VANILLA.comment=Use vanilla sky color. + +option.SKY_VANILLA_USE_FOG=Use Vanilla Fog Color +option.SKY_VANILLA_USE_FOG.comment=Allows vanilla fog color to be used while Vanilla Sky is enabled. + +option.NETHER_VANILLA=Vanilla Nether +option.NETHER_VANILLA.comment=Use vanilla nether color. + +#Color Grading & Tonemap +option.EXPOSURE=Exposure +option.EXPOSURE.comment=Adjusts overall brightness. + +option.AUTO_EXPOSURE=Auto Exposure +option.AUTO_EXPOSURE.comment=Enables automatic adjustment to overall brightness. + +option.CLASSIC_EXPOSURE=Classic Exposure +option.CLASSIC_EXPOSURE.comment=Enables increased exposure when going indoors. + +option.COLOR_GRADING=Color Grading +option.COLOR_GRADING.comment=Enables color grading. §e[*]§rThis option doesn't need to be enabled to change tonemap, saturation, and vibrance sliders. + +option.TONEMAP_LOWER_CURVE=Tonemap Lower Curve +option.TONEMAP_LOWER_CURVE.comment=Adjusts contrast of darker colors. + +option.TONEMAP_UPPER_CURVE=Tonemap Upper Curve +option.TONEMAP_UPPER_CURVE.comment=Adjusts contrast of brighter colors. + +option.TONEMAP_WHITE_CURVE=Tonemap White Curve +option.TONEMAP_WHITE_CURVE.comment=Adjusts how quickly the tonemapped color can reach maximum brightness. + +option.TONEMAP_WHITE_PATH=Tonemap White Path +option.TONEMAP_WHITE_PATH.comment=Adjusts how quickly bright and saturated color turns into white. + +option.SATURATION=Saturation +option.SATURATION.comment=Adjusts saturation of all colors. + +option.VIBRANCE=Vibrance +option.VIBRANCE.comment=Adjusts saturation of less saturated colors, well saturated colors are less affected. + +#More Exposure Config +option.AUTO_EXPOSURE_RADIUS=Auto Exposure Radius +option.AUTO_EXPOSURE_RADIUS.comment=Adjusts how much of the screen being used for exposure calculation. +value.AUTO_EXPOSURE_RADIUS.0.002=Very Low +value.AUTO_EXPOSURE_RADIUS.0.04=Low +value.AUTO_EXPOSURE_RADIUS.0.18=Medium +value.AUTO_EXPOSURE_RADIUS.0.35=High +value.AUTO_EXPOSURE_RADIUS.0.7=Very High + +option.AUTO_EXPOSURE_SPEED=Auto Exposure Speed +option.AUTO_EXPOSURE_SPEED.comment=Adjusts how fast the exposure change occurs. §c[-]§rFast speed or above may cause flashing in combination with low radius. +value.AUTO_EXPOSURE_SPEED.0.0033=Very Slow +value.AUTO_EXPOSURE_SPEED.0.01=Slow +value.AUTO_EXPOSURE_SPEED.0.033=Medium +value.AUTO_EXPOSURE_SPEED.0.1=Fast +value.AUTO_EXPOSURE_SPEED.0.33=Very Fast + +#Color Grading Config +option.CG_RR=Red - Red Value +option.CG_RG=Red - Green Value +option.CG_RB=Red - Blue Value +option.CG_RI=Red Strength Value +option.CG_RM=Minimal Red Value +option.CG_RC=Red Curve Value + +option.CG_GR=Green - Red Value +option.CG_GG=Green - Green Value +option.CG_GB=Green - Blue Value +option.CG_GI=Green Strength Value +option.CG_GM=Minimal Green Value +option.CG_GC=Green Curve Value + +option.CG_BR=Blue - Red Value +option.CG_BG=Blue - Green Value +option.CG_BB=Blue - Blue Value +option.CG_BI=Blue Strength Value +option.CG_BM=Minimal Blue Value +option.CG_BC=Blue Curve Value + +option.CG_TR=Tint - Red Value +option.CG_TG=Tint - Green Value +option.CG_TB=Tint - Blue Value +option.CG_TI=Tint Strength Value +option.CG_TM=Tint Mix Value + +#Extras +option.OUTLINE=Outline +option.OUTLINE.comment=Enables outline effect. §c[-]§rBlack, Colored, and 1.12 Update Art are not fully compatible with volumetric clouds. +value.OUTLINE.0=OFF +value.OUTLINE.1=Black +value.OUTLINE.2=Colored +value.OUTLINE.3=1.12 Update Art +value.OUTLINE.4=Dungeons + +option.TOON_LIGHTMAP=Toon Lightmap +option.TOON_LIGHTMAP.comment=Reduces the quality of vanilla lighting for cel shading. §e[*]§rThis option is known for making the game "look bad", only enable this when needed. + +option.RETRO_FILTER=Retro Filter +option.RETRO_FILTER.comment=Adds pixelation and dithering. §c[-]§rIncompatible with anti-aliasing. + +option.RETRO_FILTER_SIZE=Retro Filter Size +option.RETRO_FILTER_SIZE.comment=Adjusts pixel size for retro filter. + +option.WORLD_CURVATURE=World Curvature +option.WORLD_CURVATURE.comment=Enables world curvature. §e[*]§rWorks in overworld only. §c[-]§rMissing chunks are handled by Minecraft itself which I can't fix. §c[-]§rMay break block selection highlight on 1.17. + +option.WORLD_CURVATURE_SIZE=World Curvature Size +option.WORLD_CURVATURE_SIZE.comment=Adjusts world curvature size. Negative values will bend the world upwards. + +#Animations +option.WORLD_TIME_ANIMATION=World Time Animation +option.WORLD_TIME_ANIMATION.comment=Use ingame time for moving objects. §e[*]§rThis option is mostly used when making cinematics. §c[-]§rThis option completely stops animation in the Nether & End. + +option.ANIMATION_SPEED=Animation Speed +option.ANIMATION_SPEED.comment=Adjusts animation speed. + +#Waving Blocks +option.WAVING_GRASS=Grass +option.WAVING_GRASS.comment=Allows grass to wave. + +option.WAVING_CROP=Crops +option.WAVING_CROP.comment=Allows plants on farmlands to wave. + +option.WAVING_PLANT=Plants +option.WAVING_PLANT.comment=Allows various plants to wave. + +option.WAVING_TALL_PLANT=Tall Plants +option.WAVING_TALL_PLANT.comment=Allows 2 block height plants to wave. + +option.WAVING_LEAF=Leaves +option.WAVING_LEAF.comment=Allows leaves to wave. + +option.WAVING_VINE=Vines +option.WAVING_VINE.comment=Allows vines to wave. + +option.WAVING_WATER=Water +option.WAVING_WATER.comment=Allows water to wave. + +option.WAVING_LAVA=Lava +option.WAVING_LAVA.comment=Allows lava to wave. + +option.WAVING_FIRE=Fire +option.WAVING_FIRE.comment=Allows fire to wave. + +option.WAVING_LANTERN=Lantern +option.WAVING_LANTERN.comment=Allows lantern to wave. \ No newline at end of file diff --git a/shaders/lib/antialiasing/fxaa.glsl b/shaders/lib/antialiasing/fxaa.glsl new file mode 100644 index 0000000..3780048 --- /dev/null +++ b/shaders/lib/antialiasing/fxaa.glsl @@ -0,0 +1,166 @@ +//FXAA 3.11 from http://blog.simonrodriguez.fr/articles/30-07-2016_implementing_fxaa.html +float quality[12] = float[12] (1.0, 1.0, 1.0, 1.0, 1.0, 1.5, 2.0, 2.0, 2.0, 2.0, 4.0, 8.0); + +#if FXAA_EDGE_SENSITIVITY == 0 +float edgeThreshold = 0.25; +float edgeThresholdMin = 0.0625; +#elif FXAA_EDGE_SENSITIVITY == 1 +float edgeThreshold = 0.125; +float edgeThresholdMin = 0.0312; +#elif FXAA_EDGE_SENSITIVITY == 2 +float edgeThreshold = 0.063; +float edgeThresholdMin = 0.0156; +#endif + +vec3 FXAA311(vec3 color) { + int iterations = 12; + + vec2 view = 1.0 / vec2(viewWidth, viewHeight); + + float lumaCenter = GetLuminance(color); + float lumaDown = GetLuminance(texture2DLod(colortex1, texCoord + vec2( 0.0, -1.0) * view, 0.0).rgb); + float lumaUp = GetLuminance(texture2DLod(colortex1, texCoord + vec2( 0.0, 1.0) * view, 0.0).rgb); + float lumaLeft = GetLuminance(texture2DLod(colortex1, texCoord + vec2(-1.0, 0.0) * view, 0.0).rgb); + float lumaRight = GetLuminance(texture2DLod(colortex1, texCoord + vec2( 1.0, 0.0) * view, 0.0).rgb); + + float lumaMin = min(lumaCenter, min(min(lumaDown, lumaUp), min(lumaLeft, lumaRight))); + float lumaMax = max(lumaCenter, max(max(lumaDown, lumaUp), max(lumaLeft, lumaRight))); + + float lumaRange = lumaMax - lumaMin; + + if (lumaRange > max(edgeThresholdMin, lumaMax * edgeThreshold)) { + float lumaDownLeft = GetLuminance(texture2DLod(colortex1, texCoord + vec2(-1.0, -1.0) * view, 0.0).rgb); + float lumaUpRight = GetLuminance(texture2DLod(colortex1, texCoord + vec2( 1.0, 1.0) * view, 0.0).rgb); + float lumaUpLeft = GetLuminance(texture2DLod(colortex1, texCoord + vec2(-1.0, 1.0) * view, 0.0).rgb); + float lumaDownRight = GetLuminance(texture2DLod(colortex1, texCoord + vec2( 1.0, -1.0) * view, 0.0).rgb); + + float lumaDownUp = lumaDown + lumaUp; + float lumaLeftRight = lumaLeft + lumaRight; + + float lumaLeftCorners = lumaDownLeft + lumaUpLeft; + float lumaDownCorners = lumaDownLeft + lumaDownRight; + float lumaRightCorners = lumaDownRight + lumaUpRight; + float lumaUpCorners = lumaUpRight + lumaUpLeft; + + float edgeHorizontal = abs(-2.0 * lumaLeft + lumaLeftCorners ) + + abs(-2.0 * lumaCenter + lumaDownUp ) * 2.0 + + abs(-2.0 * lumaRight + lumaRightCorners); + float edgeVertical = abs(-2.0 * lumaUp + lumaUpCorners ) + + abs(-2.0 * lumaCenter + lumaLeftRight ) * 2.0 + + abs(-2.0 * lumaDown + lumaDownCorners ); + + bool isHorizontal = (edgeHorizontal >= edgeVertical); + + float luma1 = isHorizontal ? lumaDown : lumaLeft; + float luma2 = isHorizontal ? lumaUp : lumaRight; + float gradient1 = luma1 - lumaCenter; + float gradient2 = luma2 - lumaCenter; + + bool is1Steepest = abs(gradient1) >= abs(gradient2); + float gradientScaled = 0.25 * max(abs(gradient1), abs(gradient2)); + + float stepLength = isHorizontal ? view.y : view.x; + + float lumaLocalAverage = 0.0; + + if (is1Steepest) { + stepLength = - stepLength; + lumaLocalAverage = 0.5 * (luma1 + lumaCenter); + } else { + lumaLocalAverage = 0.5 * (luma2 + lumaCenter); + } + + vec2 currentUv = texCoord; + if (isHorizontal) { + currentUv.y += stepLength * 0.5; + } else { + currentUv.x += stepLength * 0.5; + } + + vec2 offset = isHorizontal ? vec2(view.x, 0.0) : vec2(0.0, view.y); + + vec2 uv1 = currentUv - offset; + vec2 uv2 = currentUv + offset; + + float lumaEnd1 = GetLuminance(texture2DLod(colortex1, uv1, 0.0).rgb); + float lumaEnd2 = GetLuminance(texture2DLod(colortex1, uv2, 0.0).rgb); + lumaEnd1 -= lumaLocalAverage; + lumaEnd2 -= lumaLocalAverage; + + bool reached1 = abs(lumaEnd1) >= gradientScaled; + bool reached2 = abs(lumaEnd2) >= gradientScaled; + bool reachedBoth = reached1 && reached2; + + if (!reached1) { + uv1 -= offset; + } + if (!reached2) { + uv2 += offset; + } + + if (!reachedBoth) { + for(int i = 2; i < iterations; i++) { + if (!reached1) { + lumaEnd1 = GetLuminance(texture2DLod(colortex1, uv1, 0.0).rgb); + lumaEnd1 = lumaEnd1 - lumaLocalAverage; + } + if (!reached2) { + lumaEnd2 = GetLuminance(texture2DLod(colortex1, uv2, 0.0).rgb); + lumaEnd2 = lumaEnd2 - lumaLocalAverage; + } + + reached1 = abs(lumaEnd1) >= gradientScaled; + reached2 = abs(lumaEnd2) >= gradientScaled; + reachedBoth = reached1 && reached2; + + if (!reached1) { + uv1 -= offset * quality[i]; + } + if (!reached2) { + uv2 += offset * quality[i]; + } + + if (reachedBoth) break; + } + } + + float distance1 = isHorizontal ? (texCoord.x - uv1.x) : (texCoord.y - uv1.y); + float distance2 = isHorizontal ? (uv2.x - texCoord.x) : (uv2.y - texCoord.y); + + bool isDirection1 = distance1 < distance2; + float distanceFinal = min(distance1, distance2); + + float edgeThickness = (distance1 + distance2); + + float pixelOffset = - distanceFinal / edgeThickness + 0.5; + + bool isLumaCenterSmaller = lumaCenter < lumaLocalAverage; + + bool correctVariation = ((isDirection1 ? lumaEnd1 : lumaEnd2) < 0.0) != isLumaCenterSmaller; + + float finalOffset = correctVariation ? pixelOffset : 0.0; + + float lumaAverage = (1.0 / 12.0) * (2.0 * (lumaDownUp + lumaLeftRight) + lumaLeftCorners + lumaRightCorners); + float subPixelOffset1 = clamp(abs(lumaAverage - lumaCenter) / lumaRange, 0.0, 1.0); + float subPixelOffset2 = (-2.0 * subPixelOffset1 + 3.0) * subPixelOffset1 * subPixelOffset1; + float subPixelOffsetFinal = subPixelOffset2 * subPixelOffset2 * FXAA_SUBPIXEL; + + #ifdef TAA + subPixelOffsetFinal *= 0.5; + #endif + + finalOffset = max(finalOffset, subPixelOffsetFinal); + + // Compute the final UV coordinates. + vec2 finalUv = texCoord; + if (isHorizontal) { + finalUv.y += finalOffset * stepLength; + } else { + finalUv.x += finalOffset * stepLength; + } + + color = texture2DLod(colortex1, finalUv, 0.0).rgb; + } + + return color; +} \ No newline at end of file diff --git a/shaders/lib/antialiasing/taa.glsl b/shaders/lib/antialiasing/taa.glsl new file mode 100644 index 0000000..90d3591 --- /dev/null +++ b/shaders/lib/antialiasing/taa.glsl @@ -0,0 +1,182 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +vec2 neighbourOffsets[8] = vec2[8]( + vec2( 0.0, -1.0), + vec2(-1.0, 0.0), + vec2( 1.0, 0.0), + vec2( 0.0, 1.0), + vec2(-1.0, -1.0), + vec2( 1.0, -1.0), + vec2(-1.0, 1.0), + vec2( 1.0, 1.0) +); + +vec3 GetBlurredColor(vec2 view) { + float blurFactor = 0.1667; + vec3 color = texture2DLod(colortex1, texCoord + neighbourOffsets[4] * blurFactor / view, 0).rgb; + color+= texture2DLod(colortex1, texCoord + neighbourOffsets[5] * blurFactor / view, 0).rgb; + color+= texture2DLod(colortex1, texCoord + neighbourOffsets[6] * blurFactor / view, 0).rgb; + color+= texture2DLod(colortex1, texCoord + neighbourOffsets[7] * blurFactor / view, 0).rgb; + + color /= 4.0; + + return color; +} + +#ifdef TAA_SELECTIVE +float GetSkipFlag(float depth, vec2 view) { + float skip = texture2D(colortex3, texCoord.xy).b; + float skipDepth = depth; + + for (int i = 0; i < 4; i++) { + float sampleDepth = texture2D(depthtex1, texCoord + neighbourOffsets[i + 4] / view).r; + float sampleSkip = texture2D(colortex3, texCoord + neighbourOffsets[i + 4] / view).b; + + skip = (sampleDepth < skipDepth && sampleSkip == 0) ? 0 : skip; + skipDepth = min(skipDepth, sampleDepth); + } + + return skip; +} +#endif + +//Previous frame reprojection from Chocapic13 +vec2 Reprojection(vec3 pos) { + pos = pos * 2.0 - 1.0; + + vec4 viewPosPrev = gbufferProjectionInverse * vec4(pos, 1.0); + viewPosPrev /= viewPosPrev.w; + viewPosPrev = gbufferModelViewInverse * viewPosPrev; + + vec3 cameraOffset = cameraPosition - previousCameraPosition; + cameraOffset *= float(pos.z > 0.56); + + vec4 previousPosition = viewPosPrev + vec4(cameraOffset, 0.0); + previousPosition = gbufferPreviousModelView * previousPosition; + previousPosition = gbufferPreviousProjection * previousPosition; + return previousPosition.xy / previousPosition.w * 0.5 + 0.5; +} + +//Catmull-Rom sampling from Filmic SMAA presentation +vec3 textureCatmullRom(sampler2D colortex, vec2 texcoord, vec2 view) { + vec2 position = texcoord * view; + vec2 centerPosition = floor(position - 0.5) + 0.5; + vec2 f = position - centerPosition; + vec2 f2 = f * f; + vec2 f3 = f * f2; + + float c = 0.7; + vec2 w0 = -c * f3 + 2.0 * c * f2 - c * f; + vec2 w1 = (2.0 - c) * f3 - (3.0 - c) * f2 + 1.0; + vec2 w2 = -(2.0 - c) * f3 + (3.0 - 2.0 * c) * f2 + c * f; + vec2 w3 = c * f3 - c * f2; + + vec2 w12 = w1 + w2; + vec2 tc12 = (centerPosition + w2 / w12) / view; + + vec2 tc0 = (centerPosition - 1.0) / view; + vec2 tc3 = (centerPosition + 2.0) / view; + vec4 color = vec4(texture2DLod(colortex, vec2(tc12.x, tc0.y ), 0).gba, 1.0) * (w12.x * w0.y ) + + vec4(texture2DLod(colortex, vec2(tc0.x, tc12.y), 0).gba, 1.0) * (w0.x * w12.y) + + vec4(texture2DLod(colortex, vec2(tc12.x, tc12.y), 0).gba, 1.0) * (w12.x * w12.y) + + vec4(texture2DLod(colortex, vec2(tc3.x, tc12.y), 0).gba, 1.0) * (w3.x * w12.y) + + vec4(texture2DLod(colortex, vec2(tc12.x, tc3.y ), 0).gba, 1.0) * (w12.x * w3.y ); + return color.rgb / color.a; +} + +vec3 RGBToYCoCg(vec3 col) { + return vec3( + col.r * 0.25 + col.g * 0.5 + col.b * 0.25, + col.r * 0.5 - col.b * 0.5, + col.r * -0.25 + col.g * 0.5 + col.b * -0.25 + ); +} + +vec3 YCoCgToRGB(vec3 col) { + float n = col.r - col.b; + return vec3(n + col.g, col.r + col.b, n - col.g); +} + +vec3 ClipAABB(vec3 q,vec3 aabb_min, vec3 aabb_max){ + vec3 p_clip = 0.5 * (aabb_max + aabb_min); + vec3 e_clip = 0.5 * (aabb_max - aabb_min) + 0.00000001; + + vec3 v_clip = q - vec3(p_clip); + vec3 v_unit = v_clip.xyz / e_clip; + vec3 a_unit = abs(v_unit); + float ma_unit = max(a_unit.x, max(a_unit.y, a_unit.z)); + + if (ma_unit > 1.0) + return vec3(p_clip) + v_clip / ma_unit; + else + return q; +} + +vec3 NeighbourhoodClipping(vec3 color, vec3 tempColor, vec2 view) { + vec3 minclr = RGBToYCoCg(color); + vec3 maxclr = minclr; + + for(int i = 0; i < 8; i++) { + vec2 offset = neighbourOffsets[i] * view; + vec3 clr = texture2DLod(colortex1, texCoord + offset, 0.0).rgb; + + clr = RGBToYCoCg(clr); + minclr = min(minclr, clr); maxclr = max(maxclr, clr); + } + + tempColor = RGBToYCoCg(tempColor); + tempColor = ClipAABB(tempColor, minclr, maxclr); + + return YCoCgToRGB(tempColor); +} + +vec4 TemporalAA(inout vec3 color, float tempData) { + vec2 view = vec2(viewWidth, viewHeight); + + vec3 blur = GetBlurredColor(view); + float depth = texture2D(depthtex1, texCoord).r; + + #ifdef TAA_SELECTIVE + float skip = GetSkipFlag(depth, view); + + if (skip > 0.0) { + color = blur; + return vec4(tempData, vec3(0.0)); + } + #endif + + vec3 coord = vec3(texCoord, depth); + vec2 prvCoord = Reprojection(coord); + + vec3 tempColor = textureCatmullRom(colortex2, prvCoord, view); + + if(tempColor == vec3(0.0)) { + color = blur; + return vec4(tempData, color); + } + + vec3 tempColorRaw = tempColor; + tempColor = NeighbourhoodClipping(color, tempColor, 1.0 / view); + + #if TAA_MODE == 0 + vec2 velocity = (texCoord - prvCoord.xy) * view; + float blendFactor = float( + prvCoord.x > 0.0 && prvCoord.x < 1.0 && + prvCoord.y > 0.0 && prvCoord.y < 1.0 + ); + blendFactor *= exp(-length(velocity)) * 0.2 + 0.7; + + color = mix(color, tempColor, blendFactor); + #endif + + vec3 outColor = color; + + #if TAA_MODE == 1 + color = mix(color, tempColor, 0.5); + #endif + + return vec4(tempData, outColor); +} \ No newline at end of file diff --git a/shaders/lib/atmospherics/clouds.glsl b/shaders/lib/atmospherics/clouds.glsl new file mode 100644 index 0000000..fcb58e8 --- /dev/null +++ b/shaders/lib/atmospherics/clouds.glsl @@ -0,0 +1,385 @@ +#ifdef OVERWORLD +float CloudSampleBase(vec2 coord, vec2 wind, float cloudGradient, float sunCoverage, float dither, float multiplier) { + coord.xy *= 0.004; + + #if CLOUD_BASE == 0 + float noiseBase = texture2D(noisetex, coord * 0.25 + wind).r; + #else + float noiseBase = texture2D(noisetex, coord * 0.5 + wind).g; + noiseBase = pow(1.0 - noiseBase, 2.0) * 0.5 + 0.25; + #endif + + float detailZ = floor(cloudGradient * float(CLOUD_THICKNESS)) * 0.04; + float noiseDetailLow = texture2D(noisetex, coord.xy * 0.5 - wind * 2.0 + detailZ).b; + float noiseDetailHigh = texture2D(noisetex, coord.xy * 0.5 - wind * 2.0 + detailZ + 0.04).b; + float noiseDetail = mix(noiseDetailLow, noiseDetailHigh, fract(cloudGradient * float(CLOUD_THICKNESS))); + + float noiseCoverage = abs(cloudGradient - 0.125); + noiseCoverage *= cloudGradient > 0.125 ? (2.14 - CLOUD_AMOUNT * 0.1) : 8.0; + noiseCoverage = noiseCoverage * noiseCoverage * 4.0; + + float noise = mix(noiseBase, noiseDetail, 0.0476 * CLOUD_DETAIL) * 21.0 - noiseCoverage; + noise = mix(noise, 21.0 - noiseCoverage * 2.5, 0.33 * rainStrength); + + noise = max(noise - (sunCoverage * 3.0 + CLOUD_AMOUNT), 0.0); + noise *= CLOUD_DENSITY * multiplier; + noise *= (1.0 - 0.75 * rainStrength); + noise = noise / sqrt(noise * noise + 0.5); + + return noise; +} + +float CloudSampleSkybox(vec2 coord, vec2 wind, float cloudGradient, float sunCoverage, float dither) { + return CloudSampleBase(coord, wind, cloudGradient, sunCoverage, dither, 0.125); +} + +float CloudSampleVolumetric(vec2 coord, vec2 wind, float cloudGradient, float sunCoverage, float dither) { + coord.xy /= CLOUD_VOLUMETRIC_SCALE; + return CloudSampleBase(coord, wind, cloudGradient, sunCoverage, dither, 0.125); +} + +float InvLerp(float v, float l, float h) { + return clamp((v - l) / (h - l), 0.0, 1.0); +} + +vec4 DrawCloudSkybox(vec3 viewPos, float z, float dither, vec3 lightCol, vec3 ambientCol, bool fadeFaster) { + if (z < 1.0) return vec4(0.0); + + #ifdef TAA + #if TAA_MODE == 0 + dither = fract(dither + frameCounter * 0.618); + #else + dither = fract(dither + frameCounter * 0.5); + #endif + #endif + + int samples = CLOUD_THICKNESS * 2; + + float cloud = 0.0, cloudLighting = 0.0; + + float sampleStep = 1.0 / samples; + float currentStep = dither * sampleStep; + + vec3 nViewPos = normalize(viewPos); + float VoU = dot(nViewPos, upVec); + float VoL = dot(nViewPos, lightVec); + + float sunCoverage = mix(abs(VoL), max(VoL, 0.0), shadowFade); + sunCoverage = pow(clamp(sunCoverage * 2.0 - 1.0, 0.0, 1.0), 12.0) * (1.0 - rainStrength); + + vec2 wind = vec2( + frametime * CLOUD_SPEED * 0.0005, + sin(frametime * CLOUD_SPEED * 0.001) * 0.005 + ) * CLOUD_HEIGHT / 15.0; + + vec3 cloudColor = vec3(0.0); + + if (VoU > 0.025) { + vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos, 1.0)).xyz); + + float halfVoL = mix(abs(VoL) * 0.8, VoL, shadowFade) * 0.5 + 0.5; + float halfVoLSqr = halfVoL * halfVoL; + float scattering = pow(halfVoL, 6.0); + float noiseLightFactor = (2.0 - 1.5 * VoL * shadowFade) * CLOUD_DENSITY * 0.5; + + for(int i = 0; i < samples; i++) { + if (cloud > 0.99) break; + vec3 planeCoord = wpos * ((CLOUD_HEIGHT + currentStep * CLOUD_THICKNESS) / wpos.y); + vec2 coord = cameraPosition.xz * 0.0625 * 16.0 / CLOUD_VOLUMETRIC_SCALE + planeCoord.xz; + + float noise = CloudSampleSkybox(coord, wind, currentStep, sunCoverage, dither); + + float sampleLighting = pow(currentStep, 1.125 * halfVoLSqr + 0.875) * 0.8 + 0.2; + sampleLighting *= 1.0 - pow(noise, noiseLightFactor); + + cloudLighting = mix(cloudLighting, sampleLighting, noise * (1.0 - cloud * cloud)); + cloud = mix(cloud, 1.0, noise); + + currentStep += sampleStep; + } + cloudLighting = mix(cloudLighting, 1.0, (1.0 - cloud * cloud) * scattering * 0.5); + cloudLighting *= (1.0 - 0.9 * rainStrength); + + cloudColor = mix( + ambientCol * (0.3 * sunVisibility + 0.5), + lightCol * (0.85 + 1.15 * scattering), + cloudLighting + ); + cloudColor *= 1.0 - 0.4 * rainStrength; + + cloud *= clamp(1.0 - exp(-16.0 / max(fogDensity, 0.5) * VoU + 0.5), 0.0, 1.0); + + if (fadeFaster) { + cloud *= 1.0 - pow(1.0 - VoU, 4.0); + } + } + cloudColor *= CLOUD_BRIGHTNESS * (0.5 - 0.25 * (1.0 - sunVisibility) * (1.0 - rainStrength)); + // cloudColor *= voidFade; + #if MC_VERSION >= 11800 + cloudColor *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0); + #else + cloudColor *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0); + #endif + + #ifdef UNDERGROUND_SKY + cloud *= mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS); + #endif + + return vec4(cloudColor, cloud * cloud * CLOUD_OPACITY); +} + +vec3 GetReflectedCameraPos(vec3 worldPos, vec3 normal) { + vec4 worldNormal = gbufferModelViewInverse * vec4(normal, 1.0); + worldNormal.xyz /= worldNormal.w; + + vec3 cameraPos = cameraPosition + 2.0 * worldNormal.xyz * dot(worldPos, worldNormal.xyz); + cameraPos = cameraPos + reflect(worldPos, worldNormal.xyz); //bobbing stabilizer, works like magic + + return cameraPos; +} + +vec4 DrawCloudVolumetric(vec3 viewPos, vec3 cameraPos, float z, float dither, vec3 lightCol, vec3 ambientCol, inout float cloudViewLength, bool fadeFaster) { + #ifdef TAA + #if TAA_MODE == 0 + dither = fract(dither + frameCounter * 0.618); + #else + dither = fract(dither + frameCounter * 0.5); + #endif + #endif + + vec3 nViewPos = normalize(viewPos); + vec3 worldPos = (gbufferModelViewInverse * vec4(viewPos, 1.0)).xyz; + vec3 nWorldPos = normalize(worldPos); + float viewLength = length(viewPos); + + float cloudHeight = CLOUD_HEIGHT * CLOUD_VOLUMETRIC_SCALE + 70; + // float cloudHeight = CLOUD_HEIGHT * CLOUD_VOLUMETRIC_SCALE + cameraPosition.y; + // float cloudHeight = 63; + + float lowerY = cloudHeight; + float upperY = cloudHeight + CLOUD_THICKNESS * CLOUD_VOLUMETRIC_SCALE; + + float lowerPlane = (lowerY - cameraPos.y) / nWorldPos.y; + float upperPlane = (upperY - cameraPos.y) / nWorldPos.y; + + float nearestPlane = max(min(lowerPlane, upperPlane), 0.0); + float furthestPlane = max(lowerPlane, upperPlane); + + float maxcloudViewLength = cloudViewLength; + + if (furthestPlane < 0) return vec4(0.0); + + float planeDifference = furthestPlane - nearestPlane; + + vec3 startPos = cameraPos + nearestPlane * nWorldPos; + + float scaling = abs(cameraPosition.y - (upperY + lowerY) * 0.5) / ((upperY - lowerY) * 0.5); + scaling = clamp((scaling - 1.0) * CLOUD_THICKNESS * 0.125, 0.0, 1.0); + + float sampleLength = CLOUD_THICKNESS * CLOUD_VOLUMETRIC_SCALE / 2.0; + sampleLength /= (4.0 * nWorldPos.y * nWorldPos.y) * scaling + 1.0; + vec3 sampleStep = nWorldPos * sampleLength; + int samples = int(min(planeDifference / sampleLength, 32) + 1); + + vec3 samplePos = startPos + sampleStep * dither; + float sampleTotalLength = nearestPlane + sampleLength * dither; + + vec2 wind = vec2( + frametime * CLOUD_SPEED * 0.0005, + sin(frametime * CLOUD_SPEED * 0.001) * 0.005 + ) * CLOUD_HEIGHT / 15.0; + + float cloud = 0.0; + float cloudFaded = 0.0; + float cloudLighting = 0.0; + + float VoU = dot(nViewPos, upVec); + float VoL = dot(nViewPos, lightVec); + + float sunCoverage = mix(abs(VoL), max(VoL, 0.0), shadowFade); + sunCoverage = pow(clamp(sunCoverage * 2.0 - 1.0, 0.0, 1.0), 12.0) * (1.0 - rainStrength); + + float halfVoL = mix(abs(VoL) * 0.8, VoL, shadowFade) * 0.5 + 0.5; + float halfVoLSqr = halfVoL * halfVoL; + + float scattering = pow(halfVoL, 6.0); + float noiseLightFactor = (2.0 - 1.5 * VoL * shadowFade) * CLOUD_DENSITY * 0.5; + + float viewLengthSoftMin = viewLength - sampleLength * 0.5; + float viewLengthSoftMax = viewLength + sampleLength * 0.5; + + float fade = 1.0; + float fadeStart = 32.0 / max(fogDensity, 0.5); + float fadeEnd = (fadeFaster ? 80.0 : 240.0) / max(fogDensity, 0.5); + + for (int i = 0; i < samples; i++) { + if (cloud > 0.99) break; + if (sampleTotalLength > viewLengthSoftMax && z < 1.0) break; + + float cloudGradient = InvLerp(samplePos.y, lowerY, upperY); + float xzNormalizedDistance = length(samplePos.xz - cameraPos.xz) / CLOUD_VOLUMETRIC_SCALE; + + float noise = CloudSampleVolumetric(samplePos.xz, wind, cloudGradient, sunCoverage, dither); + noise *= step(lowerY, samplePos.y) * step(samplePos.y, upperY); + + float sampleLighting = pow(cloudGradient, 1.125 * halfVoLSqr + 0.875) * 0.8 + 0.2; + sampleLighting *= 1.0 - pow(noise, noiseLightFactor); + + float sampleFade = InvLerp(xzNormalizedDistance, fadeEnd, fadeStart); + fade *= mix(1.0, sampleFade, noise * (1.0 - cloud)); + noise *= step(xzNormalizedDistance, fadeEnd); + + cloudLighting = mix(cloudLighting, sampleLighting, noise * (1.0 - cloud * cloud)); + + if (z < 1.0) { + noise *= InvLerp(sampleTotalLength, viewLengthSoftMax, viewLengthSoftMin); + } + + cloud = mix(cloud, 1.0, noise); + + if (cloudViewLength == maxcloudViewLength && cloud > 0.5) { + cloudViewLength = sampleTotalLength; + } + + samplePos += sampleStep; + sampleTotalLength += sampleLength; + } + + cloudFaded = cloud * fade; + + cloudLighting = mix(cloudLighting, 1.0, (1.0 - cloud * cloud) * scattering * 0.5); + cloudLighting *= (1.0 - 0.9 * rainStrength); + + vec3 cloudColor = mix( + ambientCol * (0.3 * sunVisibility + 0.5), + lightCol * (0.85 + 1.15 * scattering), + cloudLighting + ); + + cloudColor *= 1.0 - 0.4 * rainStrength; + cloudColor *= CLOUD_BRIGHTNESS * (0.5 - 0.25 * (1.0 - sunVisibility) * (1.0 - rainStrength)); + + cloudFaded *= cloudFaded * CLOUD_OPACITY; + + if (cloudFaded < dither) { + cloudViewLength = maxcloudViewLength; + } + + return vec4(cloudColor, cloudFaded); +} + +float GetNoise(vec2 pos) { + return fract(sin(dot(pos, vec2(12.9898, 4.1414))) * 43758.5453); +} + +void DrawStars(inout vec3 color, vec3 viewPos) { + vec3 wpos = vec3(gbufferModelViewInverse * vec4(viewPos * 100.0, 1.0)); + vec3 planeCoord = wpos / (wpos.y + length(wpos.xz)); + vec2 wind = vec2(frametime, 0.0); + vec2 coord = planeCoord.xz * 0.4 + cameraPosition.xz * 0.0001 + wind * 0.00125; + coord = floor(coord * 1024.0) / 1024.0; + + float VoU = clamp(dot(normalize(viewPos), upVec), 0.0, 1.0); + float VoL = dot(normalize(viewPos), sunVec); + float multiplier = sqrt(sqrt(VoU)) * 5.0 * (1.0 - rainStrength) * moonVisibility; + + float star = 1.0; + if (VoU > 0.0) { + star *= GetNoise(coord.xy); + star *= GetNoise(coord.xy + 0.10); + star *= GetNoise(coord.xy + 0.23); + } + star = clamp(star - 0.8125, 0.0, 1.0) * multiplier; + //star *= voidFade; + #if MC_VERSION >= 11800 + star *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0); + #else + star *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0); + #endif + + #ifdef UNDERGROUND_SKY + star *= mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS); + #endif + + float moonFade = smoothstep(-0.997,-0.992, VoL); + star *= moonFade; + + color += star * pow(lightNight, vec3(0.8)); +} + +#ifdef AURORA +#include "/lib/color/auroraColor.glsl" + +float AuroraSample(vec2 coord, vec2 wind, float VoU) { + float noise = texture2D(noisetex, coord * 0.0625 + wind * 0.25).b * 3.0; + noise+= texture2D(noisetex, coord * 0.03125 + wind * 0.15).b * 3.0; + + noise = max(1.0 - 4.0 * (0.5 * VoU + 0.5) * abs(noise - 3.0), 0.0); + + return noise; +} + +vec3 DrawAurora(vec3 viewPos, float dither, int samples) { + #ifdef TAA + #if TAA_MODE == 0 + dither = fract(dither + frameCounter * 0.618); + #else + dither = fract(dither + frameCounter * 0.5); + #endif + #endif + + float sampleStep = 1.0 / samples; + float currentStep = dither * sampleStep; + + float VoU = dot(normalize(viewPos), upVec); + + float visibility = moonVisibility * (1.0 - rainStrength) * (1.0 - rainStrength); + + #ifdef WEATHER_PERBIOME + visibility *= isCold * isCold; + #endif + + vec2 wind = vec2( + frametime * CLOUD_SPEED * 0.000125, + sin(frametime * CLOUD_SPEED * 0.05) * 0.00025 + ); + + vec3 aurora = vec3(0.0); + + if (VoU > 0.0 && visibility > 0.0) { + vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos, 1.0)).xyz); + for(int i = 0; i < samples; i++) { + vec3 planeCoord = wpos * ((8.0 + currentStep * 7.0) / wpos.y) * 0.004; + + vec2 coord = cameraPosition.xz * 0.00004 + planeCoord.xz; + coord += vec2(coord.y, -coord.x) * 0.3; + + float noise = AuroraSample(coord, wind, VoU); + + if (noise > 0.0) { + noise *= texture2D(noisetex, coord * 0.125 + wind * 0.25).b; + noise *= 0.5 * texture2D(noisetex, coord + wind * 16.0).b + 0.75; + noise = noise * noise * 3.0 * sampleStep; + noise *= max(sqrt(1.0 - length(planeCoord.xz) * 3.75), 0.0); + + vec3 auroraColor = mix(auroraLowCol, auroraHighCol, pow(currentStep, 0.4)); + aurora += noise * auroraColor * exp2(-6.0 * i * sampleStep); + } + currentStep += sampleStep; + } + } + // visibility *= voidFade; + #if MC_VERSION >= 11800 + visibility *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0); + #else + visibility *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0); + #endif + + #ifdef UNDERGROUND_SKY + visibility *= mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS); + #endif + + return aurora * visibility; +} +#endif +#endif \ No newline at end of file diff --git a/shaders/lib/atmospherics/fog.glsl b/shaders/lib/atmospherics/fog.glsl new file mode 100644 index 0000000..4e364ef --- /dev/null +++ b/shaders/lib/atmospherics/fog.glsl @@ -0,0 +1,190 @@ +#ifdef OVERWORLD +vec3 GetFogColor(vec3 viewPos) { + vec3 nViewPos = normalize(viewPos); + float lViewPos = length(viewPos) / 64.0; + lViewPos = 1.0 - exp(-lViewPos * lViewPos); + + float VoU = clamp(dot(nViewPos, upVec), -1.0, 1.0); + float VoL = clamp(dot(nViewPos, sunVec), -1.0, 1.0); + + float density = 0.4; + float nightDensity = 1.0; + float weatherDensity = 1.5; + float groundDensity = 0.08 * (4.0 - 3.0 * sunVisibility) * + (10.0 * rainStrength * rainStrength + 1.0); + + float exposure = exp2(timeBrightness * 0.75 - 0.75); + float nightExposure = exp2(-3.5); + + float baseGradient = exp(-(VoU * 0.5 + 0.5) * 0.5 / density); + + float groundVoU = clamp(-VoU * 0.5 + 0.5, 0.0, 1.0); + float ground = 1.0 - exp(-groundDensity / groundVoU); + + vec3 fog = fogCol * baseGradient / (SKY_I * SKY_I); + fog = fog / sqrt(fog * fog + 1.0) * exposure * sunVisibility * (SKY_I * SKY_I); + + float sunMix = (VoL * 0.5 + 0.5) * pow(clamp(1.0 - VoU, 0.0, 1.0), 2.0 - sunVisibility) * + pow(1.0 - timeBrightness * 0.6, 3.0); + float horizonMix = pow(1.0 - abs(VoU), 2.5) * 0.125; + float lightMix = (1.0 - (1.0 - sunMix) * (1.0 - horizonMix)) * lViewPos; + + vec3 lightFog = pow(lightSun, vec3(4.0 - sunVisibility)) * baseGradient; + lightFog = lightFog / (1.0 + lightFog * rainStrength); + + fog = mix( + sqrt(fog * (1.0 - lightMix)), + sqrt(lightFog), + lightMix + ); + fog *= fog; + + float nightGradient = exp(-(VoU * 0.5 + 0.5) * 0.35 / nightDensity); + vec3 nightFog = lightNight * lightNight * nightGradient * nightExposure; + fog = mix(nightFog, fog, sunVisibility * sunVisibility); + + float rainGradient = exp(-(VoU * 0.5 + 0.5) * 0.125 / weatherDensity); + vec3 weatherFog = weatherCol.rgb * weatherCol.rgb; + weatherFog *= GetLuminance(ambientCol / (weatherFog)) * (0.2 * sunVisibility + 0.2); + fog = mix(fog, weatherFog * rainGradient, rainStrength); + fog = mix(minLightCol * 0.5, fog * eBS, eBS); + + //fog *= voidFade; + #if MC_VERSION >= 11800 + fog *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0); + #else + fog *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0); + #endif + + return fog; +} +#endif + +void NormalFog(inout vec3 color, vec3 viewPos) { + float viewLength = length(viewPos); + + vec4 worldPos = gbufferModelViewInverse * vec4(viewPos, 1.0); + worldPos.xyz /= worldPos.w; + + #if FAR_VANILLA_FOG > 0 + #if FAR_VANILLA_FOG_STYLE == 0 + float fogFactor = viewLength; + #else + float fogFactor = length(worldPos.xz); + #endif + #endif + + #ifdef OVERWORLD + float fog = viewLength * fogDensity / 1024.0; + float clearDay = sunVisibility * (1.0 - rainStrength); + + #ifdef DISTANT_HORIZONS + fog *= FOG_DENSITY_DH; + #endif + + fog *= mix(FOG_DENSITY_INDOOR, mix(1.0, FOG_DENSITY_WEATHER, rainStrength) / mix(1.0 / FOG_DENSITY_NIGHT, 1.0, clearDay) * eBS, eBS); + fog = min(fog, (fog - 0.8) * 0.25 + 0.8); + + #ifdef FOG_HEIGHT + fog *= exp2(-max(worldPos.y + cameraPosition.y - FOG_HEIGHT_Y, 0.0) / exp2(FOG_HEIGHT_FALLOFF)); + #endif + + fog = 1.0 - exp(-2.0 * pow(fog, 0.35 * clearDay * eBS + 1.25)); + + vec3 fogColor = GetFogColor(viewPos); + + #if FAR_VANILLA_FOG == 1 || FAR_VANILLA_FOG == 3 + if(isEyeInWater == 0.0){ + #if MC_VERSION >= 11800 + float fogOffset = 0.0; + #else + float fogOffset = 12.0; + #endif + + float fogFar = far; + float vanillaDensity = 0.2; + #ifdef DISTANT_HORIZONS + fogFar = dhFarPlane * 0.5; + vanillaDensity = 0.4; + #endif + + float vanillaFog = 1.0 - (fogFar - (fogFactor + fogOffset)) / (vanillaDensity * fogFar * FOG_DENSITY_VANILLA); + vanillaFog = clamp(vanillaFog, 0.0, 1.0); + + if(vanillaFog > 0.0){ + vec3 vanillaFogColor = GetSkyColor(viewPos, false); + + vanillaFogColor *= 1.0 + nightVision; + #ifdef CLASSIC_EXPOSURE + vanillaFogColor *= 4.0 - 3.0 * eBS; + #endif + + fogColor *= fog; + + fog = mix(fog, 1.0, vanillaFog); + if(fog > 0.0) fogColor = mix(fogColor, vanillaFogColor, vanillaFog) / fog; + } + } + #endif + #endif + + #ifdef NETHER + float fog = 2.0 * pow(viewLength * fogDensity / 256.0, 1.5); + + #if FAR_VANILLA_FOG == 2 || FAR_VANILLA_FOG == 3 + #ifndef DISTANT_HORIZONS + fog += 6.0 * pow(fogFactor * 1.5 / far, 4.0); + #else + fog += 6.0 * pow(fogFactor * 3.0 / dhFarPlane, 4.0); + #endif + #endif + + fog = 1.0 - exp(-fog); + + vec3 fogColor = netherCol.rgb * 0.0425; + #endif + + #ifdef END + float fog = viewLength * fogDensity / 512.0; + + #if FAR_VANILLA_FOG == 2 || FAR_VANILLA_FOG == 3 + #ifndef DISTANT_HORIZONS + fog += 2.0 * pow(fogFactor * 1.5 / far, 4.0); + #else + fog += 2.0 * pow(fogFactor * 3.0 / dhFarPlane, 4.0); + #endif + #endif + + fog = 1.0 - exp(-fog); + + vec3 fogColor = endCol.rgb * 0.003; + #ifndef LIGHT_SHAFT + fogColor *= 4.0; + #endif + #endif + + color = mix(color, fogColor, fog); +} + +void BlindFog(inout vec3 color, vec3 viewPos) { + float fog = length(viewPos) * max(blindFactor * 0.2, darknessFactor * 0.075); + fog = (1.0 - exp(-6.0 * fog * fog * fog)) * max(blindFactor, darknessFactor); + color = mix(color, vec3(0.0), fog); +} + +vec3 denseFogColor[2] = vec3[2]( + vec3(1.0, 0.3, 0.01), + vec3(0.1, 0.16, 0.2) +); + +void DenseFog(inout vec3 color, vec3 viewPos) { + float fog = length(viewPos) * 0.5; + fog = (1.0 - exp(-4.0 * fog * fog * fog)); + color = mix(color, denseFogColor[isEyeInWater - 2], fog); +} + +void Fog(inout vec3 color, vec3 viewPos) { + NormalFog(color, viewPos); + if (isEyeInWater > 1) DenseFog(color, viewPos); + if (blindFactor > 0.0 || darknessFactor > 0.0) BlindFog(color, viewPos); +} \ No newline at end of file diff --git a/shaders/lib/atmospherics/sky.glsl b/shaders/lib/atmospherics/sky.glsl new file mode 100644 index 0000000..e9dbcd4 --- /dev/null +++ b/shaders/lib/atmospherics/sky.glsl @@ -0,0 +1,77 @@ +#ifdef OVERWORLD +vec3 GetSkyColor(vec3 viewPos, bool isReflection) { + vec3 nViewPos = normalize(viewPos); + + float VoU = clamp(dot(nViewPos, upVec), -1.0, 1.0); + float VoL = clamp(dot(nViewPos, sunVec), -1.0, 1.0); + + float groundDensity = 0.1 * (4.0 - 3.0 * sunVisibility) * + (10.0 * rainStrength * rainStrength + 1.0); + + float exposure = exp2(timeBrightness * 0.75 - 0.75 + SKY_EXPOSURE_D); + float nightExposure = exp2(-3.5 + SKY_EXPOSURE_N); + float weatherExposure = exp2(SKY_EXPOSURE_W); + + float gradientCurve = mix(SKY_HORIZON_F, SKY_HORIZON_N, VoL); + float baseGradient = exp(-(1.0 - pow(1.0 - max(VoU, 0.0), gradientCurve)) / + SKY_DENSITY_D); + + #if SKY_GROUND > 0 + float groundVoU = clamp(-VoU * 1.015 - 0.015, 0.0, 1.0); + float ground = 1.0 - exp(-groundDensity * max(fogDensity, 0.125) / groundVoU); + #if SKY_GROUND == 1 + if (!isReflection) ground = 1.0; + #endif + #else + float ground = 1.0; + #endif + + vec3 sky = skyCol; + #ifdef SKY_VANILLA + sky = mix(sky, fogCol, pow(1.0 - max(VoU, 0.0), 4.0)); + #endif + sky *= baseGradient / (SKY_I * SKY_I); + sky = sky / sqrt(sky * sky + 1.0) * exposure * sunVisibility * (SKY_I * SKY_I); + + float sunMix = (VoL * 0.5 + 0.5) * pow(clamp(1.0 - VoU, 0.0, 1.0), 2.0 - sunVisibility) * + pow(1.0 - timeBrightness * 0.6, 3.0); + float horizonMix = pow(1.0 - abs(VoU), 2.5) * 0.125; + float lightMix = (1.0 - (1.0 - sunMix) * (1.0 - horizonMix)); + + vec3 lightSky = pow(lightSun, vec3(4.0 - sunVisibility)) * baseGradient; + lightSky = lightSky / (1.0 + lightSky * rainStrength); + + sky = mix( + sqrt(sky * (1.0 - lightMix)), + sqrt(lightSky), + lightMix + ); + sky *= sky; + + float nightGradient = exp(-max(VoU, 0.0) / SKY_DENSITY_N); + vec3 nightSky = lightNight * lightNight * nightGradient * nightExposure; + sky = mix(nightSky, sky, sunVisibility * sunVisibility); + + float rainGradient = exp(-max(VoU, 0.0) / SKY_DENSITY_W); + vec3 weatherSky = weatherCol.rgb * weatherCol.rgb * weatherExposure; + weatherSky *= GetLuminance(ambientCol / (weatherSky)) * (0.2 * sunVisibility + 0.2); + sky = mix(sky, weatherSky * rainGradient, rainStrength); + + sky *= ground; + + #ifdef UNDERGROUND_SKY + float ug = mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS); + sky = mix(minLightCol * 0.125, sky, ug); + #endif + + // sky *= voidFade; + #if MC_VERSION >= 11800 + sky *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0); + #else + sky *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0); + #endif + + return sky; +} + +#endif \ No newline at end of file diff --git a/shaders/lib/atmospherics/sunmoon.glsl b/shaders/lib/atmospherics/sunmoon.glsl new file mode 100644 index 0000000..a8645a3 --- /dev/null +++ b/shaders/lib/atmospherics/sunmoon.glsl @@ -0,0 +1,85 @@ +void RoundSunMoon(inout vec3 color, vec3 viewPos, vec3 sunColor, vec3 moonColor) { + vec3 nViewPos = normalize(viewPos); + + float VoL = dot(nViewPos, sunVec); + float VoU = dot(nViewPos, upVec); + + if (VoU < -0.1) { + return; + } + + float isMoon = float(VoL < 0.0); + + float sunMoonSize = (0.007 - 0.004 * isMoon) * ROUND_SUN_MOON_SIZE; + + float sun = pow(smoothstep(1.0 - sunMoonSize, 1.0, abs(VoL)), 3.0); + float miniGlare = pow(abs(VoL), 192.0 + 64.0 * isMoon) * (0.05 - 0.04 * isMoon); + + float sunFade = smoothstep(0.0, 1.0, 1.0 - pow(1.0 - max(VoU * 0.98 + 0.02, 0.0), 8.0)); + float glareFade = smoothstep(0.0, 1.0, 1.0 - pow(1.0 - max(VoU * 0.93 + 0.07, 0.0), 8.0)); + float rainVisibility = 1.0 - sqrt(rainStrength); + + vec3 moonNormal = vec3(0.0); + + if (sun > 0.0 && isMoon > 0.5 && moonPhase > 0) { + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle + 0.0001 - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + + vec3 nextSunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + vec3 sunTangent = normalize(nextSunVec - sunVec); + vec3 sunBinormal = -cross(sunVec, sunTangent); + + float VoLt = dot(nViewPos, sunTangent); + float VoLb = dot(nViewPos, sunBinormal); + + float rad = 0.08 * sqrt(ROUND_SUN_MOON_SIZE); + + float moonNormalX = clamp(VoLt / rad, -1.0, 1.0); + float moonNormalY = clamp(VoLb / rad, -1.0, 1.0); + float moonNormalZ = sqrt(1.0 - moonNormalX * moonNormalX - moonNormalY * moonNormalY); + moonNormal = vec3(moonNormalX, moonNormalY, moonNormalZ); + if (sun > 0.0 && (moonNormalX * moonNormalX + moonNormalY * moonNormalY) > 1) color.r += 8.0; + + vec3 moonPhaseVec = moonPhaseVecs[moonPhase]; + float moonPhase = smoothstep(moonDiffuse[moonPhase].x, moonDiffuse[moonPhase].y, dot(moonNormal, moonPhaseVec)); + float glaremoonPhase = (1.0 - moonPhase) * pow(sun,0.25); + sun *= moonPhase; + miniGlare *= 1.0 - glaremoonPhase; + } + + sun *= sunFade * rainVisibility; + miniGlare *= glareFade * rainVisibility; + + float sunColorPower = pow(1.0 - max(VoU, 0.0), 16.0) * 4.0 * sunVisibility + 1.0; + + vec3 sunCol = pow(sunColor, vec3(sunColorPower)) * sunVisibility * SUN_INTENSITY * SUN_INTENSITY; + vec3 moonCol = moonColor * moonVisibility * MOON_INTENSITY * MOON_INTENSITY; + vec3 sunMoonCol = mix(sunCol, moonCol, isMoon); + + color += (sun + miniGlare) * sunMoonCol * 4.0; +} + +void SunGlare(inout vec3 color, vec3 viewPos, vec3 lightCol) { + float VoL = dot(normalize(viewPos), lightVec); + float visfactor = 0.05 * (-0.8 * timeBrightness + 1.0) * (3.0 * rainStrength + 1.0); + float invvisfactor = 1.0 - visfactor; + + float visibility = clamp(VoL * 0.5 + 0.5, 0.0, 1.0); + visibility = visfactor / (1.0 - invvisfactor * visibility) - visfactor; + visibility = clamp(visibility * 1.015 / invvisfactor - 0.015, 0.0, 1.0); + visibility = mix(1.0, visibility, 0.03125 * eBS + 0.96875) * (1.0 - rainStrength * eBS * 0.875); + visibility *= shadowFade * LIGHT_SHAFT_STRENGTH; + //visibility *= voidFade; + #if MC_VERSION >= 11800 + visibility *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0); + #else + visibility *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0); + #endif + + #ifdef LIGHT_SHAFT + if (isEyeInWater == 1) color += 0.25 * lightCol * visibility; + #else + color += 0.25 * lightCol * visibility * (1.0 + 0.25 * isEyeInWater); + #endif +} \ No newline at end of file diff --git a/shaders/lib/atmospherics/volumetricLight.glsl b/shaders/lib/atmospherics/volumetricLight.glsl new file mode 100644 index 0000000..0585b7c --- /dev/null +++ b/shaders/lib/atmospherics/volumetricLight.glsl @@ -0,0 +1,162 @@ +float GetLogarithmicDepth(float dist) { + return (far * (dist - near)) / (dist * (far - near)); +} + +float GetLinearDepth2(float depth) { + return 2.0 * near * far / (far + near - (2.0 * depth - 1.0) * (far - near)); +} + +vec4 DistortShadow(vec4 shadowpos, float distortFactor) { + shadowpos.xy *= 1.0 / distortFactor; + shadowpos.z = shadowpos.z * 0.2; + shadowpos = shadowpos * 0.5 + 0.5; + + return shadowpos; +} + +vec4 GetWorldSpace(float shadowdepth, vec2 texCoord) { + vec4 viewPos = gbufferProjectionInverse * (vec4(texCoord, shadowdepth, 1.0) * 2.0 - 1.0); + viewPos /= viewPos.w; + + vec4 wpos = gbufferModelViewInverse * viewPos; + wpos /= wpos.w; + + return wpos; +} + +vec4 GetShadowSpace(vec4 wpos) { + wpos = shadowModelView * wpos; + wpos = shadowProjection * wpos; + wpos /= wpos.w; + + float distb = sqrt(wpos.x * wpos.x + wpos.y * wpos.y); + float distortFactor = 1.0 - shadowMapBias + distb * shadowMapBias; + wpos = DistortShadow(wpos,distortFactor); + + return wpos; +} + +//Light shafts from Robobo1221 (modified) +vec3 GetLightShafts(float pixeldepth0, float pixeldepth1, vec3 color, float dither) { + vec3 vl = vec3(0.0); + + #ifdef TAA + #if TAA_MODE == 0 + dither = fract(dither + frameCounter * 0.618); + #else + dither = fract(dither + frameCounter * 0.5); + #endif + #endif + + vec3 screenPos = vec3(texCoord, pixeldepth0); + vec4 viewPos = gbufferProjectionInverse * (vec4(screenPos, 1.0) * 2.0 - 1.0); + viewPos /= viewPos.w; + + vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + float VoL = dot(normalize(viewPos.xyz), lightVec); + + #ifdef OVERWORLD + float visfactor = 0.05 * (-0.8 * timeBrightness + 1.0) * (3.0 * rainStrength + 1.0); + float invvisfactor = 1.0 - visfactor; + + float visibility = clamp(VoL * 0.5 + 0.5, 0.0, 1.0); + visibility = visfactor / (1.0 - invvisfactor * visibility) - visfactor; + visibility = clamp(visibility * 1.015 / invvisfactor - 0.015, 0.0, 1.0); + visibility = mix(1.0, visibility, 0.03125 * eBS + 0.96875); + #endif + + #ifdef END + VoL = pow(VoL * 0.5 + 0.5, 16.0) * 0.75 + 0.25; + float visibility = VoL; + #endif + + visibility *= 0.14285 * float(pixeldepth0 > 0.56); + + if (visibility > 0.0) { + float maxDist = 128.0; + + float depth0 = GetLinearDepth2(pixeldepth0); + float depth1 = GetLinearDepth2(pixeldepth1); + vec4 worldposition = vec4(0.0); + vec4 shadowposition = vec4(0.0); + + vec3 watercol = mix(vec3(1.0), + waterColor.rgb / (waterColor.a * waterColor.a), + pow(waterAlpha, 0.25)); + + for(int i = 0; i < 7; i++) { + float minDist = exp2(i + dither) - 0.95; + if (minDist >= maxDist) break; + + if (depth1 < minDist || (depth0 < minDist && color == vec3(0.0))) { + break; + } + + worldposition = GetWorldSpace(GetLogarithmicDepth(minDist), texCoord.st); + shadowposition = GetShadowSpace(worldposition); + shadowposition.z += 0.0512 / shadowMapResolution; + + if (length(shadowposition.xy * 2.0 - 1.0) < 1.0) { + float shadow0 = shadow2D(shadowtex0, shadowposition.xyz).z; + + vec3 shadowCol = vec3(0.0); + #ifdef SHADOW_COLOR + if (shadow0 < 1.0) { + float shadow1 = shadow2D(shadowtex1, shadowposition.xyz).z; + if (shadow1 > 0.0) { + shadowCol = texture2D(shadowcolor0, shadowposition.xy).rgb; + shadowCol *= shadowCol * shadow1; + #ifdef WATER_CAUSTICS + shadowCol *= 16.0 - 15.0 * (1.0 - (1.0 - shadow0) * (1.0 - shadow0)); + #endif + } + } + #endif + + shadow0 *= shadow0; + shadowCol *= shadowCol; + + vec3 shadow = clamp(shadowCol * (1.0 - shadow0) + shadow0, vec3(0.0), vec3(16.0)); + + if (depth0 < minDist) shadow *= color; + else if (isEyeInWater == 1.0) { + #ifdef WATER_SHADOW_COLOR + shadow *= 0.125 * (1.0 + eBS); + #else + shadow *= watercol * 0.01 * (1.0 + eBS); + #endif + } + + #ifdef END + vec3 npos = worldposition.xyz + cameraPosition.xyz + vec3(frametime * 4.0, 0, 0); + float n3da = texture2D(noisetex, npos.xz / 512.0 + floor(npos.y / 3.0) * 0.35).r; + float n3db = texture2D(noisetex, npos.xz / 512.0 + floor(npos.y / 3.0 + 1.0) * 0.35).r; + float noise = mix(n3da, n3db, fract(npos.y / 3.0)); + noise = sin(noise * 28.0 + frametime * 4.0) * 0.25 + 0.5; + shadow *= noise; + #endif + + vl += shadow; + } + else{ + vl += 1.0; + } + } + + //vl *= voidFade; + #if MC_VERSION >= 11800 + vl *= clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0); + #else + vl *= clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0); + #endif + + #ifdef UNDERGROUND_SKY + vl *= mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS); + #endif + + vl = sqrt(vl * visibility); + if(dot(vl, vl) > 0.0) vl += (dither - 0.25) / 128.0; + } + + return vl; +} \ No newline at end of file diff --git a/shaders/lib/atmospherics/waterFog.glsl b/shaders/lib/atmospherics/waterFog.glsl new file mode 100644 index 0000000..369f0be --- /dev/null +++ b/shaders/lib/atmospherics/waterFog.glsl @@ -0,0 +1,28 @@ +#if (WATER_MODE == 1 || WATER_MODE == 3) && !defined SKY_VANILLA && (!defined NETHER || !defined NETHER_VANILLA) +uniform vec3 fogColor; +#endif + +vec4 GetWaterFog(vec3 viewPos) { + float fog = length(viewPos) / waterFogRange; + fog = 1.0 - exp(-2.0 * fog); + + #if WATER_MODE == 0 || WATER_MODE == 2 + vec3 waterFogColor = waterColor.rgb * waterColor.a; + #elif WATER_MODE == 1 || WATER_MODE == 3 + vec3 waterFogColor = fogColor * fogColor * 0.125; + #endif + waterFogColor *= WATER_F * WATER_F * (1.0 - max(blindFactor, darknessFactor)); + + #ifdef OVERWORLD + vec3 waterFogTint = lightCol * eBS * shadowFade * 0.9 + 0.1; + #endif + #ifdef NETHER + vec3 waterFogTint = netherCol.rgb; + #endif + #ifdef END + vec3 waterFogTint = endCol.rgb; + #endif + waterFogTint = sqrt(waterFogTint * length(waterFogTint)); + + return vec4(waterFogColor * waterFogTint, fog); +} \ No newline at end of file diff --git a/shaders/lib/atmospherics/weatherDensity.glsl b/shaders/lib/atmospherics/weatherDensity.glsl new file mode 100644 index 0000000..f76a259 --- /dev/null +++ b/shaders/lib/atmospherics/weatherDensity.glsl @@ -0,0 +1,14 @@ +#if defined WEATHER_PERBIOME && defined OVERWORLD +float fogDensity = FOG_DENSITY * mix( + 1.0, + ( + FOG_DENSITY_COLD * isCold + + FOG_DENSITY_DRY * (isDesert + isMesa + isSavanna) + + FOG_DENSITY_DAMP * (isSwamp + isMushroom + isJungle) + ) / max(weatherWeight, 0.0001), + weatherWeight +); + +#else +float fogDensity = FOG_DENSITY; +#endif \ No newline at end of file diff --git a/shaders/lib/color/auroraColor.glsl b/shaders/lib/color/auroraColor.glsl new file mode 100644 index 0000000..f34dff0 --- /dev/null +++ b/shaders/lib/color/auroraColor.glsl @@ -0,0 +1,4 @@ +vec3 auroraLowColSqrt = vec3(AURORA_LR, AURORA_LG, AURORA_LB) * AURORA_LI / 255.0; +vec3 auroraLowCol = auroraLowColSqrt * auroraLowColSqrt; +vec3 auroraHighColSqrt = vec3(AURORA_HR, AURORA_HG, AURORA_HB) * AURORA_HI / 255.0; +vec3 auroraHighCol = auroraHighColSqrt * auroraHighColSqrt; \ No newline at end of file diff --git a/shaders/lib/color/blocklightColor.glsl b/shaders/lib/color/blocklightColor.glsl new file mode 100644 index 0000000..eda5607 --- /dev/null +++ b/shaders/lib/color/blocklightColor.glsl @@ -0,0 +1,2 @@ +vec3 blocklightColSqrt = vec3(BLOCKLIGHT_R, BLOCKLIGHT_G, BLOCKLIGHT_B) * BLOCKLIGHT_I / 255.0; +vec3 blocklightCol = blocklightColSqrt * blocklightColSqrt; \ No newline at end of file diff --git a/shaders/lib/color/dimensionColor.glsl b/shaders/lib/color/dimensionColor.glsl new file mode 100644 index 0000000..012b406 --- /dev/null +++ b/shaders/lib/color/dimensionColor.glsl @@ -0,0 +1,14 @@ +#ifdef OVERWORLD +#include "lightColor.glsl" +#endif + +#ifdef NETHER +#include "netherColor.glsl" +#endif + +#ifdef END +#include "endColor.glsl" +#endif + +vec3 minLightColSqrt = vec3(MINLIGHT_R, MINLIGHT_G, MINLIGHT_B) * MINLIGHT_I / 255.0; +vec3 minLightCol = minLightColSqrt * minLightColSqrt * 0.04; \ No newline at end of file diff --git a/shaders/lib/color/endColor.glsl b/shaders/lib/color/endColor.glsl new file mode 100644 index 0000000..316f0ff --- /dev/null +++ b/shaders/lib/color/endColor.glsl @@ -0,0 +1,2 @@ +vec4 endColSqrt = vec4(vec3(END_R, END_G, END_B) / 255.0, 1.0) * END_I; +vec4 endCol = endColSqrt * endColSqrt; \ No newline at end of file diff --git a/shaders/lib/color/lightColor.glsl b/shaders/lib/color/lightColor.glsl new file mode 100644 index 0000000..5c5d3b1 --- /dev/null +++ b/shaders/lib/color/lightColor.glsl @@ -0,0 +1,69 @@ +vec3 lightMorning = vec3(LIGHT_MR, LIGHT_MG, LIGHT_MB) * LIGHT_MI / 255.0; +vec3 lightDay = vec3(LIGHT_DR, LIGHT_DG, LIGHT_DB) * LIGHT_DI / 255.0; +vec3 lightEvening = vec3(LIGHT_ER, LIGHT_EG, LIGHT_EB) * LIGHT_EI / 255.0; +vec3 lightNight = vec3(LIGHT_NR, LIGHT_NG, LIGHT_NB) * LIGHT_NI * 0.3 / 255.0; + +vec3 ambientMorning = vec3(AMBIENT_MR, AMBIENT_MG, AMBIENT_MB) * AMBIENT_MI / 255.0; +vec3 ambientDay = vec3(AMBIENT_DR, AMBIENT_DG, AMBIENT_DB) * AMBIENT_DI / 255.0; +vec3 ambientEvening = vec3(AMBIENT_ER, AMBIENT_EG, AMBIENT_EB) * AMBIENT_EI / 255.0; +vec3 ambientNight = vec3(AMBIENT_NR, AMBIENT_NG, AMBIENT_NB) * AMBIENT_NI * 0.3 / 255.0; + +#ifdef WEATHER_PERBIOME +uniform float isDesert, isMesa, isCold, isSwamp, isMushroom, isSavanna, isJungle; + +vec4 weatherRain = vec4(vec3(WEATHER_RR, WEATHER_RG, WEATHER_RB) / 255.0, 1.0) * WEATHER_RI; +vec4 weatherCold = vec4(vec3(WEATHER_CR, WEATHER_CG, WEATHER_CB) / 255.0, 1.0) * WEATHER_CI; +vec4 weatherDesert = vec4(vec3(WEATHER_DR, WEATHER_DG, WEATHER_DB) / 255.0, 1.0) * WEATHER_DI; +vec4 weatherBadlands = vec4(vec3(WEATHER_BR, WEATHER_BG, WEATHER_BB) / 255.0, 1.0) * WEATHER_BI; +vec4 weatherSwamp = vec4(vec3(WEATHER_SR, WEATHER_SG, WEATHER_SB) / 255.0, 1.0) * WEATHER_SI; +vec4 weatherMushroom = vec4(vec3(WEATHER_MR, WEATHER_MG, WEATHER_MB) / 255.0, 1.0) * WEATHER_MI; +vec4 weatherSavanna = vec4(vec3(WEATHER_VR, WEATHER_VG, WEATHER_VB) / 255.0, 1.0) * WEATHER_VI; +vec4 weatherJungle = vec4(vec3(WEATHER_JR, WEATHER_JG, WEATHER_JB) / 255.0, 1.0) * WEATHER_JI; + +float weatherWeight = isCold + isDesert + isMesa + isSwamp + isMushroom + isSavanna + isJungle; + +vec4 weatherCol = mix( + weatherRain, + ( + weatherCold * isCold + weatherDesert * isDesert + weatherBadlands * isMesa + + weatherSwamp * isSwamp + weatherMushroom * isMushroom + weatherSavanna * isSavanna + + weatherJungle * isJungle + ) / max(weatherWeight, 0.0001), + weatherWeight +); + +#else +vec4 weatherCol = vec4(vec3(WEATHER_RR, WEATHER_RG, WEATHER_RB) / 255.0, 1.0) * WEATHER_RI; +#endif + +float mefade = 1.0 - clamp(abs(timeAngle - 0.5) * 8.0 - 1.5, 0.0, 1.0); +float dfade = 1.0 - pow(1.0 - timeBrightness, 1.5); + +vec3 CalcSunColor(vec3 morning, vec3 day, vec3 evening) { + vec3 me = mix(morning, evening, mefade); + return mix(me, day, dfade); +} + +vec3 CalcLightColor(vec3 sun, vec3 night, vec3 weatherCol) { + vec3 c = mix(night, sun, sunVisibility); + c = mix(c, dot(c, vec3(0.299, 0.587, 0.114)) * weatherCol, rainStrength); + return c * c; +} + +vec3 lightSun = mix(mix(lightMorning, lightEvening, mefade), lightDay, dfade); + +vec3 ambientSun = mix(mix(ambientMorning, ambientEvening, mefade), ambientDay, dfade); + +vec3 lightColRaw = mix(lightNight, lightSun, sunVisibility); +vec3 lightColSqrt = mix(lightColRaw, dot(lightColRaw, vec3(0.299, 0.587, 0.114)) * weatherCol.rgb, rainStrength); +vec3 lightCol = lightColSqrt * lightColSqrt; + +vec3 ambientColRaw = mix(ambientNight, ambientSun, sunVisibility); +vec3 ambientColSqrt = mix(ambientColRaw, dot(ambientColRaw, vec3(0.299, 0.587, 0.114)) * weatherCol.rgb, rainStrength); +vec3 ambientCol = ambientColSqrt * ambientColSqrt; + +// vec3 lightSun = CalcSunColor(lightMorning, lightDay, lightEvening); +// vec3 ambientSun = CalcSunColor(ambientMorning, ambientDay, ambientEvening); + +// vec3 lightCol = CalcLightColor(lightSun, lightNight, weatherCol.rgb); +// vec3 ambientCol = CalcLightColor(ambientSun, ambientNight, weatherCol.rgb); \ No newline at end of file diff --git a/shaders/lib/color/netherColor.glsl b/shaders/lib/color/netherColor.glsl new file mode 100644 index 0000000..56b69d1 --- /dev/null +++ b/shaders/lib/color/netherColor.glsl @@ -0,0 +1,28 @@ +vec4 netherNether = vec4(vec3(NETHER_NR, NETHER_NG, NETHER_NB) / 255.0, 1.0) * NETHER_NI; +vec4 netherValley = vec4(vec3(NETHER_VR, NETHER_VG, NETHER_VB) / 255.0, 1.0) * NETHER_VI; +vec4 netherCrimson = vec4(vec3(NETHER_CR, NETHER_CG, NETHER_CB) / 255.0, 1.0) * NETHER_CI; +vec4 netherWarped = vec4(vec3(NETHER_WR, NETHER_WG, NETHER_WB) / 255.0, 1.0) * NETHER_WI; +vec4 netherBasalt = vec4(vec3(NETHER_BR, NETHER_BG, NETHER_BB) / 255.0, 1.0) * NETHER_BI; + +#ifdef NETHER_VANILLA +uniform vec3 fogColor; +vec4 netherColSqrt = vec4(normalize(fogColor + 0.0001), length(fogColor)); +#else +#ifdef WEATHER_PERBIOME +uniform float isValley, isCrimson, isWarped, isBasalt; +float nBiomeWeight = isValley + isCrimson + isWarped + isBasalt; + +vec4 netherColSqrt = mix( + netherNether, + ( + netherValley * isValley + netherCrimson * isCrimson + + netherWarped * isWarped + netherBasalt * isBasalt + ) / max(nBiomeWeight, 0.0001), + nBiomeWeight +); +#else +vec4 netherColSqrt = netherNether; +#endif +#endif + +vec4 netherCol = netherColSqrt * netherColSqrt; \ No newline at end of file diff --git a/shaders/lib/color/skyColor.glsl b/shaders/lib/color/skyColor.glsl new file mode 100644 index 0000000..43dab0f --- /dev/null +++ b/shaders/lib/color/skyColor.glsl @@ -0,0 +1,15 @@ +#ifdef SKY_VANILLA +uniform vec3 skyColor; +uniform vec3 fogColor; + +vec3 skyCol = pow(skyColor, vec3(2.2)) * SKY_I * SKY_I; +#ifdef SKY_VANILLA_USE_FOG +vec3 fogCol = pow(fogColor, vec3(2.2)) * SKY_I * SKY_I; +#else +vec3 fogCol = skyCol; +#endif +#else +vec3 skyColSqrt = vec3(SKY_R, SKY_G, SKY_B) * SKY_I / 255.0; +vec3 skyCol = skyColSqrt * skyColSqrt; +vec3 fogCol = skyCol; +#endif \ No newline at end of file diff --git a/shaders/lib/color/specularColor.glsl b/shaders/lib/color/specularColor.glsl new file mode 100644 index 0000000..9798c24 --- /dev/null +++ b/shaders/lib/color/specularColor.glsl @@ -0,0 +1,32 @@ +vec3 GetMetalCol(float f0) { + int metalidx = int(f0 * 255.0); + + if (metalidx == 230) return vec3(0.24867, 0.22965, 0.21366); + if (metalidx == 231) return vec3(0.88140, 0.57256, 0.11450); + if (metalidx == 232) return vec3(0.81715, 0.82021, 0.83177); + if (metalidx == 233) return vec3(0.27446, 0.27330, 0.27357); + if (metalidx == 234) return vec3(0.84430, 0.48677, 0.22164); + if (metalidx == 235) return vec3(0.36501, 0.35675, 0.37653); + if (metalidx == 236) return vec3(0.42648, 0.37772, 0.31138); + if (metalidx == 237) return vec3(0.91830, 0.89219, 0.83662); + return vec3(1.0); +} + +vec3 GetSpecularColor(float skylight, float metalness, vec3 baseReflectance){ + vec3 specularColor = vec3(0.0); + #ifdef OVERWORLD + vec3 lightME = mix(lightMorning, lightEvening, mefade); + vec3 lightDaySpec = mix(sqrt(lightME), sqrt(lightDay), dfade * 0.7); + vec3 lightNightSpec = sqrt(lightNight * LIGHT_NI * 0.2); + specularColor = mix(lightNightSpec, lightDaySpec * lightDaySpec, sunVisibility); + specularColor *= specularColor * skylight; + #endif + #ifdef END + specularColor = endCol.rgb * 0.35; + #endif + + specularColor = pow(specularColor, vec3(1.0 - 0.5 * metalness)) * + pow(max(length(specularColor), 0.0001), 0.5 * metalness); + + return specularColor; +} \ No newline at end of file diff --git a/shaders/lib/color/waterColor.glsl b/shaders/lib/color/waterColor.glsl new file mode 100644 index 0000000..3323090 --- /dev/null +++ b/shaders/lib/color/waterColor.glsl @@ -0,0 +1,5 @@ +vec4 waterColorSqrt = vec4(vec3(WATER_R, WATER_G, WATER_B) / 255.0, 1.0) * WATER_I; +vec4 waterColor = waterColorSqrt * waterColorSqrt; + +const float waterAlpha = WATER_A; +const float waterFogRange = 64.0 / WATER_FOG_DENSITY; \ No newline at end of file diff --git a/shaders/lib/lighting/ambientOcclusion.glsl b/shaders/lib/lighting/ambientOcclusion.glsl new file mode 100644 index 0000000..9894917 --- /dev/null +++ b/shaders/lib/lighting/ambientOcclusion.glsl @@ -0,0 +1,95 @@ +vec2 OffsetDist(float x) { + float n = fract(x * 8.0) * 3.1415; + return vec2(cos(n), sin(n)) * x; +} + +float AmbientOcclusion(float dither) { + float ao = 0.0; + + float depth = texture2D(depthtex0, texCoord).r; + if(depth >= 1.0) return 1.0; + + float hand = float(depth < 0.56); + depth = GetLinearDepth(depth); + + #ifdef TAA + #if TAA_MODE == 0 + dither = fract(dither + frameCounter * 0.618); + #else + dither = fract(dither + frameCounter * 0.5); + #endif + #endif + + float currentStep = 0.198 * dither + 0.01; + + float radius = 0.5; + float fovScale = gbufferProjection[1][1] / 1.37; + float distScale = max((far - near) * depth + near, 5.0); + vec2 scale = radius * vec2(1.0 / aspectRatio, 1.0) * fovScale / distScale; + float mult = (0.7 / radius) * (far - near) * (hand > 0.5 ? 1024.0 : 1.0); + + for(int i = 0; i < 5; i++) { + vec2 offset = OffsetDist(currentStep) * scale; + float angle = 0.0, dist = 0.0; + + for(int i = 0; i < 2; i++){ + float sampleDepth = GetLinearDepth(texture2D(depthtex0, texCoord + offset).r); + float aoSample = (depth - sampleDepth) * mult / currentStep; + angle += clamp(0.5 - aoSample, 0.0, 1.0); + dist += clamp(0.25 * aoSample - 1.0, 0.0, 1.0); + offset = -offset; + } + + ao += clamp(angle + dist, 0.0, 1.0); + currentStep += 0.198; + } + ao *= 0.2; + + return ao; +} + +#ifdef DISTANT_HORIZONS +float DHAmbientOcclusion(float dither) { + float ao = 0.0; + + float depth = texture2D(dhDepthTex0, texCoord).r; + if(depth >= 1.0) return 1.0; + + depth = GetDHLinearDepth(depth); + + #ifdef TAA + #if TAA_MODE == 0 + dither = fract(dither + frameCounter * 0.618); + #else + dither = fract(dither + frameCounter * 0.5); + #endif + #endif + + float currentStep = 0.198 * dither + 0.01; + + float radius = 4.0; + float fovScale = gbufferProjection[1][1] / 1.37; + float distScale = max((dhFarPlane - dhNearPlane) * depth + dhNearPlane, 5.0); + vec2 scale = radius * vec2(1.0 / aspectRatio, 1.0) * fovScale / distScale; + float mult = (0.7 / radius) * (dhFarPlane - dhNearPlane); + + for(int i = 0; i < 5; i++) { + vec2 offset = OffsetDist(currentStep) * scale; + float angle = 0.0, dist = 0.0; + + for(int i = 0; i < 2; i++){ + float sampleDepth = GetDHLinearDepth(texture2D(dhDepthTex0, texCoord + offset).r); + float aoSample = (depth - sampleDepth) * mult / currentStep; + angle += clamp(0.5 - aoSample, 0.0, 1.0); + dist += clamp(0.25 * aoSample - 1.0, 0.0, 1.0); + offset = -offset; + } + + ao += clamp(angle + dist, 0.0, 1.0); + currentStep += 0.198; + } + ao *= 0.2; + + return ao; +} +#endif \ No newline at end of file diff --git a/shaders/lib/lighting/coloredBlocklight.glsl b/shaders/lib/lighting/coloredBlocklight.glsl new file mode 100644 index 0000000..8278985 --- /dev/null +++ b/shaders/lib/lighting/coloredBlocklight.glsl @@ -0,0 +1,35 @@ +vec2 Reprojection(vec3 pos) { + pos = pos * 2.0 - 1.0; + + vec4 viewPosPrev = gbufferProjectionInverse * vec4(pos, 1.0); + viewPosPrev /= viewPosPrev.w; + viewPosPrev = gbufferModelViewInverse * viewPosPrev; + + vec3 cameraOffset = cameraPosition - previousCameraPosition; + cameraOffset *= float(pos.z > 0.56); + + vec4 previousPosition = viewPosPrev + vec4(cameraOffset, 0.0); + previousPosition = gbufferPreviousModelView * previousPosition; + previousPosition = gbufferPreviousProjection * previousPosition; + return previousPosition.xy / previousPosition.w * 0.5 + 0.5; +} + +vec3 ApplyMultiColoredBlocklight(vec3 blocklightCol, vec3 screenPos) { + if (screenPos.z > 0.56) { + screenPos.xy = Reprojection(screenPos); + } + vec3 coloredLight = texture2DLod(colortex9, screenPos.xy, 2).rgb; + + #ifndef MCBL_LEGACY_COLOR + vec3 coloredLightNormalized = coloredLight + 0.000001; + coloredLightNormalized = normalize(coloredLightNormalized * coloredLightNormalized) * 0.875 + 0.125; + coloredLightNormalized *= GetLuminance(blocklightCol) * 1.7; + float coloredLightMix = min((coloredLight.r + coloredLight.g + coloredLight.b) * 2048.0, 1.0); + #else + vec3 coloredLightNormalized = normalize(coloredLight + 0.00001); + coloredLightNormalized *= GetLuminance(blocklightCol) / GetLuminance(coloredLightNormalized); + float coloredLightMix = min((coloredLight.r + coloredLight.g + coloredLight.b) * 256.0, 1.0); + #endif + + return mix(blocklightCol, coloredLightNormalized, coloredLightMix); +} \ No newline at end of file diff --git a/shaders/lib/lighting/forwardLighting.glsl b/shaders/lib/lighting/forwardLighting.glsl new file mode 100644 index 0000000..788c855 --- /dev/null +++ b/shaders/lib/lighting/forwardLighting.glsl @@ -0,0 +1,153 @@ +#if defined OVERWORLD || defined END +#include "/lib/lighting/shadows.glsl" +#endif + +void GetLighting(inout vec3 albedo, out vec3 shadow, vec3 viewPos, vec3 worldPos, vec3 normal, + vec2 lightmap, float smoothLighting, float NoL, float vanillaDiffuse, + float parallaxShadow, float emission, float subsurface, float basicSubsurface) { + #if EMISSIVE == 0 || (!defined ADVANCED_MATERIALS && EMISSIVE == 1) + emission = 0.0; + #endif + + #ifndef SSS + subsurface = 0.0; + #endif + + #ifndef BASIC_SSS + basicSubsurface = 0.0; + #endif + + #if defined OVERWORLD || defined END + #ifdef SHADOW + if (NoL > 0.0 || basicSubsurface > 0.0) { + shadow = GetShadow(worldPos, normal, NoL, basicSubsurface, lightmap.y); + } + shadow *= parallaxShadow; + shadow = max(shadow, vec3(0.0)); + NoL = clamp(NoL * 1.01 - 0.01, 0.0, 1.0); + #else + shadow = GetShadow(worldPos, normal, NoL, basicSubsurface, lightmap.y); + #endif + + #ifdef SHADOW_CLOUD + float cloudShadow = GetCloudShadow(worldPos); + shadow *= cloudShadow; + #endif + + float scattering = 0.0; + if (basicSubsurface > 0.0){ + float VoL = clamp(dot(normalize(viewPos.xyz), lightVec) * 0.5 + 0.5, 0.0, 1.0); + scattering = pow(VoL, 16.0) * (1.0 - rainStrength) * basicSubsurface * shadowFade; + NoL = mix(NoL, 1.0, sqrt(basicSubsurface) * 0.7); + NoL = mix(NoL, 1.0, scattering); + } + + #ifdef SHADOW + vec3 fullShadow = max(shadow * NoL, vec3(0.0)); + #else + vec3 fullShadow = vec3(shadow); + #ifdef OVERWORLD + float timeBrightnessAbs = abs(sin(timeAngle * 6.28318530718)); + fullShadow *= 0.25 + 0.5 * (1.0 - (1.0 - timeBrightnessAbs) * (1.0 - timeBrightnessAbs)); + fullShadow *= mix(pow(vanillaDiffuse, 1.0 + timeBrightnessAbs), 1.0, basicSubsurface * 0.4); + #else + fullShadow *= 0.75; + #endif + #endif + + #ifdef ADVANCED_MATERIALS + if (subsurface > 0.0){ + vec3 subsurfaceShadow = GetSubsurfaceShadow(worldPos, subsurface, lightmap.y); + + float VoL = clamp(dot(normalize(viewPos.xyz), lightVec) * 0.5 + 0.5, 0.0, 1.0); + float scattering = pow(VoL, 16.0) * (1.0 - rainStrength) * shadowFade; + + vec3 subsurfaceColor = normalize(albedo + 0.00001) * 1.2; + subsurfaceColor = mix(subsurfaceColor, vec3(1.0), pow(subsurfaceShadow, vec3(4.0))); + subsurfaceColor = mix(subsurfaceColor, vec3(4.0), scattering) * sqrt(subsurface); + + fullShadow = mix(subsurfaceColor * subsurfaceShadow, vec3(1.0), fullShadow); + } + #endif + + #ifdef OVERWORLD + float shadowMult = (1.0 - 0.95 * rainStrength) * shadowFade; + vec3 sceneLighting = mix(ambientCol * lightmap.y, lightCol, fullShadow * shadowMult); + sceneLighting *= lightmap.y * lightmap.y * (1.0 + scattering * shadow); + + #ifdef CLASSIC_EXPOSURE + sceneLighting *= 4.0 - 3.0 * eBS; + #endif + #endif + + #ifdef END + vec3 sceneLighting = endCol.rgb * (0.04 * fullShadow + 0.015); + #endif + + #else + vec3 sceneLighting = netherColSqrt.rgb * 0.07; + #endif + + float newLightmap = pow(lightmap.x, 10.0) * 1.6 + lightmap.x * 0.6; + vec3 blockLighting = blocklightCol * newLightmap * newLightmap; + + vec3 minLighting = minLightCol * (1.0 - lightmap.y * lightmap.y); + + #ifdef TOON_LIGHTMAP + minLighting *= floor(smoothLighting * 8.0 + 1.001) / 4.0; + smoothLighting = 1.0; + #endif + + vec3 albedoNormalized = normalize(albedo.rgb + 0.00001); + vec3 emissiveLighting = mix(albedoNormalized, vec3(1.0), emission * 0.5); + emissiveLighting *= emission * 4.0; + + float lightFlatten = clamp(1.0 - pow(1.0 - emission, 128.0), 0.0, 1.0); + vanillaDiffuse = mix(vanillaDiffuse, 1.0, lightFlatten); + smoothLighting = mix(smoothLighting, 1.0, lightFlatten); + + float nightVisionLighting = nightVision * 0.25; + + #ifdef ALBEDO_BALANCING + float albedoLength = length(albedo.rgb); + albedoLength /= sqrt((albedoLength * albedoLength) * 0.25 * (1.0 - lightFlatten) + 1.0); + albedo.rgb = albedoNormalized * albedoLength; + #endif + + //albedo = vec3(0.5); + albedo *= max(sceneLighting + blockLighting + emissiveLighting + nightVisionLighting + minLighting, vec3(0.0)); + albedo *= vanillaDiffuse * smoothLighting * smoothLighting; + + #ifdef DESATURATION + #ifdef OVERWORLD + float desatAmount = 1.0 - sqrt(max(sqrt(length(fullShadow / 3.0)) * lightmap.y, lightmap.y)) * + sunVisibility * (1.0 - rainStrength * 0.7); + desatAmount*= smoothstep(0.25, 1.0, (1.0 - lightmap.x) * (1.0 - lightmap.x)) * (1.0 - lightFlatten); + desatAmount = 1.0 - desatAmount; + + vec3 desatNight = normalize(lightNight * lightNight + 0.000001); + vec3 desatWeather = normalize(weatherCol.rgb * weatherCol.rgb + 0.000001); + + float desatNWMix = (1.0 - sunVisibility) * (1.0 - rainStrength); + + vec3 desatColor = mix(desatWeather, desatNight, desatNWMix); + desatColor = mix(vec3(0.4), desatColor, sqrt(lightmap.y)) * 1.7; + #endif + + #ifdef NETHER + float desatAmount = 1.0 - smoothstep(0.25, 1.0, (1.0 - lightmap.x) * (1.0 - lightmap.x)) * (1.0 - lightFlatten); + + vec3 desatColor = normalize(netherColSqrt.rgb + 0.000001) * 1.7; + #endif + + #ifdef END + float desatAmount = 1.0 - smoothstep(0.25, 1.0, (1.0 - lightmap.x) * (1.0 - lightmap.x)) * (1.0 - lightFlatten); + + vec3 desatColor = normalize(endCol.rgb + 0.000001) * 1.7; + #endif + + vec3 desatAlbedo = mix(albedo, GetLuminance(albedo) * desatColor, 1.0 - DESATURATION_FACTOR * 0.4); + + albedo = mix(desatAlbedo, albedo, desatAmount); + #endif +} \ No newline at end of file diff --git a/shaders/lib/lighting/shadows.glsl b/shaders/lib/lighting/shadows.glsl new file mode 100644 index 0000000..d94ac68 --- /dev/null +++ b/shaders/lib/lighting/shadows.glsl @@ -0,0 +1,308 @@ +#ifdef SHADOW +uniform sampler2DShadow shadowtex0; + +#ifdef SHADOW_COLOR +uniform sampler2DShadow shadowtex1; +uniform sampler2D shadowcolor0; +#endif + +// uniform sampler2D shadowtex0; + +// #ifdef SHADOW_COLOR +// uniform sampler2D shadowtex1; +// uniform sampler2D shadowcolor0; +// #endif + +vec2 shadowOffsets[9] = vec2[9]( + vec2( 0.0, 0.0), + vec2( 0.0, 1.0), + vec2( 0.7, 0.7), + vec2( 1.0, 0.0), + vec2( 0.7,-0.7), + vec2( 0.0,-1.0), + vec2(-0.7,-0.7), + vec2(-1.0, 0.0), + vec2(-0.7, 0.7) +); + +float biasDistribution[10] = float[10]( + 0.0, 0.057, 0.118, 0.184, 0.255, 0.333, 0.423, 0.529, 0.667, 1.0 +); + +float getShadow(sampler2D shadowtex, vec2 shadowPosXY, float shadowPosZ) { + float shadow = texture2D(shadowtex,shadowPosXY).x; + shadow = clamp((shadow - shadowPosZ)*16384.0+0.5,0.0,1.0); + return shadow; +} + +float texture2DShadow2x2(sampler2D shadowtex, vec3 shadowPos) { + shadowPos.xy -= 0.5 / shadowMapResolution; + vec2 frac = fract(shadowPos.xy * shadowMapResolution); + shadowPos.xy = (floor(shadowPos.xy * shadowMapResolution) + 0.5) / shadowMapResolution; + + float shadow0 = getShadow(shadowtex,shadowPos.st + vec2(0.0, 0.0) / shadowMapResolution, shadowPos.z); + float shadow1 = getShadow(shadowtex,shadowPos.st + vec2(0.0, 1.0) / shadowMapResolution, shadowPos.z); + float shadow2 = getShadow(shadowtex,shadowPos.st + vec2(1.0, 0.0) / shadowMapResolution, shadowPos.z); + float shadow3 = getShadow(shadowtex,shadowPos.st + vec2(1.0, 1.0) / shadowMapResolution, shadowPos.z); + + float shadowx0 = mix(shadow0, shadow1, frac.y); + float shadowx1 = mix(shadow2, shadow3, frac.y); + + float shadow = mix(shadowx0, shadowx1, frac.x); + + return shadow; +} + +float texture2DShadow(sampler2D shadowtex, vec3 shadowPos) { + return texture2DShadow2x2(shadowtex, shadowPos); +} + +float texture2DShadow(sampler2DShadow shadowtex, vec3 shadowPos) { + return shadow2D(shadowtex, shadowPos).x; +} + +vec3 DistortShadow(vec3 worldPos, float distortFactor) { + worldPos.xy /= distortFactor; + worldPos.z *= 0.2; + return worldPos * 0.5 + 0.5; +} + +float GetCurvedBias(int i, float dither) { + return mix(biasDistribution[i], biasDistribution[i+1], dither); +} + +float InterleavedGradientNoise() { + float n = 52.9829189 * fract(0.06711056 * gl_FragCoord.x + 0.00583715 * gl_FragCoord.y); + return fract(n + frameCounter * 1.618); +} + +vec3 SampleBasicShadow(vec3 shadowPos, float subsurface) { + float shadow0 = texture2DShadow(shadowtex0, vec3(shadowPos.st, shadowPos.z)); + + vec3 shadowCol = vec3(0.0); + #ifdef SHADOW_COLOR + if (shadow0 < 1.0) { + shadowCol = texture2D(shadowcolor0, shadowPos.st).rgb * + texture2DShadow(shadowtex1, vec3(shadowPos.st, shadowPos.z)); + #ifdef WATER_CAUSTICS + shadowCol *= 4.0; + #endif + } + #endif + + shadow0 *= mix(shadow0, 1.0, subsurface); + shadowCol *= shadowCol; + + return clamp(shadowCol * (1.0 - shadow0) + shadow0, vec3(0.0), vec3(16.0)); +} + +vec3 SampleFilteredShadow(vec3 shadowPos, float offset, float subsurface) { + float shadow0 = 0.0; + + for (int i = 0; i < 9; i++) { + vec2 shadowOffset = shadowOffsets[i] * offset; + shadow0 += texture2DShadow(shadowtex0, vec3(shadowPos.st + shadowOffset, shadowPos.z)); + } + shadow0 /= 9.0; + + vec3 shadowCol = vec3(0.0); + #ifdef SHADOW_COLOR + if (shadow0 < 0.999) { + for (int i = 0; i < 9; i++) { + vec2 shadowOffset = shadowOffsets[i] * offset; + vec3 shadowColSample = texture2D(shadowcolor0, shadowPos.st + shadowOffset).rgb * + texture2DShadow(shadowtex1, vec3(shadowPos.st + shadowOffset, shadowPos.z)); + #ifdef WATER_CAUSTICS + shadowColSample *= 4.0; + #endif + shadowCol += shadowColSample; + } + shadowCol /= 9.0; + } + #endif + + shadow0 *= mix(shadow0, 1.0, subsurface); + shadowCol *= shadowCol; + + return clamp(shadowCol * (1.0 - shadow0) + shadow0, vec3(0.0), vec3(16.0)); +} + +vec3 GetShadow(vec3 worldPos, vec3 normal, float NoL, float subsurface, float skylight) { + #if SHADOW_PIXEL > 0 + worldPos = (floor((worldPos + cameraPosition) * SHADOW_PIXEL + 0.01) + 0.5) / + SHADOW_PIXEL - cameraPosition; + #endif + + vec3 shadowPos = ToShadow(worldPos); + + float distb = sqrt(dot(shadowPos.xy, shadowPos.xy)); + float distortFactor = distb * shadowMapBias + (1.0 - shadowMapBias); + + #if SHADOW_BIAS == 1 + if (subsurface == 0) { + float distortNBias = distortFactor * shadowDistance / 256.0; + distortNBias *= distortNBias; + + vec3 worldNormal = (gbufferModelViewInverse * vec4(normal, 0.0)).xyz; + worldPos += worldNormal * distortNBias * 8192.0 / shadowMapResolution; + shadowPos = ToShadow(worldPos); + + distb = sqrt(dot(shadowPos.xy, shadowPos.xy)); + distortFactor = distb * shadowMapBias + (1.0 - shadowMapBias); + } + #endif + + shadowPos = DistortShadow(shadowPos, distortFactor); + + bool doShadow = shadowPos.x > 0.0 && shadowPos.x < 1.0 && + shadowPos.y > 0.0 && shadowPos.y < 1.0; + + #ifdef OVERWORLD + doShadow = doShadow && skylight > 0.001; + #endif + + if (!doShadow) return vec3(1.0); + + float bias = 0.0; + float offset = 1.0 / shadowMapResolution; + + #if SHADOW_BIAS == 0 + float biasFactor = sqrt(1.0 - NoL * NoL) / NoL; + float distortBias = distortFactor * shadowDistance / 256.0; + distortBias *= 8.0 * distortBias; + float distanceBias = sqrt(dot(worldPos.xyz, worldPos.xyz)) * 0.005; + + bias = (distortBias * biasFactor + distanceBias + 0.05) / shadowMapResolution; + #else + bias = 0.35 / shadowMapResolution; + #endif + + if (subsurface > 0.0) { + float blurFadeIn = clamp(distb * 20.0, 0.0, 1.0); + float blurFadeOut = 1.0 - clamp(distb * 10.0 - 2.0, 0.0, 1.0); + float blurMult = blurFadeIn * blurFadeOut * (1.0 - NoL); + blurMult = blurMult * 1.5 + 1.0; + + offset = 0.0007 * blurMult; + bias = 0.0002; + } + + #if SHADOW_PIXEL > 0 + bias += 0.0025 / SHADOW_PIXEL; + #endif + + shadowPos.z -= bias; + + #ifdef SHADOW_FILTER + vec3 shadow = SampleFilteredShadow(shadowPos, offset, subsurface); + #else + vec3 shadow = SampleBasicShadow(shadowPos, subsurface); + #endif + + return shadow; +} + +vec3 GetSubsurfaceShadow(vec3 worldPos, float subsurface, float skylight) { + float gradNoise = InterleavedGradientNoise(); + + vec3 shadowPos = ToShadow(worldPos); + + float distb = sqrt(dot(shadowPos.xy, shadowPos.xy)); + float distortFactor = distb * shadowMapBias + (1.0 - shadowMapBias); + shadowPos = DistortShadow(shadowPos, distortFactor); + + vec3 subsurfaceShadow = vec3(0.0); + + vec3 offsetScale = vec3(0.002 / distortFactor, 0.002 / distortFactor, 0.001) * (subsurface * 0.75 + 0.25); + + for(int i = 0; i < 12; i++) { + gradNoise = fract(gradNoise + 1.618); + float rot = gradNoise * 6.283; + float dist = (i + gradNoise) / 12.0; + + vec2 offset2D = vec2(cos(rot), sin(rot)) * dist; + float offsetZ = -(dist * dist + 0.025); + + vec3 offset = vec3(offset2D, offsetZ) * offsetScale; + + vec3 samplePos = shadowPos + offset; + float shadow0 = texture2DShadow(shadowtex0, samplePos); + + vec3 shadowCol = vec3(0.0); + #ifdef SHADOW_COLOR + if (shadow0 < 1.0) { + shadowCol = texture2D(shadowcolor0, samplePos.st).rgb * + texture2DShadow(shadowtex1, samplePos); + #ifdef WATER_CAUSTICS + shadowCol *= 4.0; + #endif + } + #endif + + subsurfaceShadow += clamp(shadowCol * (1.0 - shadow0) + shadow0, vec3(0.0), vec3(1.0)); + } + subsurfaceShadow /= 12.0; + subsurfaceShadow *= subsurfaceShadow; + + return subsurfaceShadow; +} +#else +vec3 GetShadow(vec3 worldPos, vec3 normal, float NoL, float subsurface, float skylight) { + #ifdef OVERWORLD + float skylightShadow = smoothstep(0.866,1.0,skylight); + skylightShadow *= skylightShadow; + + return vec3(skylightShadow); + #else + return vec3(1.0); + #endif +} + +vec3 GetSubsurfaceShadow(vec3 worldPos, float subsurface, float skylight) { + return vec3(0.0); +} +#endif + +float GetCloudShadow(vec3 worldPos) { + vec2 wind = vec2( + frametime * CLOUD_SPEED * 0.0005, + sin(frametime * CLOUD_SPEED * 0.001) * 0.005 + ) * CLOUD_HEIGHT / 15.0; + + vec3 coveragePos = worldPos; + worldPos += cameraPosition; + + vec3 worldLightVec = (gbufferModelViewInverse * vec4(lightVec, 0.0)).xyz; + + float cloudHeight = CLOUD_HEIGHT * CLOUD_VOLUMETRIC_SCALE + 70; + worldPos.xz += worldLightVec.xz / worldLightVec.y * max(cloudHeight - worldPos.y, 0.0); + coveragePos.xz += worldLightVec.xz / worldLightVec.y * -coveragePos.y; + + float scaledThickness = CLOUD_THICKNESS * CLOUD_VOLUMETRIC_SCALE; + float cloudFadeOut = 1.0 - clamp((worldPos.y - cloudHeight) / scaledThickness, 0.0, 1.0); + float coverageFadeOut = 1.0 - clamp((cameraPosition.y - cloudHeight) / scaledThickness, 0.0, 1.0); + + vec2 coord = worldPos.xz / CLOUD_VOLUMETRIC_SCALE; + + float sunCoverageSize = CLOUD_VOLUMETRIC_SCALE * 3.0 / worldLightVec.y; + float sunCoverage = max(1.0 - length(coveragePos.xz) / sunCoverageSize, 0.0) * coverageFadeOut; + + coord.xy *= 0.004; + + #if CLOUD_BASE == 0 + float noiseBase = texture2D(noisetex, coord * 0.25 + wind).r; + #else + float noiseBase = texture2D(noisetex, coord * 0.5 + wind).g; + noiseBase = pow(1.0 - noiseBase, 2.0) * 0.5 + 0.25; + #endif + + float noise = mix(noiseBase, 1.0, 0.33 * rainStrength) * 21.0; + + noise = max(noise - (sunCoverage * 3.0 + CLOUD_AMOUNT), 0.0); + noise *= CLOUD_DENSITY * 0.125; + noise *= (1.0 - 0.75 * rainStrength); + noise = noise / sqrt(noise * noise + 0.5); + noise *= cloudFadeOut; + + return 1.0 - noise * CLOUD_OPACITY * 0.85; +} \ No newline at end of file diff --git a/shaders/lib/materials/materialHandling/terrainMaterials.glsl b/shaders/lib/materials/materialHandling/terrainMaterials.glsl new file mode 100644 index 0000000..bfca3d5 --- /dev/null +++ b/shaders/lib/materials/materialHandling/terrainMaterials.glsl @@ -0,0 +1,2548 @@ +if (mat >= 10000) { +if (mat < 11024) { + if (mat < 10512) { + if (mat < 10256) { + if (mat < 10128) { + if (mat < 10064) { + if (mat < 10032) { + if (mat < 10016) { + if (mat < 10008) { + if (mat < 10004) { // No directional shading + noDirectionalShading = true; + } + else /*if (mat < 10008)*/ { // Grounded Waving Foliage + subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true; + + #ifdef GBUFFERS_TERRAIN + DoFoliageColorTweaks(color.rgb, shadowMult, snowMinNdotU, lViewPos); + + #ifdef COATED_TEXTURES + doTileRandomisation = false; + #endif + #endif + + #if SHADOW_QUALITY == -1 + shadowMult *= 1.0 - 0.3 * (signMidCoordPos.y + 1.0) * (1.0 - abs(signMidCoordPos.x)) + + 0.5 * (1.0 - signMidCoordPos.y) * invNoonFactor; // consistency357381 + #endif + } + } else { + if (mat < 10012) { // Leaves + #include "/lib/materials/specificMaterials/terrain/leaves.glsl" + } + else /*if (mat < 10016)*/ { // Vine + subsurfaceMode = 3, centerShadowBias = true; noSmoothLighting = true; + + #if defined COATED_TEXTURES && defined GBUFFERS_TERRAIN + doTileRandomisation = false; + #endif + + float factor = color.g; + smoothnessG = factor * 0.5; + highlightMult = factor * 4.0 + 2.0; + float fresnel = clamp(1.0 + dot(newNormal, normalize(viewPos)), 0.0, 1.0); + highlightMult *= 1.0 - pow2(pow2(fresnel)); + } + } + } else { + if (mat < 10024) { + if (mat < 10020) { // Non-waving Foliage + subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true; + } + else /*if (mat < 10024)*/ { // Upper Waving Foliage + subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true; + + #ifdef GBUFFERS_TERRAIN + DoFoliageColorTweaks(color.rgb, shadowMult, snowMinNdotU, lViewPos); + + #ifdef COATED_TEXTURES + doTileRandomisation = false; + #endif + #endif + + #if SHADOW_QUALITY == -1 + shadowMult *= 1.0 + invNoonFactor; // consistency357381 + #endif + } + } else { + if (mat < 10028) { // Modded Ores + #ifdef GLOWING_ORE_MODDED + float epsilon = 0.00001; + vec2 absMidCoordPosM = absMidCoordPos - epsilon; + vec3 avgBorderColor = vec3(0.0); + + avgBorderColor += texture2D(tex, midCoord + vec2( absMidCoordPosM.x, absMidCoordPosM.y)).rgb; + avgBorderColor += texture2D(tex, midCoord + vec2(-absMidCoordPosM.x, absMidCoordPosM.y)).rgb; + avgBorderColor += texture2D(tex, midCoord + vec2( absMidCoordPosM.x,-absMidCoordPosM.y)).rgb; + avgBorderColor += texture2D(tex, midCoord + vec2(-absMidCoordPosM.x,-absMidCoordPosM.y)).rgb; + avgBorderColor += texture2D(tex, midCoord + vec2(epsilon, absMidCoordPosM.y)).rgb; + avgBorderColor += texture2D(tex, midCoord + vec2(epsilon,-absMidCoordPosM.y)).rgb; + avgBorderColor += texture2D(tex, midCoord + vec2( absMidCoordPosM.x, epsilon)).rgb; + avgBorderColor += texture2D(tex, midCoord + vec2(-absMidCoordPosM.x, epsilon)).rgb; + avgBorderColor *= 0.125; + + vec3 colorDif = abs(avgBorderColor - color.rgb); + emission = max(colorDif.r, max(colorDif.g, colorDif.b)); + emission = pow2(emission * 2.5 - 0.15); + + emission *= GLOWING_ORE_MULT; + //color.rgb = avgBorderColor; + #endif + } + else /*if (mat < 10032)*/ { // Modded Light Sources + noSmoothLighting = true; noDirectionalShading = true; + emission = GetLuminance(color.rgb) * 2.5; + } + } + } + } else { + if (mat < 10048) { + if (mat < 10040) { + if (mat < 10036) { // Stone Bricks++ + smoothnessG = pow2(pow2(color.g)) * 2.0; + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.66; + #endif + } + else /*if (mat < 10040)*/ { // Anvil+ + #include "/lib/materials/specificMaterials/terrain/anvil.glsl" + } + } else { + if (mat < 10044) { // Rails + #if ANISOTROPIC_FILTER == 0 + albedo = texture2DLod(texture, texCoord, 0); + #endif + + noSmoothLighting = true; + if (color.r > 0.1 && color.g + color.b < 0.1) { // Redstone Parts + noSmoothLighting = true; noDirectionalShading = true; + lmCoordM.x = min(lmCoordM.x * 0.9, 0.77); + + if (color.r > 0.5) { + albedo.rgb *= color.rgb; + emission = 8.0 * color.r; + } else if (color.r > color.g * 2.0) { + materialMask = OSIEBCA * 5.0; // Redstone Fresnel + + float factor = pow2(color.r); + smoothnessG = 0.4; + highlightMult = factor + 0.4; + + smoothnessD = factor * 0.7 + 0.3; + } + } else if (abs(color.r - color.b) < 0.15) { // Iron Parts + #include "/lib/materials/specificMaterials/terrain/ironBlock.glsl" + } else if (color.g > color.b * 2.0) { // Gold Parts + #include "/lib/materials/specificMaterials/terrain/goldBlock.glsl" + } else { // Wood Parts + #include "/lib/materials/specificMaterials/planks/oakPlanks.glsl" + } + } + else /*if (mat < 10048)*/ { // Empty Cauldron, Hopper + noSmoothLighting = true; + lmCoordM.x = min(lmCoordM.x, 0.9333); + + #include "/lib/materials/specificMaterials/terrain/anvil.glsl" + } + } + } else { + if (mat < 10056) { + if (mat < 10052) { // Water Cauldron + noSmoothLighting = true; + lmCoordM.x = min(lmCoordM.x, 0.9333); + + vec3 worldPos = playerPos + cameraPosition; + vec3 fractPos = fract(worldPos.xyz); + vec2 coordM = abs(fractPos.xz - 0.5); + if (max(coordM.x, coordM.y) < 0.375 && fractPos.y > 0.3 && NdotU > 0.9) { + #if WATER_STYLE < 3 + vec3 colorP = color.rgb / glColor.rgb; + smoothnessG = min(pow2(pow2(dot(colorP.rgb, colorP.rgb) * 0.4)), 1.0); + highlightMult = 3.25; + smoothnessD = 0.8; + #else + smoothnessG = 0.3; + smoothnessD = 1.0; + #endif + + // #include "/lib/materials/specificMaterials/translucents/water.glsl" + + #ifdef COATED_TEXTURES + noiseFactor = 0.0; + #endif + } else { + #include "/lib/materials/specificMaterials/terrain/anvil.glsl" + } + } + else /*if (mat < 10056)*/ { // Powder Snow Cauldron + noSmoothLighting = true; + lmCoordM.x = min(lmCoordM.x, 0.9333); + + vec3 worldPos = playerPos + cameraPosition; + vec3 fractPos = fract(worldPos.xyz); + vec2 coordM = abs(fractPos.xz - 0.5); + if (max(coordM.x, coordM.y) < 0.375 && + fractPos.y > 0.3 && + NdotU > 0.9) { + + #include "/lib/materials/specificMaterials/terrain/snow.glsl" + } else { + #include "/lib/materials/specificMaterials/terrain/anvil.glsl" + } + } + } else { + if (mat < 10060) { // Lava Cauldron + noSmoothLighting = true; + lmCoordM.x = min(lmCoordM.x, 0.9333); + + vec3 worldPos = playerPos + cameraPosition; + vec3 fractPos = fract(worldPos.xyz); + vec2 coordM = abs(fractPos.xz - 0.5); + if (max(coordM.x, coordM.y) < 0.375 && + fractPos.y > 0.3 && + NdotU > 0.9) { + + #include "/lib/materials/specificMaterials/terrain/lava.glsl" + } else { + #include "/lib/materials/specificMaterials/terrain/anvil.glsl" + } + } + else /*if (mat < 10064)*/ { // Lever + if (color.r > color.g + color.b) { + albedo.rgb *= color.rgb; + emission = 4.0; + } else { + #include "/lib/materials/specificMaterials/terrain/cobblestone.glsl" + } + } + } + } + } + } else { + if (mat < 10096) { + if (mat < 10080) { + if (mat < 10072) { + if (mat < 10068) { // Lectern + #include "/lib/materials/specificMaterials/planks/oakPlanks.glsl" + } + else /*if (mat < 10072)*/ { // Lava + #include "/lib/materials/specificMaterials/terrain/lava.glsl" + + #if defined COATED_TEXTURES && defined GBUFFERS_TERRAIN + doTileRandomisation = false; + #endif + } + } else { + if (mat < 10076) { // Fire + noSmoothLighting = true, noDirectionalShading = true; + emission = 2.35; + albedo.rgb *= sqrt1(GetLuminance(color.rgb)); + } + else /*if (mat < 10080)*/ { // Soul Fire + noSmoothLighting = true, noDirectionalShading = true; + emission = 1.5; + albedo.rgb = pow1_5(color.rgb); + } + } + } else { + if (mat < 10088) { + if (mat < 10084) { // Stone+, Coal Ore, Smooth Stone+, Grindstone, Stonecutter + #include "/lib/materials/specificMaterials/terrain/stone.glsl" + } + else /*if (mat < 10088)*/ { // Granite+ + smoothnessG = pow2(pow2(color.r)) * 0.5; + smoothnessD = smoothnessG; + } + } else { + if (mat < 10092) { // Diorite+ + smoothnessG = pow2(color.g) * 0.5; + smoothnessD = smoothnessG; + + #ifdef GBUFFERS_TERRAIN + DoBrightBlockTweaks(color.rgb, 0.75, shadowMult, highlightMult); + #endif + } + else /*if (mat < 10096)*/ { // Andesite+ + smoothnessG = pow2(pow2(color.g)); + smoothnessD = smoothnessG; + } + } + } + } else { + if (mat < 10112) { + if (mat < 10104) { + if (mat < 10100) { // Polished Granite+ + smoothnessG = 0.1 + color.r * 0.4; + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + else /*if (mat < 10104)*/ { // Polished Diorite+ + smoothnessG = pow2(color.g) * 0.7; + smoothnessD = smoothnessG; + + #ifdef GBUFFERS_TERRAIN + DoBrightBlockTweaks(color.rgb, 0.75, shadowMult, highlightMult); + #endif + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + } else { + if (mat < 10108) { // Polished Andesite+, Packed Mud, Mud Bricks+, Bricks+ + smoothnessG = pow2(color.g); + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + else /*if (mat < 10112)*/ { // Deepslate:Non-polished Variants, Deepslate Coal Ore + #include "/lib/materials/specificMaterials/terrain/deepslate.glsl" + } + } + } else { + if (mat < 10120) { + if (mat < 10116) { // Deepslate:Polished Variants, Mud, Mangrove Roots, Muddy Mangrove Roots + smoothnessG = pow2(color.g) * 2.0; + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + else /*if (mat < 10120)*/ { // Calcite + highlightMult = pow2(color.g) + 1.0; + smoothnessG = 1.0 - color.g * 0.5; + smoothnessD = smoothnessG; + + #ifdef GBUFFERS_TERRAIN + DoBrightBlockTweaks(color.rgb, 0.75, shadowMult, highlightMult); + #endif + } + } else { + if (mat < 10124) { // Dripstone+, Daylight Detector + smoothnessG = color.r * 0.35 + 0.2; + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.66; + #endif + } + else /*if (mat < 10128)*/ { // Snowy Variants of Grass Block, Podzol, Mycelium + float dotColor = dot(color.rgb, color.rgb); + if (dotColor > 1.5) { // Snowy Variants:Snowy Part + #include "/lib/materials/specificMaterials/terrain/snow.glsl" + } else { // Snowy Variants:Dirt Part + #include "/lib/materials/specificMaterials/terrain/dirt.glsl" + } + } + } + } + } + } + } else { + if (mat < 10192) { + if (mat < 10160) { + if (mat < 10144) { + if (mat < 10136) { + if (mat < 10132) { // Dirt, Coarse Dirt, Rooted Dirt, Podzol:Normal, Mycelium:Normal, Farmland:Dry + #include "/lib/materials/specificMaterials/terrain/dirt.glsl" + } + else /*if (mat < 10136)*/ { // Grass Block:Normal + if (glColor.b < 0.999) { // Grass Block:Normal:Grass Part + smoothnessG = pow2(color.g); + + #ifdef SNOWY_WORLD + snowMinNdotU = min(pow2(pow2(color.g)) * 1.9, 0.1); + color.rgb = color.rgb * 0.5 + 0.5 * (color.rgb / glColor.rgb); + #endif + } else { //Grass Block:Normal:Dirt Part + #include "/lib/materials/specificMaterials/terrain/dirt.glsl" + } + } + } else { + if (mat < 10140) { // Farmland:Wet + if (NdotU > 0.99) { // Farmland:Wet:Top Part + #if MC_VERSION >= 11300 + smoothnessG = clamp(pow2(pow2(1.0 - color.r)) * 2.5, 0.5, 1.0); + highlightMult = 0.5 + smoothnessG * smoothnessG * 2.0; + smoothnessD = smoothnessG * 0.75; + #else + smoothnessG = 0.5 * (1.0 + abs(color.r - color.b) + color.b); + smoothnessD = smoothnessG * 0.5; + #endif + } else { // Farmland:Wet:Dirt Part + #include "/lib/materials/specificMaterials/terrain/dirt.glsl" + } + } + else /*if (mat < 10144)*/ { // Netherrack + #include "/lib/materials/specificMaterials/terrain/netherrack.glsl" + } + } + } else { + if (mat < 10152) { + if (mat < 10148) { // Warped Nylium, Warped Wart Block + if (color.g == color.b && color.g > 0.0001) { // Warped Nylium:Netherrack Part + #include "/lib/materials/specificMaterials/terrain/netherrack.glsl" + } else { // Warped Nylium:Nylium Part, Warped Wart Block + smoothnessG = color.g * 0.5; + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + } + else /*if (mat < 10152)*/ { // Crimson Nylium, Nether Wart Block + if (color.g == color.b && color.g > 0.0001 && color.r < 0.522) { // Crimson Nylium:Netherrack Part + #include "/lib/materials/specificMaterials/terrain/netherrack.glsl" + } else { // Crimson Nylium:Nylium Part, Nether Wart Block + smoothnessG = color.r * 0.5; + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + } + } else { + if (mat < 10156) { // Cobblestone+, Mossy Cobblestone+, Furnace:Unlit, Smoker:Unlit, Blast Furnace:Unlit, Moss Block+, Lodestone, Piston, Sticky Piston, Dispenser, Dropper + #include "/lib/materials/specificMaterials/terrain/cobblestone.glsl" + } + else /*if (mat < 10160)*/ { // Oak Planks++:Clean Variants, Bookshelf, Crafting Table, Tripwire Hook + #include "/lib/materials/specificMaterials/planks/oakPlanks.glsl" + } + } + } + } else { + if (mat < 10176) { + if (mat < 10168) { + if (mat < 10164) { // Oak Log, Oak Wood + if (color.g > 0.48 || + CheckForColor(color.rgb, vec3(126, 98, 55)) || + CheckForColor(color.rgb, vec3(150, 116, 65))) { // Oak Log:Clean Part + #include "/lib/materials/specificMaterials/planks/oakPlanks.glsl" + } else { // Oak Log:Wood Part, Oak Wood + #include "/lib/materials/specificMaterials/terrain/oakWood.glsl" + } + } + else /*if (mat < 10168)*/ { // Spruce Planks++:Clean Variants + #include "/lib/materials/specificMaterials/planks/sprucePlanks.glsl" + } + } else { + if (mat < 10172) { // Spruce Log, Spruce Wood + if (color.g > 0.25) { // Spruce Log:Clean Part + #include "/lib/materials/specificMaterials/planks/sprucePlanks.glsl" + } else { // Spruce Log:Wood Part, Spruce Wood + smoothnessG = pow2(color.g) * 2.5; + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG; + } + } + else /*if (mat < 10176)*/ { // Birch Planks++:Clean Variants, Scaffolding, Loom + #include "/lib/materials/specificMaterials/planks/birchPlanks.glsl" + } + } + } else { + if (mat < 10184) { + if (mat < 10180) { // Birch Log, Birch Wood + if (color.r - color.b > 0.15) { // Birch Log:Clean Part + #include "/lib/materials/specificMaterials/planks/birchPlanks.glsl" + } else { // Birch Log:Wood Part, Birch Wood + smoothnessG = pow2(color.g) * 0.25; + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 1.25; + #endif + } + } + else /*if (mat < 10184)*/ { // Jungle Planks++:Clean Variants, Composter + #include "/lib/materials/specificMaterials/planks/junglePlanks.glsl" + } + } else { + if (mat < 10188) { // Jungle Log, Jungle Wood + if (color.g > 0.405) { // Jungle Log:Clean Part + #include "/lib/materials/specificMaterials/planks/junglePlanks.glsl" + } else { // Jungle Log:Wood Part, Jungle Wood + smoothnessG = pow2(pow2(color.g)) * 5.0; + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + } + else /*if (mat < 10192)*/ { // Acacia Planks++:Clean Variants + #include "/lib/materials/specificMaterials/planks/acaciaPlanks.glsl" + } + } + } + } + } else { + if (mat < 10224) { + if (mat < 10208) { + if (mat < 10200) { + if (mat < 10196) { // Acacia Log, Acacia Wood + if (color.r - color.b > 0.2) { // Acacia Log:Clean Part + #include "/lib/materials/specificMaterials/planks/acaciaPlanks.glsl" + } else { // Acacia Log:Wood Part, Acacia Wood + smoothnessG = pow2(color.b) * 1.3; + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.66; + #endif + } + } + else /*if (mat < 10200)*/ { // Dark Oak Planks++:Clean Variants + #include "/lib/materials/specificMaterials/planks/darkOakPlanks.glsl" + } + } else { + if (mat < 10204) { // Dark Oak Log, Dark Oak Wood + if (color.r - color.g > 0.08 || + CheckForColor(color.rgb, vec3(48, 30, 14))) { // Dark Oak Log:Clean Part + #include "/lib/materials/specificMaterials/planks/darkOakPlanks.glsl" + } else { // Dark Oak Log:Wood Part, Dark Oak Wood + smoothnessG = color.r * 0.4; + smoothnessD = smoothnessG; + } + } + else /*if (mat < 10208)*/ { // Mangrove Planks++:Clean Variants + #include "/lib/materials/specificMaterials/planks/mangrovePlanks.glsl" + } + } + } else { + if (mat < 10216) { + if (mat < 10212) { // Mangrove Log, Mangrove Wood + if (color.r - color.g > 0.2) { // Mangrove Log:Clean Part + #include "/lib/materials/specificMaterials/planks/mangrovePlanks.glsl" + } else { // Mangrove Log:Wood Part, Mangrove Wood + smoothnessG = pow2(color.r) * 0.6; + smoothnessD = smoothnessG; + } + } + else /*if (mat < 10216)*/ { // Crimson Planks++:Clean Variants + #include "/lib/materials/specificMaterials/planks/crimsonPlanks.glsl" + } + } else { + if (mat < 10220) { // Crimson Stem, Crimson Hyphae + if (color.r / color.b > 2.5) { // Emissive Part + emission = pow2(color.r) * 6.5; + albedo.gb *= 0.5; + } else { // Flat Part + #include "/lib/materials/specificMaterials/planks/crimsonPlanks.glsl" + } + } + else /*if (mat < 10224)*/ { // Warped Planks++:Clean Variants + #include "/lib/materials/specificMaterials/planks/warpedPlanks.glsl" + } + } + } + } else { + if (mat < 10240) { + if (mat < 10232) { + if (mat < 10228) { // Warped Stem, Warped Hyphae + //if (color.r < 0.12 || color.r + color.g * 3.0 < 3.4 * color.b) { // Emissive Part + if (color.r < 0.37 * color.b || color.r + color.g * 3.0 < 3.4 * color.b) { // Emissive Part + emission = pow2(color.g + 0.2 * color.b) * 4.5 + 0.15; + } else { // Flat Part + #include "/lib/materials/specificMaterials/planks/warpedPlanks.glsl" + } + } + else /*if (mat < 10232)*/ { // Bedrock + smoothnessG = color.b * 0.2 + 0.1; + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 1.5; + #endif + } + } else { + if (mat < 10236) { // Sand, Suspicious Sand + smoothnessG = pow(color.g, 16.0) * 2.0; + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG * 0.7; + highlightMult = 2.0; + + #ifdef GBUFFERS_TERRAIN + DoBrightBlockTweaks(color.rgb, 0.5, shadowMult, highlightMult); + + DoOceanBlockTweaks(smoothnessD); + #endif + + #if RAIN_PUDDLES >= 1 + noPuddles = 1.0; + #endif + } + else /*if (mat < 10240)*/ { // Red Sand + smoothnessG = pow(color.r * 1.08, 16.0) * 2.0; + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG * 0.7; + highlightMult = 2.0; + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + + #if RAIN_PUDDLES >= 1 + noPuddles = 1.0; + #endif + } + } + } else { + if (mat < 10248) { + if (mat < 10244) { // Sandstone+ + highlightMult = 2.0; + smoothnessG = pow2(pow2(color.g)) * 0.5; + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG * 0.7; + + #ifdef GBUFFERS_TERRAIN + DoBrightBlockTweaks(color.rgb, 0.5, shadowMult, highlightMult); + #endif + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + else /*if (mat < 10248)*/ { // Red Sandstone+ + highlightMult = 2.0; + smoothnessG = pow2(pow2(color.r * 1.05)) * 0.5; + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG * 0.7; + + #ifdef COATED_TEXTURES + noiseFactor = 0.5; + #endif + } + } else { + if (mat < 10252) { // Netherite Block + #include "/lib/materials/specificMaterials/terrain/netheriteBlock.glsl" + } + else /*if (mat < 10256)*/ { // Ancient Debris + smoothnessG = pow2(color.r); + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 1.5; + #endif + + #ifdef GLOWING_ORE_ANCIENTDEBRIS + emission = min(pow2(color.g * 6.0), 8.0); + color.rgb *= pow(color.rgb, vec3(min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + #endif + } + } + } + } + } + } + } else { + if (mat < 10384) { + if (mat < 10320) { + if (mat < 10288) { + if (mat < 10272) { + if (mat < 10264) { + if (mat < 10260) { // Iron Bars + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/terrain/ironBlock.glsl" + } + else /*if (mat < 10264)*/ { // Iron Door, Iron Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/terrain/ironBlock.glsl" + } + } else { + if (mat < 10268) { // Iron Block, Heavy Weighted Pressure Plate + #include "/lib/materials/specificMaterials/terrain/ironBlock.glsl" + albedo.rgb *= max(color.r, 0.85) * 0.9; + } + else /*if (mat < 10272)*/ { // Raw Iron Block + #include "/lib/materials/specificMaterials/terrain/rawIronBlock.glsl" + } + } + } else { + if (mat < 10280) { + if (mat < 10276) { // Iron Ore + if (color.r != color.g) { // Iron Ore:Raw Iron Part + #include "/lib/materials/specificMaterials/terrain/rawIronBlock.glsl" + #ifdef GLOWING_ORE_IRON + if (color.r - color.b > 0.15) { + emission = pow1_5(color.r) * 1.5; + color.rgb *= pow(color.rgb, vec3(0.5 * min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + } + #endif + } else { // Iron Ore:Stone Part + #include "/lib/materials/specificMaterials/terrain/stone.glsl" + } + } + else /*if (mat < 10280)*/ { // Deepslate Iron Ore + if (color.r != color.g) { // Deepslate Iron Ore:Raw Iron Part + #include "/lib/materials/specificMaterials/terrain/rawIronBlock.glsl" + #ifdef GLOWING_ORE_IRON + if (color.r - color.b > 0.15) { + emission = pow1_5(color.r) * 1.5; + color.rgb *= pow(color.rgb, vec3(0.5 * min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + } + #endif + } else { // Deepslate Iron Ore:Deepslate Part + #include "/lib/materials/specificMaterials/terrain/deepslate.glsl" + } + } + } else { + if (mat < 10284) { // Raw Copper Block + #include "/lib/materials/specificMaterials/terrain/rawCopperBlock.glsl" + } + else /*if (mat < 10288)*/ { // Copper Ore + if (color.r != color.g) { // Copper Ore:Raw Copper Part + #include "/lib/materials/specificMaterials/terrain/rawCopperBlock.glsl" + #ifdef GLOWING_ORE_COPPER + if (max(color.r * 0.5, color.g) - color.b > 0.05) { + emission = color.r * 2.0 + 0.7; + color.rgb *= pow(color.rgb, vec3(min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + } + #endif + } else { // Copper Ore:Stone Part + #include "/lib/materials/specificMaterials/terrain/stone.glsl" + } + } + } + } + } else { + if (mat < 10304) { + if (mat < 10296) { + if (mat < 10292) { // Deepslate Copper Ore + if (color.r != color.g) { // Deepslate Copper Ore:Raw Copper Part + #include "/lib/materials/specificMaterials/terrain/rawCopperBlock.glsl" + #ifdef GLOWING_ORE_COPPER + if (max(color.r * 0.5, color.g) - color.b > 0.05) { + emission = color.r * 2.0 + 0.7; + color.rgb *= pow(color.rgb, vec3(min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + } + #endif + } else { // Deepslate Copper Ore:Deepslate Part + #include "/lib/materials/specificMaterials/terrain/deepslate.glsl" + } + } + else /*if (mat < 10296)*/ { // Copper Block++:All Non-raw Variants + #include "/lib/materials/specificMaterials/terrain/copperBlock.glsl" + } + } else { + if (mat < 10300) { // Raw Gold Block + #include "/lib/materials/specificMaterials/terrain/rawGoldBlock.glsl" + } + else /*if (mat < 10304)*/ { // Gold Ore + if (color.r != color.g || color.r > 0.99) { // Gold Ore:Raw Gold Part + #include "/lib/materials/specificMaterials/terrain/rawGoldBlock.glsl" + #ifdef GLOWING_ORE_GOLD + if (color.g - color.b > 0.15) { + emission = color.r + 1.0; + color.rgb *= pow(color.rgb, vec3(min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + } + #endif + } else { // Gold Ore:Stone Part + #include "/lib/materials/specificMaterials/terrain/stone.glsl" + } + } + } + } else { + if (mat < 10312) { + if (mat < 10308) { // Deepslate Gold Ore + if (color.r != color.g || color.r > 0.99) { // Deepslate Gold Ore:Raw Gold Part + #include "/lib/materials/specificMaterials/terrain/rawGoldBlock.glsl" + #ifdef GLOWING_ORE_GOLD + if (color.g - color.b > 0.15) { + emission = color.r + 1.0; + color.rgb *= pow(color.rgb, vec3(min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + } + #endif + } else { // Deepslate Gold Ore:Deepslate Part + #include "/lib/materials/specificMaterials/terrain/deepslate.glsl" + } + } + else /*if (mat < 10312)*/ { // Nether Gold Ore + if (color.g != color.b) { // Nether Gold Ore:Raw Gold Part + #include "/lib/materials/specificMaterials/terrain/rawGoldBlock.glsl" + #ifdef GLOWING_ORE_NETHERGOLD + emission = color.g * 1.5; + emission *= GLOWING_ORE_MULT; + #endif + } else { // Nether Gold Ore:Netherrack Part + #include "/lib/materials/specificMaterials/terrain/netherrack.glsl" + } + } + } else { + if (mat < 10316) { // Gold Block, Light Weighted Pressure Plate + #include "/lib/materials/specificMaterials/terrain/goldBlock.glsl" + } + else /*if (mat < 10320)*/ { // Diamond Block + #include "/lib/materials/specificMaterials/terrain/diamondBlock.glsl" + } + } + } + } + } else { + if (mat < 10352) { + if (mat < 10336) { + if (mat < 10328) { + if (mat < 10324) { // Diamond Ore + if (color.b / color.r > 1.5 || color.b > 0.8) { // Diamond Ore:Diamond Part + #include "/lib/materials/specificMaterials/terrain/diamondBlock.glsl" + #ifdef GLOWING_ORE_DIAMOND + emission = color.g + 1.5; + color.rgb *= pow(color.rgb, vec3(min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + #endif + } else { // Diamond Ore:Stone Part, Diamond Ore:StoneToDiamond part + #include "/lib/materials/specificMaterials/terrain/stone.glsl" + } + } + else /*if (mat < 10328)*/ { // Deepslate Diamond Ore + if (color.b / color.r > 1.5 || color.b > 0.8) { // Deepslate Diamond Ore:Diamond Part + #include "/lib/materials/specificMaterials/terrain/diamondBlock.glsl" + #ifdef GLOWING_ORE_DIAMOND + emission = color.g + 1.5; + color.rgb *= pow(color.rgb, vec3(min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + #endif + } else { // Deepslate Diamond Ore:Deepslate Part, Deepslate Diamond Ore:DeepslateToDiamond part + #include "/lib/materials/specificMaterials/terrain/deepslate.glsl" + } + } + } else { + if (mat < 10332) { // Amethyst Block, Budding Amethyst + // materialMask = OSIEBCA; // Intense Fresnel + float factor = pow2(color.r); + smoothnessG = 0.8 - factor * 0.3; + highlightMult = factor * 3.0; + smoothnessD = factor; + + #if GLOWING_AMETHYST >= 2 + emission = dot(color.rgb, color.rgb) * 0.3; + #endif + + albedo.rgb *= 0.7 + 0.3 * GetLuminance(albedo.rgb); + + #ifdef COATED_TEXTURES + noiseFactor = 0.66; + #endif + } + else /*if (mat < 10336)*/ { // Amethyst Cluster, Amethyst Buds + materialMask = OSIEBCA; // Intense Fresnel + float factor = pow2(albedo.r); + smoothnessG = 0.8 - factor * 0.3; + highlightMult = factor * 3.0; + smoothnessD = factor; + + noSmoothLighting = true; + lmCoordM.x *= 0.85; + + #if GLOWING_AMETHYST >= 1 && defined GBUFFERS_TERRAIN + vec3 worldPos = playerPos.xyz + cameraPosition.xyz; + vec3 blockPos = abs(fract(worldPos) - vec3(0.5)); + float maxBlockPos = max(blockPos.x, max(blockPos.y, blockPos.z)); + emission = pow2(max0(1.0 - maxBlockPos * 1.85) * albedo.g) * 7.0; + + if (CheckForColor(albedo.rgb, vec3(254, 203, 230))) + emission = pow(emission, max0(1.0 - 0.2 * max0(emission - 1.0))); + + albedo.g *= 1.0 - emission * 0.07; + + emission *= 1.3; + #endif + + #ifdef COATED_TEXTURES + noiseFactor = 0.66; + #endif + } + } + } else { + if (mat < 10344) { + if (mat < 10340) { // Emerald Block + #include "/lib/materials/specificMaterials/terrain/emeraldBlock.glsl" + } + else /*if (mat < 10344)*/ { // Emerald Ore + float dif = GetMaxColorDif(albedo.rgb); + if (dif > 0.4 || albedo.b > 0.85) { // Emerald Ore:Emerald Part + #include "/lib/materials/specificMaterials/terrain/emeraldBlock.glsl" + #ifdef GLOWING_ORE_EMERALD + emission = 2.0; + albedo.rgb *= pow(albedo.rgb, vec3(min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + #endif + } else { // Emerald Ore:Stone Part + #include "/lib/materials/specificMaterials/terrain/stone.glsl" + } + } + } else { + if (mat < 10348) { // Deepslate Emerald Ore + float dif = GetMaxColorDif(albedo.rgb); + if (dif > 0.4 || albedo.b > 0.85) { // Deepslate Emerald Ore:Emerald Part + #include "/lib/materials/specificMaterials/terrain/emeraldBlock.glsl" + #ifdef GLOWING_ORE_EMERALD + emission = 2.0; + albedo.rgb *= pow(albedo.rgb, vec3(min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + #endif + } else { // Deepslate Emerald Ore:Deepslate Part + #include "/lib/materials/specificMaterials/terrain/deepslate.glsl" + } + } + else /*if (mat < 10352)*/ { // Azalea, Flowering Azalea + subsurfaceMode = 2; + // shadowMult = vec3(0.85); + } + } + } + } else { + if (mat < 10368) { + if (mat < 10360) { + if (mat < 10356) { // Lapis Block + #include "/lib/materials/specificMaterials/terrain/lapisBlock.glsl" + + #ifdef EMISSIVE_LAPIS_BLOCK + emission = pow2(dot(color.rgb, color.rgb)) * 10.0; + #endif + } + else /*if (mat < 10360)*/ { // Lapis Ore + if (color.r != color.g) { // Lapis Ore:Lapis Part + #include "/lib/materials/specificMaterials/terrain/lapisBlock.glsl" + smoothnessG *= 0.5; + smoothnessD *= 0.5; + #ifdef GLOWING_ORE_LAPIS + if (color.b - color.r > 0.2) { + emission = 2.0; + color.rgb *= pow(color.rgb, vec3(min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + } + #endif + } else { // Lapis Ore:Stone Part + #include "/lib/materials/specificMaterials/terrain/stone.glsl" + } + } + } else { + if (mat < 10364) { // Deepslate Lapis Ore + if (color.r != color.g) { // Deepslate Lapis Ore:Lapis Part + #include "/lib/materials/specificMaterials/terrain/lapisBlock.glsl" + smoothnessG *= 0.5; + smoothnessD *= 0.5; + #ifdef GLOWING_ORE_LAPIS + if (color.b - color.r > 0.2) { + emission = 2.0; + color.rgb *= pow(color.rgb, vec3(min1(GLOWING_ORE_MULT))); + emission *= GLOWING_ORE_MULT; + } + #endif + } else { // Deepslate Lapis Ore:Deepslate Part + #include "/lib/materials/specificMaterials/terrain/deepslate.glsl" + } + } + else /*if (mat < 10368)*/ { // Quartz Block++ + #include "/lib/materials/specificMaterials/terrain/quartzBlock.glsl" + } + } + } else { + if (mat < 10376) { + if (mat < 10372) { // Nether Quartz Ore + if (color.g != color.b) { // Nether Quartz Ore:Quartz Part + #include "/lib/materials/specificMaterials/terrain/quartzBlock.glsl" + #ifdef GLOWING_ORE_NETHERQUARTZ + emission = pow2(color.b * 1.6); + emission *= GLOWING_ORE_MULT; + #endif + } else { // Nether Quartz Ore:Netherrack Part + #include "/lib/materials/specificMaterials/terrain/netherrack.glsl" + } + } + else /*if (mat < 10376)*/ { // Obsidian + #include "/lib/materials/specificMaterials/terrain/obsidian.glsl" + } + } else { + if (mat < 10380) { // Purpur Block+ + highlightMult = 2.0; + smoothnessG = pow2(color.r) * 0.6; + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.5; + #endif + } + else /*if (mat < 10384)*/ { // Snow, Snow Block, Powder Snow + #include "/lib/materials/specificMaterials/terrain/snow.glsl" + } + } + } + } + } + } else { + if (mat < 10448) { + if (mat < 10416) { + if (mat < 10400) { + if (mat < 10392) { + if (mat < 10388) { // Packed Ice + materialMask = OSIEBCA; // Intense Fresnel + float factor = pow2(color.g); + float factor2 = pow2(factor); + smoothnessG = 1.0 - 0.5 * factor; + highlightMult = factor2 * 3.5; + smoothnessD = factor; + + #ifdef COATED_TEXTURES + noiseFactor = 0.33; + #endif + } + else /*if (mat < 10392)*/ { // Blue Ice + materialMask = OSIEBCA; // Intense Fresnel + float factor = min1(pow2(color.g) * 1.38); + float factor2 = pow2(factor); + smoothnessG = 1.0 - 0.5 * factor; + highlightMult = factor2 * 3.5; + smoothnessD = pow1_5(color.g); + + #ifdef COATED_TEXTURES + noiseFactor = 0.33; + #endif + } + } else { + if (mat < 10396) { // Pumpkin, Carved Pumpkin + #include "/lib/materials/specificMaterials/terrain/pumpkin.glsl" + } + else /*if (mat < 10400)*/ { // Jack o'Lantern + #include "/lib/materials/specificMaterials/terrain/pumpkin.glsl" + noSmoothLighting = true, noDirectionalShading = true; + lmCoordM.y = 0.0; + lmCoordM.x = 1.0; + + #if MC_VERSION >= 11300 + if (color.b > 0.28 && color.r > 0.9) { + float factor = pow2(color.g); + emission = pow2(factor) * factor * 5.0; + } + #else + if (color.b < 0.4) + emission = clamp01(color.g * 1.3 - color.r) * 5.0; + #endif + } + } + } else { + if (mat < 10408) { + if (mat < 10404) { // Sea Pickle:Not Waterlogged + noSmoothLighting = true; + } + else /*if (mat < 10408)*/ { // Sea Pickle:Waterlogged + noSmoothLighting = true; + if (color.b > 0.5) { // Sea Pickle:Emissive Part + #ifdef GBUFFERS_TERRAIN + color.g *= 1.1; + emission = 5.0; + #endif + } + } + } else { + if (mat < 10412) { // Basalt+ + smoothnessG = color.r * 0.35; + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + else /*if (mat < 10416)*/ { // Glowstone + noSmoothLighting = true; noDirectionalShading = true; + lmCoordM = vec2(0.9, 0.0); + + emission = max0(color.g - 0.3) * 4.6; + albedo.rg += emission * vec2(0.15, 0.05); + } + } + } + } else { + if (mat < 10432) { + if (mat < 10424) { + if (mat < 10420) { // Nether Bricks+ + float factor = smoothstep1(min1(color.r * 1.5)); + factor = factor > 0.12 ? factor : factor * 0.5; + smoothnessG = factor; + smoothnessD = factor; + } + else /*if (mat < 10424)*/ { // Red Nether Bricks+ + float factor = color.r * 0.9; + factor = color.r > 0.215 ? factor : factor * 0.25; + smoothnessG = factor; + smoothnessD = factor; + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + } else { + if (mat < 10428) { // Melon + smoothnessG = color.r * 0.75; + smoothnessD = color.r * 0.5; + + #ifdef COATED_TEXTURES + noiseFactor = 0.66; + #endif + } + else /*if (mat < 10432)*/ { // End Stone++, + #include "/lib/materials/specificMaterials/terrain/endStone.glsl" + } + } + } else { + if (mat < 10440) { + if (mat < 10436) { // Terracotta+ + smoothnessG = 0.25; + highlightMult = 1.5; + smoothnessD = 0.17; + + #ifdef COATED_TEXTURES + noiseFactor = 0.33; + #endif + } + else /*if (mat < 10440)*/ { // Glazed Terracotta+ + smoothnessG = 0.75; + smoothnessD = 0.35; + + #ifdef COATED_TEXTURES + noiseFactor = 0.5; + #endif + } + } else { + if (mat < 10444) { // Prismarine+, Prismarine Bricks+ + smoothnessG = pow2(color.g) * 0.8; + highlightMult = 1.5; + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.66; + #endif + } + else /*if (mat < 10448)*/ { // Dark Prismarine+ + smoothnessG = min1(pow2(color.g) * 2.0); + highlightMult = 1.5; + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + } + } + } + } else { + if (mat < 10480) { + if (mat < 10464) { + if (mat < 10456) { + if (mat < 10452) { // Sea Lantern + noSmoothLighting = true; noDirectionalShading = true; + lmCoordM.x = 0.85; + + smoothnessD = min1(max0(0.5 - color.r) * 2.0); + smoothnessG = color.g; + + float blockRes = absMidCoordPos.x * atlasSize.x; + vec2 signMidCoordPosM = (floor((signMidCoordPos + 1.0) * blockRes) + 0.5) / blockRes - 1.0; + float dotsignMidCoordPos = dot(signMidCoordPosM, signMidCoordPosM); + float lBlockPosM = pow2(max0(1.0 - 1.7 * pow2(pow2(dotsignMidCoordPos)))); + emission = pow2(color.b) * 1.6 + 2.2 * lBlockPosM; + + emission *= 0.4 + max0(0.6 - 0.006 * lViewPos); + + albedo.rb *= vec2(1.13, 1.1); + + #ifdef COATED_TEXTURES + noiseFactor = 0.5; + #endif + } + else /*if (mat < 10456)*/ { // Magma Block + noSmoothLighting = true; noDirectionalShading = true; + lmCoordM = vec2(0.75, 0.0); + + if (color.g > 0.22) { // Emissive Part + emission = pow2(pow2(color.r)) * 4.0; + + #if RAIN_PUDDLES >= 1 + noPuddles = color.g * 4.0; + #endif + + albedo.gb *= max(2.0 - 11.0 * pow2(color.g), 0.5); + + maRecolor = vec3(emission * 0.075); + } else { // Netherrack Part + #include "/lib/materials/specificMaterials/terrain/netherrack.glsl" + + emission = 0.2; + } + + } + } else { + if (mat < 10460) { // Command Block+ + albedo = texture2DLod(texture, texCoord, 0); + + vec2 coord = signMidCoordPos; + float blockRes = absMidCoordPos.x * atlasSize.x; + vec2 absCoord = abs(coord); + float maxCoord = max(absCoord.x, absCoord.y); + + float dif = GetMaxColorDif(color.rgb); + + if ( // This mess exists because Iris' midCoord is slightly inaccurate + dif > 0.1 && maxCoord < 0.375 && + !CheckForColor(color.rgb, vec3(111, 73, 43)) && + !CheckForColor(color.rgb, vec3(207, 166, 139)) && + !CheckForColor(color.rgb, vec3(155, 139, 207)) && + !CheckForColor(color.rgb, vec3(161, 195, 180)) && + !CheckForColor(color.rgb, vec3(201, 143, 107)) && + !CheckForColor(color.rgb, vec3(135, 121, 181)) && + !CheckForColor(color.rgb, vec3(131, 181, 145)) + ) { + emission = 6.0; + albedo.rgb *= color.rgb; + highlightMult = 2.0; + maRecolor = vec3(0.5); + } else { + smoothnessG = dot(color.rgb, color.rgb) * 0.33; + smoothnessD = smoothnessG; + } + } + else /*if (mat < 10464)*/ { // Concrete+ except Lime + smoothnessG = 0.4; + highlightMult = 1.5; + smoothnessD = 0.3; + + #ifdef COATED_TEXTURES + noiseFactor = 0.2; + #endif + } + } + } else { + if (mat < 10472) { + if (mat < 10468) { // Concrete Powder+ + smoothnessG = 0.2; + smoothnessD = 0.1; + + #ifdef COATED_TEXTURES + noiseFactor = 0.5; + #endif + } + else /*if (mat < 10472)*/ { // Coral Block+ + #include "/lib/materials/specificMaterials/terrain/coral.glsl" + } + } else { + if (mat < 10476) { // Coral Fan+, Coral+ + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/terrain/coral.glsl" + } + else /*if (mat < 10480)*/ { // Crying Obsidian + #include "/lib/materials/specificMaterials/terrain/cryingObsidian.glsl" + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + } + } + } else { + if (mat < 10496) { + if (mat < 10488) { + if (mat < 10484) { // Blackstone++ + #include "/lib/materials/specificMaterials/terrain/blackstone.glsl" + } + else /*if (mat < 10488)*/ { // Gilded Blackstone + if (color.r > color.b * 3.0) { // Gilded Blackstone:Gilded Part + #include "/lib/materials/specificMaterials/terrain/rawGoldBlock.glsl" + #ifdef GLOWING_ORE_GILDEDBLACKSTONE + emission = color.g * 1.5; + emission *= GLOWING_ORE_MULT; + #endif + } else { // Gilded Blackstone:Blackstone Part + #include "/lib/materials/specificMaterials/terrain/blackstone.glsl" + } + + } + } else { + if (mat < 10492) { // Lily Pad + noSmoothLighting = true; + subsurfaceMode = 2; + + #if defined COATED_TEXTURES && defined GBUFFERS_TERRAIN + doTileRandomisation = false; + #endif + + #ifdef IPBR + float factor = min1(color.g * 2.0); + smoothnessG = factor * 0.5; + highlightMult = factor; + #endif + } + else /*if (mat < 10496)*/ { // Dirt Path + #include "/lib/materials/specificMaterials/terrain/dirt.glsl" + #ifdef GBUFFERS_TERRAIN + glColor.a = sqrt(glColor.a); + #endif + } + } + } else { + if (mat < 10504) { + if (mat < 10500) { // Torch + noDirectionalShading = true; + + if (color.r > 0.95) { + noSmoothLighting = true; + lmCoordM.x = 1.0; + emission = GetLuminance(color.rgb) * 4.1; + albedo.r *= 1.4; + albedo.b *= 0.5; + } else + #ifdef GBUFFERS_TERRAIN + if (abs(NdotU) < 0.5) { + lmCoordM.x = min1(0.7 + 0.3 * pow2(1.0 - signMidCoordPos.y)); + } + #else + noSmoothLighting = false; + lmCoordM.x = 0.9; + #endif + + emission += 0.0001; // No light reducing during noon + } + else /*if (mat < 10504)*/ { // End Rod + noDirectionalShading = true; + + #ifdef GBUFFERS_TERRAIN + vec3 fractPos = abs(fract(playerPos + cameraPosition) - 0.5); + float maxCoord = max(fractPos.x, max(fractPos.y, fractPos.z)); + lmCoordM.x = maxCoord < 0.4376 ? 0.97 : 0.8; + #else + lmCoordM.x = 0.9; + #endif + + float dotColor = dot(color.rgb, color.rgb); + if (dotColor > 2.0) { + emission = 2.8; + emission *= 0.4 + max0(0.6 - 0.006 * lViewPos); + + albedo.rgb = pow2(color.rgb); + albedo.g *= 0.95; + } + } + } else { + if (mat < 10508) { // Chorus Plant + + } + else /*if (mat < 10512)*/ { // Chorus Flower:Alive + float dotColor = dot(color.rgb, color.rgb); + if (dotColor > 1.0) + emission = pow2(pow2(pow2(dotColor * 0.33))) + 0.2 * dotColor; + } + } + } + } + } + } + } + } else { + if (mat < 10768) { + if (mat < 10640) { + if (mat < 10576) { + if (mat < 10544) { + if (mat < 10528) { + if (mat < 10520) { + if (mat < 10516) { // Chorus Flower:Dead + if (color.b < color.g) { + emission = 10.7; + albedo.rgb *= color.rgb * dot(color.rgb, color.rgb) * vec3(0.4, 0.35, 0.4); + } + } + else /*if (mat < 10520)*/ { // Furnace:Lit + lmCoordM.x *= 0.95; + + #include "/lib/materials/specificMaterials/terrain/cobblestone.glsl" + + float dotColor = dot(color.rgb, color.rgb); + emission = 2.5 * dotColor * max0(pow2(pow2(pow2(color.r))) - color.b) + pow(dotColor * 0.35, 32.0); + albedo.r *= 1.0 + 0.1 * emission; + } + } else { + if (mat < 10524) { // Cactus + float factor = sqrt1(color.r); + smoothnessG = factor * 0.5; + highlightMult = factor; + } + else /*if (mat < 10528)*/ { // Note Block, Jukebox + float factor = color.r * 0.5; + smoothnessG = factor; + smoothnessD = factor; + + #ifdef COATED_TEXTURES + noiseFactor = 0.66; + #endif + } + } + } else { + if (mat < 10536) { + if (mat < 10532) { // Soul Torch + noSmoothLighting = true; noDirectionalShading = true; + lmCoordM.x = min(lmCoordM.x * 0.9, 0.77); + + if (color.b > 0.6) { + emission = 2.7; + albedo.rgb = pow1_5(color.rgb); + albedo.r = min1(color.r + 0.1); + } + emission += 0.0001; // No light reducing during noon + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + else /*if (mat < 10536)*/ { // Brown Mushroom Block + if (color.r > color.g && color.g > color.b && color.b > 0.37) { + #include "/lib/materials/specificMaterials/terrain/cobblestone.glsl" + } else { + float factor = pow2(color.r) * color.r * 0.8; + highlightMult = 1.5; + smoothnessG = factor; + smoothnessD = factor * 0.9; + + #ifdef COATED_TEXTURES + noiseFactor = 0.33; + #endif + } + } + } else { + if (mat < 10540) { // Red Mushroom Block + if (color.r > color.g && color.g > color.b && color.b > 0.37) { + #include "/lib/materials/specificMaterials/terrain/cobblestone.glsl" + } else { + float factor = min1(pow2(color.g) + 0.25); + highlightMult = 1.5; + smoothnessG = factor; + smoothnessD = factor * 0.7; + + #ifdef COATED_TEXTURES + noiseFactor = 0.33; + #endif + } + } + else /*if (mat < 10544)*/ { // Mushroom Stem, + if (color.r > color.g && color.g > color.b && color.b < 0.6) { + #include "/lib/materials/specificMaterials/terrain/cobblestone.glsl" + } else { + float factor = pow2(pow2(color.g)); + highlightMult = 1.5; + smoothnessG = factor; + smoothnessD = factor * 0.5; + + #ifdef COATED_TEXTURES + noiseFactor = 0.33; + #endif + } + } + } + } + } else { + if (mat < 10560) { + if (mat < 10552) { + if (mat < 10548) { // Glow Lichen + noSmoothLighting = true; + + #if GLOWING_LICHEN > 0 + float dotColor = dot(color.rgb, color.rgb); + emission = min(pow2(pow2(dotColor) * dotColor) * 1.4 + dotColor * 0.9, 6.0); + emission = mix(emission, dotColor * 1.5, min1(lViewPos / 96.0)); // Less noise in the distance + + #if GLOWING_LICHEN == 1 + float skyLightFactor = pow2(1.0 - min1(lmCoord.y * 2.9)); + emission *= skyLightFactor; + + color.r *= 1.0 + 0.15 * skyLightFactor; + #else + color.r *= 1.15; + #endif + #endif + } + else /*if (mat < 10552)*/ { // Enchanting Table:Base + float dotColor = dot(color.rgb, color.rgb); + if (dotColor < 0.19 && color.r < color.b) { + #include "/lib/materials/specificMaterials/terrain/obsidian.glsl" + } else if (color.g >= color.r) { + #include "/lib/materials/specificMaterials/terrain/diamondBlock.glsl" + } else { + smoothnessG = color.r * 0.3 + 0.1; + } + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + } else { + if (mat < 10556) { // End Portal Frame:Inactive + noSmoothLighting = true; + + if (abs(color.r - color.g - 0.05) < 0.10) { + #include "/lib/materials/specificMaterials/terrain/endStone.glsl" + } else { + #include "/lib/materials/specificMaterials/terrain/endPortalFrame.glsl" + } + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + else /*if (mat < 10560)*/ { // End Portal Frame:Active + noSmoothLighting = true; + + if (abs(color.r - color.g - 0.05) < 0.10) { + #include "/lib/materials/specificMaterials/terrain/endStone.glsl" + } else { + #include "/lib/materials/specificMaterials/terrain/endPortalFrame.glsl" + + vec2 absCoord = abs(fract(playerPos.xz + cameraPosition.xz) - 0.5); + float maxCoord = max(absCoord.x, absCoord.y); + if (maxCoord < 0.2505) { // End Portal Frame:Eye of Ender + smoothnessG = 0.5; + smoothnessD = 0.5; + emission = pow2(min(color.g, 0.25)) * 170.0 * (0.28 - maxCoord); + } else { + float minCoord = min(absCoord.x, absCoord.y); + if (CheckForColor(color.rgb, vec3(153, 198, 147)) + && minCoord > 0.25) { // End Portal Frame:Emissive Corner Bits + emission = 1.4; + albedo.rgb = vec3(0.45, 1.0, 0.6); + } + } + } + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + } + } else { + if (mat < 10568) { + if (mat < 10564) { // Lantern + noSmoothLighting = true; + lmCoordM.x = 0.77; + + #include "/lib/materials/specificMaterials/terrain/lanternMetal.glsl" + + emission = 4.3 * max0(color.r - color.b); + emission += min(pow2(pow2(0.75 * dot(color.rgb, color.rgb))), 5.0); + albedo.gb *= pow(vec2(0.8, 0.7), vec2(sqrt(emission) * 0.5)); + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + else /*if (mat < 10568)*/ { // Soul Lantern + noSmoothLighting = true; + lmCoordM.x = min(lmCoordM.x, 0.77); // consistency748523 + + #include "/lib/materials/specificMaterials/terrain/lanternMetal.glsl" + + emission = 1.45 * max0(color.g - color.r * 2.0); + emission += 1.17 * min(pow2(pow2(0.55 * dot(color.rgb, color.rgb))), 3.5); + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + } else { + if (mat < 10572) { // Turtle Egg, Sniffer Egg + smoothnessG = (color.r + color.g) * 0.35; + smoothnessD = (color.r + color.g) * 0.25; + } + else /*if (mat < 10576)*/ { // Dragon Egg + emission = float(color.b > 0.1) * 10.0 + 1.25; + } + } + } + } + } else { + if (mat < 10608) { + if (mat < 10592) { + if (mat < 10584) { + if (mat < 10580) { // Smoker:Lit + lmCoordM.x *= 0.95; + + float dotColor = dot(color.rgb, color.rgb); + if (color.r > color.b * 2.0 && dotColor > 0.7) { + emission = 2.5 * dotColor; + albedo.r *= 1.5; + } else { + #include "/lib/materials/specificMaterials/terrain/cobblestone.glsl" + } + } + else /*if (mat < 10584)*/ { // Blast Furnace:Lit + lmCoordM.x *= 0.95; + + float dotColor = dot(color.rgb, color.rgb); + if (color.r > color.b * 2.0 && dotColor > 0.7) { + emission = pow2(color.g) * (20.0 - 13.7 * float(color.b > 0.25)); + albedo.r *= 1.5; + } else { + #include "/lib/materials/specificMaterials/terrain/cobblestone.glsl" + } + } + } else { + if (mat < 10588) { // Candles:Lit + noSmoothLighting = true; + + albedo.rgb *= 1.0 + pow2(max(-signMidCoordPos.y, float(NdotU > 0.9) * 1.2)); + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + else /*if (mat < 10592)*/ { // Respawn Anchor:Unlit + noSmoothLighting = true; + + #include "/lib/materials/specificMaterials/terrain/cryingObsidian.glsl" + emission += 0.2; + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + } + } else { + if (mat < 10600) { + if (mat < 10596) { // Respawn Anchor:Lit + noSmoothLighting = true; + + #include "/lib/materials/specificMaterials/terrain/cryingObsidian.glsl" + + vec2 absCoord = abs(signMidCoordPos); + if (NdotU > 0.9 && max(absCoord.x, absCoord.y) < 0.754) { // Portal + highlightMult = 0.0; + smoothnessD = 0.0; + emission = pow2(color.r) * color.r * 16.0; + maRecolor = vec3(0.0); + } else if (color.r + color.g > 1.3) { // Respawn Anchor:Glowstone Part + emission = 4.5 * sqrt3(max0(color.r + color.g - 1.3)); + } + + emission += 0.3; + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + else /*if (mat < 10600)*/ { // Redstone Wire:Lit + #include "/lib/materials/specificMaterials/terrain/redstoneBlock.glsl" + + #if COLORED_LIGHTING == 0 + emission = pow2(min(color.r, 0.9)) * 4.0; + #else + vec3 colorP = color.rgb / glColor.rgb; + emission = pow2((colorP.r + color.r) * 0.5) * 3.5; + #endif + + albedo.gb *= 0.25; + } + } else { + if (mat < 10604) { // Redstone Wire:Unlit + #include "/lib/materials/specificMaterials/terrain/redstoneBlock.glsl" + } + else /*if (mat < 10608)*/ { // Redstone Torch + #include "/lib/materials/specificMaterials/terrain/redstoneTorch.glsl" + emission += 0.0001; // No light reducing during noon + } + } + } + } else { + if (mat < 10624) { + if (mat < 10616) { + if (mat < 10612) { // Redstone Block + #include "/lib/materials/specificMaterials/terrain/redstoneBlock.glsl" + #ifdef EMISSIVE_REDSTONE_BLOCK + emission = 0.75 + 3.0 * pow2(pow2(color.r)); + color.gb *= 0.65; + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + #endif + } + else /*if (mat < 10616)*/ { // Redstone Ore:Unlit + if (color.r - color.g > 0.2) { // Redstone Ore:Unlit:Redstone Part + #include "/lib/materials/specificMaterials/terrain/redstoneBlock.glsl" + #ifdef GLOWING_ORE_REDSTONE + emission = color.r * pow1_5(color.r) * 4.0; + color.gb *= 1.0 - 0.9 * min1(GLOWING_ORE_MULT); + emission *= GLOWING_ORE_MULT; + #endif + } else { // Redstone Ore:Unlit:Stone Part + #include "/lib/materials/specificMaterials/terrain/stone.glsl" + } + } + } else { + if (mat < 10620) { // Redstone Ore:Lit + if (color.r - color.g > 0.2) { // Redstone Ore:Lit:Redstone Part + #include "/lib/materials/specificMaterials/terrain/redstoneBlock.glsl" + emission = pow2(color.r) * color.r * 5.5; + albedo.gb *= 0.1; + } else { // Redstone Ore:Lit:Stone Part + #include "/lib/materials/specificMaterials/terrain/stone.glsl" + } + noSmoothLighting = true; + } + else /*if (mat < 10624)*/ { // Deepslate Redstone Ore:Unlit + if (color.r - color.g > 0.2) { // Deepslate Redstone Ore:Unlit:Redstone Part + #include "/lib/materials/specificMaterials/terrain/redstoneBlock.glsl" + #ifdef GLOWING_ORE_REDSTONE + emission = color.r * pow1_5(color.r) * 4.0; + color.gb *= 1.0 - 0.9 * min1(GLOWING_ORE_MULT); + emission *= GLOWING_ORE_MULT; + #endif + } else { // Deepslate Redstone Ore:Unlit:Deepslate Part + #include "/lib/materials/specificMaterials/terrain/deepslate.glsl" + } + } + } + } else { + if (mat < 10632) { + if (mat < 10628) { // Deepslate Redstone Ore:Lit + if (color.r - color.g > 0.2) { // Deepslate Redstone Ore:Lit:Redstone Part + #include "/lib/materials/specificMaterials/terrain/redstoneBlock.glsl" + emission = pow2(color.r) * color.r * 6.0; + albedo.gb *= 0.05; + } else { // Deepslate Redstone Ore:Lit:Deepslate Part + #include "/lib/materials/specificMaterials/terrain/deepslate.glsl" + } + noSmoothLighting = true; + } + else /*if (mat < 10632)*/ { // Cave Vines:No Glow Berries + subsurfaceMode = 1; + lmCoordM.x *= 0.875; + } + } else { + if (mat < 10636) { // Cave Vines:With Glow Berries + subsurfaceMode = 1; + lmCoordM.x *= 0.875; + + if (color.r > 0.64) { + emission = color.r < 0.75 ? 2.5 : 8.0; + albedo.rgb = color.rgb * vec3(1.0, 0.8, 0.6); + } + } + else /*if (mat < 10640)*/ { // Redstone Lamp:Unlit + materialMask = OSIEBCA; // Intense Fresnel + smoothnessG = color.r * 0.5 + 0.2; + float factor = pow2(smoothnessG); + highlightMult = factor * 2.0 + 1.0; + smoothnessD = min1(factor * 2.0); + } + } + } + } + } + } else { + if (mat < 10704) { + if (mat < 10672) { + if (mat < 10656) { + if (mat < 10648) { + if (mat < 10644) { // Redstone Lamp:Lit + noDirectionalShading = true; + lmCoordM.x = 0.89; + + materialMask = OSIEBCA; // Intense Fresnel + smoothnessG = color.r * 0.35 + 0.2; + float factor = pow2(smoothnessG); + highlightMult = factor * 2.0 + 1.0; + smoothnessD = min1(factor * 2.0); + + if (color.b > 0.1) { + float dotColor = dot(color.rgb, color.rgb); + #if MC_VERSION >= 11300 + emission = pow2(dotColor) * 1.0; + #else + emission = dotColor * 1.2; + #endif + albedo.rgb = pow1_5(color.rgb); + maRecolor = vec3(emission * 0.2); + } + } + else /*if (mat < 10648)*/ { // Repeater, Comparator + #if ANISOTROPIC_FILTER > 0 + color = texture2D(tex, texCoord); // Fixes artifacts + color.rgb *= glColor.rgb; + #endif + + vec3 absDif = abs(vec3(color.r - color.g, color.g - color.b, color.r - color.b)); + float maxDif = max(absDif.r, max(absDif.g, absDif.b)); + if (maxDif > 0.125 || color.b > 0.99) { // Redstone Parts + if (color.r < 0.999 && color.b > 0.4) albedo.gb *= 0.5; // Comparator:Emissive Wire + + #include "/lib/materials/specificMaterials/terrain/redstoneTorch.glsl" + } else { // Quartz Base + float factor = pow2(color.g) * 0.6; + + smoothnessG = factor; + highlightMult = 1.0 + 2.5 * factor; + smoothnessD = factor; + } + } + } else { + if (mat < 10652) { // Shroomlight + noSmoothLighting = true; noDirectionalShading = true; + lmCoordM = vec2(1.0, 0.0); + + float dotColor = dot(color.rgb, color.rgb); + emission = min(pow2(pow2(pow2(dotColor * 0.6))), 6.0) * 0.8 + 0.5; + } + else /*if (mat < 10656)*/ { // Campfire:Lit + #ifdef GBUFFERS_TERRAIN + vec3 fractPos = fract(playerPos + cameraPosition) - 0.5; + lmCoordM.x = pow2(pow2(smoothstep1(1.0 - 0.4 * dot(fractPos.xz, fractPos.xz)))); + #endif + + float dotColor = dot(color.rgb, color.rgb); + if (color.r > color.b && color.r - color.g < 0.15 && dotColor < 1.4) { + #include "/lib/materials/specificMaterials/terrain/oakWood.glsl" + } else if (color.r > color.b || dotColor > 2.9) { + noDirectionalShading = true; + emission = 3.5; + albedo.rgb *= sqrt1(GetLuminance(color.rgb)); + } + } + } + } else { + if (mat < 10664) { + if (mat < 10660) { // Soul Campfire:Lit + noSmoothLighting = true; + + float dotColor = dot(color.rgb, color.rgb); + if (color.r > color.b) { + #include "/lib/materials/specificMaterials/terrain/oakWood.glsl" + } else if (color.g - color.r > 0.1 || dotColor > 2.9) { + noDirectionalShading = true; + emission = 2.1; + albedo.rgb *= sqrt1(GetLuminance(color.rgb)); + } + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + else /*if (mat < 10664)*/ { // Campfire:Unlit, Soul Campfire:Unlit + noSmoothLighting = true; + + if (color.r > color.b) { + #include "/lib/materials/specificMaterials/terrain/oakWood.glsl" + } + } + } else { + if (mat < 10668) { // Observer + if (color.r > 0.1 && color.g + color.b < 0.1) { + #include "/lib/materials/specificMaterials/terrain/redstoneTorch.glsl" + } else { + #include "/lib/materials/specificMaterials/terrain/cobblestone.glsl" + } + } + else /*if (mat < 10672)*/ { // Wool+, Carpet+ except Lime + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + } + } + } else { + if (mat < 10688) { + if (mat < 10680) { + if (mat < 10676) { // Bone Block + smoothnessG = color.r * 0.2; + smoothnessD = smoothnessG; + + #ifdef GBUFFERS_TERRAIN + DoBrightBlockTweaks(color.rgb, 0.5, shadowMult, highlightMult); + #endif + + #ifdef COATED_TEXTURES + noiseFactor = 0.33; + #endif + } + else /*if (mat < 10680)*/ { // Barrel, Beehive, Bee Nest, Honeycomb Block + #include "/lib/materials/specificMaterials/terrain/cobblestone.glsl" + + #ifdef COATED_TEXTURES + noiseFactor = 0.66; + #endif + } + } else { + if (mat < 10684) { // Ochre Froglight + float frogPow = 8.0; + #include "/lib/materials/specificMaterials/terrain/froglights.glsl" + } + else /*if (mat < 10688)*/ { // Verdant Froglight + float frogPow = 16.0; + #include "/lib/materials/specificMaterials/terrain/froglights.glsl" + } + } + } else { + if (mat < 10696) { + if (mat < 10692) { // Pearlescent Froglight + float frogPow = 24.0; + #include "/lib/materials/specificMaterials/terrain/froglights.glsl" + } + else /*if (mat < 10696)*/ { // Reinforced Deepslate + if (abs(color.r - color.g) < 0.01) { // Reinforced Deepslate:Deepslate Part + #include "/lib/materials/specificMaterials/terrain/deepslate.glsl" + } else { // Reinforced Deepslate:Sculk + float boneFactor = max0(color.r * 1.25 - color.b); + + if (boneFactor < 0.0001) emission = 0.15; + + smoothnessG = min1(boneFactor * 1.7); + smoothnessD = smoothnessG; + } + } + } else { + if (mat < 10700) { // Sculk, Sculk Catalyst, Sculk Vein, Sculk Sensor:Unlit + float boneFactor = max0(color.r * 1.25 - color.b); + + if (boneFactor < 0.0001) { + emission = pow2(max0(color.g - color.r)) * 1.7; + + #ifdef GBUFFERS_TERRAIN + vec2 bpos = floor(playerPos.xz + cameraPosition.xz + 0.501) + + floor(playerPos.y + cameraPosition.y + 0.501); + bpos = bpos * 0.01 + 0.003 * frameTimeCounter; + emission *= pow2(texture2D(noisetex, bpos).r * pow1_5(texture2D(noisetex, bpos * 0.5).r)); + emission *= 6.0; + #endif + } + + smoothnessG = min1(boneFactor * 1.7); + smoothnessD = smoothnessG; + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + else /*if (mat < 10704)*/ { // Sculk Shrieker + float boneFactor = max0(color.r * 1.25 - color.b); + + if (boneFactor < 0.0001) { + emission = pow2(max0(color.g - color.r)) * 2.0; + + #ifdef GBUFFERS_TERRAIN + vec2 coordFactor = abs(fract(playerPos.xz + cameraPosition.xz) - 0.5); + float coordFactorM = max(coordFactor.x, coordFactor.y); + if (coordFactorM < 0.43) emission += color.g * 7.0; + #endif + } + + smoothnessG = min1(boneFactor * 1.7); + smoothnessD = smoothnessG; + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + } + } + } + } else { + if (mat < 10736) { + if (mat < 10720) { + if (mat < 10712) { + if (mat < 10708) { // Sculk Sensor:Lit + lmCoordM = vec2(0.0, 0.0); + emission = pow2(max0(color.g - color.r)) * 7.0 + 0.7; + } + else /*if (mat < 10712)*/ { // Spawner + smoothnessG = color.b + 0.2; + smoothnessD = smoothnessG; + + emission = 7.0 * float(CheckForColor(color.rgb, vec3(110, 4, 83))); + } + } else { + if (mat < 10716) { // Tuff++ + smoothnessG = color.r * 0.3; + smoothnessD = smoothnessG; + + #if COLORED_LIGHTING == 0 + /* Tweak to make caves with Glow Lichen look better lit and closer to vanilla Minecraft. */ + lmCoordM = pow(lmCoordM + 0.0001, vec2(0.65)); + #endif + } + else /*if (mat < 10720)*/ { // Clay + highlightMult = 2.0; + smoothnessG = pow2(pow2(color.g)) * 0.5; + smoothnessG = min1(smoothnessG); + smoothnessD = smoothnessG * 0.7; + + #ifdef GBUFFERS_TERRAIN + DoOceanBlockTweaks(smoothnessD); + #endif + + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + } + } + } else { + if (mat < 10728) { + if (mat < 10724) { // Ladder + noSmoothLighting = true; + } + else /*if (mat < 10728)*/ { // Gravel, Suspicious Gravel + #include "/lib/materials/specificMaterials/terrain/stone.glsl" + + #ifdef GBUFFERS_TERRAIN + DoOceanBlockTweaks(smoothnessD); + #endif + + #ifdef COATED_TEXTURES + noiseFactor = 1.25; + #endif + } + } else { + if (mat < 10732) { // Flower Pot, Potted Stuff:Without Subsurface + noSmoothLighting = true; + } + else /*if (mat < 10736)*/ { // Potted Stuff:With Subsurface + noSmoothLighting = true; + + float NdotE = dot(newNormal, eastVec); + if (abs(abs(NdotE) - 0.5) < 0.4) { + subsurfaceMode = 1, noDirectionalShading = true; + } + } + } + } + } else { + if (mat < 10752) { + if (mat < 10744) { + if (mat < 10740) { // Structure Block, Jigsaw Block + float blockRes = absMidCoordPos.x * atlasSize.x; + vec2 signMidCoordPosM = (floor((signMidCoordPos + 1.0) * blockRes) + 0.5) / blockRes - 1.0; + float dotsignMidCoordPos = dot(signMidCoordPosM, signMidCoordPosM); + float lBlockPosM = pow2(max0(1.0 - 1.125 * pow2(dotsignMidCoordPos))); + + emission = 4.5 * lBlockPosM; + albedo.rgb = pow2(color.rgb); + } + else /*if (mat < 10744)*/ { // Chain + noSmoothLighting = true; + lmCoordM.x = min(lmCoordM.x, 0.77); // consistency748523 + + #include "/lib/materials/specificMaterials/terrain/lanternMetal.glsl" + } + } else { + if (mat < 10748) { // Soul Sand, Soul Soil + smoothnessG = color.r * 0.4; + smoothnessD = color.r * 0.25; + } + else /*if (mat < 10752)*/ { // Dried Kelp Block + smoothnessG = pow2(color.b) * 0.8; + smoothnessD = smoothnessG; + + #ifdef COATED_TEXTURES + noiseFactor = 0.5; + #endif + } + } + } else { + if (mat < 10760) { + if (mat < 10756) { // Bamboo + if (absMidCoordPos.x > 0.005) + subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true; + // No further material properties as bamboo jungles are already slow + } + else /*if (mat < 10760)*/ { // Block of Bamboo, Bamboo Planks++ + #include "/lib/materials/specificMaterials/planks/bambooPlanks.glsl" + } + } else { + if (mat < 10764) { // Cherry Planks++ + #include "/lib/materials/specificMaterials/planks/cherryPlanks.glsl" + } + else /*if (mat < 10768)*/ { // Cherry Log, Cherry Wood + if (color.g > 0.33) { // Cherry Log:Clean Part + #include "/lib/materials/specificMaterials/planks/cherryPlanks.glsl" + } else { // Cherry Log:Wood Part, Cherry Wood + smoothnessG = pow2(color.r); + smoothnessD = smoothnessG; + } + } + } + } + } + } + } + } else { + if (mat < 10896) { + if (mat < 10832) { + if (mat < 10800) { + if (mat < 10784) { + if (mat < 10776) { + if (mat < 10772) { // Torchflower + subsurfaceMode = 1, noSmoothLighting = true, noDirectionalShading = true; + + #ifdef GBUFFERS_TERRAIN + DoFoliageColorTweaks(color.rgb, shadowMult, snowMinNdotU, lViewPos); + + emission = (1.0 - abs(signMidCoordPos.x)) * max0(0.7 - abs(signMidCoordPos.y + 0.7)); + emission = pow1_5(emission) * 2.5; + #endif + + #if SHADOW_QUALITY == -1 + shadowMult *= 1.0 - 0.3 * (signMidCoordPos.y + 1.0) * (1.0 - abs(signMidCoordPos.x)) + + 0.5 * (1.0 - signMidCoordPos.y) * invNoonFactor; // consistency357381 + #endif + } + else /*if (mat < 10776)*/ { // Potted Torchflower + noSmoothLighting = true; + + float NdotE = dot(newNormal, eastVec); + if (abs(abs(NdotE) - 0.5) < 0.4) { + subsurfaceMode = 1, noDirectionalShading = true; + + #ifdef GBUFFERS_TERRAIN + emission = (1.0 - abs(signMidCoordPos.x)) * max0(0.7 - abs(signMidCoordPos.y + 0.7)); + emission = pow1_5(emission) * 2.5; + #endif + } + } + } else { + if (mat < 10780) { // Crimson Fungus, Warped Fungus + noSmoothLighting = true; + + if (color.r > 0.91) { + emission = 3.0 * color.g; + albedo.r *= 1.2; + maRecolor = vec3(0.1); + } + } + else /*if (mat < 10784)*/ { // Potted Crimson Fungus, Potted Warped Fungus + noSmoothLighting = true; + + float NdotE = dot(newNormal, eastVec); + if (abs(abs(NdotE) - 0.5) < 0.4) { + if (color.r > 0.91) { + emission = 3.0 * color.g; + albedo.r *= 1.2; + maRecolor = vec3(0.1); + } + } + } + } + } else { + if (mat < 10792) { + if (mat < 10788) { // Calibrated Sculk Sensor:Unlit + #if ANISOTROPIC_FILTER == 0 + vec4 checkColor = color; + #else + vec4 checkColor = texture2D(tex, texCoord); // Fixes artifacts + #endif + if (checkColor.r + checkColor.b > checkColor.g * 2.2 || checkColor.r > 0.99) { // Amethyst Part + #if GLOWING_AMETHYST >= 1 && defined GBUFFERS_TERRAIN + vec2 absCoord = abs(signMidCoordPos); + float maxBlockPos = max(absCoord.x, absCoord.y); + emission = pow2(max0(1.0 - maxBlockPos) * color.g) * 5.4 + 1.2 * color.g; + + color.g *= 1.0 - emission * 0.07; + color.rgb *= color.g; + #endif + + #ifdef COATED_TEXTURES + noiseFactor = 0.66; + #endif + } else { // Sculk Part + float boneFactor = max0(color.r * 1.25 - color.b); + + if (boneFactor < 0.0001) emission = pow2(max0(color.g - color.r)); + + smoothnessG = min1(boneFactor * 1.7); + smoothnessD = smoothnessG; + } + + #ifdef SNOWY_WORLD + snowFactor = 0.0; + #endif + } + else /*if (mat < 10792)*/ { // Calibrated Sculk Sensor:Lit + lmCoordM = vec2(0.0, 0.0); + + #if ANISOTROPIC_FILTER == 0 + vec4 checkColor = color; + #else + vec4 checkColor = texture2D(tex, texCoord); // Fixes artifacts + #endif + if (checkColor.r + checkColor.b > checkColor.g * 2.2 || checkColor.r > 0.99) { // Amethyst Part + lmCoordM.x = 1.0; + + #if GLOWING_AMETHYST >= 1 && defined GBUFFERS_TERRAIN + vec2 absCoord = abs(signMidCoordPos); + float maxBlockPos = max(absCoord.x, absCoord.y); + emission = pow2(max0(1.0 - maxBlockPos) * color.g) * 5.4 + 1.2 * color.g; + + color.g *= 1.0 - emission * 0.07; + color.rgb *= color.g; + #endif + + #ifdef COATED_TEXTURES + noiseFactor = 0.66; + #endif + } else { // Sculk Part + emission = pow2(max0(color.g - color.r)) * 7.0 + 0.7; + } + } + } else { + if (mat < 10796) { // Oak Door, Oak Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/planks/oakPlanks.glsl" + } + else /*if (mat < 10800)*/ { // Spruce Door, Spruce Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/planks/sprucePlanks.glsl" + } + } + } + } else { + if (mat < 10816) { + if (mat < 10808) { + if (mat < 10804) { // Birch Door, Birch Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/planks/birchPlanks.glsl" + } + else /*if (mat < 10808)*/ { // Jungle Door, Jungle Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/planks/junglePlanks.glsl" + } + } else { + if (mat < 10812) { // Acacia Door, Acacia Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/planks/acaciaPlanks.glsl" + } + else /*if (mat < 10816)*/ { // Dark Oak Door, Dark Oak Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/planks/darkOakPlanks.glsl" + } + } + } else { + if (mat < 10824) { + if (mat < 10820) { // Mangrove Door, Mangrove Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/planks/mangrovePlanks.glsl" + } + else /*if (mat < 10824)*/ { // Crimson Door, Crimson Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/planks/crimsonPlanks.glsl" + } + } else { + if (mat < 10828) { // Warped Door, Warped Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/planks/warpedPlanks.glsl" + } + else /*if (mat < 10832)*/ { // Bamboo Door, Bamboo Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/planks/bambooPlanks.glsl" + } + } + } + } + } else { + if (mat < 10864) { + if (mat < 10848) { + if (mat < 10840) { + if (mat < 10836) { // Cherry Door, Cherry Trapdoor + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/planks/cherryPlanks.glsl" + } + else /*if (mat < 10840)*/ { // Brewing Stand + #ifdef GBUFFERS_TERRAIN + vec3 worldPos = playerPos + cameraPosition; + vec3 fractPos = fract(worldPos.xyz); + vec3 coordM = abs(fractPos.xyz - 0.5); + float cLength = dot(coordM, coordM) * 1.3333333; + cLength = pow2(1.0 - cLength); + + if (color.r + color.g > color.b * 3.0 && max(coordM.x, coordM.z) < 0.07) { + emission = 2.5 * pow1_5(cLength); + } else { + lmCoordM.x = max(lmCoordM.x * 0.9, cLength); + + #include "/lib/materials/specificMaterials/terrain/cobblestone.glsl" + } + #else + emission = max0(color.r + color.g - color.b * 1.8 - 0.3) * 2.2; + #endif + } + } else { + if (mat < 10844) { // Lime Concrete + smoothnessG = 0.4; + highlightMult = 1.5; + smoothnessD = 0.3; + + #ifdef COATED_TEXTURES + noiseFactor = 0.2; + #endif + + #ifdef GREEN_SCREEN_LIME + materialMask = OSIEBCA * 240.0; // Green Screen Lime Blocks + #endif + } + else /*if (mat < 10848)*/ { // Lime Carpet, Lime Wool + #ifdef COATED_TEXTURES + noiseFactor = 0.77; + #endif + + #ifdef GREEN_SCREEN_LIME + materialMask = OSIEBCA * 240.0; // Green Screen Lime Blocks + #endif + } + } + } else { + if (mat < 10856) { + if (mat < 10852) { // Crafter + smoothnessG = pow2(color.b); + smoothnessD = max(smoothnessG, 0.2); + + if (color.r > 2.5 * (color.g + color.b)) { + emission = 4.0; + albedo.rgb *= color.rgb; + } + } + // else /*if (mat < 10856)*/ { // Copper Bulb:BrighterOnes + // #include "/lib/materials/specificMaterials/terrain/copperBulb.glsl" + // } + } else { + if (mat < 10860) { // Copper Bulb:DimmerOnes + #include "/lib/materials/specificMaterials/terrain/copperBulb.glsl" + emission *= 0.85; + } + else /*if (mat < 10864)*/ { // Copper Door+, Copper Trapdoor+ + noSmoothLighting = true; + #include "/lib/materials/specificMaterials/terrain/copperBlock.glsl" + } + } + } + } else { + if (mat < 10880) { + if (mat < 10872) { + if (mat < 10868) { // Candles:Unlit + + } + else /*if (mat < 10872)*/ { // Trial Spawner:NotOmiNdotUs:Active, Vault:NotOmiNdotUs:Active + smoothnessG = max0(color.b - color.r * 0.5); + smoothnessD = smoothnessG; + + emission = max0(color.r - color.b) * 3.0; + albedo.rgb = pow(color.rgb, vec3(1.0 + 0.5 * sqrt(emission))); + } + } else { + if (mat < 10876) { // Trial Spawner:Inactive, Vault:Inactive + smoothnessG = max0(color.b - color.r * 0.5); + smoothnessD = smoothnessG; + } + else /*if (mat < 10880)*/ { // Trial Spawner:OmiNdotUs:Active, Vault:OmiNdotUs:Active + float maxComponent = max(max(color.r, color.g), color.b); + float minComponent = min(min(color.r, color.g), color.b); + float saturation = (maxComponent - minComponent) / (1.0 - abs(maxComponent + minComponent - 1.0)); + + smoothnessG = max0(color.b - pow2(saturation) * 0.5) * 0.5 + 0.1; + smoothnessD = smoothnessG; + + emission = saturation > 0.5 ? 4.0 : 0.0; + albedo.rgb = pow(color.rgb, vec3(1.0 + (0.3 + 0.5 * color.r) * emission)); + } + } + } else { + if (mat < 10888) { + if (mat < 10884) { // Several Non-solid Blocks + + } + else /*if (mat < 10888)*/ { // Weeping Vines, Twisting Vines + noSmoothLighting = true; + + #if defined COATED_TEXTURES && defined GBUFFERS_TERRAIN + doTileRandomisation = false; + #endif + + if (color.r > 0.91) { + emission = 3.0 * color.g; + albedo.r *= 1.2; + maRecolor = vec3(0.1); + } + } + } else { + if (mat < 10892) { // Hay Block + smoothnessG = pow2(color.r) * 0.5; + highlightMult *= 1.5; + smoothnessD = float(color.r > color.g * 2.0) * 0.3; + } + else /*if (mat < 10896)*/ { // + + } + } + } + } + } + } else { + if (mat < 10960) { + if (mat < 10928) { + if (mat < 10912) { + if (mat < 10904) { + if (mat < 10900) { // + + } + else /*if (mat < 10904)*/ { // + + } + } else { + if (mat < 10908) { // + + } + else /*if (mat < 10912)*/ { // + + } + } + } else { + if (mat < 10920) { + if (mat < 10916) { // + + } + else /*if (mat < 10920)*/ { // + + } + } else { + if (mat < 10924) { // + + } + else /*if (mat < 10928)*/ { // + + } + } + } + } else { + if (mat < 10944) { + if (mat < 10936) { + if (mat < 10932) { // + + } + else /*if (mat < 10936)*/ { // + + } + } else { + if (mat < 10940) { // + + } + else /*if (mat < 10944)*/ { // + + } + } + } else { + if (mat < 10952) { + if (mat < 10948) { // + + } + else /*if (mat < 10952)*/ { // + + } + } else { + if (mat < 10956) { // + + } + else /*if (mat < 10960)*/ { // + + } + } + } + } + } else { + if (mat < 10992) { + if (mat < 10976) { + if (mat < 10968) { + if (mat < 10964) { // + + } + else /*if (mat < 10968)*/ { // + + } + } else { + if (mat < 10972) { // + + } + else /*if (mat < 10976)*/ { // + + } + } + } else { + if (mat < 10984) { + if (mat < 10980) { // + + } + else /*if (mat < 10984)*/ { // + + } + } else { + if (mat < 10988) { // + + } + else /*if (mat < 10992)*/ { // + + } + } + } + } else { + if (mat < 11008) { + if (mat < 11000) { + if (mat < 10996) { // + + } + else /*if (mat < 11000)*/ { // + + } + } else { + if (mat < 11004) { // + + } + else /*if (mat < 11008)*/ { // + + } + } + } else { + if (mat < 11016) { + if (mat < 11012) { // + + } + else /*if (mat < 11016)*/ { // + + } + } else { + if (mat < 11020) { // + + } + else /*if (mat < 11024)*/ { // + + } + } + } + } + } + } + } + } +} +} \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/others/endPortalEffect.glsl b/shaders/lib/materials/specificMaterials/others/endPortalEffect.glsl new file mode 100644 index 0000000..a494cea --- /dev/null +++ b/shaders/lib/materials/specificMaterials/others/endPortalEffect.glsl @@ -0,0 +1,100 @@ +// End Portal fix by fayer3#2332 (Modified) +vec3[8] colors = vec3[]( + vec3(0.3472479, 0.6559956, 0.7387838) * 1.5, + vec3(0.6010780, 0.7153565, 1.060625 ), + vec3(0.4221090, 0.8135094, 0.9026056), + vec3(0.3492291, 1.0241201, 1.8612821), + vec3(0.7543085, 0.8238697, 0.6803233), + vec3(0.4144472, 0.5648165, 0.8037 ), + vec3(0.508905 , 0.6719649, 0.9982805), + vec3(0.5361914, 0.4476583, 0.8008522)); +color.rgb = vec3(0.4214321, 0.4722309, 1.9922364) * 0.08; + +float dither = Bayer64(gl_FragCoord.xy); +#ifdef TAA + dither = fract(dither + 1.61803398875 * mod(float(frameCounter), 3600.0)); + int repeat = 4; +#else + int repeat = 8; +#endif +float dismult = 0.5; +for (int j = 0; j < repeat; j++) { + float add = float(j + dither) * 0.0625 / float(repeat); + for (int i = 1; i <= 8; i++) { + float colormult = 0.9/(30.0+i); + float rotation = (i - 0.1 * i + 0.71 * i - 11 * i + 21) * 0.01 + i * 0.01; + float Cos = cos(radians(rotation)); + float Sin = sin(radians(rotation)); + vec2 offset = vec2(0.0, 1.0/(3600.0/24.0)) * pow(16.0 - i, 2.0) * 0.004; + + vec3 wpos = normalize((gbufferModelViewInverse * vec4(viewPos * (i * dismult + 1), 1.0)).xyz); + if (abs(NdotU) > 0.9) { + wpos.xz /= wpos.y; + wpos.xz *= 0.06 * sign(- playerPos.y); + wpos.xz *= abs(playerPos.y) + i * dismult + add; + wpos.xz -= cameraPosition.xz * 0.05; + } else { + vec3 absPos = abs(playerPos); + if (abs(dot(normal, eastVec)) > 0.9) { + wpos.xz = wpos.yz / wpos.x; + wpos.xz *= 0.06 * sign(- playerPos.x); + wpos.xz *= abs(playerPos.x) + i * dismult + add; + wpos.xz -= cameraPosition.yz * 0.05; + } else { + wpos.xz = wpos.yx / wpos.z; + wpos.xz *= 0.06 * sign(- playerPos.z); + wpos.xz *= abs(playerPos.z) + i * dismult + add; + wpos.xz -= cameraPosition.yx * 0.05; + } + } + vec2 pos = wpos.xz; + + vec2 wind = fract((frameTimeCounter + 984.0) * (i + 8) * 0.125 * offset); + vec2 coord = mat2(Cos, Sin, -Sin, Cos) * pos + wind; + if (mod(float(i), 4) < 1.5) coord = coord.yx + vec2(-1.0, 1.0) * wind.y; + + vec3 psample = pow(texture2D(tex, coord).rgb, vec3(0.85)) * colors[i-1] * colormult; + color.rgb += psample * length(psample.rgb) * (3000.0 / repeat); + } +} +color.rgb *= vec3(0.09, 0.077, 0.07); +emission = 10.0; +noDirectionalShading = true; + +#ifdef COATED_TEXTURES + noiseFactor = 0.0; +#endif + +#ifdef PORTAL_EDGE_EFFECT + //vec3 voxelPos = SceneToVoxel(mix(playerPos, vec3(0.0), -0.02)); // Fixes weird parallax offset + vec3 voxelPos = SceneToVoxel(playerPos); + + float portalOffset = 0.08333 * dither; + vec3[4] portalOffsets = vec3[]( + vec3( portalOffset, 0, portalOffset), + vec3( portalOffset, 0,-portalOffset), + vec3(-portalOffset, 0, portalOffset), + vec3(-portalOffset, 0,-portalOffset) + ); + + float edge = 0.0; + for (int i = 0; i < 4; i++) { + int voxel = int(texelFetch(voxel_sampler, ivec3(voxelPos + portalOffsets[i]), 0).r); + if (voxel == 58 || voxel == 255) { // End Portal Frame or Bedrock + edge = 1.0; break; + } + } + + #ifdef END + // No edge effect in the middle of the return fountain + vec2 var1 = abs(playerPos.xz + cameraPosition.xz - 0.5); + float var2 = max(var1.x, var1.y); + if (var2 > 1.0) + #endif + + { + vec4 edgeColor = vec4(vec3(0.3, 0.6, 0.7), 1.0); + color = mix(color, edgeColor, edge); + emission = mix(emission, 5.0, edge); + } +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/others/signText.glsl b/shaders/lib/materials/specificMaterials/others/signText.glsl new file mode 100644 index 0000000..c196c54 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/others/signText.glsl @@ -0,0 +1,15 @@ +normalM = upVec; + +highlightMult = 0.0; +shadowMult = vec3(0.0); + +#if MC_VERSION >= 11700 + if (lmCoord.x > 0.99) { // Glowing Sign Text + lmCoordM = vec2(0.0); + + emission = 1.0; + + color.rgb *= length(color.rgb) + 0.5; + } else // Normal Sign Text +#endif +color.rgb *= 5.0; \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/planks/acaciaPlanks.glsl b/shaders/lib/materials/specificMaterials/planks/acaciaPlanks.glsl new file mode 100644 index 0000000..8ea0ab5 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/planks/acaciaPlanks.glsl @@ -0,0 +1,6 @@ +smoothnessG = pow2(pow2(color.r)) * 0.65; +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.5; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/planks/bambooPlanks.glsl b/shaders/lib/materials/specificMaterials/planks/bambooPlanks.glsl new file mode 100644 index 0000000..2b0a45e --- /dev/null +++ b/shaders/lib/materials/specificMaterials/planks/bambooPlanks.glsl @@ -0,0 +1,3 @@ +smoothnessG = color.r * 0.4; + +smoothnessD = color.r * 0.3; \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/planks/birchPlanks.glsl b/shaders/lib/materials/specificMaterials/planks/birchPlanks.glsl new file mode 100644 index 0000000..6ed814d --- /dev/null +++ b/shaders/lib/materials/specificMaterials/planks/birchPlanks.glsl @@ -0,0 +1,6 @@ +smoothnessG = pow2(pow2(color.g)) * 0.75; +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.66; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/planks/cherryPlanks.glsl b/shaders/lib/materials/specificMaterials/planks/cherryPlanks.glsl new file mode 100644 index 0000000..80ef5a9 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/planks/cherryPlanks.glsl @@ -0,0 +1,6 @@ +smoothnessG = pow2(pow2(color.g)) * 0.7; +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.66; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/planks/crimsonPlanks.glsl b/shaders/lib/materials/specificMaterials/planks/crimsonPlanks.glsl new file mode 100644 index 0000000..2506ad2 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/planks/crimsonPlanks.glsl @@ -0,0 +1,6 @@ +smoothnessG = pow2(color.r) * 0.7; +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.77; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/planks/darkOakPlanks.glsl b/shaders/lib/materials/specificMaterials/planks/darkOakPlanks.glsl new file mode 100644 index 0000000..7b61730 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/planks/darkOakPlanks.glsl @@ -0,0 +1,6 @@ +smoothnessG = color.r * 0.7; +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.66; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/planks/junglePlanks.glsl b/shaders/lib/materials/specificMaterials/planks/junglePlanks.glsl new file mode 100644 index 0000000..68e61b6 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/planks/junglePlanks.glsl @@ -0,0 +1,7 @@ +smoothnessG = pow2(pow2(pow2(color.g))) * 12.0; +smoothnessG = min1(smoothnessG); +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.66; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/planks/mangrovePlanks.glsl b/shaders/lib/materials/specificMaterials/planks/mangrovePlanks.glsl new file mode 100644 index 0000000..cc5f933 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/planks/mangrovePlanks.glsl @@ -0,0 +1,3 @@ +smoothnessG = pow2(color.r) * 0.7; +smoothnessG = min1(smoothnessG); +smoothnessD = smoothnessG; \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/planks/oakPlanks.glsl b/shaders/lib/materials/specificMaterials/planks/oakPlanks.glsl new file mode 100644 index 0000000..56e3772 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/planks/oakPlanks.glsl @@ -0,0 +1,7 @@ +smoothnessG = pow2(pow2(pow2(color.g))) * 12.0; +smoothnessG = min1(smoothnessG); +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.77; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/planks/sprucePlanks.glsl b/shaders/lib/materials/specificMaterials/planks/sprucePlanks.glsl new file mode 100644 index 0000000..6d37644 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/planks/sprucePlanks.glsl @@ -0,0 +1,7 @@ +smoothnessG = pow2(pow2(color.g)) * 8.0; +smoothnessG = min1(smoothnessG); +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.66; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/planks/warpedPlanks.glsl b/shaders/lib/materials/specificMaterials/planks/warpedPlanks.glsl new file mode 100644 index 0000000..434288d --- /dev/null +++ b/shaders/lib/materials/specificMaterials/planks/warpedPlanks.glsl @@ -0,0 +1,6 @@ +smoothnessG = pow2(color.g) * 0.7; +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.77; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/anvil.glsl b/shaders/lib/materials/specificMaterials/terrain/anvil.glsl new file mode 100644 index 0000000..f55110b --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/anvil.glsl @@ -0,0 +1,6 @@ +smoothnessG = color.r; +smoothnessD = color.r; + +#ifdef COATED_TEXTURES + noiseFactor = 0.33; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/blackstone.glsl b/shaders/lib/materials/specificMaterials/terrain/blackstone.glsl new file mode 100644 index 0000000..cd04345 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/blackstone.glsl @@ -0,0 +1,2 @@ +smoothnessG = color.r; +smoothnessD = color.r * 0.65; \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/cobblestone.glsl b/shaders/lib/materials/specificMaterials/terrain/cobblestone.glsl new file mode 100644 index 0000000..6aa428e --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/cobblestone.glsl @@ -0,0 +1,3 @@ +smoothnessG = pow2(pow2(color.g)); +smoothnessD = smoothnessG; +smoothnessG = max(smoothnessG, 0.3 * color.g * float(color.g > color.b * 1.5)); \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/copperBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/copperBlock.glsl new file mode 100644 index 0000000..81bbfc3 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/copperBlock.glsl @@ -0,0 +1,10 @@ +materialMask = OSIEBCA * 2.0; // Copper Fresnel +smoothnessG = pow2(pow2(color.r)) + pow2(max0(color.g - color.r * 0.5)) * 0.3; +smoothnessG = min1(smoothnessG); +smoothnessD = smoothnessG; + +color.rgb *= 0.6 + 0.7 * GetLuminance(color.rgb); + +#ifdef COATED_TEXTURES + noiseFactor = 0.5; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/copperBulb.glsl b/shaders/lib/materials/specificMaterials/terrain/copperBulb.glsl new file mode 100644 index 0000000..dba61fc --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/copperBulb.glsl @@ -0,0 +1,20 @@ +noSmoothLighting = true; + +vec3 hsvColor = rgb2hsv(color.rgb); +if (abs(hsvColor.r - 0.09722) < 0.04305 && hsvColor.b > 0.7) { // Active Light Part + smoothnessG = 0.75; + smoothnessD = 0.35; + + float blockRes = absMidCoordPos.x * atlasSize.x; + vec2 signMidCoordPosM = (floor((signMidCoordPos + 1.0) * blockRes) + 0.5) / blockRes - 1.0; + float dotsignMidCoordPos = dot(signMidCoordPosM, signMidCoordPosM); + float lBlockPosM = pow2(max0(1.0 - 1.7 * pow2(pow2(dotsignMidCoordPos)))); + + emission = pow2(lmCoordM.x) + 0.3 * color.r; + emission *= (0.7 + 2.0 * pow2(lBlockPosM)); +} else if (color.r > 2.5 * (color.g + color.b)) { // Middle Redstone Part + emission = 4.0; + color.rgb *= color.rgb; +} else { // Copper Base + #include "/lib/materials/specificMaterials/terrain/copperBlock.glsl" +} \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/coral.glsl b/shaders/lib/materials/specificMaterials/terrain/coral.glsl new file mode 100644 index 0000000..77d5d72 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/coral.glsl @@ -0,0 +1,7 @@ +float lColor = length(color.rgb); +smoothnessG = lColor * 0.2; +smoothnessD = lColor * 0.15; + +#ifdef COATED_TEXTURES + noiseFactor = 0.66; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/cryingObsidian.glsl b/shaders/lib/materials/specificMaterials/terrain/cryingObsidian.glsl new file mode 100644 index 0000000..ffcdada --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/cryingObsidian.glsl @@ -0,0 +1,11 @@ +#include "/lib/materials/specificMaterials/terrain/obsidian.glsl" + +highlightMult *= 0.5; + +float factor0 = sqrt2(max0(color.b - color.g * 6.0)); +float factor1 = pow2(color.b); +emission = 1.35 + pow2(pow2(factor1)) * 7.5; +emission *= factor0; +color.r *= 1.15; + +maRecolor = vec3(factor0 * min(max0(factor1 * 0.7 - 0.1) * 1.3, 0.5)); \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/deepslate.glsl b/shaders/lib/materials/specificMaterials/terrain/deepslate.glsl new file mode 100644 index 0000000..0cfccda --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/deepslate.glsl @@ -0,0 +1,8 @@ +smoothnessG = pow2(color.g) * 1.5; +smoothnessG = min1(smoothnessG); +smoothnessD = smoothnessG; + +#if COLORED_LIGHTING == 0 + /* Tweak to make caves with Glow Lichen look better lit and closer to vanilla Minecraft. */ + lmCoordM = pow(lmCoordM + 0.0001, vec2(0.65)); +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/diamondBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/diamondBlock.glsl new file mode 100644 index 0000000..72deb02 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/diamondBlock.glsl @@ -0,0 +1,25 @@ +materialMask = OSIEBCA; // Intense Fresnel + +float factor = max(max(color.g, 0.8),max(color.b, 0.8)); +float factor2 = pow2(factor); +#ifdef GBUFFERS_TERRAIN + float factor4 = pow2(factor2); +#else + float factor4 = factor2; +#endif + +smoothnessG = factor - pow2(pow2(color.g)) * 0.4; +highlightMult = 3.0 * max(pow2(factor4), 0.2); + +smoothnessD = factor4 * 0.75; + +#if MC_VERSION < 11300 + highlightMult *= 2.0; + smoothnessD /= 0.75; +#endif + +color.rgb *= 0.7 + 0.4 * GetLuminance(color.rgb); + +#ifdef COATED_TEXTURES + noiseFactor = 0.5; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/dirt.glsl b/shaders/lib/materials/specificMaterials/terrain/dirt.glsl new file mode 100644 index 0000000..342053e --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/dirt.glsl @@ -0,0 +1 @@ +smoothnessG = color.r * 0.1 + 0.1; \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/emeraldBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/emeraldBlock.glsl new file mode 100644 index 0000000..f2e049c --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/emeraldBlock.glsl @@ -0,0 +1,14 @@ +materialMask = OSIEBCA; // Intense Fresnel + +float factor = pow2(sqrt2(GetLuminance(color.rgb))); +float factor2 = pow2(factor); +float factor4 = pow2(factor2); + +smoothnessG = factor - factor4 * 0.4; +highlightMult = 3.0 * factor4; + +smoothnessD = factor4 * 0.75; + +#ifdef COATED_TEXTURES + noiseFactor = 0.5; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/endPortalFrame.glsl b/shaders/lib/materials/specificMaterials/terrain/endPortalFrame.glsl new file mode 100644 index 0000000..65dba9f --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/endPortalFrame.glsl @@ -0,0 +1,3 @@ +// End Portal Frame:Green Parts +smoothnessG = 0.25; +smoothnessD = 0.45; \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/endStone.glsl b/shaders/lib/materials/specificMaterials/terrain/endStone.glsl new file mode 100644 index 0000000..d34805f --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/endStone.glsl @@ -0,0 +1,7 @@ +float factor = pow2(pow2(color.r)); +smoothnessG = factor * 0.65; +smoothnessD = smoothnessG * 0.6; + +#ifdef COATED_TEXTURES + noiseFactor = 0.66; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/froglights.glsl b/shaders/lib/materials/specificMaterials/terrain/froglights.glsl new file mode 100644 index 0000000..95432de --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/froglights.glsl @@ -0,0 +1,10 @@ +noSmoothLighting = true; noDirectionalShading = true; +lmCoordM = vec2(1.0, 0.0); + +float blockRes = absMidCoordPos.x * atlasSize.x; +vec2 signMidCoordPosM = abs((floor((signMidCoordPos + 1.0) * blockRes) + 0.5) / blockRes - 1.0); +float value = 1.0 - max(signMidCoordPosM.x, signMidCoordPosM.y); +emission = 0.3 + value + pow(dot(color.rgb, color.rgb) * 0.33, frogPow); +emission *= 1.7; + +color.rgb = pow2(color.rgb); \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/goldBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/goldBlock.glsl new file mode 100644 index 0000000..9b202b9 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/goldBlock.glsl @@ -0,0 +1,20 @@ +materialMask = OSIEBCA * 3.0; // Gold Fresnel + +#ifdef GBUFFERS_TERRAIN + float colorG2 = pow2(max(color.g, color.r)); +#else + float colorG2 = color.g; +#endif +float colorG4 = pow2(colorG2); +float factor = max(color.g, 0.8); + +smoothnessG = min1(factor - colorG4 * 0.2); +highlightMult = 3.5 * max(colorG4, 0.7); + +smoothnessD = colorG4; + +color.rgb *= 0.5 + 0.4 * GetLuminance(color.rgb); + +#ifdef COATED_TEXTURES + noiseFactor = 0.33; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/ironBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/ironBlock.glsl new file mode 100644 index 0000000..9be9421 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/ironBlock.glsl @@ -0,0 +1,14 @@ +#ifdef GBUFFERS_TERRAIN + smoothnessG = pow2(pow2(color.r * 3)); +#else + smoothnessG = pow2(color.r * 3); +#endif +highlightMult = smoothnessG * 3.0; +smoothnessD = smoothnessG; +materialMask = OSIEBCA; // Intense Fresnel + +color.rgb *= 0.8+ .5 * GetLuminance(color.rgb); + +#ifdef COATED_TEXTURES + noiseFactor = 0.33; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/lanternMetal.glsl b/shaders/lib/materials/specificMaterials/terrain/lanternMetal.glsl new file mode 100644 index 0000000..374efc7 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/lanternMetal.glsl @@ -0,0 +1,6 @@ +smoothnessG = color.b; +smoothnessD = color.b; + +#ifdef COATED_TEXTURES + noiseFactor = 0.66; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/lapisBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/lapisBlock.glsl new file mode 100644 index 0000000..1b562e0 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/lapisBlock.glsl @@ -0,0 +1,6 @@ +smoothnessG = pow2(color.b) * 0.8; +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.5; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/lava.glsl b/shaders/lib/materials/specificMaterials/terrain/lava.glsl new file mode 100644 index 0000000..0903620 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/lava.glsl @@ -0,0 +1,30 @@ +// Tweak to prevent the animation of lava causing brightness pulsing +vec3 avgColor = vec3(0.0); +ivec2 itexCoordC = ivec2(midCoord * atlasSize + 0.0001); +for (int x = -8; x < 8; x += 2) { + for (int y = -8; y < 8; y += 2) { + avgColor += texelFetch(tex, itexCoordC + ivec2(x, y), 0).rgb; + } +} +color.rgb /= max(GetLuminance(avgColor) * 0.0390625, 0.001); + +#ifdef NETHER + vec3 worldPos = playerPos + cameraPosition; + vec2 lavaPos = (floor(worldPos.xz * 16.0) + worldPos.y * 32.0) * 0.000666; + vec2 wind = vec2(frameTimeCounter * 0.012, 0.0); + + float noiseSample = texture2D(noisetex, lavaPos + wind).g; + noiseSample = noiseSample - 0.5; + noiseSample *= 0.1; + color.rgb = pow(color.rgb, vec3(1.0 + noiseSample)); +#endif + +noDirectionalShading = true; +lmCoordM = vec2(0.0); +emission = GetLuminance(color.rgb) * 6.5; + +maRecolor = vec3(clamp(pow2(pow2(pow2(smoothstep1(emission * 0.28)))), 0.12, 0.4) * 1.3) * vec3(1.0, vec2(0.7)); + +#if RAIN_PUDDLES >= 1 + noPuddles = 1.0; +#endif diff --git a/shaders/lib/materials/specificMaterials/terrain/leaves.glsl b/shaders/lib/materials/specificMaterials/terrain/leaves.glsl new file mode 100644 index 0000000..d8b692a --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/leaves.glsl @@ -0,0 +1,26 @@ +subsurfaceMode = 2; + +#ifdef GBUFFERS_TERRAIN + materialMask = OSIEBCA * 253.0; // Reduced Edge TAA + + #ifdef COATED_TEXTURES + doTileRandomisation = false; + #endif +#endif + +#ifdef IPBR + float factor = min1(pow2(color.g - 0.15 * (color.r + color.b)) * 2.5); + smoothnessG = factor * 0.5; + highlightMult = factor * 4.0 + 2.0; + float fresnel = clamp(1.0 + dot(normalM, normalize(viewPos)), 0.0, 1.0); + highlightMult *= 1.0 - pow2(pow2(fresnel)); +#endif + +#ifdef SNOWY_WORLD + snowMinNdotU = min(pow2(pow2(color.g)), 0.1); + color.rgb = color.rgb * 0.5 + 0.5 * (color.rgb / glColor.rgb); +#endif + +#if SHADOW_QUALITY > -1 && SHADOW_QUALITY < 3 + shadowMult = vec3(sqrt1(max0(max(lmCoordM.y, min1(lmCoordM.x * 2.0)) - 0.95) * 20.0)); +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/netheriteBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/netheriteBlock.glsl new file mode 100644 index 0000000..88229f9 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/netheriteBlock.glsl @@ -0,0 +1,8 @@ +smoothnessG = pow2(color.r * 2.0); +smoothnessG = min1(smoothnessG); +highlightMult = smoothnessG * 2.0; +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.33; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/netherrack.glsl b/shaders/lib/materials/specificMaterials/terrain/netherrack.glsl new file mode 100644 index 0000000..c5fba0f --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/netherrack.glsl @@ -0,0 +1,7 @@ +#if MC_VERSION >= 11300 + smoothnessG = pow2(color.r) * 1.5; + smoothnessG = min1(smoothnessG); +#else + smoothnessG = color.r * 0.4 + 0.2; +#endif +smoothnessD = smoothnessG; \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/oakWood.glsl b/shaders/lib/materials/specificMaterials/terrain/oakWood.glsl new file mode 100644 index 0000000..763ba83 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/oakWood.glsl @@ -0,0 +1,3 @@ +smoothnessG = pow2(pow2(color.g)) * 2.5; +smoothnessG = min1(smoothnessG); +smoothnessD = smoothnessG; \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/obsidian.glsl b/shaders/lib/materials/specificMaterials/terrain/obsidian.glsl new file mode 100644 index 0000000..a768754 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/obsidian.glsl @@ -0,0 +1,13 @@ +materialMask = OSIEBCA; // Intense Fresnel + +float factor = max0(0.3 - abs(color.r - 0.3)) * 1.5; + +smoothnessG = factor; +highlightMult = 2.0 + min1(smoothnessG * 2.0) * 1.5; +smoothnessG = min1(smoothnessG); + +smoothnessD = min1(factor + 0.07); + +#ifdef COATED_TEXTURES + noiseFactor = 1.25; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/pumpkin.glsl b/shaders/lib/materials/specificMaterials/terrain/pumpkin.glsl new file mode 100644 index 0000000..a5c240c --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/pumpkin.glsl @@ -0,0 +1 @@ +smoothnessG = color.g * 0.25; \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/quartzBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/quartzBlock.glsl new file mode 100644 index 0000000..d0c0122 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/quartzBlock.glsl @@ -0,0 +1,19 @@ +materialMask = OSIEBCA; // Intense Fresnel + +float factor = color.g; +float factor2 = pow2(factor); +float factor4 = pow2(factor2); +float factor8 = pow2(factor4); + +smoothnessG = factor - factor8 * 0.5; +highlightMult = 3.5 * factor8; + +smoothnessD = factor8; + +#ifdef GBUFFERS_TERRAIN + DoBrightBlockTweaks(color.rgb, 0.5, shadowMult, highlightMult); +#endif + +#ifdef COATED_TEXTURES + noiseFactor = 0.5; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/rawCopperBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/rawCopperBlock.glsl new file mode 100644 index 0000000..baf471f --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/rawCopperBlock.glsl @@ -0,0 +1,4 @@ +materialMask = OSIEBCA * 2.0; // Copper Fresnel +smoothnessG = pow2(color.r + color.g * 0.25) * 0.4; +smoothnessG = min1(smoothnessG); +smoothnessD = min1(smoothnessG * smoothnessG * 2.0); \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/rawGoldBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/rawGoldBlock.glsl new file mode 100644 index 0000000..4168ef6 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/rawGoldBlock.glsl @@ -0,0 +1,3 @@ +materialMask = OSIEBCA * 3.0; // Gold Fresnel +smoothnessG = pow2(pow2(color.g)); +smoothnessD = 0.5 * (smoothnessG + color.b); \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/rawIronBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/rawIronBlock.glsl new file mode 100644 index 0000000..6ffa82a --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/rawIronBlock.glsl @@ -0,0 +1,3 @@ +materialMask = OSIEBCA; // Intense Fresnel +smoothnessG = pow2(pow2(color.r)) * 0.7; +smoothnessD = smoothnessG * 0.6; \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/redstoneBlock.glsl b/shaders/lib/materials/specificMaterials/terrain/redstoneBlock.glsl new file mode 100644 index 0000000..7bc1fa0 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/redstoneBlock.glsl @@ -0,0 +1,11 @@ +materialMask = OSIEBCA * 5.0; // Redstone Fresnel + +float factor = pow2(color.r); +smoothnessG = 0.4; +highlightMult = factor + 0.2; + +smoothnessD = factor * 0.5 + 0.1; + +#ifdef COATED_TEXTURES + noiseFactor = 0.77; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/redstoneTorch.glsl b/shaders/lib/materials/specificMaterials/terrain/redstoneTorch.glsl new file mode 100644 index 0000000..ac7d320 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/redstoneTorch.glsl @@ -0,0 +1,15 @@ +noSmoothLighting = true; noDirectionalShading = true; +lmCoordM.x = min(lmCoordM.x * 0.9, 0.77); + +if (color.r > 0.65) { + emission = (3.5 - 2.25 * color.g) * 0.97; + color.rgb *= color.rgb; +} else if (color.r > color.g * 2.0) { + materialMask = OSIEBCA * 5.0; // Redstone Fresnel + + float factor = pow2(color.r); + smoothnessG = 0.4; + highlightMult = factor + 0.4; + + smoothnessD = factor * 0.7 + 0.3; +} \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/snow.glsl b/shaders/lib/materials/specificMaterials/terrain/snow.glsl new file mode 100644 index 0000000..6cc4f52 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/snow.glsl @@ -0,0 +1,12 @@ +smoothnessG = (1.0 - pow(color.g, 64.0) * 0.3) * 0.4; +highlightMult = 2.0; + +smoothnessD = smoothnessG; + +#ifdef GBUFFERS_TERRAIN + DoBrightBlockTweaks(color.rgb, 0.5, shadowMult, highlightMult); +#endif + +#if RAIN_PUDDLES >= 1 + noPuddles = 1.0; +#endif \ No newline at end of file diff --git a/shaders/lib/materials/specificMaterials/terrain/stone.glsl b/shaders/lib/materials/specificMaterials/terrain/stone.glsl new file mode 100644 index 0000000..47dc809 --- /dev/null +++ b/shaders/lib/materials/specificMaterials/terrain/stone.glsl @@ -0,0 +1,7 @@ +smoothnessG = pow2(pow2(color.g)) * 1.5; +smoothnessG = min1(smoothnessG); +smoothnessD = smoothnessG; + +#ifdef COATED_TEXTURES + noiseFactor = 0.77; +#endif \ No newline at end of file diff --git a/shaders/lib/post/lensFlare.glsl b/shaders/lib/post/lensFlare.glsl new file mode 100644 index 0000000..966ba9b --- /dev/null +++ b/shaders/lib/post/lensFlare.glsl @@ -0,0 +1,96 @@ +float fovmult = gbufferProjection[1][1] / 1.37373871; + +float BaseLens(vec2 lightPos, float size, float dist, float hardness) { + vec2 lensCoord = (texCoord + (lightPos * dist - 0.5)) * vec2(aspectRatio, 1.0); + float lens = clamp(1.0 - length(lensCoord) / (size * fovmult), 0.0, 1.0 / hardness) * hardness; + lens *= lens; lens *= lens; + return lens; +} + +float OverlapLens(vec2 lightPos, float size, float dista, float distb) { + return BaseLens(lightPos, size, dista, 2.0) * BaseLens(lightPos, size, distb, 2.0); +} + +float PointLens(vec2 lightPos, float size, float dist) { + return BaseLens(lightPos, size, dist, 1.5) + BaseLens(lightPos, size * 4.0, dist, 1.0) * 0.5; +} + +float RingLensTransform(float lensFlare) { + return pow(1.0 - pow(1.0 - pow(lensFlare, 0.25), 10.0), 5.0); +} +float RingLens(vec2 lightPos, float size, float distA, float distB) { + float lensFlare1 = RingLensTransform(BaseLens(lightPos, size, distA, 1.0)); + float lensFlare2 = RingLensTransform(BaseLens(lightPos, size, distB, 1.0)); + + float lensFlare = clamp(lensFlare2 - lensFlare1, 0.0, 1.0); + lensFlare *= sqrt(lensFlare); + return lensFlare; +} + +float AnamorphicLens(vec2 lightPos, float size, float dist) { + vec2 lensCoord = abs(texCoord + (lightPos.xy * dist - 0.5)) * vec2(aspectRatio * 0.07, 2.0); + float lens = clamp(1.0 - length(pow(lensCoord / (size * fovmult), vec2(0.85))) * 4.0, 0.0, 1.0); + lens *= lens * lens; + return lens; +} + +vec3 RainbowLens(vec2 lightPos, float size, float dist, float rad) { + vec2 lensCoord = (texCoord + (lightPos * dist - 0.5)) * vec2(aspectRatio,1.0); + float lens = clamp(1.0 - length(lensCoord) / (size * fovmult), 0.0, 1.0); + + vec3 rainbowLens = + (smoothstep(0.0, rad, lens) - smoothstep(rad, rad * 2.0, lens)) * vec3(1.0, 0.0, 0.0) + + (smoothstep(rad * 0.5, rad * 1.5, lens) - smoothstep(rad * 1.5, rad * 2.5, lens)) * vec3(0.0, 1.0, 0.0) + + (smoothstep(rad, rad * 2.0, lens) - smoothstep(rad * 2.0, rad * 3.0, lens)) * vec3(0.0, 0.0, 1.0) + ; + + return rainbowLens; +} + +vec3 LensTint(vec3 lens, float truePos) { + float isMoon = truePos * 0.5 + 0.5; + + float visibility = mix(sunVisibility,moonVisibility, isMoon); + lens = mix(lens, GetLuminance(lens) * lightNight, isMoon * 0.98); + return lens * visibility; +} + +void LensFlare(inout vec3 color, vec2 lightPos, float truePos, float multiplier) { + float falloffBase = length(lightPos * vec2(aspectRatio, 1.0)); + float falloffIn = pow(clamp(falloffBase * 10.0, 0.0, 1.0), 2.0); + float falloffOut = clamp(falloffBase * 3.0 - 1.5, 0.0, 1.0); + + if (falloffOut < 0.999) { + vec3 lensFlare = ( + BaseLens(lightPos, 0.3, -0.45, 1.0) * vec3(2.2, 1.2, 0.1) * 0.07 + + BaseLens(lightPos, 0.3, 0.10, 1.0) * vec3(2.2, 0.4, 0.1) * 0.03 + + BaseLens(lightPos, 0.3, 0.30, 1.0) * vec3(2.2, 0.2, 0.1) * 0.04 + + BaseLens(lightPos, 0.3, 0.50, 1.0) * vec3(2.2, 0.4, 2.5) * 0.05 + + BaseLens(lightPos, 0.3, 0.70, 1.0) * vec3(1.8, 0.4, 2.5) * 0.06 + + BaseLens(lightPos, 0.3, 0.95, 1.0) * vec3(0.1, 0.2, 2.5) * 0.10 + + + OverlapLens(lightPos, 0.18, -0.30, -0.41) * vec3(2.5, 1.2, 0.1) * 0.010 + + OverlapLens(lightPos, 0.16, -0.18, -0.29) * vec3(2.5, 0.5, 0.1) * 0.020 + + OverlapLens(lightPos, 0.15, 0.06, 0.19) * vec3(2.5, 0.2, 0.1) * 0.015 + + OverlapLens(lightPos, 0.14, 0.15, 0.28) * vec3(1.8, 0.1, 1.2) * 0.015 + + OverlapLens(lightPos, 0.16, 0.24, 0.37) * vec3(1.0, 0.1, 2.5) * 0.015 + + + PointLens(lightPos, 0.03, -0.55) * vec3(2.5, 1.6, 0.0) * 0.20 + + PointLens(lightPos, 0.02, -0.40) * vec3(2.5, 1.0, 0.0) * 0.15 + + PointLens(lightPos, 0.04, 0.43) * vec3(2.5, 0.6, 0.6) * 0.20 + + PointLens(lightPos, 0.02, 0.60) * vec3(0.2, 0.6, 2.5) * 0.15 + + PointLens(lightPos, 0.03, 0.67) * vec3(0.2, 1.6, 2.5) * 0.25 + + + RingLens(lightPos, 0.25, 0.43, 0.45) * vec3(0.10, 0.35, 2.50) * 1.5 + + RingLens(lightPos, 0.18, 0.98, 0.99) * vec3(0.15, 1.00, 2.55) * 2.5 + ) * (falloffIn - falloffOut) + ( + AnamorphicLens(lightPos, 1.0, -1.0) * vec3(0.3,0.7,1.0) * 0.35 + + RainbowLens(lightPos, 0.525, -1.0, 0.2) * 0.05 + + RainbowLens(lightPos, 2.0, 4.0, 0.1) * 0.05 + ) * (1.0 - falloffOut); + + lensFlare = LensTint(lensFlare, truePos); + + color = mix(color, vec3(1.0), lensFlare * multiplier * multiplier); + } +} \ No newline at end of file diff --git a/shaders/lib/post/outline.glsl b/shaders/lib/post/outline.glsl new file mode 100644 index 0000000..c905352 --- /dev/null +++ b/shaders/lib/post/outline.glsl @@ -0,0 +1,78 @@ +void Outline(vec3 color, bool secondPass, out vec4 outerOutline, out vec4 innerOutline) { + float ph = ceil(viewHeight / 1440.0) / viewHeight; + float pw = ph / aspectRatio; + + float oOutlineMask = 1.0, iOutlineMask = 1.0, iBevel = 1.0; + vec3 oOutlineColor = vec3(0.0), iOutlineColor = color; + + float z = texture2D(depthtex0, texCoord).r; + float linZ = GetLinearDepth(z); + float minZ = z, maxZ = z; + + int sampleCount = viewHeight >= 720.0 ? 12 : 4; + + #ifdef RETRO_FILTER + ph = RETRO_FILTER_SIZE / viewHeight; + pw = ph / aspectRatio; + sampleCount = 4; + #endif + + for (int i = 0; i < sampleCount; i++) { + vec2 offset = vec2(pw, ph) * outlineOffsets[i]; + float linSampleZSum = 0.0, linSampleZDiff = 0.0; + + for (int j = 0; j < 2; j++) { + float sampleZ = texture2D(depthtex0, texCoord + offset).r; + float linSampleZ = GetLinearDepth(sampleZ); + + #ifdef OUTLINE_OUTER_COLOR + if((GetLinearDepth(minZ) - 0.125 / far) > linSampleZ) { + oOutlineColor = texture2D(colortex0, texCoord + offset).rgb; + } + #endif + + linSampleZSum += linSampleZ; + if(j == 0) linSampleZDiff = linSampleZ; + else linSampleZDiff -= linSampleZ; + + minZ = min(minZ, sampleZ); + maxZ = max(maxZ, sampleZ); + offset = -offset; + } + + #ifdef OUTLINE_OUTER + oOutlineMask *= clamp(1.0 - (linZ * 2.0 - linSampleZSum) * far * 0.25, 0.0, 1.0); + #endif + + #ifdef OUTLINE_INNER + linSampleZSum -= abs(linSampleZDiff) * 0.5; + iOutlineMask *= clamp(1.125 + (linZ * 2.0 - linSampleZSum) * 32.0 * far, 0.0, 1.0); + #endif + } + + #if ALPHA_BLEND == 0 + oOutlineColor *= oOutlineColor; + #endif + + oOutlineColor = sqrt(oOutlineColor) * 0.35; + oOutlineColor *= oOutlineColor; + oOutlineMask = 1.0 - oOutlineMask; + + iOutlineColor = sqrt(iOutlineColor) * 1.2; + iOutlineColor *= iOutlineColor; + iOutlineMask = 1.0 - iOutlineMask; + + vec4 viewPos = gbufferProjectionInverse * (vec4(texCoord.x, texCoord.y, minZ, 1.0) * 2.0 - 1.0); + viewPos /= viewPos.w; + + if (oOutlineMask > 0.001) { + Fog(oOutlineColor, viewPos.xyz); + if (isEyeInWater == 1.0 && secondPass) { + vec4 waterFog = GetWaterFog(viewPos.xyz); + oOutlineColor = mix(oOutlineColor, waterFog.rgb, waterFog.a); + } + } + + outerOutline = vec4(oOutlineColor, oOutlineMask); + innerOutline = vec4(iOutlineColor, iOutlineMask); +} \ No newline at end of file diff --git a/shaders/lib/reflections/complexFresnel.glsl b/shaders/lib/reflections/complexFresnel.glsl new file mode 100644 index 0000000..cd90fd6 --- /dev/null +++ b/shaders/lib/reflections/complexFresnel.glsl @@ -0,0 +1,47 @@ +vec3 GetN(int idx) { + if (idx == 230) return vec3(2.9114, 2.9497, 2.5845); + if (idx == 231) return vec3(0.18299, 0.42108, 1.3734); + if (idx == 232) return vec3(1.3456, 0.96521, 0.61722); + if (idx == 233) return vec3(3.1071, 3.1812, 2.3230); + if (idx == 234) return vec3(0.27105, 0.67693, 1.3164); + if (idx == 235) return vec3(1.9100, 1.8300, 1.4400); + if (idx == 236) return vec3(2.3757, 2.0847, 1.8453); + if (idx == 237) return vec3(0.15943, 0.14512, 0.13547); + return vec3(0.0); +} + +vec3 GetK(int idx) { + if (idx == 230) return vec3(3.0893, 2.9318, 2.7670); + if (idx == 231) return vec3(3.4242, 2.3459, 1.7704); + if (idx == 232) return vec3(7.4746, 6.3995, 5.3031); + if (idx == 233) return vec3(3.3314, 3.3291, 3.1350); + if (idx == 234) return vec3(3.6092, 2.6248, 2.2921); + if (idx == 235) return vec3(3.5100, 3.4000, 3.1800); + if (idx == 236) return vec3(4.2655, 3.7153, 3.1365); + if (idx == 237) return vec3(3.9291, 3.1900, 2.3808); + return vec3(1.0); +} + +vec3 ComplexFresnel(float fresnel, float f0) { + int metalidx = int(f0 * 255.0); + vec3 k = GetK(metalidx); + vec3 n = GetN(metalidx); + float f = 1.0 - fresnel; + + vec3 k2 = k * k; + vec3 n2 = n * n; + float f2 = f * f; + + vec3 rs_num = n2 + k2 - 2 * n * f + f2; + vec3 rs_den = n2 + k2 + 2 * n * f + f2; + vec3 rs = rs_num / rs_den; + + vec3 rp_num = (n2 + k2) * f2 - 2 * n * f + 1; + vec3 rp_den = (n2 + k2) * f2 + 2 * n * f + 1; + vec3 rp = rp_num / rp_den; + + vec3 fresnel3 = clamp(0.5 * (rs + rp), vec3(0.0), vec3(1.0)); + fresnel3 *= fresnel3; + + return fresnel3; +} \ No newline at end of file diff --git a/shaders/lib/reflections/rainPuddles.glsl b/shaders/lib/reflections/rainPuddles.glsl new file mode 100644 index 0000000..17495e1 --- /dev/null +++ b/shaders/lib/reflections/rainPuddles.glsl @@ -0,0 +1,86 @@ +float GetPuddles(vec3 worldPos, vec2 coord, float skylight, float NoU, float wetness) { + if (wetness < 0.001) return 0.0; + + worldPos = (worldPos + cameraPosition) * 0.005; + + float height = texture2DGradARB(normals, coord, dcdx, dcdy).a; + height = mix(1.0, height, PARALLAX_DEPTH); + height = smoothstep(1.0, 0.95, height) * 0.1 - 0.05; + float noise = texture2D(noisetex, worldPos.xz * 0.5 ).r * 0.375; + noise+= texture2D(noisetex, worldPos.xz * 0.125).r * 0.625; + noise = noise + height + (wetness * REFLECTION_RAIN_AMOUNT - 0.5); + + float puddles = smoothstep(0.4, 0.6, noise); + + #ifdef WEATHER_PERBIOME + float weatherWeight = isCold + isDesert + isMesa + isSavanna; + puddles *= 1.0 - weatherWeight; + #endif + + puddles *= clamp(skylight * 32.0 - 31.0, 0.0, 1.0) * clamp(NoU, 0.0, 1.0); + + return puddles; +} + +float rand(vec2 worldPos){ + return fract(sin(dot(worldPos, vec2(12.9898, 4.1414))) * 43758.5453); +} + +vec2 getpos(vec2 i){ + return vec2(rand(i), rand(i + 1.0)) * 0.5 + 0.25; +} + +float GetRipple(vec3 worldPos, vec2 offset) { + vec2 ppos = worldPos.xz + offset * 0.1 + frametime * 0.01; + ppos = vec2(ppos.x * 0.7 + ppos.y * 0.7, ppos.x * -0.7 + ppos.y * 0.7) * 0.8; + vec2 ppossh = ppos + vec2(fract(0.618 * floor(ppos.y)) * sin(frametime * 0.05), 0.0); + vec2 pposfr = fract(ppossh); + vec2 pposfl = floor(ppossh); + + float val = texture2D(noisetex, ppos / 64.0 + frametime * 0.007).r * 0.125; + val += texture2D(noisetex, ppos / 64.0 - frametime * 0.005).r * 0.125; + + float seed = rand(pposfl); + float rippleTime = frametime * 1.7 + fract(seed * 1.618); + float rippleSeed = seed + floor(rippleTime) * 1.618; + vec2 ripplePos = getpos(pposfl + rippleSeed); + float ripple = clamp(1.0 - 4.0 * length(pposfr - ripplePos), 0.0, 1.0); + ripple = clamp(ripple + fract(rippleTime) - 1.0, 0.0, 1.0); + ripple = sin(min(ripple * 6.0 * 3.1415, 3.0 * 3.1415)) * pow(1.0 - fract(rippleTime), 2.0); + val += ripple * 0.3; + + //if(pposfr.x < 0.01 || pposfr.y < 0.01) val += 0.85; + + return val; +} + +vec3 GetPuddleNormal(vec3 worldPos, vec3 viewPos, mat3 tbn) { + vec3 puddlePos = worldPos + cameraPosition; + float normalOffset = 0.1; + + float fresnel = pow(clamp(1.0 + dot(normalize(normal), normalize(viewPos)), 0.0, 1.0), 7.5); + float normalStrength = 0.35 * (1.0 - fresnel); + + float h1 = GetRipple(puddlePos, vec2( normalOffset, 0.0)); + float h2 = GetRipple(puddlePos, vec2(-normalOffset, 0.0)); + float h3 = GetRipple(puddlePos, vec2(0.0, normalOffset)); + float h4 = GetRipple(puddlePos, vec2(0.0, -normalOffset)); + + float xDelta = (h2 - h1) / normalOffset; + float yDelta = (h4 - h3) / normalOffset; + + vec3 normalMap = vec3(xDelta, yDelta, 1.0 - (xDelta * xDelta + yDelta * yDelta)); + normalMap = normalMap * normalStrength + vec3(0.0, 0.0, 1.0 - normalStrength); + + return clamp(normalize(normalMap * tbn), vec3(-1.0), vec3(1.0)); +} + +void ApplyPuddleToMaterial(float puddles, inout vec4 albedo, inout float smoothness, inout float f0, float porosity) { + float puddleSmoothness = sqrt(1.0 - 0.75 * porosity); + float puddleDarkening = (0.5 * porosity + 0.15); + + smoothness = mix(smoothness, 1.0, puddles * puddleSmoothness); + f0 = max(f0, puddles * 0.02); + + albedo.rgb *= 1.0 - (puddles * puddleDarkening); +} \ No newline at end of file diff --git a/shaders/lib/reflections/raytrace.glsl b/shaders/lib/reflections/raytrace.glsl new file mode 100644 index 0000000..06df323 --- /dev/null +++ b/shaders/lib/reflections/raytrace.glsl @@ -0,0 +1,89 @@ +vec3 nvec3(vec4 pos) { + return pos.xyz/pos.w; +} + +vec4 nvec4(vec3 pos) { + return vec4(pos.xyz, 1.0); +} + +float cdist(vec2 coord) { + return max(abs(coord.x - 0.5), abs(coord.y - 0.5)) * 1.85; +} + +#if REFLECTION_MODE == 0 +float errMult = 1.0; +#elif REFLECTION_MODE == 1 +float errMult = 1.3; +#else +float errMult = 1.6; +#endif + +vec4 Raytrace(sampler2D depthtex, vec3 viewPos, vec3 normal, float dither, out float border, + int maxf, float stp, float ref, float inc) { + vec3 pos = vec3(0.0); + float dist = 0.0; + + #ifdef TAA + #if TAA_MODE == 0 + dither = fract(dither + frameCounter * 0.618); + #else + dither = fract(dither + frameCounter * 0.5); + #endif + #endif + + vec3 start = viewPos + normal * 0.075; + + vec3 vector = stp * reflect(normalize(viewPos), normalize(normal)); + viewPos += vector; + vec3 tvector = vector; + + int sr = 0; + + for(int i = 0; i < 30; i++) { + pos = nvec3(gbufferProjection * nvec4(viewPos)) * 0.5 + 0.5; + if (pos.x < -0.05 || pos.x > 1.05 || pos.y < -0.05 || pos.y > 1.05) break; + + vec3 rfragpos = vec3(pos.xy, texture2D(depthtex,pos.xy).r); + rfragpos = nvec3(gbufferProjectionInverse * nvec4(rfragpos * 2.0 - 1.0)); + dist = abs(dot(normalize(start - rfragpos), normal)); + + float err = length(viewPos - rfragpos); + float lVector = length(vector) * pow(length(tvector), 0.1) * errMult; + if (err < lVector) { + sr++; + if (sr >= maxf) break; + tvector -= vector; + vector *= ref; + } + vector *= inc; + tvector += vector; + viewPos = start + tvector * (0.025 * dither + 0.975); + } + + border = cdist(pos.st); + + #ifdef REFLECTION_PREVIOUS + //Previous frame reprojection from Chocapic13 + vec4 viewPosPrev = gbufferProjectionInverse * vec4(pos * 2.0 - 1.0, 1.0); + viewPosPrev /= viewPosPrev.w; + + viewPosPrev = gbufferModelViewInverse * viewPosPrev; + + vec4 previousPosition = viewPosPrev + vec4(cameraPosition - previousCameraPosition, 0.0); + previousPosition = gbufferPreviousModelView * previousPosition; + previousPosition = gbufferPreviousProjection * previousPosition; + pos.xy = previousPosition.xy / previousPosition.w * 0.5 + 0.5; + #endif + + return vec4(pos, dist); +} + +vec4 BasicReflect(vec3 viewPos, vec3 normal, out float border) { + vec3 reflectedViewPos = reflect(viewPos, normal) + normal * dot(viewPos, normal) * 0.5; + + vec3 pos = nvec3(gbufferProjection * nvec4(reflectedViewPos)) * 0.5 + 0.5; + + border = cdist(pos.st); + + return vec4(pos, 0.0); +} \ No newline at end of file diff --git a/shaders/lib/reflections/roughReflections.glsl b/shaders/lib/reflections/roughReflections.glsl new file mode 100644 index 0000000..445f0ce --- /dev/null +++ b/shaders/lib/reflections/roughReflections.glsl @@ -0,0 +1,67 @@ +#ifdef REFLECTION_PREVIOUS +#define colortexR colortex5 +#else +#define colortexR colortex0 +#endif + +vec4 RoughReflection(vec3 viewPos, vec3 normal, float dither, float smoothness) { + vec4 color = vec4(0.0); + float border = 0.0; + + vec4 pos = Raytrace(depthtex0, viewPos, normal, dither, border, 6, 0.5, 0.1, 1.8); + border = clamp(13.333 * (1.0 - border) * (0.9 * smoothness + 0.1), 0.0, 1.0); + + float fovScale = gbufferProjection[1][1] / 1.37; + + if (pos.z < 1.0 - 1e-5) { + #ifdef REFLECTION_ROUGH + float dist = 0.03125 * pow(1.0 - smoothness, 2.0) * pos.a * fovScale; + float lod = log2(viewHeight * dist); + #else + float lod = 0.0; + #endif + + if (lod < 1.0) { + color.a = texture2DLod(colortex6, pos.st, 1.0).b; + if (color.a > 0.001) color.rgb = texture2DLod(colortexR, pos.st, 1.0).rgb; + #ifdef REFLECTION_PREVIOUS + color.rgb = pow(color.rgb * 2.0, vec3(8.0)); + #else + #if ALPHA_BLEND == 0 + color.rgb = pow(color.rgb, vec3(2.2)); + #endif + #endif + }else{ + for(int i = -2; i <= 2; i++) { + for(int j = -2; j <= 2; j++) { + vec2 refOffset = vec2(i, j) * exp2(lod - 1.0) / vec2(viewWidth, viewHeight); + vec2 refCoord = pos.st + refOffset; + float alpha = texture2DLod(colortex6, refCoord, lod).b; + if (alpha > 0.001) { + vec3 ssrSample = texture2DLod(colortexR, refCoord, max(lod - 1.0, 0.0)).rgb; + + #ifdef REFLECTION_PREVIOUS + ssrSample = pow(ssrSample * 2.0, vec3(8.0)); + #else + #if ALPHA_BLEND == 0 + ssrSample = pow(ssrSample, vec3(2.2)); + #endif + #endif + + color.rgb += ssrSample; + color.a += alpha; + } + } + } + color /= 25.0; + } + + //Fog(color.rgb, (gbufferProjectionInverse * pos).xyz); + + color *= color.a; + color.a = clamp(color.a * 2.0 - 1.0, 0.0, 1.0) * border; + // color.a = pos.a * float(border > 0.0); + } + + return color; +} \ No newline at end of file diff --git a/shaders/lib/reflections/simpleReflections.glsl b/shaders/lib/reflections/simpleReflections.glsl new file mode 100644 index 0000000..847f610 --- /dev/null +++ b/shaders/lib/reflections/simpleReflections.glsl @@ -0,0 +1,65 @@ +vec4 SimpleReflection(vec3 viewPos, vec3 normal, float dither, out float reflectionMask) { + vec4 color = vec4(0.0); + float border = 0.0; + reflectionMask = 0.0; + + vec4 pos = Raytrace(depthtex1, viewPos, normal, dither, border, 4, 1.0, 0.1, 2.0); + border = clamp(13.333 * (1.0 - border), 0.0, 1.0); + + #ifdef REFLECTION_SKYBOX + float zThreshold = 1.0 + 1e-5; + #else + float zThreshold = 1.0; + #endif + + if (pos.z < zThreshold) { + #if MC_VERSION > 10800 + color = texture2D(gaux2, pos.st); + #else + color = texture2DLod(gaux2, pos.st, 0); + #endif + reflectionMask = color.a; + + #ifdef REFLECTION_SKYBOX + color.a = 1.0; + #endif + + color.a *= border; + reflectionMask *= border; + } + + return color; +} + +vec4 DHReflection(vec3 viewPos, vec3 normal, float dither, out float reflectionMask) { + vec4 color = vec4(0.0); + float border = 0.0; + reflectionMask = 0.0; + + vec4 pos = BasicReflect(viewPos, normal, border); + border = clamp(13.333 * (1.0 - border), 0.0, 1.0); + + #ifdef REFLECTION_SKYBOX + float zThreshold = 1.0 + 1e-5; + #else + float zThreshold = 1.0; + #endif + + if (pos.z < zThreshold) { + #if MC_VERSION > 10800 + color = texture2D(gaux2, pos.st); + #else + color = texture2DLod(gaux2, pos.st, 0); + #endif + reflectionMask = color.a; + + #ifdef REFLECTION_SKYBOX + color.a = 1.0; + #endif + + color.a *= border; + reflectionMask *= border; + } + + return color; +} \ No newline at end of file diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl new file mode 100644 index 0000000..7c36e78 --- /dev/null +++ b/shaders/lib/settings.glsl @@ -0,0 +1,488 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +/* +You can edit this file to enable, disable, and tweak features. +Make sure to make a copy of this file before editing as backup. + +#define with a name only is a toggleable feature. +Adding double slash (//) disables a feature + #define FEATURE -> feature is enabled +//#define FEATURE -> feature is disabled + +#define with a name and value is either a multi option feature or a parameter. +Parameter tends to contain lots of values, some starts with const int/float. +Use the values provided within the squared bracket comment (//[...]), +Do not add double slash on these lines, as it may cause errors. + #define MULTI_OPTION_FEATURE 0 //[0 1 2] -> 0 is the current value + #define PARAMETER 1.00 //[0.00 0.25 ... 1.75 2.00] -> 1.00 is the current value + +Read lang/en_US.lang to get the description of what every option does. +Please don't edit anything from Undefine section and onwards. +*/ + +//Shader Options// + + #define ABOUT 0 //[0] + +//Lighting// + #define SHADOW + const int shadowMapResolution = 2048; //[512 1024 1536 2048 3072 4096 8192] + const float shadowDistance = 256.0; //[128.0 192.0 256.0 384.0 512.0 768.0 1024.0] + #define SHADOW_COLOR + #define SHADOW_FILTER + const float sunPathRotation = -40.0; //[-85.0 -80.0 -75.0 -70.0 -65.0 -60.0 -55.0 -50.0 -45.0 -40.0 -35.0 -30.0 -25.0 -20.0 -15.0 -10.0 -5.0 0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 65.0 70.0 75.0 80.0 85.0] + const float shadowMapBias = 1.0 - 25.6 / shadowDistance; + + #define SHADOW_ENTITY + #define SHADOW_BLOCK_ENTITY + #define SHADOW_VEGETATION + #define SHADOW_CLOUD + #define SHADOW_BIAS 0 //[0 1] + #define SHADOW_PIXEL 0 //[0 16 32 64 128] + + #define AO + #define AO_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00] + #define DESATURATION + #define DESATURATION_FACTOR 1.5 //[2.0 1.5 1.0 0.5 0.0] + #define MULTICOLORED_BLOCKLIGHT +//#define DYNAMIC_HANDLIGHT +//#define WHITE_WORLD + + #define MCBL_ANTI_BLEED +//#define MCBL_LEGACY_COLOR + +//Material// +//#define ADVANCED_MATERIALS + #define MATERIAL_FORMAT 1 //[0 1 2] + + #define REFLECTION 2 //[0 1 2] + #define REFLECTION_TRANSLUCENT + #define REFLECTION_SPECULAR + #define REFLECTION_ROUGH + #define REFLECTION_RAIN + #define REFLECTION_RAIN_AMOUNT 1.0 //[0.4 0.5 0.6 0.7 1.0] +//#define REFLECTION_PREVIOUS +//#define SPECULAR_HIGHLIGHT_ROUGH +//#define ALBEDO_METAL + #define REFLECTION_MODE 1 //[0 1 2] + #define REFLECTION_SKY_FALLOFF 1 //[1 2 4 8 16] +//#define REFLECTION_SKYBOX + + #define PARALLAX + #define PARALLAX_DEPTH 0.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50] + #define PARALLAX_QUALITY 128 //[16 32 64 128 256 512] + #define PARALLAX_DISTANCE 64 //[8 16 32 48 64 80 96 112 128] + #define SELF_SHADOW + #define SELF_SHADOW_ANGLE 2.0 //[0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0] + #define SELF_SHADOW_QUALITY 8 //[8 16 32] + #define SELF_SHADOW_STRENGTH 16 //[4 8 16 32 64] +//#define DIRECTIONAL_LIGHTMAP + #define DIRECTIONAL_LIGHTMAP_STRENGTH 1.0 //[2.0 1.4 1.0 0.7 0.5] + #define GENERATED_NORMALS + #define GENERATED_NORMAL_MULT 100 //[25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 110 120 130 140 150 160 170 180 190 200 250 300 400] + #define GENERATED_NORMAL_THRESHOLD 0.05 //[0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20] + #define GENERATED_NORMAL_CLAMP 0.20 //[0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36 0.38 0.40] + #define GENERATED_NORMAL_RESOLUTION 128 //[16 32 64 128 256 512] + #define NORMAL_DAMPENING + #define NORMAL_PLANTS + + #define SSS + #define BASIC_SSS + #define EMISSIVE 2 //[0 1 2] + #define REFRACTION 0 //[0 1 2] + #define ALBEDO_BALANCING + #define ALPHA_BLEND 0 //[0 1] + #define ENTITY_FLASH + +//Atmospherics// + #define LIGHT_SHAFT + #define LIGHT_SHAFT_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00] + #define WEATHER_PERBIOME + #define WEATHER + #define WEATHER_OPACITY 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.50 5.00 5.50 6.00 6.50 7.00 7.50 8.00] + + #define SKY_DENSITY_D 0.35 //[0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00] + #define SKY_EXPOSURE_D 0.00 //[-1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 1.00] + #define SKY_DENSITY_N 0.65 //[0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00] + #define SKY_EXPOSURE_N 0.00 //[-1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 1.00] + #define SKY_DENSITY_W 1.50 //[1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00] + #define SKY_EXPOSURE_W 0.00 //[-1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 1.00] + #define SKY_HORIZON_N 1.00 //[0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50] + #define SKY_HORIZON_F 1.50 //[0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50] + #define SKY_DESATURATION + #define SKY_GROUND 2 //[0 1 2] +//#define UNDERGROUND_SKY +//#define SHADER_END_SKY +//#define SKY_DEFERRED + + #define CLOUDS 2 //[0 1 2 3] + #define CLOUD_BASE 0 //[0 1] + #define CLOUD_DENSITY 4 //[1 2 4 6 8] + #define CLOUD_AMOUNT 10.0 //[12.0 11.0 10.0 9.0 8.0] + #define CLOUD_HEIGHT 10.0 //[5.0 7.5 10.0 12.5 15.0] + #define CLOUD_THICKNESS 5 //[2 4 5 7 10] + #define CLOUD_DETAIL 1.0 //[0.3 0.7 1.0 1.3 1.7] + #define CLOUD_SPEED 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.50 3.00 3.50 4.00] + #define CLOUD_OPACITY 1.0 //[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] + #define CLOUD_BRIGHTNESS 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00] + #define CLOUD_VOLUMETRIC_SCALE 12.4 //[6.0 12.4 16.0] + + #define FOG_DENSITY 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00] + #define FOG_HEIGHT + #define FAR_VANILLA_FOG 2 //[0 1 2 3] + + #define FOG_DENSITY_NIGHT 4.00 //[1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00 6.25 6.50 6.75 7.00 7.25 7.50 7.75 8.00] + #define FOG_DENSITY_WEATHER 1.50 //[1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00] + #define FOG_DENSITY_COLD 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00] + #define FOG_DENSITY_DRY 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00] + #define FOG_DENSITY_DAMP 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00] + #define FOG_DENSITY_INDOOR 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00] + #define FOG_DENSITY_DH 1.00 //[0.00 0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00] + + #define FOG_HEIGHT_Y 62 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 62 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 136 144 152 160 168 172 180 188 192] + #define FOG_HEIGHT_FALLOFF 7.00 //[3.00 3.50 4.00 4.50 5.00 5.50 6.00 6.50 7.00 7.50 8.00 8.50 9.00] + + #define FAR_VANILLA_FOG_STYLE 0 //[0 1] + #define FOG_DENSITY_VANILLA 1.00 //[0.12 0.25 0.37 0.50 0.62 0.75 0.87 1.00 1.12 1.25 1.37 1.50 1.62 1.75 1.87 2.00 2.12 2.25 2.37 2.50 2.62 2.75 2.87 3.00 3.12 3.25 3.37 3.50 3.62 3.75 3.87 4.00] + #define FOG_VANILLA_CLOUD 3 //[0 1 2 3] + +//#define ROUND_SUN_MOON + #define ROUND_SUN_MOON_SIZE 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50] + #define STARS +//#define AURORA + #define SKYBOX_INTENSITY 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00] + #define SKYBOX_OPACITY 0.50 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00] + #define SUN_INTENSITY 1.50 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00] + #define MOON_INTENSITY 1.50 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00] + +//Water// + #define WATER_MODE 0 //[0 1 2 3] + #define WATER_ALPHA_MODE 0 //[0 1] + #define WATER_SHADOW_MODE 0 //[0 1 2 3] + #define WATER_NORMALS 1 //[0 1 2] + #define WATER_PARALLAX +//#define WATER_SHADOW_COLOR +//#define WATER_CAUSTICS + #define WATER_BUMP 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00] + #define WATER_DETAIL 0.25 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50] + #define WATER_SHARPNESS 0.2 //[0.8 0.5 0.2] + #define WATER_SPEED 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.50 3.00 3.50 4.00] + #define WATER_FOG 0 //[0 1] + #define WATER_FOG_DENSITY 1.00 //[0.25 0.50 0.75 1.00 1.50 2.00 2.50 3.00 3.50 4.00] + #define WATER_CAUSTICS_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00] + #define WATER_PIXEL 0 //[0 16 32 64 128] + +//Post Effects// +//#define DOF + #define DOF_STRENGTH 8.0 //[1.0 2.0 4.0 8.0 16.0 32.0 64.0 128.0 256.0 384.0 512.0] +//#define MOTION_BLUR + #define MOTION_BLUR_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00] + #define BLOOM + #define BLOOM_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00] + #define BLOOM_CONTRAST 0 //[-4 -3 -2 -1 0 1 2 3 4] + #define BLOOM_RADIUS 5 //[1 2 3 4 5 6 7] + #define LENS_FLARE + #define LENS_FLARE_STRENGTH 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00] + #define VIGNETTE + #define VIGNETTE_STRENGTH 1.06 //[0.26 0.51 0.72 0.91 1.06 1.19 1.28 1.36 1.40 1.41] +//#define DIRTY_LENS + #define CHROMATIC_ABERRATION 0 //[0 1 2] + #define UNDERWATER_DISTORTION + +//Anti-aliasing + #define FXAA +//#define TAA + + #define FXAA_SUBPIXEL 0.75 //[0.00 0.25 0.50 0.75 1.00] + #define FXAA_EDGE_SENSITIVITY 1 //[0 1 2] + + #define TAA_MODE 0 //[0 1] +//#define TAA_SELECTIVE + +//Color// + #define LIGHT_MR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_MG 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_MB 80 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_MI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define AMBIENT_MR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_MG 204 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_MB 144 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_MI 0.35 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define LIGHT_DR 196 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_DG 220 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_DB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_DI 1.40 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define AMBIENT_DR 120 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_DG 172 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_DB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_DI 0.60 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define LIGHT_ER 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_EG 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_EB 80 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_EI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define AMBIENT_ER 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_EG 204 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_EB 144 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_EI 0.35 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define LIGHT_NR 96 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_NG 192 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_NB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define LIGHT_NI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define AMBIENT_NR 96 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_NG 192 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_NB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AMBIENT_NI 0.60 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define MINLIGHT_R 128 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define MINLIGHT_G 128 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define MINLIGHT_B 128 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define MINLIGHT_I 0.70 //[0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00] + + #define BLOCKLIGHT_R 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define BLOCKLIGHT_G 212 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define BLOCKLIGHT_B 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define BLOCKLIGHT_I 0.85 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define SKY_R 96 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define SKY_G 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define SKY_B 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define SKY_I 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define WATER_R 64 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WATER_G 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WATER_B 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WATER_I 0.35 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + #define WATER_A 0.70 //[0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00] + #define WATER_F 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define WEATHER_RR 176 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_RG 224 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_RB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_RI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define WEATHER_CR 216 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_CG 240 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_CB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_CI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define WEATHER_DR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_DG 232 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_DB 180 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_DI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define WEATHER_BR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_BG 216 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_BB 176 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_BI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define WEATHER_SR 200 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_SG 224 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_SB 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_SI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define WEATHER_MR 216 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_MG 216 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_MB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_MI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define WEATHER_VR 224 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_VG 224 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_VB 224 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_VI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define WEATHER_JR 176 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_JG 232 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_JB 232 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define WEATHER_JI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define AURORA_LR 80 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AURORA_LG 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AURORA_LB 180 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AURORA_LI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define AURORA_HR 80 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AURORA_HG 80 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AURORA_HB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define AURORA_HI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define NETHER_NR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_NG 96 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_NB 32 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_NI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define NETHER_VR 104 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_VG 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_VB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_VI 0.60 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define NETHER_CR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_CG 32 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_CB 24 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_CI 1.20 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define NETHER_WR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_WG 160 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_WB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_WI 0.60 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define NETHER_BR 236 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_BG 216 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_BB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define NETHER_BI 0.55 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define END_R 192 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define END_G 196 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define END_B 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define END_I 0.90 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + +//#define SKY_VANILLA + #define SKY_VANILLA_USE_FOG +//#define NETHER_VANILLA +//#define EMISSIVE_RECOLOR + +//Tonemap & Color Grading// + #define EXPOSURE 0.00 //[-2.00 -1.75 -1.50 -1.25 -1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00] + +//#define AUTO_EXPOSURE +//#define CLASSIC_EXPOSURE + #define AUTO_EXPOSURE_RADIUS 0.7 //[0.002 0.04 0.18 0.35 0.7] + #define AUTO_EXPOSURE_SPEED 0.033 //[0.0033 0.01 0.033 0.1 0.33] + +//#define COLOR_GRADING + + #define TONEMAP_LOWER_CURVE 1.0 //[0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5] + #define TONEMAP_UPPER_CURVE 1.0 //[0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5] + #define TONEMAP_WHITE_CURVE 2.0 //[1.0 1.5 2.0 2.5 3.0 3.5 4.0] + #define TONEMAP_WHITE_PATH 1.00 //[0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00] + + #define SATURATION 1.00 //[0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00] + #define VIBRANCE 1.00 //[0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00] + + #define CG_RR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_RG 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_RB 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_RI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + #define CG_RM 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_RC 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define CG_GR 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_GG 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_GB 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_GI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + #define CG_GM 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_GC 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define CG_BR 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_BG 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_BB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_BI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + #define CG_BM 0 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_BC 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + + #define CG_TR 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_TG 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_TB 255 //[0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 255] + #define CG_TI 1.00 //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00] + #define CG_TM 0.0 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] + +//Extras// + #define OUTLINE 0 //[0 1 2 3 4] +//#define TOON_LIGHTMAP +//#define RETRO_FILTER + #define RETRO_FILTER_SIZE 2 //[2 3 4 5 6 7 8] +//#define WORLD_CURVATURE + #define WORLD_CURVATURE_SIZE 256 //[-256 -512 -1024 -2048 -4096 4096 2048 1024 512 256 128 64 32 16] + +//Animations// +//#define WORLD_TIME_ANIMATION + #define ANIMATION_SPEED 1.00 //[0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.50 3.00 3.50 4.00 5.00 6.00 7.00 8.00] + #define WAVING_GRASS + #define WAVING_CROP + #define WAVING_PLANT + #define WAVING_TALL_PLANT + #define WAVING_LEAF + #define WAVING_VINE + #define WAVING_WATER + #define WAVING_LAVA + #define WAVING_FIRE + #define WAVING_LANTERN + +//Undefine// + #ifdef NETHER + #undef LIGHT_SHAFT + #undef LENS_FLARE + #undef SKY_VANILLA + #undef REFLECTION_RAIN + #endif + + #ifdef END + #undef LENS_FLARE + #undef REFLECTION_RAIN + #endif + + #ifndef SHADOW + #undef LIGHT_SHAFT + #endif + +//Outline Params// + #if OUTLINE > 0 + #define OUTLINE_ENABLED + #endif + + #if OUTLINE == 1 + #define OUTLINE_OUTER + #endif + + #if OUTLINE == 2 + #define OUTLINE_OUTER + #define OUTLINE_OUTER_COLOR + #endif + + #if OUTLINE == 3 + #define OUTLINE_OUTER + #define OUTLINE_OUTER_COLOR + #define OUTLINE_INNER + #endif + + #if OUTLINE == 4 + #define OUTLINE_INNER + #endif + +//Retro Filter Removes AA// + #ifdef RETRO_FILTER + #undef FXAA + #undef TAA + #endif + +//Normal Skip for 1.15 - 1.16 G7// + #if MC_VERSION >= 11500 && MC_VERSION < 11605 + #define NORMAL_SKIP + #endif + +//Multi-colored Unavailable on 1.16.5 and below// + #if MC_VERSION < 11605 + // #undef MULTICOLORED_BLOCKLIGHT //not working properly for some reason + #endif + +//Show In Shader Options// + #ifdef SHADOW_ENTITY + #endif + + #ifdef SHADOW_BLOCK_ENTITY + #endif + + #ifdef TAA_SELECTIVE + #endif + + #ifdef SKY_DEFERRED + #endif \ No newline at end of file diff --git a/shaders/lib/surface/directionalLightmap.glsl b/shaders/lib/surface/directionalLightmap.glsl new file mode 100644 index 0000000..a18986b --- /dev/null +++ b/shaders/lib/surface/directionalLightmap.glsl @@ -0,0 +1,25 @@ +mat3 GetLightmapTBN(vec3 viewPos) { + mat3 lightmapTBN = mat3(normalize(dFdx(viewPos)), normalize(dFdy(viewPos)), vec3(0.0)); + lightmapTBN[2] = cross(lightmapTBN[0], lightmapTBN[1]); + + return lightmapTBN; +} + +float DirectionalLightmap(float lightmap, float lightmapRaw, vec3 normal, mat3 lightmapTBN) { + if (lightmap < 0.001) return lightmap; + + vec2 deriv = vec2(dFdx(lightmapRaw), dFdy(lightmapRaw)) * 256.0; + vec3 dir = normalize(vec3( + deriv.x * lightmapTBN[0] + + 0.0005 * lightmapTBN[2] + + deriv.y * lightmapTBN[1] + )); + + float pwr = clamp(dot(normal, dir), -1.0, 1.0); + if (abs(pwr) > 0.0) + pwr = pow(abs(pwr), DIRECTIONAL_LIGHTMAP_STRENGTH) * sign(pwr) * lightmap; + if (length(deriv) > 0.001) + lightmap = pow(lightmap, max(1.0 - pwr, 0.001)); + + return lightmap; +} \ No newline at end of file diff --git a/shaders/lib/surface/generatedNormals.glsl b/shaders/lib/surface/generatedNormals.glsl new file mode 100644 index 0000000..cad0f1c --- /dev/null +++ b/shaders/lib/surface/generatedNormals.glsl @@ -0,0 +1,85 @@ +const float normalThreshold = GENERATED_NORMAL_THRESHOLD; +const float normalClamp = GENERATED_NORMAL_CLAMP; +const float packSizeGN = GENERATED_NORMAL_RESOLUTION; + +#ifndef GBUFFERS_HAND + const float normalMult = GENERATED_NORMAL_MULT * 0.05; +#else + const float normalMult = GENERATED_NORMAL_MULT * 0.03; +#endif + +float GetDif(float lOriginalAlbedo, vec2 offsetCoord) { + #ifndef GBUFFERS_WATER + float lNearbyAlbedo = length(texture2D(texture, offsetCoord).rgb); + #else + vec4 textureSample = texture2D(texture, offsetCoord); + float lNearbyAlbedo = length(textureSample.rgb * textureSample.a * 1); + #endif + + #ifdef GBUFFERS_ENTITIES + lOriginalAlbedo = abs(lOriginalAlbedo - 1.0); + lNearbyAlbedo = abs(lNearbyAlbedo - 1.0); + #endif + + float dif = lOriginalAlbedo - lNearbyAlbedo; + + #ifdef GBUFFERS_ENTITIES + dif = -dif; + #endif + + #ifndef GBUFFERS_WATER + if (dif > 0.0) dif = max(dif - normalThreshold, 0.0); + else dif = min(dif + normalThreshold, 0.0); + #endif + + return clamp(dif, -normalClamp, normalClamp); +} + +void GenerateNormals(inout vec3 normal, vec3 color) { + #ifndef ENTITY_GN_AND_CT + #if defined GBUFFERS_ENTITIES || defined GBUFFERS_HAND + return; + #endif + #endif + + vec2 absMidCoordPos2 = absMidCoordPos * 4.0; + float lOriginalAlbedo = length(color.rgb); + + float normalMult = max0(1 - mipDelta) * normalMult; + + #ifndef SAFER_GENERATED_NORMALS + vec2 offsetR = 16.0 / atlasSizeM; + #else + vec2 offsetR = max(absMidCoordPos2.x, absMidCoordPos2.y) * vec2(float(atlasSizeM.y) / float(atlasSizeM.x), 1); + #endif + offsetR /= packSizeGN; + + vec2 midCoord = texCoord - midCoordPos; + vec2 maxOffsetCoord = midCoord + absMidCoordPos; + vec2 minOffsetCoord = midCoord - absMidCoordPos; + if (normalMult > 0.0) { + vec3 normalMap = vec3(0.0, 0.0, 1.0); + + vec2 offsetCoord = texCoord + vec2( 0.0, offsetR.y); + if (offsetCoord.y < maxOffsetCoord.y) + normalMap.y += GetDif(lOriginalAlbedo, offsetCoord); + + offsetCoord = texCoord + vec2( offsetR.x, 0.0); + if (offsetCoord.x < maxOffsetCoord.x) + normalMap.x += GetDif(lOriginalAlbedo, offsetCoord); + + offsetCoord = texCoord + vec2( 0.0,-offsetR.y); + if (offsetCoord.y > minOffsetCoord.y) + normalMap.y -= GetDif(lOriginalAlbedo, offsetCoord); + + offsetCoord = texCoord + vec2(-offsetR.x, 0.0); + if (offsetCoord.x > minOffsetCoord.x) + normalMap.x -= GetDif(lOriginalAlbedo, offsetCoord); + + normalMap.xy *= normalMult; + normalMap.xy = clamp(normalMap.xy, vec2(-1.0), vec2(1.0)); + + if (normalMap.xy != vec2(0.0, 0.0)) + normal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + } +} \ No newline at end of file diff --git a/shaders/lib/surface/ggx.glsl b/shaders/lib/surface/ggx.glsl new file mode 100644 index 0000000..ed95e44 --- /dev/null +++ b/shaders/lib/surface/ggx.glsl @@ -0,0 +1,108 @@ +//GGX area light approximation from Decima Engine: Advances in Lighting and AA presentation +float GetNoHSquared(float radiusTan, float NoL, float NoV, float VoL) { + float radiusCos = 1.0 / sqrt(1.0 + radiusTan * radiusTan); + + float RoL = 2.0 * NoL * NoV - VoL; + if (RoL >= radiusCos) + return 1.0; + + float rOverLengthT = radiusCos * radiusTan / sqrt(1.0 - RoL * RoL); + float NoTr = rOverLengthT * (NoV - RoL * NoL); + float VoTr = rOverLengthT * (2.0 * NoV * NoV - 1.0 - RoL * VoL); + + float triple = sqrt(clamp(1.0 - NoL * NoL - NoV * NoV - VoL * VoL + 2.0 * NoL * NoV * VoL, 0.0, 1.0)); + + float NoBr = rOverLengthT * triple, VoBr = rOverLengthT * (2.0 * triple * NoV); + float NoLVTr = NoL * radiusCos + NoV + NoTr, VoLVTr = VoL * radiusCos + 1.0 + VoTr; + float p = NoBr * VoLVTr, q = NoLVTr * VoLVTr, s = VoBr * NoLVTr; + float xNum = q * (-0.5 * p + 0.25 * VoBr * NoLVTr); + float xDenom = p * p + s * ((s - 2.0 * p)) + NoLVTr * ((NoL * radiusCos + NoV) * VoLVTr * VoLVTr + + q * (-0.5 * (VoLVTr + VoL * radiusCos) - 0.5)); + float twoX1 = 2.0 * xNum / (xDenom * xDenom + xNum * xNum); + float sinTheta = twoX1 * xDenom; + float cosTheta = 1.0 - twoX1 * xNum; + NoTr = cosTheta * NoTr + sinTheta * NoBr; + VoTr = cosTheta * VoTr + sinTheta * VoBr; + + float newNoL = NoL * radiusCos + NoTr; + float newVoL = VoL * radiusCos + VoTr; + float NoH = NoV + newNoL; + float HoH = 2.0 * newVoL + 2.0; + return clamp(NoH * NoH / HoH, 0.0, 1.0); +} + +float GGXTrowbridgeReitz(float NoHsqr, float roughness){ + float roughnessSqr = roughness * roughness; + float distr = NoHsqr * (roughnessSqr - 1.0) + 1.0; + return roughnessSqr / (3.14159 * distr * distr); +} + +float SchlickGGX(float NoL, float NoV, float roughness){ + float k = roughness * 0.5; + + float smithL = 0.5 / (NoL * (1.0 - k) + k); + float smithV = 0.5 / (NoV * (1.0 - k) + k); + + return smithL * smithV; +} + +vec3 SphericalGaussianFresnel(float HoL, vec3 baseReflectance){ + float fresnel = exp2(((-5.55473 * HoL) - 6.98316) * HoL); + return fresnel * (1.0 - baseReflectance) + baseReflectance; +} + +vec3 GGX(vec3 normal, vec3 viewPos, float smoothness, vec3 baseReflectance, float sunSize) { + float roughness = max(1.0 - smoothness, 0.025); roughness *= roughness; + viewPos = -viewPos; + + vec3 halfVec = normalize(lightVec + viewPos); + + float HoL = clamp(dot(halfVec, lightVec), 0.0, 1.0); + float NoL = clamp(dot(normal, lightVec), 0.0, 1.0); + float NoV = clamp(dot(normal, viewPos), -1.0, 1.0); + float VoL = dot(lightVec, viewPos); + + float NoHsqr = GetNoHSquared(sunSize, NoL, NoV, VoL); + if (NoV < 0.0){ + NoHsqr = dot(normal, halfVec); + NoHsqr *= NoHsqr; + } + NoV = max(NoV, 0.0); + + float D = GGXTrowbridgeReitz(NoHsqr, roughness); + vec3 F = SphericalGaussianFresnel(HoL, baseReflectance); + float G = SchlickGGX(NoL, NoV, roughness); + + float Fl = max(length(F), 0.001); + vec3 Fn = F / Fl; + + float specular = D * Fl * G; + vec3 specular3 = specular / (1.0 + 0.03125 / 4.0 * specular) * Fn * NoL; + + #ifndef SPECULAR_HIGHLIGHT_ROUGH + specular3 *= 1.0 - roughness * roughness; + #endif + + return specular3; +} + +vec3 GetSpecularHighlight(vec3 normal, vec3 viewPos, float smoothness, vec3 baseReflectance, + vec3 specularColor, vec3 shadow, float smoothLighting) { + if (dot(shadow, shadow) < 0.00001) return vec3(0.0); + #ifndef SPECULAR_HIGHLIGHT_ROUGH + if (smoothness < 0.00002) return vec3(0.0); + #endif + + smoothLighting *= smoothLighting; + + #ifdef END + smoothness *= 0.75; + #endif + + vec3 specular = GGX(normal, normalize(viewPos), smoothness, baseReflectance, + (0.025 * sunVisibility + 0.05) * ROUND_SUN_MOON_SIZE); + specular *= shadow * shadowFade * smoothLighting; + specular *= (1.0 - rainStrength) * (1.0 - rainStrength); + + return specular * specularColor; +} \ No newline at end of file diff --git a/shaders/lib/surface/materialDeferred.glsl b/shaders/lib/surface/materialDeferred.glsl new file mode 100644 index 0000000..5d8de6c --- /dev/null +++ b/shaders/lib/surface/materialDeferred.glsl @@ -0,0 +1,18 @@ +void GetMaterials(out float smoothness, out float skyOcclusion, out vec3 normal, out vec3 fresnel3, + vec2 coord) { + vec3 specularData = texture2D(colortex3, coord).rgb; + + smoothness = specularData.r; + smoothness *= smoothness; + smoothness /= 2.0 - smoothness; + + skyOcclusion = specularData.g; + #if REFLECTION_SKY_FALLOFF > 1 + skyOcclusion = clamp(1.0 - (1.0 - skyOcclusion) * REFLECTION_SKY_FALLOFF, 0.0, 1.0); + #endif + skyOcclusion *= skyOcclusion; + + normal = DecodeNormal(texture2D(colortex6, coord).xy); + + fresnel3 = texture2D(colortex7, coord).rgb * smoothness; +} \ No newline at end of file diff --git a/shaders/lib/surface/materialGbuffers.glsl b/shaders/lib/surface/materialGbuffers.glsl new file mode 100644 index 0000000..c762296 --- /dev/null +++ b/shaders/lib/surface/materialGbuffers.glsl @@ -0,0 +1,130 @@ +void GetMaterials(out float smoothness, out float metalness, out float f0, inout float emission, + inout float subsurface, out float porosity, out float ao, out vec3 normalMap, + vec2 newCoord, vec2 dcdx, vec2 dcdy) +{ + float emissionMat = 0.0; + + + + #if MATERIAL_FORMAT == 0 + #ifdef PARALLAX + vec4 specularMap = texture2DGradARB(specular, newCoord, dcdx, dcdy); + #else + vec4 specularMap = texture2D(specular, texCoord); + #endif + + smoothness = specularMap.r; + + f0 = 0.04; + metalness = specularMap.g; + + emissionMat = specularMap.b * specularMap.b; + + porosity = 0.5 - 0.5 * smoothness; + subsurface = specularMap.a > 0.0 ? 1.0 - specularMap.a : 0.0; + + #ifdef PARALLAX + normalMap = texture2DGradARB(normals, newCoord, dcdx, dcdy).xyz * 2.0 - 1.0; + #else + normalMap = texture2D(normals, texCoord).xyz * 2.0 - 1.0; + #endif + ao = 1.0; + + if (normalMap.x + normalMap.y < -1.999) normalMap = vec3(0.0, 0.0, 1.0); + #endif + + #if MATERIAL_FORMAT == 1 + vec4 specularMap = texture2DLod(specular, newCoord, 0); + smoothness = specularMap.r; + + f0 = specularMap.g; + metalness = f0 >= 0.9 ? 1.0 : 0.0; + + emissionMat = specularMap.a < 1.0 ? clamp(specularMap.a * 1.004 - 0.004, 0.0, 1.0) : 0.0; + emissionMat *= emissionMat; + + porosity = specularMap.b <= 0.251 ? specularMap.b * 3.984 : 0.0; + subsurface = specularMap.b > 0.251 ? clamp(specularMap.b * 1.335 - 0.355, 0.0, 1.0) : 0.0; + + #ifdef PARALLAX + normalMap = vec3(texture2DGradARB(normals, newCoord, dcdx, dcdy).xy, 0.0) * 2.0 - 1.0; + ao = texture2DGradARB(normals, newCoord, dcdx, dcdy).z; + #else + normalMap = vec3(texture2D(normals, texCoord).xy, 0.0) * 2.0 - 1.0; + ao = texture2D(normals, texCoord).z; + #endif + + if (normalMap.x + normalMap.y > -1.999) { + if (length(normalMap.xy) > 1.0) normalMap.xy = normalize(normalMap.xy); + normalMap.z = sqrt(1.0 - dot(normalMap.xy, normalMap.xy)); + normalMap = normalize(clamp(normalMap, vec3(-1.0), vec3(1.0))); + }else{ + normalMap = vec3(0.0, 0.0, 1.0); + ao = 1.0; + } + #endif + + #if EMISSIVE == 2 + emission = mix(emissionMat, 1.0, emission); + #else + emission = emissionMat; + #endif + + #ifdef NORMAL_DAMPENING + mipx = dcdx * atlasSize; + mipy = dcdy * atlasSize; + mipDelta = max(dot(mipx, mipx), dot(mipy, mipy)); + miplevel = max(0.25 * log2(mipDelta), 0.0); + + normalMap = normalize(mix(vec3(0.0, 0.0, 1.0), normalMap, 1.0 / exp2(miplevel))); + #endif + + + + #if MATERIAL_FORMAT == 2 + vec4 specularMap = texture2DLod(specular, newCoord, 0); + smoothness = specularMap.r; + + f0 = specularMap.g; + metalness = f0 >= 0.9 ? 1.0 : 0.0; + + emissionMat = specularMap.a < 1.0 ? clamp(specularMap.a * 1.004 - 0.004, 0.0, 1.0) : 0.0; + emissionMat *= emissionMat; + + porosity = specularMap.b <= 0.251 ? specularMap.b * 3.984 : 0.0; + subsurface = specularMap.b > 0.251 ? clamp(specularMap.b * 1.335 - 0.355, 0.0, 1.0) : 0.0; + + #ifdef PARALLAX + normalMap = vec3(texture2DGradARB(normals, newCoord, dcdx, dcdy).xy, 0.0) * 2.0 - 1.0; + ao = texture2DGradARB(normals, newCoord, dcdx, dcdy).z; + #else + normalMap = vec3(texture2D(normals, texCoord).xy, 0.0) * 2.0 - 1.0; + ao = texture2D(normals, texCoord).z; + #endif + + if (normalMap.x + normalMap.y > -1.999) { + if (length(normalMap.xy) > 1.0) normalMap.xy = normalize(normalMap.xy); + normalMap.z = sqrt(1.0 - dot(normalMap.xy, normalMap.xy)); + normalMap = normalize(clamp(normalMap, vec3(-1.0), vec3(1.0))); + }else{ + normalMap = vec3(0.0, 0.0, 1.0); + ao = 1.0; + } + #endif + + #if EMISSIVE == 2 + emission = mix(emissionMat, 1.0, emission); + #else + emission = emissionMat; + #endif + + #ifdef NORMAL_DAMPENING + mipx = dcdx * atlasSize; + mipy = dcdy * atlasSize; + mipDelta = max(dot(mipx, mipx), dot(mipy, mipy)); + miplevel = max(0.25 * log2(mipDelta), 0.0); + + normalMap = normalize(mix(vec3(0.0, 0.0, 1.0), normalMap, 1.0 / exp2(miplevel))); + #endif + +} \ No newline at end of file diff --git a/shaders/lib/surface/materialHandling/blockEntityMaterials.glsl b/shaders/lib/surface/materialHandling/blockEntityMaterials.glsl new file mode 100644 index 0000000..fb619a7 --- /dev/null +++ b/shaders/lib/surface/materialHandling/blockEntityMaterials.glsl @@ -0,0 +1,105 @@ +// if (blockEntityId < 60028) { +// if (blockEntityId < 60012) { +// if (blockEntityId < 60004) { +// if (blockEntityId == 10548) { // Enchanting Table:Book +// smoothnessG = pow2(color.g) * 0.35; + +// if (color.b < 0.0001 && color.r > color.g) { +// emission = color.g * 4.0; +// } +// } else if (blockEntityId == 60000) { // + +// } +// } else { +// if (blockEntityId == 60004) { // Signs +// noSmoothLighting = true; + +// if (glColor.r + glColor.g + glColor.b <= 2.99 || lmCoord.x > 0.999) { // Sign Text +// #include "/lib/materials/specificMaterials/others/signText.glsl" +// } + +// #ifdef COATED_TEXTURES +// noiseFactor = 0.66; +// #endif +// } else /*if (blockEntityId == 60008)*/ { // Chest +// noSmoothLighting = true; + +// smoothnessG = pow2(color.g); + +// #ifdef COATED_TEXTURES +// noiseFactor = 0.66; +// #endif +// } +// } +// } else { +// if (blockEntityId < 60020) { +// if (blockEntityId == 60012) { // Ender Chest +// noSmoothLighting = true; + +// float factor = min(pow2(color.g), 0.25); +// smoothnessG = factor * 2.0; + +// if (color.g > color.r || color.b > color.g) +// emission = pow2(factor) * 20.0; +// emission += 0.35; + +// #ifdef COATED_TEXTURES +// noiseFactor = 0.66; +// #endif +// } else /*if (blockEntityId == 60016)*/ { // Shulker Box+, Banner+, Head+, Bed+ +// noSmoothLighting = true; +// #ifdef COATED_TEXTURES +// noiseFactor = 0.2; +// #endif +// } +// } else { +// if (blockEntityId == 60020) { // Conduit +// noSmoothLighting = true; +// lmCoordM.x = 0.9; + +// if (color.b > color.r) { // Conduit:Wind, Conduit:Blue Pixels of The Eye +// emission = color.r * 16.0; +// } else if (color.r > color.b * 2.5) { // Conduit:Red Pixels of The Eye +// emission = 20.0; +// color.rgb *= vec3(1.0, 0.25, 0.1); +// } +// } else /*if (blockEntityId == 60024)*/ { // End Portal, End Gateway +// #include "/lib/materials/specificMaterials/others/endPortalEffect.glsl" +// } +// } +// } +// } else { +// if (blockEntityId < 60044) { +// if (blockEntityId < 60036) { +// if (blockEntityId == 60028) { // + +// } else /*if (blockEntityId == 60032)*/ { // Bell +// if (color.r + color.g > color.b + 0.5) { // Bell:Golden Part +// #include "/lib/materials/specificMaterials/terrain/goldBlock.glsl" +// } else { +// #include "/lib/materials/specificMaterials/terrain/stone.glsl" +// } +// } +// } else { +// if (blockEntityId == 60036) { // + +// } else /*if (blockEntityId == 60040)*/ { // + +// } +// } +// } else { +// if (blockEntityId < 60052) { +// if (blockEntityId == 60044) { // + +// } else /*if (blockEntityId == 60048)*/ { // + +// } +// } else { +// if (blockEntityId == 60052) { // + +// } else if (blockEntityId == 60056) { // + +// } +// } +// } +// } \ No newline at end of file diff --git a/shaders/lib/surface/parallax.glsl b/shaders/lib/surface/parallax.glsl new file mode 100644 index 0000000..8a58bb1 --- /dev/null +++ b/shaders/lib/surface/parallax.glsl @@ -0,0 +1,76 @@ +vec4 ReadNormal(vec2 coord) { + coord = fract(coord) * vTexCoordAM.pq + vTexCoordAM.st; + return texture2DGradARB(normals, coord, dcdx, dcdy); +} + +vec2 GetParallaxCoord(vec2 texCoord, float parallaxFade, out float surfaceDepth) { + vec2 coord = vTexCoord.st; + surfaceDepth = 1.0; + + if (viewVector != viewVector) { + return texCoord; + } + + float sampleStep = 1.0 / PARALLAX_QUALITY; + float currentStep = 1.0; + + vec2 scaledDir = viewVector.xy * PARALLAX_DEPTH / -viewVector.z; + vec2 stepDir = scaledDir * sampleStep * (1.0 - parallaxFade); + + vec3 normalMap = ReadNormal(coord).xyz * 2.0 - 1.0; + float normalCheck = normalMap.x + normalMap.y; + if (parallaxFade >= 1.0 || normalCheck < -1.999) return texCoord; + + float depth = ReadNormal(coord).a; + + for(int i = 0; i < PARALLAX_QUALITY; i++){ + if (currentStep <= depth) break; + coord += stepDir; + depth = ReadNormal(coord).a; + currentStep -= sampleStep; + } + + coord = fract(coord.st) * vTexCoordAM.pq + vTexCoordAM.st; + surfaceDepth = currentStep; + + return coord; +} + +float GetParallaxShadow(float surfaceDepth, float parallaxFade, vec2 coord, vec3 lightVec, + mat3 tbn) { + float parallaxshadow = 1.0; + if(parallaxFade >= 1.0) return 1.0; + + float height = surfaceDepth; + if(height > 1.0 - 0.5 / PARALLAX_QUALITY) return 1.0; + + vec3 parallaxdir = tbn * lightVec; + parallaxdir.xy *= PARALLAX_DEPTH * SELF_SHADOW_ANGLE; + vec2 newvTexCoord = (coord - vTexCoordAM.st) / vTexCoordAM.pq; + float sampleStep = 0.32 / SELF_SHADOW_QUALITY; + + vec2 ptexCoord = fract(newvTexCoord + parallaxdir.xy * sampleStep) * + vTexCoordAM.pq + vTexCoordAM.st; + + float texHeight = texture2DGradARB(normals, coord, dcdx, dcdy).a; + float texHeightOffset = texture2DGradARB(normals, ptexCoord, dcdx, dcdy).a; + + float texFactor = clamp((height - texHeightOffset) / sampleStep + 1.0, 0.0, 1.0); + + height = mix(height, texHeight, texFactor); + + for(int i = 0; i < SELF_SHADOW_QUALITY; i++) { + float currentHeight = height + parallaxdir.z * sampleStep * i; + vec2 parallaxCoord = fract(newvTexCoord + parallaxdir.xy * i * sampleStep) * + vTexCoordAM.pq + vTexCoordAM.st; + float offsetHeight = texture2DGradARB(normals, parallaxCoord, dcdx, dcdy).a; + float sampleShadow = clamp(1.0 - (offsetHeight - currentHeight) * SELF_SHADOW_STRENGTH, 0.0, 1.0); + parallaxshadow = min(parallaxshadow, sampleShadow); + if (parallaxshadow < 0.01) break; + } + parallaxshadow *= parallaxshadow; + + parallaxshadow = mix(parallaxshadow, 1.0, parallaxFade); + + return parallaxshadow; +} \ No newline at end of file diff --git a/shaders/lib/util/commonFunctions.glsl b/shaders/lib/util/commonFunctions.glsl new file mode 100644 index 0000000..e9e80fc --- /dev/null +++ b/shaders/lib/util/commonFunctions.glsl @@ -0,0 +1,15 @@ +float min1(float x) { + return min(x, 1.0); +} +float max0(float x) { + return max(x, 0.0); +} +float clamp01(float x) { + return clamp(x, 0.0, 1.0); +} +vec2 clamp01(vec2 x) { + return clamp(x, vec2(0.0), vec2(1.0)); +} +vec3 clamp01(vec3 x) { + return clamp(x, vec3(0.0), vec3(1.0)); +} \ No newline at end of file diff --git a/shaders/lib/util/dFdxdFdy.glsl b/shaders/lib/util/dFdxdFdy.glsl new file mode 100644 index 0000000..0509a2d --- /dev/null +++ b/shaders/lib/util/dFdxdFdy.glsl @@ -0,0 +1,7 @@ +#ifndef INCLUDE_DFDX_DFDY +#define INCLUDE_DFDX_DFDY + +vec2 dcdx = dFdx(texCoord.xy); +vec2 dcdy = dFdy(texCoord.xy); + +#endif \ No newline at end of file diff --git a/shaders/lib/util/dither.glsl b/shaders/lib/util/dither.glsl new file mode 100644 index 0000000..707e68b --- /dev/null +++ b/shaders/lib/util/dither.glsl @@ -0,0 +1,16 @@ +//Dithering from Jodie +float Bayer2(vec2 a) { + a = floor(a); + return fract(a.x * 0.5 + a.y * a.y * 0.75); +} + +#define Bayer4(a) (Bayer2(a * 0.5) * 0.25 + Bayer2(a)) +#define Bayer8(a) (Bayer4(a * 0.5) * 0.25 + Bayer2(a)) + +float BayerCloud2(vec2 a) { + a = floor(a); + return fract(a.x * 0.5 + a.y * 0.75); +} + +#define BayerCloud4(a) (BayerCloud2(a * 0.5) * 0.25 + BayerCloud2(a)) +#define BayerCloud8(a) (BayerCloud4(a * 0.5) * 0.25 + BayerCloud2(a)) \ No newline at end of file diff --git a/shaders/lib/util/encode.glsl b/shaders/lib/util/encode.glsl new file mode 100644 index 0000000..448f6d4 --- /dev/null +++ b/shaders/lib/util/encode.glsl @@ -0,0 +1,15 @@ +//Spheremap Transform from https://aras-p.info/texts/CompactNormalStorage.html +vec2 EncodeNormal(vec3 n) { + float f = sqrt(n.z * 8.0 + 8.0); + return n.xy / f + 0.5; +} + +vec3 DecodeNormal(vec2 enc) { + vec2 fenc = enc * 4.0 - 2.0; + float f = dot(fenc,fenc); + float g = sqrt(1.0 - f / 4.0); + vec3 n; + n.xy = fenc * g; + n.z = 1.0 - f / 2.0; + return n; +} \ No newline at end of file diff --git a/shaders/lib/util/jitter.glsl b/shaders/lib/util/jitter.glsl new file mode 100644 index 0000000..f394b9b --- /dev/null +++ b/shaders/lib/util/jitter.glsl @@ -0,0 +1,27 @@ +//Jitter offset from Chocapic13 +uniform float framemod8; +uniform float framemod2; + +vec2 jitterOffsets8[8] = vec2[8]( + vec2( 0.125,-0.375), + vec2(-0.125, 0.375), + vec2( 0.625, 0.125), + vec2( 0.375,-0.625), + vec2(-0.625, 0.625), + vec2(-0.875,-0.125), + vec2( 0.375,-0.875), + vec2( 0.875, 0.875) + ); +vec2 jitterOffsets2[2] = vec2[2]( + vec2( 1.0, 0.0), + vec2( 0.0, 1.0) + ); + +vec2 TAAJitter(vec2 coord, float w) { + #if TAA_MODE == 0 + vec2 offset = jitterOffsets8[int(framemod8)] * (w / vec2(viewWidth, viewHeight)); + #else + vec2 offset = jitterOffsets2[int(framemod2)] * (w / vec2(viewWidth, viewHeight)); + #endif + return coord + offset; +} \ No newline at end of file diff --git a/shaders/lib/util/outlineDepth.glsl b/shaders/lib/util/outlineDepth.glsl new file mode 100644 index 0000000..6f233fc --- /dev/null +++ b/shaders/lib/util/outlineDepth.glsl @@ -0,0 +1,20 @@ +void DepthOutline(inout float z, sampler2D depthtex) { + float ph = ceil(viewHeight / 1440.0) / viewHeight; + float pw = ph / aspectRatio; + + int sampleCount = viewHeight >= 720.0 ? 12 : 4; + + #ifdef RETRO_FILTER + ph = RETRO_FILTER_SIZE / viewHeight; + pw = ph / aspectRatio; + sampleCount = 4; + #endif + + for (int i = 0; i < sampleCount; i++) { + vec2 offset = vec2(pw, ph) * outlineOffsets[i]; + for (int j = 0; j < 2; j++) { + z = min(z, texture2D(depthtex, texCoord + offset).r); + offset = -offset; + } + } +} \ No newline at end of file diff --git a/shaders/lib/util/outlineMask.glsl b/shaders/lib/util/outlineMask.glsl new file mode 100644 index 0000000..99b2ccf --- /dev/null +++ b/shaders/lib/util/outlineMask.glsl @@ -0,0 +1,24 @@ +float GetOutlineMask() { + float ph = ceil(viewHeight / 1440.0) / viewHeight; + float pw = ph / aspectRatio; + + int sampleCount = viewHeight >= 720.0 ? 12 : 4; + + #ifdef RETRO_FILTER + ph = RETRO_FILTER_SIZE / viewHeight; + pw = ph / aspectRatio; + sampleCount = 4; + #endif + + float mask = 0.0; + for (int i = 0; i < sampleCount; i++) { + vec2 offset = vec2(pw, ph) * outlineOffsets[i]; + for (int j = 0; j < 2; j++){ + mask += float(texture2D(depthtex0, texCoord + offset).r < + texture2D(depthtex1, texCoord + offset).r); + offset = -offset; + } + } + + return float(mask > 0.5); +} \ No newline at end of file diff --git a/shaders/lib/util/outlineOffset.glsl b/shaders/lib/util/outlineOffset.glsl new file mode 100644 index 0000000..2cd98d5 --- /dev/null +++ b/shaders/lib/util/outlineOffset.glsl @@ -0,0 +1,14 @@ +vec2 outlineOffsets[12] = vec2[12]( + vec2( 0.0, 1.0), + vec2( 1.0, 0.0), + vec2( 1.0, 1.0), + vec2(-1.0, 1.0), + vec2( 2.0, 0.0), + vec2( 0.0, 2.0), + vec2( 2.0, 1.0), + vec2( 1.0, 2.0), + vec2(-1.0, 2.0), + vec2(-2.0, 1.0), + vec2( 2.0, 2.0), + vec2(-2.0, 2.0) +); \ No newline at end of file diff --git a/shaders/lib/util/spaceConversion.glsl b/shaders/lib/util/spaceConversion.glsl new file mode 100644 index 0000000..9de5fb1 --- /dev/null +++ b/shaders/lib/util/spaceConversion.glsl @@ -0,0 +1,20 @@ +#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) +#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) + +vec3 ToNDC(vec3 pos) { + vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, + gbufferProjectionInverse[1].y, + gbufferProjectionInverse[2].zw); + vec3 p3 = pos * 2.0 - 1.0; + vec4 viewPos = iProjDiag * p3.xyzz + gbufferProjectionInverse[3]; + return viewPos.xyz / viewPos.w; +} + +vec3 ToWorld(vec3 pos) { + return mat3(gbufferModelViewInverse) * pos + gbufferModelViewInverse[3].xyz; +} + +vec3 ToShadow(vec3 pos) { + vec3 shadowpos = mat3(shadowModelView) * pos + shadowModelView[3].xyz; + return projMAD(shadowProjection, shadowpos); +} \ No newline at end of file diff --git a/shaders/lib/vertex/waving.glsl b/shaders/lib/vertex/waving.glsl new file mode 100644 index 0000000..7eed0d1 --- /dev/null +++ b/shaders/lib/vertex/waving.glsl @@ -0,0 +1,133 @@ +const float pi = 3.1415927; +float pi2wt = 6.2831854 * (frametime * 24.0); + +float GetNoise(vec2 pos) { + return fract(sin(dot(pos, vec2(12.9898, 4.1414))) * 43758.5453); +} + +float Noise2D(vec2 pos) { + vec2 flr = floor(pos); + vec2 frc = fract(pos); + frc = frc * frc * (3.0 - 2.0 * frc); + + float n00 = GetNoise(flr); + float n01 = GetNoise(flr + vec2(0.0, 1.0)); + float n10 = GetNoise(flr + vec2(1.0, 0.0)); + float n11 = GetNoise(flr + vec2(1.0, 1.0)); + + float n0 = mix(n00, n01, frc.y); + float n1 = mix(n10, n11, frc.y); + + return mix(n0, n1, frc.x) - 0.5; +} + +vec3 CalcMove(vec3 pos, float density, float speed, vec2 mult) { + pos = pos * density + frametime * speed; + vec3 wave = vec3(Noise2D(pos.yz), Noise2D(pos.xz + 0.333), Noise2D(pos.xy + 0.667)); + return wave * vec3(mult, mult.x); +} + +float CalcLilypadMove(vec3 worldpos) { + float wave = sin(2 * pi * (frametime * 0.7 + worldpos.x * 0.14 + worldpos.z * 0.07)) + + sin(2 * pi * (frametime * 0.5 + worldpos.x * 0.10 + worldpos.z * 0.20)); + return wave * 0.0125; +} + +float CalcLavaMove(vec3 worldpos) { + float fy = fract(worldpos.y + 0.005); + + if (fy > 0.01) { + float wave = sin(pi * (frametime * 0.7 + worldpos.x * 0.14 + worldpos.z * 0.07)) + + sin(pi * (frametime * 0.5 + worldpos.x * 0.10 + worldpos.z * 0.20)); + return wave * 0.0125; + } else return 0.0; +} + +vec3 CalcLanternMove(vec3 position) { + vec3 frc = fract(position); + frc = vec3(frc.x - 0.5, fract(frc.y - 0.001) - 1.0, frc.z - 0.5); + vec3 flr = position - frc; + float offset = flr.x * 2.4 + flr.y * 2.7 + flr.z * 2.2; + + float rmult = pi * 0.016; + float rx = sin(frametime + offset) * rmult; + float ry = sin(frametime * 1.7 + offset) * rmult; + float rz = sin(frametime * 1.4 + offset) * rmult; + mat3 rotx = mat3( + 1, 0, 0, + 0, cos(rx), -sin(rx), + 0, sin(rx), cos(rx) + ); + mat3 roty = mat3( + cos(ry), 0, sin(ry), + 0, 1, 0, + -sin(ry), 0, cos(ry) + ); + mat3 rotz = mat3( + cos(rz), -sin(rz), 0, + sin(rz), cos(rz), 0, + 0, 0, 1 + ); + frc = rotx * roty * rotz * frc; + + return flr + frc - position; +} + +vec3 WavingBlocks(vec3 position, int blockID, float istopv) { + vec3 wave = vec3(0.0); + vec3 worldpos = position + cameraPosition; + + #ifdef WAVING_GRASS + if (blockID == 100 && istopv > 0.9) + wave += CalcMove(worldpos, 0.35, 1.0, vec2(0.25, 0.06)); + #endif + + #ifdef WAVING_CROP + if (blockID == 104 && (istopv > 0.9 || fract(worldpos.y + 0.0675) > 0.01)) + wave += CalcMove(worldpos, 0.35, 1.0, vec2(0.15, 0.06)); + #endif + + #ifdef WAVING_PLANT + if (blockID == 101 && (istopv > 0.9 || fract(worldpos.y + 0.005) > 0.01)) + wave += CalcMove(worldpos, 0.7, 1.35, vec2(0.12, 0.00)); + if (blockID == 107 || blockID == 207) + wave += CalcMove(worldpos, 0.5, 1.25, vec2(0.06, 0.00)); + if (blockID == 108) + wave.y += CalcLilypadMove(worldpos); + #endif + + #ifdef WAVING_TALL_PLANT + if (blockID == 102 && (istopv > 0.9 || fract(worldpos.y + 0.005) > 0.01) || + blockID == 103) + wave += CalcMove(worldpos, 0.35, 1.15, vec2(0.15, 0.06)); + #endif + + #ifdef WAVING_LEAF + if (blockID == 105) + wave += CalcMove(worldpos, 0.25, 1.0, vec2(0.08, 0.08)); + #endif + + #ifdef WAVING_VINE + if (blockID == 106) + wave += CalcMove(worldpos, 0.35, 1.25, vec2(0.06, 0.06)); + #endif + + #ifdef WAVING_LAVA + if (blockID == 203) + wave.y += CalcLavaMove(worldpos); + #endif + + #ifdef WAVING_FIRE + if (blockID == 204 && istopv > 0.9) + wave += CalcMove(worldpos, 1.0, 1.5, vec2(0.0, 0.37)); + #endif + + #ifdef WAVING_LANTERN + if (blockID == 206) + wave += CalcLanternMove(worldpos); + #endif + + position += wave; + + return position; +} \ No newline at end of file diff --git a/shaders/lib/vertex/worldCurvature.glsl b/shaders/lib/vertex/worldCurvature.glsl new file mode 100644 index 0000000..c897bfa --- /dev/null +++ b/shaders/lib/vertex/worldCurvature.glsl @@ -0,0 +1,3 @@ +float WorldCurvature(vec2 pos) { + return dot(pos, pos) / WORLD_CURVATURE_SIZE; +} \ No newline at end of file diff --git a/shaders/program/composite.glsl b/shaders/program/composite.glsl new file mode 100644 index 0000000..bb543ea --- /dev/null +++ b/shaders/program/composite.glsl @@ -0,0 +1,336 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 sunVec, upVec; + +//Uniforms// +uniform int frameCounter; +uniform int isEyeInWater; +uniform int worldTime; + +uniform float blindFactor, darknessFactor, nightVision; +uniform float darknessLightFactor; +uniform float far, near; +uniform float frameTimeCounter; +uniform float rainStrength; +uniform float shadowFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight, aspectRatio; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; +uniform mat4 gbufferProjection, gbufferProjectionInverse; +uniform mat4 gbufferModelViewInverse; +uniform mat4 shadowModelView; +uniform mat4 shadowProjection; + +uniform sampler2D colortex0; +uniform sampler2D colortex1; +uniform sampler2D depthtex0; +uniform sampler2D depthtex1; + +#ifdef LIGHT_SHAFT +uniform sampler2DShadow shadowtex0; +uniform sampler2DShadow shadowtex1; +uniform sampler2D shadowcolor0; +uniform sampler2D noisetex; +#endif + +#if REFRACTION > 0 +uniform sampler2D colortex6; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +uniform vec3 previousCameraPosition; + +uniform mat4 gbufferPreviousModelView; +uniform mat4 gbufferPreviousProjection; + +uniform sampler2D colortex8; +uniform sampler2D colortex9; +#endif + +#ifdef OUTLINE_ENABLED +uniform sampler2D gaux1; +#endif + +#ifdef DISTANT_HORIZONS +uniform float dhFarPlane; +#endif + +//Optifine Constants// +const bool colortex5Clear = false; + +#ifdef MULTICOLORED_BLOCKLIGHT +const bool colortex9Clear = false; +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp(dot(sunVec, upVec) + 0.05, 0.0, 0.1) * 10.0; + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +float GetLinearDepth(float depth) { + return (2.0 * near) / (far + near - depth * (far - near)); +} + +#ifdef MULTICOLORED_BLOCKLIGHT +vec2 Reprojection(vec3 pos) { + pos = pos * 2.0 - 1.0; + + vec4 viewPosPrev = gbufferProjectionInverse * vec4(pos, 1.0); + viewPosPrev /= viewPosPrev.w; + viewPosPrev = gbufferModelViewInverse * viewPosPrev; + + vec3 cameraOffset = cameraPosition - previousCameraPosition; + cameraOffset *= float(pos.z > 0.56); + + vec4 previousPosition = viewPosPrev + vec4(cameraOffset, 0.0); + previousPosition = gbufferPreviousModelView * previousPosition; + previousPosition = gbufferPreviousProjection * previousPosition; + return previousPosition.xy / previousPosition.w * 0.5 + 0.5; +} + +vec2 OffsetDist(float x) { + float n = fract(x * 8.0) * 6.283; + return vec2(cos(n), sin(n)) * x * x; +} + +vec3 GetMultiColoredBlocklight(vec2 coord, float z, float dither) { + vec2 prevCoord = Reprojection(vec3(coord, z)); + float lz = GetLinearDepth(z); + + float distScale = clamp((far - near) * lz + near, 4.0, 128.0); + float fovScale = gbufferProjection[1][1] / 1.37; + + vec2 blurstr = vec2(1.0 / aspectRatio, 1.0) * 2.5 * fovScale / distScale; + + vec3 lightAlbedo = texture2D(colortex8, coord).rgb; + vec3 previousColoredLight = vec3(0.0); + + #ifdef MCBL_ANTI_BLEED + float linearZ = GetLinearDepth(z); + #endif + + float mask = clamp(2.0 - 2.0 * max(abs(prevCoord.x - 0.5), abs(prevCoord.y - 0.5)), 0.0, 1.0); + + for(int i = 0; i < 4; i++) { + vec2 offset = OffsetDist((dither + i) * 0.25) * blurstr; + offset = floor(offset * vec2(viewWidth, viewHeight) + 0.5) / vec2(viewWidth, viewHeight); + + #ifdef MCBL_ANTI_BLEED + vec2 sampleZPos = coord + offset; + float sampleZ0 = texture2D(depthtex0, sampleZPos).r; + float sampleZ1 = texture2D(depthtex1, sampleZPos).r; + float linearSampleZ = GetLinearDepth(sampleZ1 >= 1.0 ? sampleZ0 : sampleZ1); + + float sampleWeight = clamp(abs(linearZ - linearSampleZ) * far / 16.0, 0.0, 1.0); + sampleWeight = 1.0 - sampleWeight * sampleWeight; + #else + float sampleWeight = 1.0; + #endif + + previousColoredLight += texture2D(colortex9, prevCoord.xy + offset).rgb * sampleWeight; + } + + previousColoredLight *= 0.25; + previousColoredLight *= previousColoredLight * mask; + + return sqrt(mix(previousColoredLight, lightAlbedo * lightAlbedo / 0.1, 0.1)); +} +#endif + +//Includes// +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/skyColor.glsl" +#include "/lib/color/waterColor.glsl" +#include "/lib/util/dither.glsl" +#include "/lib/atmospherics/waterFog.glsl" + +#ifdef LIGHT_SHAFT +#include "/lib/atmospherics/volumetricLight.glsl" +#endif + +#ifdef OUTLINE_ENABLED +#include "/lib/color/blocklightColor.glsl" +#include "/lib/util/outlineOffset.glsl" +#include "/lib/util/outlineDepth.glsl" +#include "/lib/util/outlineMask.glsl" +#include "/lib/atmospherics/weatherDensity.glsl" +#include "/lib/atmospherics/sky.glsl" +#include "/lib/atmospherics/fog.glsl" +#include "/lib/post/outline.glsl" +#endif + +//Program// +void main() { + vec4 color = texture2D(colortex0, texCoord); + vec3 translucent = texture2D(colortex1,texCoord).rgb; + float z0 = texture2D(depthtex0, texCoord).r; + float z1 = texture2D(depthtex1, texCoord).r; + + vec4 screenPos = vec4(texCoord.x, texCoord.y, z0, 1.0); + vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0); + viewPos /= viewPos.w; + + #if REFRACTION > 0 + if (z1 > z0) { + vec3 distort = texture2D(colortex6, texCoord).xyz; + float fovScale = gbufferProjection[1][1] / 1.37; + distort.xy = distort.xy * 2.0 - 1.0; + distort.xy *= vec2(1.0 / aspectRatio, 1.0) * fovScale / max(length(viewPos.xyz), 8.0); + + vec2 newCoord = texCoord + distort.xy; + #if MC_VERSION > 10800 + float distortMask = texture2D(colortex6, newCoord).b * distort.b; + #else + float distortMask = texture2DLod(colortex6, newCoord, 0).b * distort.b; + #endif + + if (distortMask == 1.0 && z0 > 0.56) { + z0 = texture2D(depthtex0, newCoord).r; + z1 = texture2D(depthtex1, newCoord).r; + #if MC_VERSION > 10800 + color.rgb = texture2D(colortex0, newCoord).rgb; + #else + color.rgb = texture2DLod(colortex0, newCoord, 0).rgb; + #endif + } + + screenPos = vec4(newCoord.x, newCoord.y, z0, 1.0); + viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0); + viewPos /= viewPos.w; + } + #endif + + #if ALPHA_BLEND == 0 + color.rgb *= color.rgb; + #endif + + #ifdef OUTLINE_ENABLED + vec4 outerOutline = vec4(0.0), innerOutline = vec4(0.0); + float outlineMask = GetOutlineMask(); + if (outlineMask > 0.5 || isEyeInWater > 0.5) + Outline(color.rgb, true, outerOutline, innerOutline); + + if(z1 > z0) { + float worldDistance = length(viewPos.xyz) / far; + float distantFade = 1.0 - smoothstep(0.6, 1.1, worldDistance); + innerOutline.a *= distantFade; + + color.rgb = mix(color.rgb, innerOutline.rgb, innerOutline.a); + } + + #ifdef OUTLINE_OUTER + float outlineZ = z0; + DepthOutline(outlineZ, depthtex0); + + vec4 outlineViewPos = gbufferProjectionInverse * (vec4(texCoord, outlineZ, 1.0) * 2.0 - 1.0); + outlineViewPos /= outlineViewPos.w; + + float outlineViewLength = length(outlineViewPos.xyz); + float cloudViewLength = texture2D(gaux1, screenPos.xy).r * (far * 2.0); + outerOutline.a *= step(outlineViewLength, cloudViewLength); + #endif + #endif + + if (isEyeInWater == 1.0) { + vec4 waterFog = GetWaterFog(viewPos.xyz); + waterFog.a = mix(waterAlpha * 0.5, 1.0, waterFog.a); + color.rgb = mix(sqrt(color.rgb), sqrt(waterFog.rgb), waterFog.a); + color.rgb *= color.rgb; + } + + #ifdef OUTLINE_ENABLED + color.rgb = mix(color.rgb, outerOutline.rgb, outerOutline.a); + #endif + + #ifdef LIGHT_SHAFT + float blueNoise = texture2D(noisetex, gl_FragCoord.xy / 512.0).b; + vec3 vl = GetLightShafts(z0, z1, translucent, blueNoise); + #else + vec3 vl = vec3(0.0); + #endif + + color.rgb *= clamp(1.0 - 2.0 * darknessLightFactor, 0.0, 1.0); + + vec3 reflectionColor = pow(color.rgb, vec3(0.125)) * 0.5; + + #ifdef MULTICOLORED_BLOCKLIGHT + float dither = Bayer8(gl_FragCoord.xy); + float lightZ = z1 >= 1.0 ? z0 : z1; + vec3 coloredLight = GetMultiColoredBlocklight(texCoord, lightZ, dither); + #endif + + /*DRAWBUFFERS:01*/ + gl_FragData[0] = color; + gl_FragData[1] = vec4(vl, 1.0); + + #ifdef MULTICOLORED_BLOCKLIGHT + /*DRAWBUFFERS:019*/ + gl_FragData[2] = vec4(coloredLight, 1.0); + + #ifdef REFLECTION_PREVIOUS + /*DRAWBUFFERS:0195*/ + gl_FragData[3] = vec4(reflectionColor, float(z0 < 1.0)); + #endif + #else + #ifdef REFLECTION_PREVIOUS + /*DRAWBUFFERS:015*/ + gl_FragData[2] = vec4(reflectionColor, float(z0 < 1.0)); + #endif + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 sunVec, upVec; + +//Uniforms// +uniform float timeAngle; + +uniform mat4 gbufferModelView; + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + gl_Position = ftransform(); + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); +} + +#endif diff --git a/shaders/program/composite1.glsl b/shaders/program/composite1.glsl new file mode 100644 index 0000000..249d41f --- /dev/null +++ b/shaders/program/composite1.glsl @@ -0,0 +1,102 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 sunVec, upVec; + +//Uniforms// +uniform int isEyeInWater; +uniform int worldTime; + +uniform float blindFactor, darknessFactor; +uniform float rainStrength; +uniform float shadowFade, voidFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform sampler2D colortex0; +uniform sampler2D colortex1; + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp(dot(sunVec, upVec) + 0.05, 0.0, 0.1) * 10.0; + +vec2 vlOffsets[4] = vec2[4]( + vec2( 1.5, 0.5), + vec2(-0.5, 1.5), + vec2(-1.5, -0.5), + vec2( 0.5, -1.5) +); + +//Includes// +#include "/lib/color/dimensionColor.glsl" + +//Program// +void main() { + vec4 color = texture2D(colortex0, texCoord.xy); + + vec3 vl = texture2D(colortex1, texCoord.xy + vlOffsets[0] / vec2(viewWidth, viewHeight)).rgb; + vl+= texture2D(colortex1, texCoord.xy + vlOffsets[1] / vec2(viewWidth, viewHeight)).rgb; + vl+= texture2D(colortex1, texCoord.xy + vlOffsets[2] / vec2(viewWidth, viewHeight)).rgb; + vl+= texture2D(colortex1, texCoord.xy + vlOffsets[3] / vec2(viewWidth, viewHeight)).rgb; + vl*= vl * 0.0625; + + #ifdef OVERWORLD + vl *= lightCol * 0.25; + #endif + + #ifdef END + vl *= endCol.rgb * 0.1; + #endif + + vl *= LIGHT_SHAFT_STRENGTH * (1.0 - rainStrength * eBS * 0.875) * shadowFade * + (1.0 - max(blindFactor, darknessFactor)); + + color.rgb += vl; + + /*DRAWBUFFERS:0*/ + gl_FragData[0] = color; +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 sunVec, upVec; + +//Uniforms// +uniform float timeAngle; + +uniform mat4 gbufferModelView; + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + gl_Position = ftransform(); + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); +} + +#endif \ No newline at end of file diff --git a/shaders/program/composite2.glsl b/shaders/program/composite2.glsl new file mode 100644 index 0000000..b6e2d10 --- /dev/null +++ b/shaders/program/composite2.glsl @@ -0,0 +1,109 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +//Uniforms// +uniform float viewWidth, viewHeight, aspectRatio; + +uniform vec3 cameraPosition, previousCameraPosition; + +uniform mat4 gbufferPreviousProjection, gbufferProjectionInverse; +uniform mat4 gbufferModelView, gbufferPreviousModelView, gbufferModelViewInverse; + +uniform sampler2D colortex0; +uniform sampler2D depthtex1; + +//Common Functions// +vec3 MotionBlur(vec3 color, float z, float dither) { + + float hand = float(z < 0.56); + + if (hand < 0.5) { + float mbwg = 0.0; + vec2 doublePixel = 2.0 / vec2(viewWidth, viewHeight); + vec3 mblur = vec3(0.0); + + vec4 currentPosition = vec4(texCoord, z, 1.0) * 2.0 - 1.0; + + vec4 viewPos = gbufferProjectionInverse * currentPosition; + viewPos = gbufferModelViewInverse * viewPos; + viewPos /= viewPos.w; + + vec3 cameraOffset = cameraPosition - previousCameraPosition; + + vec4 previousPosition = viewPos + vec4(cameraOffset, 0.0); + previousPosition = gbufferPreviousModelView * previousPosition; + previousPosition = gbufferPreviousProjection * previousPosition; + previousPosition /= previousPosition.w; + + vec2 velocity = (currentPosition - previousPosition).xy; + velocity = velocity / (1.0 + length(velocity)) * MOTION_BLUR_STRENGTH * 0.02; + + vec2 coord = texCoord.st - velocity * (1.5 + dither); + for(int i = 0; i < 5; i++, coord += velocity) { + vec2 sampleCoord = clamp(coord, doublePixel, 1.0 - doublePixel); + float mask = float(texture2D(depthtex1, sampleCoord).r > 0.56); + mblur += texture2DLod(colortex0, sampleCoord, 0.0).rgb * mask; + mbwg += mask; + } + mblur /= max(mbwg, 1.0); + + return mblur; + } + else return color; +} + + +//Includes// +#include "/lib/util/dither.glsl" + +#ifdef OUTLINE_OUTER +#include "/lib/util/outlineOffset.glsl" +#include "/lib/util/outlineDepth.glsl" +#endif + +//Program// +void main() { + vec3 color = texture2DLod(colortex0, texCoord, 0.0).rgb; + + #ifdef MOTION_BLUR + float z = texture2D(depthtex1, texCoord.st).x; + float dither = Bayer8(gl_FragCoord.xy); + + #ifdef OUTLINE_OUTER + DepthOutline(z, depthtex1); + #endif + + color = MotionBlur(color, z, dither); + #endif + + /*DRAWBUFFERS:0*/ + gl_FragData[0] = vec4(color,1.0); +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + gl_Position = ftransform(); +} + +#endif \ No newline at end of file diff --git a/shaders/program/composite3.glsl b/shaders/program/composite3.glsl new file mode 100644 index 0000000..e24a5f9 --- /dev/null +++ b/shaders/program/composite3.glsl @@ -0,0 +1,151 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +//Uniforms// +uniform float viewWidth, viewHeight, aspectRatio; +uniform float centerDepthSmooth; + +uniform mat4 gbufferProjection; + +uniform sampler2D colortex0; +uniform sampler2D depthtex1; + +//Optifine Constants// +const bool colortex0MipmapEnabled = true; + +//Common Variables// +vec2 dofOffsets[60] = vec2[60]( + vec2( 0.0 , 0.25 ), + vec2(-0.2165 , 0.125 ), + vec2(-0.2165 , -0.125 ), + vec2( 0 , -0.25 ), + vec2( 0.2165 , -0.125 ), + vec2( 0.2165 , 0.125 ), + vec2( 0 , 0.5 ), + vec2(-0.25 , 0.433 ), + vec2(-0.433 , 0.25 ), + vec2(-0.5 , 0 ), + vec2(-0.433 , -0.25 ), + vec2(-0.25 , -0.433 ), + vec2( 0 , -0.5 ), + vec2( 0.25 , -0.433 ), + vec2( 0.433 , -0.2 ), + vec2( 0.5 , 0 ), + vec2( 0.433 , 0.25 ), + vec2( 0.25 , 0.433 ), + vec2( 0 , 0.75 ), + vec2(-0.2565 , 0.7048), + vec2(-0.4821 , 0.5745), + vec2(-0.51295, 0.375 ), + vec2(-0.7386 , 0.1302), + vec2(-0.7386 , -0.1302), + vec2(-0.51295, -0.375 ), + vec2(-0.4821 , -0.5745), + vec2(-0.2565 , -0.7048), + vec2(-0 , -0.75 ), + vec2( 0.2565 , -0.7048), + vec2( 0.4821 , -0.5745), + vec2( 0.51295, -0.375 ), + vec2( 0.7386 , -0.1302), + vec2( 0.7386 , 0.1302), + vec2( 0.51295, 0.375 ), + vec2( 0.4821 , 0.5745), + vec2( 0.2565 , 0.7048), + vec2( 0 , 1 ), + vec2(-0.2588 , 0.9659), + vec2(-0.5 , 0.866 ), + vec2(-0.7071 , 0.7071), + vec2(-0.866 , 0.5 ), + vec2(-0.9659 , 0.2588), + vec2(-1 , 0 ), + vec2(-0.9659 , -0.2588), + vec2(-0.866 , -0.5 ), + vec2(-0.7071 , -0.7071), + vec2(-0.5 , -0.866 ), + vec2(-0.2588 , -0.9659), + vec2(-0 , -1 ), + vec2( 0.2588 , -0.9659), + vec2( 0.5 , -0.866 ), + vec2( 0.7071 , -0.7071), + vec2( 0.866 , -0.5 ), + vec2( 0.9659 , -0.2588), + vec2( 1 , 0 ), + vec2( 0.9659 , 0.2588), + vec2( 0.866 , 0.5 ), + vec2( 0.7071 , 0.7071), + vec2( 0.5 , 0.8660), + vec2( 0.2588 , 0.9659) +); + +//Common Functions// +vec3 DepthOfField(vec3 color, float z) { + vec3 dof = vec3(0.0); + float hand = float(z < 0.56); + + float fovScale = gbufferProjection[1][1] / 1.37; + float coc = max(abs(z - centerDepthSmooth) * DOF_STRENGTH - 0.01, 0.0); + coc = coc / sqrt(coc * coc + 0.1); + + if (coc > 0.0 && hand < 0.5) { + for(int i = 0; i < 60; i++) { + vec2 offset = dofOffsets[i] * coc * 0.015 * fovScale * vec2(1.0 / aspectRatio, 1.0); + float lod = log2(viewHeight * aspectRatio * coc * fovScale / 320.0); + dof += texture2DLod(colortex0, texCoord + offset, lod).rgb; + } + dof /= 60.0; + } + else dof = color; + return dof; +} + +//Includes// +#ifdef OUTLINE_OUTER +#include "/lib/util/outlineOffset.glsl" +#include "/lib/util/outlineDepth.glsl" +#endif + +//Program// +void main() { + vec3 color = texture2DLod(colortex0, texCoord, 0.0).rgb; + + #ifdef DOF + float z = texture2D(depthtex1, texCoord.st).x; + + #ifdef OUTLINE_OUTER + DepthOutline(z, depthtex1); + #endif + + color = DepthOfField(color, z); + #endif + + /*DRAWBUFFERS:0*/ + gl_FragData[0] = vec4(color,1.0); +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + gl_Position = ftransform(); +} + +#endif \ No newline at end of file diff --git a/shaders/program/composite4.glsl b/shaders/program/composite4.glsl new file mode 100644 index 0000000..91ae266 --- /dev/null +++ b/shaders/program/composite4.glsl @@ -0,0 +1,87 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +//Uniforms// +uniform float viewWidth, viewHeight, aspectRatio; + +uniform sampler2D colortex0; + +//Optifine Constants// +const bool colortex0MipmapEnabled = true; + +//Common Variables// +float ph = 0.8 / min(360.0, viewHeight); +float pw = ph / aspectRatio; +vec2 view = vec2(1.0 / viewWidth, 1.0 / viewHeight); + +float weight[6] = float[6](0.0556, 0.1667, 0.2777, 0.2777, 0.1667, 0.0556); + +//Common Functions// +vec3 BloomTile(float lod, vec2 coord, vec2 offset) { + vec3 bloom = vec3(0.0), temp = vec3(0.0); + float scale = exp2(lod); + coord = (coord - offset) * scale; + vec2 padding = vec2(0.5) + 2.0 * view * scale; + + if (abs(coord.x - 0.5) < padding.x && abs(coord.y - 0.5) < padding.y) { + for(int i = 0; i < 6; i++) { + for(int j = 0; j < 6; j++) { + float wg = weight[i] * weight[j]; + vec2 pixelOffset = vec2((float(i) - 2.5) * pw, (float(j) - 2.5) * ph); + vec2 sampleCoord = coord + pixelOffset * scale; + bloom += texture2D(colortex0, sampleCoord).rgb * wg; + } + } + } + + return bloom; +} + +#include "/lib/util/dither.glsl" + +//Program// +void main() { + vec2 bloomCoord = texCoord * viewHeight * 0.8 / min(360.0, viewHeight); + vec3 blur = BloomTile(1.0, bloomCoord, vec2(0.0 , 0.0 )); + blur += BloomTile(2.0, bloomCoord, vec2(0.50 , 0.0 ) + vec2( 4.0, 0.0) * view); + blur += BloomTile(3.0, bloomCoord, vec2(0.50 , 0.25 ) + vec2( 4.0, 4.0) * view); + blur += BloomTile(4.0, bloomCoord, vec2(0.625 , 0.25 ) + vec2( 8.0, 4.0) * view); + blur += BloomTile(5.0, bloomCoord, vec2(0.6875 , 0.25 ) + vec2(12.0, 4.0) * view); + blur += BloomTile(6.0, bloomCoord, vec2(0.625 , 0.3125) + vec2( 8.0, 8.0) * view); + blur += BloomTile(7.0, bloomCoord, vec2(0.640625 , 0.3125) + vec2(12.0, 8.0) * view); + + blur = pow(blur / 32.0, vec3(0.25)); + + blur = clamp(blur + (Bayer8(gl_FragCoord.xy) - 0.5) / 384.0, vec3(0.0), vec3(1.0)); + + /* DRAWBUFFERS:1 */ + gl_FragData[0] = vec4(blur, 1.0); +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + gl_Position = ftransform(); +} + +#endif \ No newline at end of file diff --git a/shaders/program/composite5.glsl b/shaders/program/composite5.glsl new file mode 100644 index 0000000..8a17f00 --- /dev/null +++ b/shaders/program/composite5.glsl @@ -0,0 +1,429 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 sunVec, upVec; + +//Uniforms// +uniform int isEyeInWater; +uniform int worldTime; + +uniform float blindFactor, darknessFactor; +uniform float frameTimeCounter; +uniform float rainStrength; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight, aspectRatio; + +uniform ivec2 eyeBrightnessSmooth; + +uniform sampler2D colortex0; +uniform sampler2D colortex1; +uniform sampler2D colortex2; +uniform sampler2D noisetex; +uniform sampler2D depthtex0; + +#ifdef DIRTY_LENS +uniform sampler2D depthtex2; +#endif + +#ifdef LENS_FLARE +uniform vec3 sunPosition; +uniform mat4 gbufferProjection; +#endif + +#ifdef UNDERGROUND_SKY +uniform vec3 cameraPosition; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +uniform sampler2D colortex9; +#endif + +//Optifine Constants// +const bool colortex2Clear = false; + +#ifdef AUTO_EXPOSURE +const bool colortex0MipmapEnabled = true; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +const bool colortex9MipmapEnabled = true; +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float pw = 1.0 / viewWidth; +float ph = 1.0 / viewHeight; + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color, vec3(0.299, 0.587, 0.114)); +} + +void UnderwaterDistort(inout vec2 texCoord) { + vec2 originalTexCoord = texCoord; + + texCoord += vec2( + cos(texCoord.y * 32.0 + frameTimeCounter * 3.0), + sin(texCoord.x * 32.0 + frameTimeCounter * 1.7) + ) * 0.0005; + + float mask = float( + texCoord.x > 0.0 && texCoord.x < 1.0 && + texCoord.y > 0.0 && texCoord.y < 1.0 + ) + ; + if (mask < 0.5) texCoord = originalTexCoord; +} + +void RetroDither(inout vec3 color, float dither) { + color.rgb = pow(color.rgb, vec3(0.25)); + float lenColor = length(color); + vec3 normColor = color / lenColor; + + dither = mix(dither, 0.5, exp(-2.0 * lenColor)) - 0.25; + color = normColor * floor(lenColor * 16.0 + dither * 1.7) / 16.0; + + color = max(pow(color.rgb, vec3(4.0)), vec3(0.0)); +} + +vec3 GetBloomTile(float lod, vec2 coord, vec2 offset) { + float scale = exp2(lod); + float resScale = 1.25 * min(360.0, viewHeight) / viewHeight; + vec3 bloom = texture2D(colortex1, (coord / scale + offset) * resScale).rgb; + bloom *= bloom; bloom *= bloom * 32.0; + return bloom; +} + +void Bloom(inout vec3 color, vec2 coord) { + vec2 view = vec2(1.0 / viewWidth, 1.0 / viewHeight); + vec3 blur1 = GetBloomTile(1.0, coord, vec2(0.0 , 0.0 ) + vec2( 0.5, 0.0) * view); + vec3 blur2 = GetBloomTile(2.0, coord, vec2(0.50 , 0.0 ) + vec2( 4.5, 0.0) * view); + vec3 blur3 = GetBloomTile(3.0, coord, vec2(0.50 , 0.25 ) + vec2( 4.5, 4.0) * view); + vec3 blur4 = GetBloomTile(4.0, coord, vec2(0.625 , 0.25 ) + vec2( 8.5, 4.0) * view); + vec3 blur5 = GetBloomTile(5.0, coord, vec2(0.6875 , 0.25 ) + vec2(12.5, 4.0) * view); + vec3 blur6 = GetBloomTile(6.0, coord, vec2(0.625 , 0.3125) + vec2( 8.5, 8.0) * view); + vec3 blur7 = GetBloomTile(7.0, coord, vec2(0.640625 , 0.3125) + vec2(12.5, 8.0) * view); + + #ifdef DIRTY_LENS + float newAspectRatio = 1.777777777777778 / aspectRatio; + vec2 scale = vec2(max(newAspectRatio, 1.0), max(1.0 / newAspectRatio, 1.0)); + float dirt = texture2D(depthtex2, (coord - 0.5) / scale + 0.5).r; + dirt *= length(blur6 / (1.0 + blur6)); + blur3 *= dirt * 2.0 + 1.0; + blur4 *= dirt * 4.0 + 1.0; + blur5 *= dirt * 8.0 + 1.0; + blur6 *= dirt * 16.0 + 1.0; + blur7 *= dirt * 32.0 + 1.0; + #endif + + #if BLOOM_RADIUS == 1 + vec3 blur = blur1; + #elif BLOOM_RADIUS == 2 + vec3 blur = (blur1 * 1.23 + blur2) / 2.23; + #elif BLOOM_RADIUS == 3 + vec3 blur = (blur1 * 1.71 + blur2 * 1.52 + blur3) / 4.23; + #elif BLOOM_RADIUS == 4 + vec3 blur = (blur1 * 2.46 + blur2 * 2.25 + blur3 * 1.71 + blur4) / 7.42; + #elif BLOOM_RADIUS == 5 + vec3 blur = (blur1 * 3.58 + blur2 * 3.35 + blur3 * 2.72 + blur4 * 1.87 + blur5) / 12.52; + #elif BLOOM_RADIUS == 6 + vec3 blur = (blur1 * 5.25 + blur2 * 4.97 + blur3 * 4.20 + blur4 * 3.13 + blur5 * 2.00 + blur6) / 20.55; + #elif BLOOM_RADIUS == 7 + vec3 blur = (blur1 * 7.76 + blur2 * 7.41 + blur3 * 6.43 + blur4 * 5.04 + blur5 * 3.51 + blur6 * 2.11 + blur7) / 33.26; + #endif + + #if BLOOM_CONTRAST == 0 + color = mix(color, blur, 0.2 * BLOOM_STRENGTH); + #else + vec3 bloomContrast = vec3(exp2(BLOOM_CONTRAST * 0.25)); + color = pow(color, bloomContrast); + blur = pow(blur, bloomContrast); + vec3 bloomStrength = pow(vec3(0.2 * BLOOM_STRENGTH), bloomContrast); + color = mix(color, blur, bloomStrength); + color = pow(color, 1.0 / bloomContrast); + #endif + +} + +void AutoExposure(inout vec3 color, inout float exposure, float tempExposure) { + float exposureLod = log2(viewHeight * AUTO_EXPOSURE_RADIUS); + + exposure = length(texture2DLod(colortex0, vec2(0.5), exposureLod).rgb); + exposure = max(exposure, 0.0001); + + color /= 2.0 * tempExposure + 0.125; +} + +void ColorGrading(inout vec3 color) { + vec3 cgColor = pow(color.r, CG_RC) * pow(vec3(CG_RR, CG_RG, CG_RB) / 255.0, vec3(2.2)) + + pow(color.g, CG_GC) * pow(vec3(CG_GR, CG_GG, CG_GB) / 255.0, vec3(2.2)) + + pow(color.b, CG_BC) * pow(vec3(CG_BR, CG_BG, CG_BB) / 255.0, vec3(2.2)); + vec3 cgMin = pow(vec3(CG_RM, CG_GM, CG_BM) / 255.0, vec3(2.2)); + color = (cgColor * (1.0 - cgMin) + cgMin) * vec3(CG_RI, CG_GI, CG_BI); + + vec3 cgTint = pow(vec3(CG_TR, CG_TG, CG_TB) / 255.0, vec3(2.2)) * GetLuminance(color) * CG_TI; + color = mix(color, cgTint, CG_TM); +} + +vec3 RGB2HSV(vec3 c){ + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); + vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); +} + +vec3 HSV2RGB(vec3 c) { + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} + +void Notorious6Test(inout vec3 color) { + vec2 testCoord = texCoord * vec2(8.0,6.0) - vec2(3.5, 1.0); + + // if (testCoord.x > 0 && testCoord.x < 1 && testCoord.y > 0 && testCoord.y < 1){ + // float h = floor((1.0 - testCoord.y) * 18.0) / 18.0; + + // color = pow(HSV2RGB(vec3(h, 1.0, 1.0)), vec3(2.2)); + // color *= exp2(floor(testCoord.x * 20.0) - 10.0); + + // color /= exp2(2.0 + EXPOSURE); + // } + + if (testCoord.x > -2 && testCoord.x < 3 && testCoord.y > 0 && testCoord.y < 1){ + float h = floor((1.0 - testCoord.y) * 18.0) / 18.0; + float s = pow(floor(testCoord.x) * 0.25 + 0.5, 0.5); + + color = pow(HSV2RGB(vec3(h, s, 1.0)), vec3(2.2)); + color *= exp2(floor(fract(testCoord.x) * 20.0) - 10.0); + + color /= exp2(2.0 + EXPOSURE); + } +} + +mat3 inverseMatrix(mat3 m) { + float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2]; + float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2]; + float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2]; + + float b01 = a22 * a11 - a12 * a21; + float b11 = -a22 * a10 + a12 * a20; + float b21 = a21 * a10 - a11 * a20; + + float det = a00 * b01 + a01 * b11 + a02 * b21; + + return mat3( + b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11), + b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10), + b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10) + ) / det; +} + +void BSLTonemap(inout vec3 color) { + color *= exp2(2.0 + EXPOSURE); + + float s = TONEMAP_WHITE_PATH; + + float a = 0.03 * s; + float b = 0.01 * s; + float c = 1.0 - (a + b); + float d = 1.0 - (a + a); + + mat3 desatMatrix = mat3( + vec3(c, a, b), + vec3(a, d, a), + vec3(b, a, c) + ); + + mat3 satMatrix = inverseMatrix(desatMatrix); + + color *= desatMatrix; + + color = color / pow(pow(color, vec3(TONEMAP_WHITE_CURVE)) + 1.0, vec3(1.0 / TONEMAP_WHITE_CURVE)); + color = pow(color, mix(vec3(TONEMAP_LOWER_CURVE), vec3(TONEMAP_UPPER_CURVE), sqrt(color))); + + color *= satMatrix; + + color = clamp(color, vec3(0.0), vec3(1.0)); +} + +void ColorSaturation(inout vec3 color) { + float grayVibrance = (color.r + color.g + color.b) / 3.0; + float graySaturation = dot(color, vec3(0.299, 0.587, 0.114)); + + float mn = min(color.r, min(color.g, color.b)); + float mx = max(color.r, max(color.g, color.b)); + float sat = (1.0 - (mx - mn)) * (1.0 - mx) * grayVibrance * 5.0; + vec3 lightness = vec3((mn + mx) * 0.5); + + color = mix(color, mix(color, lightness, 1.0 - VIBRANCE), sat); + color = mix(color, lightness, (1.0 - lightness) * (2.0 - VIBRANCE) / 2.0 * abs(VIBRANCE - 1.0)); + color = color * SATURATION - graySaturation * (SATURATION - 1.0); +} + +#ifdef LENS_FLARE +vec2 GetLightPos() { + vec4 tpos = gbufferProjection * vec4(sunPosition, 1.0); + tpos.xyz /= tpos.w; + return tpos.xy / tpos.z * 0.5; +} +#endif + +//Includes// +#include "/lib/color/lightColor.glsl" + +#ifdef LENS_FLARE +#include "/lib/post/lensFlare.glsl" +#endif + +#ifdef RETRO_FILTER +#include "/lib/util/dither.glsl" +#endif + +//Program// +void main() { + vec2 newTexCoord = texCoord; + + #ifdef UNDERWATER_DISTORTION + if (isEyeInWater == 1.0) UnderwaterDistort(newTexCoord); + #endif + + vec3 color = texture2D(colortex0, newTexCoord).rgb; + + #ifdef AUTO_EXPOSURE + float tempExposure = texture2D(colortex2, vec2(pw, ph)).r; + #endif + + #ifdef LENS_FLARE + float tempVisibleSun = texture2D(colortex2, vec2(3.0 * pw, ph)).r; + #endif + + vec3 temporalColor = vec3(0.0); + #ifdef TAA + temporalColor = texture2D(colortex2, texCoord).gba; + #endif + + #ifdef RETRO_FILTER + float dither = Bayer8(gl_FragCoord.xy / RETRO_FILTER_SIZE); + RetroDither(color.rgb, dither); + #endif + + #ifdef BLOOM + Bloom(color, newTexCoord); + #endif + + #ifdef AUTO_EXPOSURE + float exposure = 1.0; + AutoExposure(color, exposure, tempExposure); + #endif + + // Notorious6Test(color); + + #ifdef COLOR_GRADING + ColorGrading(color); + #endif + + #ifdef VIGNETTE + float screenDist = length(texCoord - 0.5); + screenDist *= screenDist * 0.3535 + 0.75; + color *= 1.0 - screenDist * VIGNETTE_STRENGTH; + #endif + + BSLTonemap(color); + + #ifdef LENS_FLARE + vec2 lightPos = GetLightPos(); + float truePos = sign(sunVec.z); + + float visibleSun = float(texture2D(depthtex0, lightPos + 0.5).r >= 1.0); + visibleSun *= max(1.0 - isEyeInWater, eBS) * (1.0 - max(blindFactor, darknessFactor)) * (1.0 - rainStrength); + + #ifdef UNDERGROUND_SKY + visibleSun *= mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS); + #endif + + float multiplier = tempVisibleSun * LENS_FLARE_STRENGTH * (length(color) * 0.25 + 0.25); + + if (multiplier > 0.001) LensFlare(color, lightPos, truePos, multiplier); + #endif + + float temporalData = 0.0; + + #ifdef AUTO_EXPOSURE + if (texCoord.x < 2.0 * pw && texCoord.y < 2.0 * ph) + temporalData = mix(tempExposure, sqrt(exposure), AUTO_EXPOSURE_SPEED); + #endif + + #ifdef LENS_FLARE + if (texCoord.x > 2.0 * pw && texCoord.x < 4.0 * pw && texCoord.y < 2.0 * ph) + temporalData = mix(tempVisibleSun, visibleSun, 0.125); + #endif + + color = pow(color, vec3(1.0 / 2.2)); + + ColorSaturation(color); + + float filmGrain = texture2D(noisetex, texCoord * vec2(viewWidth, viewHeight) / 512.0).b; + color += (filmGrain - 0.5) / 256.0; + + #ifdef MULTICOLORED_BLOCKLIGHT + vec3 coloredLight = texture2DLod(colortex9, texCoord.xy, 2).rgb; + coloredLight *= 0.99; + #endif + + /* DRAWBUFFERS:12 */ + gl_FragData[0] = vec4(color, 1.0); + gl_FragData[1] = vec4(temporalData,temporalColor); + + #ifdef MULTICOLORED_BLOCKLIGHT + /*DRAWBUFFERS:129*/ + gl_FragData[2] = vec4(coloredLight, 1.0); + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 sunVec, upVec; + +//Uniforms// +uniform float timeAngle; + +uniform mat4 gbufferModelView; + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + gl_Position = ftransform(); + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); +} + +#endif \ No newline at end of file diff --git a/shaders/program/composite6.glsl b/shaders/program/composite6.glsl new file mode 100644 index 0000000..7a17a7b --- /dev/null +++ b/shaders/program/composite6.glsl @@ -0,0 +1,61 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +//Uniforms// +uniform float frameTimeCounter; +uniform float viewWidth, viewHeight, aspectRatio; + +uniform sampler2D colortex1; + +//Optifine Constants// +#ifdef LIGHT_SHAFT +const bool colortex1MipmapEnabled = true; +#endif + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color, vec3(0.299, 0.587, 0.114)); +} + +//Includes// +#include "/lib/antialiasing/fxaa.glsl" + +//Program// +void main() { + vec3 color = texture2DLod(colortex1, texCoord, 0.0).rgb; + + #ifdef FXAA + color = FXAA311(color); + #endif + + /*DRAWBUFFERS:1*/ + gl_FragData[0] = vec4(color, 1.0); +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + gl_Position = ftransform(); +} + +#endif \ No newline at end of file diff --git a/shaders/program/composite7.glsl b/shaders/program/composite7.glsl new file mode 100644 index 0000000..196247b --- /dev/null +++ b/shaders/program/composite7.glsl @@ -0,0 +1,80 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +//Uniforms// +uniform int frameCounter; +uniform float viewWidth, viewHeight, aspectRatio; + +uniform vec3 cameraPosition, previousCameraPosition; + +uniform mat4 gbufferPreviousProjection, gbufferProjectionInverse; +uniform mat4 gbufferPreviousModelView, gbufferModelViewInverse; + +uniform sampler2D colortex1; +uniform sampler2D colortex2; +uniform sampler2D depthtex1; + +#ifdef TAA_SELECTIVE +uniform sampler2D colortex3; +#endif + +//Optifine Constants// +#ifdef LIGHT_SHAFT +const bool colortex1MipmapEnabled = true; +#endif + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color, vec3(0.299, 0.587, 0.114)); +} + +//Includes// +#include "/lib/antialiasing/taa.glsl" + +//Program// +void main() { + vec2 newTexCoord = texCoord; + #if defined TAA && TAA_MODE == 1 + vec2 offset = frameCounter % 2 == 0 ? vec2(0.5, 0.0) : vec2(0.0, 0.5); + newTexCoord += offset / vec2(viewWidth, viewHeight); + #endif + + vec3 color = texture2DLod(colortex1, newTexCoord, 0.0).rgb; + vec4 prev = vec4(texture2DLod(colortex2, texCoord, 0).r, 0.0, 0.0, 0.0); + + #ifdef TAA + prev = TemporalAA(color, prev.r); + #endif + + /*DRAWBUFFERS:12*/ + gl_FragData[0] = vec4(color, 1.0); + gl_FragData[1] = vec4(prev); +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + gl_Position = ftransform(); +} + +#endif \ No newline at end of file diff --git a/shaders/program/deferred.glsl b/shaders/program/deferred.glsl new file mode 100644 index 0000000..3f4a8e1 --- /dev/null +++ b/shaders/program/deferred.glsl @@ -0,0 +1,77 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +//Uniforms// +uniform int frameCounter; + +uniform float far, near; +uniform float frameTimeCounter; +uniform float viewWidth, viewHeight, aspectRatio; + +uniform mat4 gbufferProjection; + +uniform sampler2D depthtex0; +uniform sampler2D noisetex; + +#ifdef DISTANT_HORIZONS +uniform float dhFarPlane, dhNearPlane; +uniform sampler2D dhDepthTex0; +#endif + +//Common Functions// +float GetLinearDepth(float depth) { + return (2.0 * near) / (far + near - depth * (far - near)); +} + +#ifdef DISTANT_HORIZONS +float GetDHLinearDepth(float depth) { + return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - depth * (dhFarPlane - dhNearPlane)); +} +#endif + +//Includes// +#include "/lib/lighting/ambientOcclusion.glsl" + +//Program// +void main() { + float blueNoise = texture2D(noisetex, gl_FragCoord.xy / 512.0).b; + float ao = AmbientOcclusion(blueNoise); + + #ifdef DISTANT_HORIZONS + float z = texture2D(depthtex0, texCoord.xy).r; + if (z == 1.0) { + ao = DHAmbientOcclusion(blueNoise); + } + #endif + + /* DRAWBUFFERS:4 */ + gl_FragData[0] = vec4(ao, 0.0, 0.0, 0.0); +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + gl_Position = ftransform(); +} + +#endif diff --git a/shaders/program/deferred1.glsl b/shaders/program/deferred1.glsl new file mode 100644 index 0000000..fc303d5 --- /dev/null +++ b/shaders/program/deferred1.glsl @@ -0,0 +1,545 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 sunVec, upVec, eastVec; + +//Uniforms// +uniform int frameCounter; +uniform int isEyeInWater; +uniform int moonPhase; +uniform int worldTime; + +uniform float blindFactor, darknessFactor, nightVision; +uniform float far, near; +uniform float frameTimeCounter; +uniform float rainStrength; +uniform float shadowFade, voidFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight, aspectRatio; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferProjection, gbufferPreviousProjection, gbufferProjectionInverse; +uniform mat4 gbufferModelView, gbufferPreviousModelView, gbufferModelViewInverse; + +uniform sampler2D colortex0; +uniform sampler2D colortex3; +uniform sampler2D depthtex0; +uniform sampler2D noisetex; + +#ifdef AO +uniform sampler2D colortex4; +#endif + +#if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR +uniform vec3 previousCameraPosition; + +uniform sampler2D colortex5; +uniform sampler2D colortex6; +uniform sampler2D colortex7; +// uniform sampler2D noisetex; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +uniform sampler2D colortex8; +uniform sampler2D colortex9; +#endif + +#ifdef DISTANT_HORIZONS +uniform float dhFarPlane, dhNearPlane; + +uniform mat4 dhProjectionInverse; + +uniform sampler2D dhDepthTex0; +#endif + +//Optifine Constants// +#if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR +const bool colortex0MipmapEnabled = true; +const bool colortex5MipmapEnabled = true; +const bool colortex6MipmapEnabled = true; +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +vec2 aoSampleOffsets[4] = vec2[4]( + vec2( 1.5, 0.5), + vec2(-0.5, 1.5), + vec2(-1.5, -0.5), + vec2( 0.5, -1.5) +); + +vec2 aoDepthOffsets[4] = vec2[4]( + vec2( 2.0, 1.0), + vec2(-1.0, 2.0), + vec2(-2.0, -1.0), + vec2( 1.0, -2.0) +); + +vec2 glowOffsets[16] = vec2[16]( + vec2( 0.0, -1.0), + vec2(-1.0, 0.0), + vec2( 1.0, 0.0), + vec2( 0.0, 1.0), + vec2(-1.0, -2.0), + vec2( 0.0, -2.0), + vec2( 1.0, -2.0), + vec2(-2.0, -1.0), + vec2( 2.0, -1.0), + vec2(-2.0, 0.0), + vec2( 2.0, 0.0), + vec2(-2.0, 1.0), + vec2( 2.0, 1.0), + vec2(-1.0, 2.0), + vec2( 0.0, 2.0), + vec2( 1.0, 2.0) +); + +vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + +vec3 moonPhaseVecs[8] = vec3[8]( + vec3( 0.0 , 0.0 , 1.0 ), + vec3( 0.0 , -0.89, 0.45), + vec3( 0.0 , -1.0 , 0.0 ), + vec3( 0.0 , -0.45, -0.89), + vec3( 0.0 , 0.0 , -1.0 ), + vec3( 0.0 , 0.45, -0.89), + vec3( 0.0 , 1.0 , 0.0 ), + vec3( 0.0 , 0.89, 0.45) +); + +vec2 moonDiffuse[8] = vec2[8]( + vec2( 0.0 , 0.0 ), + vec2(-0.125, 1.0 ), + vec2(-0.2 , 0.625), + vec2(-0.8 , 0.375), + vec2(-0.75 , -0.25 ), + vec2(-0.8 , 0.375), + vec2(-0.2 , 0.625), + vec2(-0.125, 1.0 ) +); + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +float GetLinearDepth(float depth) { + return (2.0 * near) / (far + near - depth * (far - near)); +} + +#ifdef AO +float GetAmbientOcclusion(float z){ + float ao = 0.0; + float tw = 0.0; + float lz = GetLinearDepth(z); + + for(int i = 0; i < 4; i++){ + vec2 sampleOffset = aoSampleOffsets[i] / vec2(viewWidth, viewHeight); + vec2 depthOffset = aoDepthOffsets[i] / vec2(viewWidth, viewHeight); + float samplez = GetLinearDepth(texture2D(depthtex0, texCoord + depthOffset).r); + float wg = max(1.0 - 2.0 * far * abs(lz - samplez), 0.00001); + ao += texture2D(colortex4, texCoord + sampleOffset).r * wg; + tw += wg; + } + ao /= tw; + if(tw < 0.0001) ao = texture2D(colortex4, texCoord).r; + + return pow(ao, AO_STRENGTH); +} + +#ifdef DISTANT_HORIZONS +float GetDHLinearDepth(float depth) { + return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - depth * (dhFarPlane - dhNearPlane)); +} + +float GetDHAmbientOcclusion(float dhZ){ + float ao = 0.0; + float tw = 0.0; + float lz = GetDHLinearDepth(dhZ); + + for(int i = 0; i < 4; i++){ + vec2 sampleOffset = aoSampleOffsets[i] / vec2(viewWidth, viewHeight); + vec2 depthOffset = aoDepthOffsets[i] / vec2(viewWidth, viewHeight); + float samplez = GetDHLinearDepth(texture2D(dhDepthTex0, texCoord + depthOffset).r); + float wg = max(1.0 - 2.0 * far * abs(lz - samplez), 0.00001); + ao += texture2D(colortex4, texCoord + sampleOffset).r * wg; + tw += wg; + } + ao /= tw; + if(tw < 0.0001) ao = texture2D(colortex4, texCoord).r; + + return pow(ao, AO_STRENGTH + 1.0); +} +#endif +#endif + +void GlowOutline(inout vec3 color){ + for(int i = 0; i < 16; i++){ + vec2 glowOffset = glowOffsets[i] / vec2(viewWidth, viewHeight); + float glowSample = texture2D(colortex3, texCoord.xy + glowOffset).b; + if(glowSample < 0.5){ + if(i < 4) color.rgb = vec3(0.0); + else color.rgb = vec3(0.5); + break; + } + } +} + +//Includes// +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/skyColor.glsl" +#include "/lib/color/blocklightColor.glsl" +#include "/lib/color/waterColor.glsl" +#include "/lib/util/dither.glsl" +#include "/lib/atmospherics/weatherDensity.glsl" +#include "/lib/atmospherics/sky.glsl" +#include "/lib/atmospherics/fog.glsl" +#include "/lib/atmospherics/clouds.glsl" +#include "/lib/atmospherics/sunmoon.glsl" + +#ifdef OUTLINE_ENABLED +#include "/lib/util/outlineOffset.glsl" +#include "/lib/util/outlineDepth.glsl" +#include "/lib/atmospherics/waterFog.glsl" +#include "/lib/post/outline.glsl" +#endif + +#if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR +#include "/lib/util/encode.glsl" +#include "/lib/reflections/raytrace.glsl" +#include "/lib/reflections/complexFresnel.glsl" +#include "/lib/surface/materialDeferred.glsl" +#include "/lib/reflections/roughReflections.glsl" +#endif + +#ifdef END +vec3 GetEndSkyColor(vec3 viewPos) { + vec4 worldPos = gbufferModelViewInverse * vec4(viewPos.xyz, 1.0); + worldPos.xyz /= worldPos.w; + + worldPos = normalize(worldPos); + + vec3 sky = vec3(0.0); + vec3 absWorldPos = abs(worldPos.xyz); + float maxViewDir = absWorldPos.x; + sky = vec3(worldPos.yz, 0.0); + if (absWorldPos.y > maxViewDir) { + maxViewDir = absWorldPos.y; + sky = vec3(worldPos.xz, 0.0); + } + if (absWorldPos.z > maxViewDir) { + maxViewDir = absWorldPos.z; + sky = vec3(worldPos.xy, 0.0); + } + vec2 skyUV = sky.xy * 2.0; + skyUV = (floor(skyUV * 512.0) + 0.5) / 512.0; + float noise = texture2D(noisetex, skyUV).b; + sky = vec3(1.0) * pow(noise * 0.3 + 0.35, 2.0); + sky *= sky; + sky *= endCol.rgb * 0.03; + return sky; +} +#endif + +//Program// +void main() { + vec4 color = texture2D(colortex0, texCoord); + float z = texture2D(depthtex0, texCoord).r; + + #ifdef DISTANT_HORIZONS + float dhZ = texture2D(dhDepthTex0, texCoord).r; + #endif + + float dither = Bayer8(gl_FragCoord.xy); + + #if ALPHA_BLEND == 0 + if (z == 1.0) color.rgb = max(color.rgb - dither / vec3(128.0), vec3(0.0)); + color.rgb *= color.rgb; + #endif + + vec4 screenPos = vec4(texCoord, z, 1.0); + vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0); + viewPos /= viewPos.w; + + #ifdef OUTLINE_ENABLED + vec4 outerOutline = vec4(0.0), innerOutline = vec4(0.0); + Outline(color.rgb, false, outerOutline, innerOutline); + + color.rgb = mix(color.rgb, innerOutline.rgb, innerOutline.a); + #endif + + if (z < 1.0) { + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR + float smoothness = 0.0, skyOcclusion = 0.0; + vec3 normal = vec3(0.0), fresnel3 = vec3(0.0); + + GetMaterials(smoothness, skyOcclusion, normal, fresnel3, texCoord); + + if (smoothness > 0.0) { + vec4 reflection = vec4(0.0); + vec3 skyReflection = vec3(0.0); + + float ssrMask = clamp(length(fresnel3) * 400.0 - 1.0, 0.0, 1.0); + if(ssrMask > 0.0) reflection = RoughReflection(viewPos.xyz, normal, dither, smoothness); + reflection.a *= ssrMask; + + if (reflection.a < 1.0) { + #ifdef OVERWORLD + vec3 skyRefPos = reflect(normalize(viewPos.xyz), normal); + skyReflection = GetSkyColor(skyRefPos, true); + + #ifdef REFLECTION_ROUGH + float cloudMixRate = smoothness * smoothness * (3.0 - 2.0 * smoothness); + #else + float cloudMixRate = 1.0; + #endif + + #ifdef AURORA + skyReflection += DrawAurora(skyRefPos * 100.0, dither, 12) * cloudMixRate; + #endif + + #if CLOUDS == 1 + vec4 cloud = DrawCloudSkybox(skyRefPos * 100.0, 1.0, dither, lightCol, ambientCol, false); + skyReflection = mix(skyReflection, cloud.rgb, cloud.a * cloudMixRate); + #endif + #if CLOUDS == 2 + vec4 worldPos = gbufferModelViewInverse * vec4(viewPos.xyz, 1.0); + worldPos.xyz /= worldPos.w; + + vec3 cameraPos = GetReflectedCameraPos(worldPos.xyz, normal); + float cloudViewLength = 0.0; + + vec4 cloud = DrawCloudVolumetric(skyRefPos * 8192.0, cameraPos, 1.0, dither, lightCol, ambientCol, cloudViewLength, true); + skyReflection = mix(skyReflection, cloud.rgb, cloud.a * cloudMixRate); + #endif + + float NoU = clamp(dot(normal, upVec), -1.0, 1.0); + float NoE = clamp(dot(normal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + + (0.5 - abs(NoE)) * (1.0 - abs(NoU)) * 0.1; + vanillaDiffuse *= vanillaDiffuse; + + #ifdef CLASSIC_EXPOSURE + skyReflection *= 4.0 - 3.0 * eBS; + #endif + + skyReflection = mix(vanillaDiffuse * minLightCol, skyReflection, skyOcclusion); + #endif + #ifdef NETHER + skyReflection = netherCol.rgb * 0.04; + #endif + #ifdef END + skyReflection = endCol.rgb * 0.025; + #endif + } + + reflection.rgb = max(mix(skyReflection, reflection.rgb, reflection.a), vec3(0.0)); + + color.rgb += reflection.rgb * fresnel3; + } + #endif + + #ifdef AO + color.rgb *= GetAmbientOcclusion(z); + #endif + + Fog(color.rgb, viewPos.xyz); + + #ifdef DISTANT_HORIZONS + } else if (dhZ < 1.0) { + z = 1.0 - 1e-5; + + vec4 dhScreenPos = vec4(texCoord, dhZ, 1.0); + viewPos = dhProjectionInverse * (dhScreenPos * 2.0 - 1.0); + viewPos /= viewPos.w; + + #ifdef AO + color.rgb *= GetDHAmbientOcclusion(dhZ); + #endif + + Fog(color.rgb, viewPos.xyz); + #endif + } else { + #if defined OVERWORLD && defined SKY_DEFERRED + color.rgb += GetSkyColor(viewPos.xyz, false); + + #ifdef ROUND_SUN_MOON + vec3 lightMA = mix(lightMorning, lightEvening, mefade); + vec3 sunColor = mix(lightMA, sqrt(lightDay * lightMA * LIGHT_DI), timeBrightness); + vec3 moonColor = sqrt(lightNight); + + RoundSunMoon(color.rgb, viewPos.xyz, sunColor, moonColor); + #endif + + #ifdef STARS + if (moonVisibility > 0.0) DrawStars(color.rgb, viewPos.xyz); + #endif + + #ifdef AURORA + color.rgb += DrawAurora(viewPos.xyz, dither, 24); + #endif + + SunGlare(color.rgb, viewPos.xyz, lightCol); + + color.rgb *= 1.0 + nightVision; + #ifdef CLASSIC_EXPOSURE + color.rgb *= 4.0 - 3.0 * eBS; + #endif + #endif + #ifdef NETHER + color.rgb = netherCol.rgb * 0.0425; + #endif + #ifdef END + #ifdef SHADER_END_SKY + color.rgb = GetEndSkyColor(viewPos.xyz); + #endif + + #ifndef LIGHT_SHAFT + float VoL = dot(normalize(viewPos.xyz), lightVec); + VoL = pow(VoL * 0.5 + 0.5, 16.0) * 0.75 + 0.25; + color.rgb += endCol.rgb * 0.04 * VoL; + #endif + #endif + + if (isEyeInWater == 2) { + #ifdef EMISSIVE_RECOLOR + color.rgb = pow(blocklightCol / BLOCKLIGHT_I, vec3(4.0)) * 2.0; + #else + color.rgb = vec3(1.0, 0.3, 0.01); + #endif + } + + if (blindFactor > 0.0 || darknessFactor > 0.0) color.rgb *= 1.0 - max(blindFactor, darknessFactor); + } + + vec4 cloud = vec4(0.0); + float cloudDither = BayerCloud8(gl_FragCoord.xy); + + float cloudMaxDistance = 2.0 * far; + #ifdef DISTANT_HORIZONS + cloudMaxDistance = max(cloudMaxDistance, dhFarPlane); + #endif + + float cloudViewLength = cloudMaxDistance; + float cloudSampleZ = z; + + #ifdef OUTLINE_OUTER + DepthOutline(cloudSampleZ, depthtex0); + #endif + + #ifdef OVERWORLD + #if CLOUDS == 1 + cloud = DrawCloudSkybox(viewPos.xyz, cloudSampleZ, cloudDither, lightCol, ambientCol, false); + #endif + + #if CLOUDS == 2 + vec4 cloudViewPos = viewPos; + + #ifdef OUTLINE_OUTER + cloudViewPos = gbufferProjectionInverse * (vec4(texCoord, cloudSampleZ, 1.0) * 2.0 - 1.0); + cloudViewPos /= cloudViewPos.w; + #endif + + cloud = DrawCloudVolumetric(cloudViewPos.xyz, cameraPosition, cloudSampleZ, cloudDither, lightCol, ambientCol, cloudViewLength, false); + #endif + + #ifndef LIGHT_SHAFT + SunGlare(cloud.rgb, viewPos.xyz, lightCol); + #endif + + color.rgb = mix(color.rgb, cloud.rgb, cloud.a); + #endif + cloudViewLength /= cloudMaxDistance; + + #ifdef OUTLINE_ENABLED + outerOutline.rgb = mix(outerOutline.rgb, cloud.rgb, cloud.a); + color.rgb = mix(color.rgb, outerOutline.rgb, outerOutline.a); + #endif + + #if MC_VERSION >= 10900 && !defined IS_IRIS + float isGlowing = texture2D(colortex3, texCoord).b; + if (isGlowing > 0.5) GlowOutline(color.rgb); + #endif + + vec3 reflectionColor = pow(color.rgb, vec3(0.125)) * 0.5; + + #if ALPHA_BLEND == 0 + color.rgb = sqrt(max(color.rgb, vec3(0.0))); + #endif + + float reflectionMask = float(z < 1.0); + #ifdef DISTANT_HORIZONS + reflectionMask = max(reflectionMask, float(dhZ < 1.0)); + #endif + + /*DRAWBUFFERS:04 */ + gl_FragData[0] = color; + gl_FragData[1] = vec4(cloudViewLength, 0.0, 0.0, 1.0); + + #if !defined REFLECTION_PREVIOUS && REFRACTION == 0 + /*DRAWBUFFERS:045*/ + gl_FragData[2] = vec4(reflectionColor, reflectionMask); + #elif defined REFLECTION_PREVIOUS && REFRACTION > 0 + /*DRAWBUFFERS:046*/ + gl_FragData[2] = vec4(0.0, 0.0, 0.0, 1.0); + #elif !defined REFLECTION_PREVIOUS && REFRACTION > 0 + /*DRAWBUFFERS:0456*/ + gl_FragData[2] = vec4(reflectionColor, reflectionMask); + gl_FragData[3] = vec4(0.0, 0.0, 0.0, 1.0); + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 sunVec, upVec, eastVec; + +//Uniforms// +uniform float timeAngle; + +uniform mat4 gbufferModelView; + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + gl_Position = ftransform(); + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = normalize(gbufferModelView[0].xyz); +} + +#endif diff --git a/shaders/program/dh_terrain.glsl b/shaders/program/dh_terrain.glsl new file mode 100644 index 0000000..07ea8ed --- /dev/null +++ b/shaders/program/dh_terrain.glsl @@ -0,0 +1,290 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying float mat; + +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +//Uniforms// +uniform int frameCounter; +uniform int isEyeInWater; +uniform int worldTime; + +uniform float far; +uniform float frameTimeCounter; +uniform float blindFactor, darknessFactor, nightVision; +uniform float rainStrength; +uniform float screenBrightness; +uniform float shadowFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; + +uniform mat4 dhProjectionInverse; +uniform mat4 gbufferModelViewInverse; +uniform mat4 shadowProjection; +uniform mat4 shadowModelView; + +uniform sampler2D noisetex; + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +#ifdef ADVANCED_MATERIALS +vec2 dcdx = dFdx(texCoord); +vec2 dcdy = dFdy(texCoord); +#endif + +vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + +mat4 gbufferProjectionInverse = dhProjectionInverse; + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +float GetBlueNoise3D(vec3 pos, vec3 normal) { + pos = (floor(pos + 0.01) + 0.5) / 512.0; + + vec3 worldNormal = (gbufferModelViewInverse * vec4(normal, 0.0)).xyz; + vec3 noise3D = vec3( + texture2D(noisetex, pos.yz).b, + texture2D(noisetex, pos.xz).b, + texture2D(noisetex, pos.xy).b + ); + + float noiseX = noise3D.x * abs(worldNormal.x); + float noiseY = noise3D.y * abs(worldNormal.y); + float noiseZ = noise3D.z * abs(worldNormal.z); + float noise = noiseX + noiseY + noiseZ; + + return noise - 0.5; +} + +//Includes// +#include "/lib/color/blocklightColor.glsl" +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/specularColor.glsl" +#include "/lib/util/dither.glsl" +#include "/lib/util/spaceConversion.glsl" +#include "/lib/lighting/forwardLighting.glsl" +#include "/lib/surface/ggx.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +//Program// +void main() { + vec4 albedo = color; + vec3 newNormal = normal; + + if (albedo.a > 0.001) { + vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0)); + + float foliage = float(mat > 0.98 && mat < 1.02); + float leaves = float(mat > 1.98 && mat < 2.02); + float emissive = float(mat > 2.98 && mat < 3.02); + float lava = float(mat > 3.98 && mat < 4.02); + float candle = float(mat > 4.98 && mat < 5.02); + + float metalness = 0.0; + float emission = emissive + lava; + float subsurface = 0.0; + float basicSubsurface = leaves * 0.5; + vec3 baseReflectance = vec3(0.04); + + emission *= pow(max(max(albedo.r, albedo.g), albedo.b), 4.0) * 0.4; + + vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z); + #ifdef TAA + vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z)); + #else + vec3 viewPos = ToNDC(screenPos); + #endif + vec3 worldPos = ToWorld(viewPos); + + float dither = Bayer8(gl_FragCoord.xy); + + float viewLength = length(viewPos); + float minDist = (dither - 1.0) * 16.0 + far; + if (viewLength < minDist) { + discard; + } + + vec3 noisePos = (worldPos + cameraPosition) * 4.0; + float albedoLuma = GetLuminance(albedo.rgb); + float noiseAmount = (1.0 - albedoLuma * albedoLuma) * 0.05; + float albedoNoise = GetBlueNoise3D(noisePos, normal); + albedo.rgb = clamp(albedo.rgb + albedoNoise * noiseAmount, vec3(0.0), vec3(1.0)); + // albedo.rgb = vec3(albedoNoise + 0.5); + + #ifdef TOON_LIGHTMAP + lightmap = floor(lmCoord * 14.999) / 14.0; + lightmap = clamp(lightmap, vec2(0.0), vec2(1.0)); + #endif + + albedo.rgb = pow(albedo.rgb, vec3(2.2)); + + #ifdef WHITE_WORLD + albedo.rgb = vec3(0.35); + #endif + + vec3 outNormal = newNormal; + + float NoL = clamp(dot(newNormal, lightVec), 0.0, 1.0); + + float NoU = clamp(dot(newNormal, upVec), -1.0, 1.0); + float NoE = clamp(dot(newNormal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15; + vanillaDiffuse*= vanillaDiffuse; + + #ifndef NORMAL_PLANTS + if (foliage > 0.5) vanillaDiffuse *= 1.8; + #endif + if (leaves > 0.5) { + float halfNoL = dot(newNormal, lightVec) * 0.5 + 0.5; + basicSubsurface *= halfNoL * step(length(albedo.rgb), 1.7); + } + + vec3 shadow = vec3(0.0); + GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL, + vanillaDiffuse, 1.0, emission, subsurface, basicSubsurface); + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + } else albedo.a = 0.0; + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying float mat; + +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +//Uniforms// +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float timeAngle; + +uniform vec3 cameraPosition; + +uniform mat4 dhProjection; +uniform mat4 gbufferModelView, gbufferModelViewInverse; + +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth, viewHeight; +#endif + +//Attributes// +attribute vec4 mc_Entity; +attribute vec4 mc_midTexCoord; + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Includes// +#include "/lib/vertex/waving.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; + lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0)); + + int blockID = dhMaterialId; + + normal = normalize(gl_NormalMatrix * gl_Normal); + + color = gl_Color; + + mat = 0.0; + + if (blockID == DH_BLOCK_LEAVES){ + mat = 2.0; + color.rgb *= 1.3; + } + if (blockID == DH_BLOCK_ILLUMINATED) + mat = 3.0; + if (blockID == DH_BLOCK_LAVA) { + mat = 4.0; + lmCoord.x += 0.0667; + } + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = normalize(gbufferModelView[0].xyz); + + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + + #ifdef WORLD_CURVATURE + position.y -= WorldCurvature(position.xz); + #endif + + gl_Position = dhProjection * gbufferModelView * position; + + #ifdef TAA + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/dh_water.glsl b/shaders/program/dh_water.glsl new file mode 100644 index 0000000..7af1d5d --- /dev/null +++ b/shaders/program/dh_water.glsl @@ -0,0 +1,535 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying float mat; +varying float dist; + +varying vec2 texCoord, lmCoord; + +varying vec3 normal, binormal, tangent; +varying vec3 sunVec, upVec, eastVec; +varying vec3 viewVector; + +varying vec4 color; + +//Uniforms// +uniform int frameCounter; +uniform int isEyeInWater; +uniform int worldTime; + +uniform float blindFactor, darknessFactor, nightVision; +uniform float dhFarPlane; +uniform float far, near; +uniform float frameTimeCounter; +uniform float rainStrength; +uniform float screenBrightness; +uniform float shadowFade, voidFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition, previousCameraPosition; + +uniform mat4 dhProjection, dhPreviousProjection, dhProjectionInverse; +uniform mat4 gbufferModelView, gbufferPreviousModelView, gbufferModelViewInverse; +uniform mat4 shadowProjection; +uniform mat4 shadowModelView; + +uniform sampler2D texture; +uniform sampler2D gaux2; +uniform sampler2D depthtex1; +uniform sampler2D depthtex2; +uniform sampler2D noisetex; + +#if CLOUDS == 2 +uniform sampler2D gaux1; +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +#ifdef ADVANCED_MATERIALS +vec2 dcdx = dFdx(texCoord); +vec2 dcdy = dFdy(texCoord); +#endif + +vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + +mat4 gbufferProjection = dhProjection; +mat4 gbufferPreviousProjection = dhPreviousProjection; +mat4 gbufferProjectionInverse = dhProjectionInverse; + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +float GetWaterHeightMap(vec3 worldPos, vec2 offset) { + float noise = 0.0; + + vec2 wind = vec2(frametime) * 0.5 * WATER_SPEED; + + worldPos.xz += worldPos.y * 0.2; + + #if WATER_NORMALS == 1 + offset /= 256.0; + float noiseA = texture2D(noisetex, (worldPos.xz - wind) / 256.0 + offset).g; + float noiseB = texture2D(noisetex, (worldPos.xz + wind) / 48.0 + offset).g; + #elif WATER_NORMALS == 2 + offset /= 256.0; + float noiseA = texture2D(noisetex, (worldPos.xz - wind) / 256.0 + offset).r; + float noiseB = texture2D(noisetex, (worldPos.xz + wind) / 96.0 + offset).r; + noiseA *= noiseA; noiseB *= noiseB; + #endif + + #if WATER_NORMALS > 0 + noise = mix(noiseA, noiseB, WATER_DETAIL); + #endif + + return noise * WATER_BUMP; +} + +vec3 GetParallaxWaves(vec3 worldPos, vec3 viewVector) { + vec3 parallaxPos = worldPos; + + for(int i = 0; i < 4; i++) { + float height = -1.25 * GetWaterHeightMap(parallaxPos, vec2(0.0)) + 0.25; + parallaxPos.xz += height * viewVector.xy / dist; + } + return parallaxPos; +} + +vec3 GetWaterNormal(vec3 worldPos, vec3 viewPos, vec3 viewVector) { + vec3 waterPos = worldPos + cameraPosition; + + #if WATER_PIXEL > 0 + waterPos = floor(waterPos * WATER_PIXEL) / WATER_PIXEL; + #endif + + #ifdef WATER_PARALLAX + waterPos = GetParallaxWaves(waterPos, viewVector); + #endif + + float normalOffset = WATER_SHARPNESS; + + float fresnel = pow(clamp(1.0 + dot(normalize(normal), normalize(viewPos)), 0.0, 1.0), 8.0); + float normalStrength = 0.35 * (1.0 - fresnel); + + float h1 = GetWaterHeightMap(waterPos, vec2( normalOffset, 0.0)); + float h2 = GetWaterHeightMap(waterPos, vec2(-normalOffset, 0.0)); + float h3 = GetWaterHeightMap(waterPos, vec2(0.0, normalOffset)); + float h4 = GetWaterHeightMap(waterPos, vec2(0.0, -normalOffset)); + + float xDelta = (h2 - h1) / normalOffset; + float yDelta = (h4 - h3) / normalOffset; + + vec3 normalMap = vec3(xDelta, yDelta, 1.0 - (xDelta * xDelta + yDelta * yDelta)); + return normalMap * normalStrength + vec3(0.0, 0.0, 1.0 - normalStrength); +} + +//Includes// +#include "/lib/color/blocklightColor.glsl" +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/skyColor.glsl" +#include "/lib/color/specularColor.glsl" +#include "/lib/color/waterColor.glsl" +#include "/lib/util/dither.glsl" +#include "/lib/util/spaceConversion.glsl" +#include "/lib/atmospherics/weatherDensity.glsl" +#include "/lib/atmospherics/sky.glsl" +#include "/lib/atmospherics/clouds.glsl" +#include "/lib/atmospherics/fog.glsl" +#include "/lib/atmospherics/waterFog.glsl" +#include "/lib/lighting/forwardLighting.glsl" +#include "/lib/reflections/raytrace.glsl" +#include "/lib/reflections/simpleReflections.glsl" +#include "/lib/surface/ggx.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +//Program// +void main() { + vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z); + + float opaqueDepth = texture2D(depthtex1, screenPos.xy).r; + if (opaqueDepth < 1.0) discard; + + vec4 albedo = color; + vec3 newNormal = normal; + float smoothness = 0.0; + vec3 lightAlbedo = vec3(0.0); + + vec3 vlAlbedo = vec3(1.0); + vec3 refraction = vec3(0.0); + + float cloudBlendOpacity = 1.0; + + if (albedo.a > 0.001) { + vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0)); + + float water = float(mat > 0.98 && mat < 1.02); + float glass = float(mat > 1.98 && mat < 2.02); + float translucent = float(mat > 2.98 && mat < 3.02); + float portal = float(mat > 3.98 && mat < 4.02); + + float metalness = 0.0; + float emission = portal; + float subsurface = 0.0; + float basicSubsurface = water; + vec3 baseReflectance = vec3(0.04); + + emission *= pow(max(max(albedo.r, albedo.g), albedo.b), 4.0) * 0.4; + + #ifndef REFLECTION_TRANSLUCENT + glass = 0.0; + translucent = 0.0; + #endif + + #ifdef TAA + vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z)); + #else + vec3 viewPos = ToNDC(screenPos); + #endif + vec3 worldPos = ToWorld(viewPos); + + float dither = Bayer8(gl_FragCoord.xy); + + float viewLength = length(viewPos); + float minDist = (dither - 1.0) * 16.0 + far; + if (viewLength < minDist) { + discard; + } + + #if CLOUDS == 2 + float cloudMaxDistance = 2.0 * far; + #ifdef DISTANT_HORIZONS + cloudMaxDistance = max(cloudMaxDistance, dhFarPlane); + #endif + + float cloudViewLength = texture2D(gaux1, screenPos.xy).r * cloudMaxDistance; + + cloudBlendOpacity = step(viewLength, cloudViewLength); + + if (cloudBlendOpacity == 0) { + discard; + } + // albedo.rgb *= fract(viewLength); + #endif + + vec3 normalMap = vec3(0.0, 0.0, 1.0); + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + #if WATER_NORMALS == 1 || WATER_NORMALS == 2 + if (water > 0.5) { + normalMap = GetWaterNormal(worldPos, viewPos, viewVector); + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + } + #endif + + #if REFRACTION == 1 + refraction = vec3((newNormal.xy - normal.xy) * 0.5 + 0.5, float(albedo.a < 0.95) * water); + #elif REFRACTION == 2 + refraction = vec3((newNormal.xy - normal.xy) * 0.5 + 0.5, float(albedo.a < 0.95)); + #endif + + #ifdef TOON_LIGHTMAP + lightmap = floor(lmCoord * 14.999) / 14.0; + lightmap = clamp(lightmap, vec2(0.0), vec2(1.0)); + #endif + + albedo.rgb = pow(albedo.rgb, vec3(2.2)); + + vlAlbedo = albedo.rgb; + + #ifdef WHITE_WORLD + albedo.rgb = vec3(0.35); + #endif + + if (water > 0.5) { + #if WATER_MODE == 0 + albedo.rgb = waterColor.rgb * waterColor.a; + #elif WATER_MODE == 1 + // do nothing + #elif WATER_MODE == 2 + float waterLuma = length(albedo.rgb / pow(color.rgb, vec3(2.2))) * 2.0; + albedo.rgb = waterLuma * waterColor.rgb * waterColor.a; + #elif WATER_MODE == 3 + albedo.rgb = color.rgb * color.rgb * 0.35; + #endif + #if WATER_ALPHA_MODE == 0 + albedo.a = waterAlpha; + #endif + vlAlbedo = sqrt(albedo.rgb); + baseReflectance = vec3(0.02); + } + + vlAlbedo = mix(vec3(1.0), vlAlbedo, sqrt(albedo.a)) * (1.0 - pow(albedo.a, 64.0)); + + float NoL = clamp(dot(newNormal, lightVec), 0.0, 1.0); + + float NoU = clamp(dot(newNormal, upVec), -1.0, 1.0); + float NoE = clamp(dot(newNormal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15; + vanillaDiffuse*= vanillaDiffuse; + + vec3 shadow = vec3(0.0); + GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, color.a, NoL, + vanillaDiffuse, 1.0, emission, subsurface, basicSubsurface); + + float fresnel = pow(clamp(1.0 + dot(newNormal, normalize(viewPos)), 0.0, 1.0), 5.0); + + if (water > 0.5 || ((translucent + glass) > 0.5 && albedo.a < 0.95)) { + #if REFLECTION > 0 + vec4 reflection = vec4(0.0); + vec3 skyReflection = vec3(0.0); + float reflectionMask = 0.0; + + fresnel = fresnel * 0.98 + 0.02; + fresnel*= max(1.0 - isEyeInWater * 0.5 * water, 0.5); + // fresnel = 1.0; + + #if REFLECTION == 2 + reflection = DHReflection(viewPos, newNormal, dither, reflectionMask); + reflection.rgb = pow(reflection.rgb * 2.0, vec3(8.0)); + #endif + + if (reflection.a < 1.0) { + #ifdef OVERWORLD + vec3 skyRefPos = reflect(normalize(viewPos), newNormal); + skyReflection = GetSkyColor(skyRefPos, true); + + #ifdef AURORA + skyReflection += DrawAurora(skyRefPos * 100.0, dither, 12); + #endif + + #if CLOUDS == 1 + vec4 cloud = DrawCloudSkybox(skyRefPos * 100.0, 1.0, dither, lightCol, ambientCol, true); + skyReflection = mix(skyReflection, cloud.rgb, cloud.a); + #endif + #if CLOUDS == 2 + vec3 cameraPos = GetReflectedCameraPos(worldPos, newNormal); + float cloudViewLength = 0.0; + + vec4 cloud = DrawCloudVolumetric(skyRefPos * 8192.0, cameraPos, 1.0, dither, lightCol, ambientCol, cloudViewLength, true); + skyReflection = mix(skyReflection, cloud.rgb, cloud.a); + #endif + + #ifdef CLASSIC_EXPOSURE + skyReflection *= 4.0 - 3.0 * eBS; + #endif + + float waterSkyOcclusion = lightmap.y; + #if REFLECTION_SKY_FALLOFF > 1 + waterSkyOcclusion = clamp(1.0 - (1.0 - waterSkyOcclusion) * REFLECTION_SKY_FALLOFF, 0.0, 1.0); + #endif + waterSkyOcclusion *= waterSkyOcclusion; + skyReflection *= waterSkyOcclusion; + #endif + + #ifdef NETHER + skyReflection = netherCol.rgb * 0.04; + #endif + + #ifdef END + skyReflection = endCol.rgb * 0.01; + #endif + + skyReflection *= clamp(1.0 - isEyeInWater, 0.0, 1.0); + } + + reflection.rgb = max(mix(skyReflection, reflection.rgb, reflection.a), vec3(0.0)); + + #if defined OVERWORLD || defined END + vec3 specularColor = GetSpecularColor(lightmap.y, 0.0, vec3(1.0)); + + vec3 specular = GetSpecularHighlight(newNormal, viewPos, 0.9, vec3(0.02), + specularColor, shadow, color.a); + #if ALPHA_BLEND == 0 + float specularAlpha = pow(mix(albedo.a, 1.0, fresnel), 2.2) * fresnel; + #else + float specularAlpha = mix(albedo.a , 1.0, fresnel) * fresnel; + #endif + + reflection.rgb += specular * (1.0 - reflectionMask) / specularAlpha; + #endif + + albedo.rgb = mix(albedo.rgb, reflection.rgb, fresnel); + albedo.a = mix(albedo.a, 1.0, fresnel); + #endif + } + + #if WATER_FOG == 1 + if((isEyeInWater == 0 && water > 0.5) || (isEyeInWater == 1 && water < 0.5)) { + float opaqueDepth = texture2D(depthtex1, screenPos.xy).r; + vec3 opaqueScreenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), opaqueDepth); + #ifdef TAA + vec3 opaqueViewPos = ToNDC(vec3(TAAJitter(opaqueScreenPos.xy, -0.5), opaqueScreenPos.z)); + #else + vec3 opaqueViewPos = ToNDC(opaqueScreenPos); + #endif + + vec4 waterFog = GetWaterFog(opaqueViewPos - viewPos.xyz); + albedo = mix(waterFog, vec4(albedo.rgb, 1.0), albedo.a); + } + #endif + + Fog(albedo.rgb, viewPos); + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + } + albedo.a *= cloudBlendOpacity; + + /* DRAWBUFFERS:01 */ + gl_FragData[0] = albedo; + gl_FragData[1] = vec4(vlAlbedo, 1.0); +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying float mat; +varying float dist; + +varying vec2 texCoord, lmCoord; + +varying vec3 normal, binormal, tangent; +varying vec3 sunVec, upVec, eastVec; +varying vec3 viewVector; + +varying vec4 color; + +//Uniforms// +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float timeAngle; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferModelView, gbufferModelViewInverse; + +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth, viewHeight; +#endif + +//Attributes// +attribute vec4 mc_Entity; +attribute vec4 mc_midTexCoord; +attribute vec4 at_tangent; + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Common Functions// +float WavingWater(vec3 worldPos) { + worldPos += cameraPosition; + float fractY = fract(worldPos.y + 0.005); + + float wave = sin(6.2831854 * (frametime * 0.7 + worldPos.x * 0.14 + worldPos.z * 0.07)) + + sin(6.2831854 * (frametime * 0.5 + worldPos.x * 0.10 + worldPos.z * 0.20)); + if (fractY > 0.01) return wave * 0.0125; + + return 0.0; +} + +//Includes// +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; + lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0)); + + int blockID = dhMaterialId; + + normal = normalize(gl_NormalMatrix * gl_Normal); + binormal = normalize(gbufferModelView[2].xyz); + tangent = normalize(gbufferModelView[0].xyz); + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz; + + dist = length(gl_ModelViewMatrix * gl_Vertex); + + color = gl_Color; + + mat = 0.0; + + if (blockID == DH_BLOCK_WATER) mat = 1.0; + + const vec2 sunRotationData = vec2( + cos(sunPathRotation * 0.01745329251994), + -sin(sunPathRotation * 0.01745329251994) + ); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = tangent; + + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + + #ifdef WAVING_WATER + float istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t ? 1.0 : 0.0; + if (blockID == 300 || blockID == 302 || blockID == 304) position.y += WavingWater(position.xyz); + #endif + + #ifdef WORLD_CURVATURE + position.y -= WorldCurvature(position.xz); + #endif + + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + if (mat == 0.0) gl_Position.z -= 0.00001; + + #ifdef TAA + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/final.glsl b/shaders/program/final.glsl new file mode 100644 index 0000000..6d656c4 --- /dev/null +++ b/shaders/program/final.glsl @@ -0,0 +1,123 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +//Uniforms// +uniform sampler2D colortex1; + +uniform float viewWidth, viewHeight; +uniform float aspectRatio, frameTimeCounter; + +//Optifine Constants// +/* +const int colortex0Format = R11F_G11F_B10F; //main scene +const int colortex1Format = RGB8; //raw translucent, vl, bloom, final scene +const int colortex2Format = RGBA16; //temporal data +const int colortex3Format = RGB8; //smoothness, sky occlusion, entity mask +const int gaux1Format = R8; //cloud alpha, ao +const int gaux2Format = RGB10_A2; //reflection image +const int gaux3Format = RGBA16; //opaque normals, refraction vector +const int gaux4Format = RGBA16; //fresnel +const int colortex8Format = RGB8; //colored light +const int colortex9Format = RGB16F; //colored light +*/ + +const bool shadowHardwareFiltering = true; +const float shadowDistanceRenderMul = 1.0; + +const int noiseTextureResolution = 512; + +const float drynessHalflife = 5.0; +const float wetnessHalflife = 30.0; + +//Common Functions// +#ifdef TAA +vec2 sharpenOffsets[4] = vec2[4]( + vec2( 1.0, 0.0), + vec2( 0.0, 1.0), + vec2(-1.0, 0.0), + vec2( 0.0, -1.0) +); + +void SharpenFilter(inout vec3 color, vec2 coord) { + float mult = MC_RENDER_QUALITY * 0.0625; + vec2 view = 1.0 / vec2(viewWidth, viewHeight); + + vec3 mincolor = color; + vec3 maxcolor = color; + + color *= mult * 4.0 + 1.0; + + for(int i = 0; i < 4; i++) { + vec2 offset = sharpenOffsets[i] * view; + vec3 colorSample = texture2DLod(colortex1, coord + offset, 0).rgb; + color -= colorSample * mult; + + mincolor = min(mincolor, colorSample); + maxcolor = max(maxcolor, colorSample); + } + + color = clamp(color, mincolor, maxcolor); +} +#endif + +#ifdef SHADOW +#endif + +//Program// +void main() { + vec2 newTexCoord = texCoord; + + #ifdef RETRO_FILTER + vec2 view = vec2(viewWidth, viewHeight) / float(RETRO_FILTER_SIZE); + float offset = (ceil(RETRO_FILTER_SIZE * 0.5) - 0.5) / float(RETRO_FILTER_SIZE); + newTexCoord = (floor(newTexCoord * view) + offset) / view; + #endif + + vec3 color = texture2DLod(colortex1, newTexCoord, 0).rgb; + + #if CHROMATIC_ABERRATION > 0 + float caStrength = 0.004 * CHROMATIC_ABERRATION; + vec2 caScale = vec2(1.0 / aspectRatio, 1.0); + color *= vec3(0.0,1.0,0.0); + color += texture2DLod(colortex1, mix(newTexCoord, vec2(0.5), caScale * -caStrength), 0).rgb * vec3(1.0,0.0,0.0); + color += texture2DLod(colortex1, mix(newTexCoord, vec2(0.5), caScale * -caStrength * 0.5), 0).rgb * vec3(0.5,0.5,0.0); + color += texture2DLod(colortex1, mix(newTexCoord, vec2(0.5), caScale * caStrength * 0.5), 0).rgb * vec3(0.0,0.5,0.5); + color += texture2DLod(colortex1, mix(newTexCoord, vec2(0.5), caScale* caStrength), 0).rgb * vec3(0.0,0.0,1.0); + + color /= vec3(1.5,2.0,1.5); + #endif + + #if defined FXAA && defined TAA + SharpenFilter(color, newTexCoord); + #endif + + gl_FragColor = vec4(color, 1.0); +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + gl_Position = ftransform(); +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_armor_glint.glsl b/shaders/program/gbuffers_armor_glint.glsl new file mode 100644 index 0000000..40e805e --- /dev/null +++ b/shaders/program/gbuffers_armor_glint.glsl @@ -0,0 +1,86 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +varying vec4 color; + +//Uniforms// +uniform ivec2 eyeBrightnessSmooth; + +uniform sampler2D texture; + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; + +//Program// +void main() { + vec4 albedo = texture2D(texture, texCoord) * color; + albedo.rgb = pow(albedo.rgb,vec3(2.2)) / (4.0 - 3.0 * eBS); + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +varying vec4 color; + +//Uniforms// +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth; +uniform float viewHeight; +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +uniform mat4 gbufferModelView; +uniform mat4 gbufferModelViewInverse; +#endif + +//Includes// +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + color = gl_Color; + + #ifdef WORLD_CURVATURE + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + if (gl_ProjectionMatrix[2][2] < -0.5) position.y -= WorldCurvature(position.xz); + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + #else + gl_Position = ftransform(); + #endif + + #if defined TAA && !defined TAA_SELECTIVE + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_basic.glsl b/shaders/program/gbuffers_basic.glsl new file mode 100644 index 0000000..24fe678 --- /dev/null +++ b/shaders/program/gbuffers_basic.glsl @@ -0,0 +1,247 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +//Uniforms// +uniform int frameCounter; +uniform int isEyeInWater; +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float nightVision; +uniform float rainStrength; +uniform float screenBrightness; +uniform float shadowFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferProjectionInverse; +uniform mat4 gbufferModelViewInverse; +uniform mat4 shadowProjection; +uniform mat4 shadowModelView; + +uniform sampler2D noisetex; + +#ifdef DYNAMIC_HANDLIGHT +uniform int heldBlockLightValue; +uniform int heldBlockLightValue2; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +uniform mat4 gbufferPreviousModelView; +uniform mat4 gbufferPreviousProjection; +uniform vec3 previousCameraPosition; + +uniform sampler2D colortex9; +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +//Includes// +#include "/lib/color/blocklightColor.glsl" +#include "/lib/color/dimensionColor.glsl" +#include "/lib/util/spaceConversion.glsl" +#include "/lib/lighting/forwardLighting.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +#include "/lib/lighting/coloredBlocklight.glsl" +#endif + +//Program// +void main() { + vec4 albedo = color; + + if (albedo.a > 0.001) { + vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0)); + + vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z); + #ifdef TAA + vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z)); + #else + vec3 viewPos = ToNDC(screenPos); + #endif + vec3 worldPos = ToWorld(viewPos); + + #ifdef DYNAMIC_HANDLIGHT + float heldLightValue = max(float(heldBlockLightValue), float(heldBlockLightValue2)); + float handlight = clamp((heldLightValue - 2.0 * length(viewPos)) / 15.0, 0.0, 0.9333); + lightmap.x = max(lightmap.x, handlight); + #endif + + #ifdef TOON_LIGHTMAP + lightmap = floor(lightmap * 14.999 * (0.75 + 0.25 * color.a)) / 14.0; + lightmap = clamp(lightmap, vec2(0.0), vec2(1.0)); + #endif + + albedo.rgb = pow(albedo.rgb, vec3(2.2)); + albedo.a = albedo.a * 0.5 + 0.5; + + #ifdef WHITE_WORLD + if (albedo.a > 0.9) albedo.rgb = vec3(0.35); + #endif + + float NoL = clamp(dot(normal, lightVec) * 1.01 - 0.01, 0.0, 1.0); + + float NoU = clamp(dot(normal, upVec), -1.0, 1.0); + float NoE = clamp(dot(normal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15; + vanillaDiffuse*= vanillaDiffuse; + + #ifdef MULTICOLORED_BLOCKLIGHT + blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos); + #endif + + vec3 shadow = vec3(0.0); + GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL, + vanillaDiffuse, 1.0, 0.0, 0.0, 0.0); + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + } + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; + + #ifdef MULTICOLORED_BLOCKLIGHT + /* DRAWBUFFERS:08 */ + gl_FragData[1] = vec4(0.0,0.0,0.0,1.0); + + #ifdef ADVANCED_MATERIALS + /* DRAWBUFFERS:08367 */ + gl_FragData[2] = vec4(0.0, 0.0, 0.0, 1.0); + gl_FragData[3] = vec4(0.0, 0.0, float(gl_FragCoord.z < 1.0), 1.0); + gl_FragData[4] = vec4(0.0, 0.0, 0.0, 1.0); + #endif + #else + #ifdef ADVANCED_MATERIALS + /* DRAWBUFFERS:0367 */ + gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0); + gl_FragData[2] = vec4(0.0, 0.0, float(gl_FragCoord.z < 1.0), 1.0); + gl_FragData[3] = vec4(0.0, 0.0, 0.0, 1.0); + #endif + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +//Uniforms// +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float timeAngle; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferModelView, gbufferModelViewInverse; +uniform mat4 gbufferProjectionInverse; + +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth, viewHeight; +#endif + +//Attributes// +attribute vec4 mc_Entity; +attribute vec4 mc_midTexCoord; + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Includes// +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; + lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0)); + + normal = normalize(gl_NormalMatrix * gl_Normal); + + color = gl_Color; + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = normalize(gbufferModelView[0].xyz); + + #ifdef WORLD_CURVATURE + vec4 position = gbufferModelViewInverse * gbufferProjectionInverse * ftransform(); + position.y -= WorldCurvature(position.xz); + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + #else + gl_Position = ftransform(); + #endif + + #ifdef TAA + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_beaconbeam.glsl b/shaders/program/gbuffers_beaconbeam.glsl new file mode 100644 index 0000000..a3773d7 --- /dev/null +++ b/shaders/program/gbuffers_beaconbeam.glsl @@ -0,0 +1,104 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +varying vec4 color; + +//Uniforms// +uniform sampler2D texture; + +//Includes// +#include "/lib/color/blocklightColor.glsl" + +//Program// +void main() { + vec4 albedo = texture2D(texture, texCoord) * color; + + #ifdef EMISSIVE_RECOLOR + if (dot(color.rgb, vec3(1.0)) > 2.66) { + float ec = length(albedo.rgb); + albedo.rgb = blocklightCol * (ec * 0.63 / BLOCKLIGHT_I) + ec * 0.07; + } + #endif + + albedo.rgb = pow(albedo.rgb,vec3(2.2)) * 4.0; + + #ifdef WHITE_WORLD + albedo.rgb = vec3(2.0); + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + albedo.a = sqrt(albedo.a); + #endif + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; + + #ifdef ADVANCED_MATERIALS + /* DRAWBUFFERS:0367 */ + gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0); + gl_FragData[2] = vec4(0.0, 0.0, float(gl_FragCoord.z < 1.0), 1.0); + gl_FragData[3] = vec4(0.0, 0.0, 0.0, 1.0); + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +varying vec4 color; + +//Uniforms// +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth; +uniform float viewHeight; +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +uniform mat4 gbufferModelView; +uniform mat4 gbufferModelViewInverse; +#endif + +//Includes// +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + color = gl_Color; + + #ifdef WORLD_CURVATURE + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + if (gl_ProjectionMatrix[2][2] < -0.5) position.y -= WorldCurvature(position.xz); + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + #else + gl_Position = ftransform(); + #endif + + #ifdef TAA + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_block.glsl b/shaders/program/gbuffers_block.glsl new file mode 100644 index 0000000..05eee04 --- /dev/null +++ b/shaders/program/gbuffers_block.glsl @@ -0,0 +1,522 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" +#include "/lib/util/commonFunctions.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS + varying float dist; + + varying vec3 binormal, tangent; + + varying vec3 viewVector; + + varying vec4 vTexCoord, vTexCoordAM; + + flat varying vec2 absMidCoordPos; + varying vec2 signMidCoordPos; + +#endif + +//Uniforms// +uniform int blockEntityId; +uniform int frameCounter; +uniform int isEyeInWater; +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float nightVision; +uniform float rainStrength; +uniform float screenBrightness; +uniform float shadowFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight, aspectRatio; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferProjectionInverse; +uniform mat4 gbufferModelViewInverse; +uniform mat4 shadowProjection; +uniform mat4 shadowModelView; + +uniform sampler2D texture; +uniform sampler2D noisetex; + +#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS +uniform ivec2 atlasSize; +vec2 atlasSizeM = atlasSize; + +uniform sampler2D specular; +uniform sampler2D normals; +#endif + +#ifdef DYNAMIC_HANDLIGHT +uniform int heldBlockLightValue; +uniform int heldBlockLightValue2; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +uniform mat4 gbufferPreviousModelView; +uniform mat4 gbufferPreviousProjection; +uniform vec3 previousCameraPosition; + +uniform sampler2D colortex9; +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS +vec2 dcdx = dFdx(texCoord); +vec2 dcdy = dFdy(texCoord); + +vec2 mipx; +vec2 mipy; +float mipDelta; +float miplevel; +#endif + +vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + +#if defined GENERATED_NORMALS + mat3 tbnMatrix = mat3( + tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z + ); + + vec2 midCoordPos = absMidCoordPos * signMidCoordPos; +#endif + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +//Includes// +#include "/lib/color/blocklightColor.glsl" +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/specularColor.glsl" +#include "/lib/util/spaceConversion.glsl" +#include "/lib/lighting/forwardLighting.glsl" +#include "/lib/surface/ggx.glsl" + +#ifdef TAA + #include "/lib/util/jitter.glsl" +#endif + +#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS + #include "/lib/util/encode.glsl" + #include "/lib/reflections/complexFresnel.glsl" + #include "/lib/surface/materialGbuffers.glsl" + #include "/lib/surface/parallax.glsl" + + #ifdef GENERATED_NORMALS + #include "/lib/surface/generatedNormals.glsl" + #endif +#endif + + + +#ifdef MULTICOLORED_BLOCKLIGHT + #include "/lib/lighting/coloredBlocklight.glsl" +#endif + +#ifdef NORMAL_SKIP + #undef PARALLAX + #undef SELF_SHADOW +#endif + +//Program// +void main() { + vec4 albedo = texture2D(texture, texCoord) * color; + #ifdef GENERATED_NORMALS + vec3 colorP = albedo.rgb; + #endif + vec3 newNormal = normal, geoNormal = normal, shadowMult = vec3(1.0); + float smoothness = 0.0; + vec3 lightAlbedo = vec3(0.0); + + #ifdef ADVANCED_MATERIALS + vec2 newCoord = vTexCoord.st * absMidCoordPos + signMidCoordPos; + float surfaceDepth = 1.0; + float parallaxFade = clamp((dist - PARALLAX_DISTANCE) / 32.0, 0.0, 1.0); + + #if MC_VERSION >= 11300 + float skipAdvMat = float(blockEntityId == 10400); + #else + float skipAdvMat = float(blockEntityId == 63 || blockEntityId == 68); + #endif + + #ifdef PARALLAX + if (skipAdvMat < 0.5) { + newCoord = GetParallaxCoord(texCoord, parallaxFade, surfaceDepth); + albedo = texture2DGradARB(texture, newCoord, dcdx, dcdy) * color; + } + #endif + + float skyOcclusion = 0.0; + vec3 fresnel3 = vec3(0.0); + #endif + + if(blockEntityId == 10401) albedo.a = 0.0; + + if (albedo.a > 0.001) { + vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0)); + + float metalness = 0.0; + float emission = float(blockEntityId == 10205); + float subsurface = 0.0; + float basicSubsurface = float(blockEntityId == 10109) * 0.5; + vec3 baseReflectance = vec3(0.04); + + emission *= pow(max(max(albedo.r, albedo.g), albedo.b), 4.0); + + vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z); + #ifdef TAA + vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z)); + #else + vec3 viewPos = ToNDC(screenPos); + #endif + vec3 worldPos = ToWorld(viewPos); + + #ifdef ADVANCED_MATERIALS + float f0 = 0.0, porosity = 0.5, ao = 1.0; + vec3 normalMap = vec3(0.0, 0.0, 1.0); + #ifdef GENERATED_NORMALS + #include "/lib/surface/materialHandling/blockEntityMaterials.glsl" + #else + GetMaterials(smoothness, metalness, f0, emission, subsurface, porosity, ao, normalMap, + newCoord, dcdx, dcdy); + #endif + + #ifdef NORMAL_SKIP + normalMap = vec3(0.0, 0.0, 1.0); + + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + if ((normalMap.x > -0.999 || normalMap.y > -0.999) && viewVector == viewVector) + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + #endif + + #ifdef DYNAMIC_HANDLIGHT + float heldLightValue = max(float(heldBlockLightValue), float(heldBlockLightValue2)); + float handlight = clamp((heldLightValue - 2.0 * length(viewPos)) / 15.0, 0.0, 0.9333); + lightmap.x = max(lightmap.x, handlight); + #endif + + #ifdef TOON_LIGHTMAP + lightmap = floor(lightmap * 14.999 * (0.75 + 0.25 * color.a)) / 14.0; + lightmap = clamp(lightmap, vec2(0.0), vec2(1.0)); + #endif + + albedo.rgb = pow(albedo.rgb, vec3(2.2)); + + #elif defined GENERATED_NORMALS + GenerateNormals(newNormal, albedo.rgb); + #endif + + #ifdef EMISSIVE_RECOLOR + if (blockEntityId == 10205 && dot(color.rgb, vec3(1.0)) > 2.66) { + float ec = length(albedo.rgb); + albedo.rgb = blocklightCol * (ec * 0.63 / BLOCKLIGHT_I) + ec * 0.07; + } + #endif + + #ifdef MULTICOLORED_BLOCKLIGHT + lightAlbedo = albedo.rgb + 0.00001; + lightAlbedo = sqrt(normalize(lightAlbedo) * emission); + #endif + + #ifdef WHITE_WORLD + albedo.rgb = vec3(0.35); + #endif + + float NoL = clamp(dot(newNormal, lightVec), 0.0, 1.0); + + float NoU = clamp(dot(newNormal, upVec), -1.0, 1.0); + float NoE = clamp(dot(newNormal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15; + vanillaDiffuse*= vanillaDiffuse; + + float parallaxShadow = 1.0; + #ifdef ADVANCED_MATERIALS + vec3 rawAlbedo = albedo.rgb * 0.999 + 0.001; + albedo.rgb *= ao; + + #ifdef REFLECTION_SPECULAR + albedo.rgb *= 1.0 - metalness * smoothness; + #endif + + float doParallax = 0.0; + #ifdef SELF_SHADOW + #ifdef OVERWORLD + doParallax = float(lightmap.y > 0.0 && NoL > 0.0); + #endif + #ifdef END + doParallax = float(NoL > 0.0); + #endif + + if (doParallax > 0.5) { + parallaxShadow = GetParallaxShadow(surfaceDepth, parallaxFade, newCoord, lightVec, + tbnMatrix); + } + #endif + #endif + + #ifdef MULTICOLORED_BLOCKLIGHT + blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos); + #endif + + vec3 shadow = vec3(0.0); + GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, color.a, NoL, + vanillaDiffuse, parallaxShadow, emission, subsurface, basicSubsurface); + + #ifdef ADVANCED_MATERIALS + skyOcclusion = lightmap.y; + + baseReflectance = mix(vec3(f0), rawAlbedo, metalness); + float fresnel = pow(clamp(1.0 + dot(newNormal, normalize(viewPos.xyz)), 0.0, 1.0), 5.0); + + fresnel3 = mix(baseReflectance, vec3(1.0), fresnel); + #if MATERIAL_FORMAT == 1 + if (f0 >= 0.9 && f0 < 1.0) { + baseReflectance = GetMetalCol(f0); + fresnel3 = ComplexFresnel(pow(fresnel, 0.2), f0); + #ifdef ALBEDO_METAL + fresnel3 *= rawAlbedo; + #endif + } + #endif + + float aoSquared = ao * ao; + shadow *= aoSquared; fresnel3 *= aoSquared; + albedo.rgb = albedo.rgb * (1.0 - fresnel3 * smoothness * smoothness * (1.0 - metalness)); + #endif + + #if (defined OVERWORLD || defined END) && (defined ADVANCED_MATERIALS || defined SPECULAR_HIGHLIGHT_ROUGH) + vec3 specularColor = GetSpecularColor(lightmap.y, metalness, baseReflectance); + + albedo.rgb += GetSpecularHighlight(newNormal, viewPos, smoothness, baseReflectance, + specularColor, shadow * vanillaDiffuse, color.a); + #endif + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR && defined REFLECTION_ROUGH + normalMap = mix(vec3(0.0, 0.0, 1.0), normalMap, smoothness); + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + if(blockEntityId == 10205) albedo.a = sqrt(albedo.a); + #endif + } + + if(blockEntityId == 10401) { + vec2 portalCoord = gl_FragCoord.xy / vec2(viewWidth, viewHeight); + portalCoord = (portalCoord - 0.5) * vec2(aspectRatio, 1.0); + + vec3 portColSqrt = vec3(END_R, END_G, END_B) / 255.0 * END_I; + vec3 portCol = portColSqrt * portColSqrt * 0.05; + vec2 wind = vec2(0, frametime * 0.025); + + float portal = texture2D(noisetex, portalCoord * 0.1 + wind * 0.05).r * 0.25 + 0.375; + + #ifdef END + portal *= 0.5; + #endif + + portal+= texture2D(texture, portalCoord * 0.5 + wind).r * 1.4; + portal+= texture2D(texture, portalCoord + wind + 0.15).r; + portal+= texture2D(texture, portalCoord * 2.0 + wind + 0.30).r * 0.7; + portal+= texture2D(texture, portalCoord * 4.0 + wind + 0.45).r * 0.5; + + albedo.rgb = portal * portal * portCol.rgb; + albedo.a = 1.0; + + lightAlbedo = normalize(albedo.rgb * 20.0 + 0.00001); + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + } + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; + + #ifdef MULTICOLORED_BLOCKLIGHT + /* DRAWBUFFERS:08 */ + gl_FragData[1] = vec4(lightAlbedo, 1.0); + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR + /* DRAWBUFFERS:08367 */ + gl_FragData[2] = vec4(smoothness, skyOcclusion, 0.0, 1.0); + gl_FragData[3] = vec4(EncodeNormal(newNormal), float(gl_FragCoord.z < 1.0), 1.0); + gl_FragData[4] = vec4(fresnel3, 1.0); + #endif + #else + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR + /* DRAWBUFFERS:0367 */ + gl_FragData[1] = vec4(smoothness, skyOcclusion, 0.0, 1.0); + gl_FragData[2] = vec4(EncodeNormal(newNormal), float(gl_FragCoord.z < 1.0), 1.0); + gl_FragData[3] = vec4(fresnel3, 1.0); + #endif + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +#ifdef ADVANCED_MATERIALS + varying float dist; + + varying vec2 signMidCoordPos; + flat varying vec2 absMidCoordPos; + + varying vec3 binormal, tangent; + varying vec3 viewVector; + + varying vec4 vTexCoord, vTexCoordAM; +#endif + +//Uniforms// +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float timeAngle; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferModelView, gbufferModelViewInverse; + +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth, viewHeight; +#endif + +//Attributes// +attribute vec4 mc_Entity; + +#ifdef ADVANCED_MATERIALS +attribute vec4 mc_midTexCoord; +attribute vec4 at_tangent; +#endif + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Includes// +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; + lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0)); + + normal = normalize(gl_NormalMatrix * gl_Normal); + + if (normal != normal) normal = -upVec; // Mod Fix: Fixes Better Nether Fireflies + + + #ifdef ADVANCED_MATERIALS + binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w); + tangent = normalize(gl_NormalMatrix * at_tangent.xyz); + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz; + + dist = length(gl_ModelViewMatrix * gl_Vertex); + + vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st; + vec2 texMinMidCoord = texCoord - midCoord; + + vTexCoordAM.pq = abs(texMinMidCoord) * 2; + vTexCoordAM.st = min(texCoord, midCoord - texMinMidCoord); + + vTexCoord.xy = sign(texMinMidCoord) * 0.5 + 0.5; + + signMidCoordPos = sign(texMinMidCoord) * (5 + 5); + absMidCoordPos = abs(texMinMidCoord); + + + #endif + + color = gl_Color; + + if(color.a < 0.1) color.a = 1.0; + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = normalize(gbufferModelView[0].xyz); + + #ifdef WORLD_CURVATURE + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + position.y -= WorldCurvature(position.xz); + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + #else + gl_Position = ftransform(); + #endif + + #ifdef TAA + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_clouds.glsl b/shaders/program/gbuffers_clouds.glsl new file mode 100644 index 0000000..af2567f --- /dev/null +++ b/shaders/program/gbuffers_clouds.glsl @@ -0,0 +1,155 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +//Uniforms// +uniform int isEyeInWater; +uniform int worldTime; + +uniform float rainStrength; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform sampler2D texture; + +uniform mat4 gbufferProjectionInverse; +uniform mat4 gbufferModelViewInverse; +uniform mat4 shadowProjection; +uniform mat4 shadowModelView; + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +//Includes// +#include "/lib/color/lightColor.glsl" +#include "/lib/util/spaceConversion.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +//Program// +void main() { + #if CLOUDS != 3 + discard; + #endif + + vec4 albedo = texture2D(texture, texCoord); + albedo.rgb = pow(albedo.rgb,vec3(2.2)); + + float NoU = clamp(dot(normal, upVec), -1.0, 1.0); + float NoE = clamp(dot(normal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + (-0.333 + abs(NoE)) * (1.0 - abs(NoU)) * 0.15; + vanillaDiffuse = mix(vanillaDiffuse, 0.75, rainStrength * 0.75); + vanillaDiffuse*= vanillaDiffuse; + + albedo.rgb *= lightCol * vanillaDiffuse * CLOUD_BRIGHTNESS; + albedo.rgb *= mix(0.4 - 0.25 * rainStrength, 0.5 - 0.425 * rainStrength, sunVisibility); + + vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z); + #ifdef TAA + vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z)); + #else + vec3 viewPos = ToNDC(screenPos); + #endif + vec3 worldPos = ToWorld(viewPos); + + #if FOG_VANILLA_CLOUD > 0 + #if FOG_VANILLA_CLOUD == 1 + float vanillaFogEnd = 4.0; + #elif FOG_VANILLA_CLOUD == 2 + float vanillaFogEnd = 2.0; + #else + float vanillaFogEnd = 1.0; + #endif + + float worldDistance = length(worldPos.xz) / 256.0; + float vanillaFog = 1.0 - smoothstep(0.5, vanillaFogEnd, worldDistance); + + albedo.a *= color.a * vanillaFog; + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; + + #ifdef ADVANCED_MATERIALS + /* DRAWBUFFERS:0367 */ + gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0); + gl_FragData[2] = vec4(0.0, 0.0, 0.0, 1.0); + gl_FragData[3] = vec4(0.0, 0.0, 0.0, 1.0); + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +//Uniforms// +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth; +uniform float viewHeight; +#include "/lib/util/jitter.glsl" +#endif + +uniform float timeAngle; + +uniform mat4 gbufferModelView; + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + color = gl_Color; + + normal = normalize(gl_NormalMatrix * gl_Normal); + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = normalize(gbufferModelView[0].xyz); + + gl_Position = ftransform(); + + #ifdef TAA + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_damagedblock.glsl b/shaders/program/gbuffers_damagedblock.glsl new file mode 100644 index 0000000..305d22b --- /dev/null +++ b/shaders/program/gbuffers_damagedblock.glsl @@ -0,0 +1,79 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +//Uniforms// +uniform sampler2D texture; + +//Program// +void main() { + //Texture + vec4 albedo = texture2D(texture, texCoord); + + #if ALPHA_BLEND == 1 + albedo.rgb = pow(albedo.rgb,vec3(2.2)) * 2.25; + #endif + + #ifdef WHITE_WORLD + albedo.a = 0.0; + #endif + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +//Uniforms// +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth; +uniform float viewHeight; +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +uniform mat4 gbufferModelView; +uniform mat4 gbufferModelViewInverse; +#endif + +//Includes// +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + #ifdef WORLD_CURVATURE + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + position.y -= WorldCurvature(position.xz); + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + #else + gl_Position = ftransform(); + #endif + + #ifdef TAA + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_entities.glsl b/shaders/program/gbuffers_entities.glsl new file mode 100644 index 0000000..4b49c6f --- /dev/null +++ b/shaders/program/gbuffers_entities.glsl @@ -0,0 +1,459 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +#ifdef ADVANCED_MATERIALS +varying float dist; + +varying vec3 binormal, tangent; +varying vec3 viewVector; + +varying vec4 vTexCoord, vTexCoordAM; +#endif + +//Uniforms// +uniform int entityId; +uniform int frameCounter; +uniform int isEyeInWater; +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float nightVision; +uniform float rainStrength; +uniform float screenBrightness; +uniform float shadowFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; + +uniform vec4 entityColor; + +uniform mat4 gbufferProjectionInverse; +uniform mat4 gbufferModelViewInverse; +uniform mat4 shadowProjection; +uniform mat4 shadowModelView; + +uniform sampler2D texture; +uniform sampler2D noisetex; + +#ifdef ADVANCED_MATERIALS +uniform ivec2 atlasSize; + +uniform sampler2D specular; +uniform sampler2D normals; +#endif + +#ifdef DYNAMIC_HANDLIGHT +uniform int heldBlockLightValue; +uniform int heldBlockLightValue2; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +uniform mat4 gbufferPreviousModelView; +uniform mat4 gbufferPreviousProjection; +uniform vec3 previousCameraPosition; + +uniform sampler2D colortex9; +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +#ifdef ADVANCED_MATERIALS +vec2 dcdx = dFdx(texCoord); +vec2 dcdy = dFdy(texCoord); +#endif + +vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +//Includes// +#include "/lib/color/blocklightColor.glsl" +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/specularColor.glsl" +#include "/lib/util/spaceConversion.glsl" +#include "/lib/lighting/forwardLighting.glsl" +#include "/lib/surface/ggx.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef ADVANCED_MATERIALS +#include "/lib/util/encode.glsl" +#include "/lib/reflections/complexFresnel.glsl" +#include "/lib/surface/materialGbuffers.glsl" +#include "/lib/surface/parallax.glsl" +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +#include "/lib/lighting/coloredBlocklight.glsl" +#endif + +#ifdef NORMAL_SKIP +#undef PARALLAX +#undef SELF_SHADOW +#endif + +#if MC_VERSION <= 10710 +#undef PARALLAX +#undef SELF_SHADOW +#endif + +//Program// +void main() { + vec4 albedo = texture2D(texture, texCoord) * color; + vec3 newNormal = normal; + float smoothness = 0.0; + + #ifdef ADVANCED_MATERIALS + vec2 newCoord = vTexCoord.st * vTexCoordAM.pq + vTexCoordAM.st; + float surfaceDepth = 1.0; + float parallaxFade = clamp((dist - PARALLAX_DISTANCE) / 32.0, 0.0, 1.0); + float skipAdvMat = float(entityId == 10100); + + #ifdef PARALLAX + if (skipAdvMat < 0.5) { + newCoord = GetParallaxCoord(texCoord, parallaxFade, surfaceDepth); + albedo = texture2DGradARB(texture, newCoord, dcdx, dcdy) * color; + } + #endif + + float skyOcclusion = 0.0; + vec3 fresnel3 = vec3(0.0); + #endif + + #ifdef ENTITY_FLASH + albedo.rgb = mix(albedo.rgb, entityColor.rgb, entityColor.a); + #endif + + float lightningBolt = float(entityId == 10101); + if(lightningBolt > 0.5) { + #ifdef OVERWORLD + albedo.rgb = weatherCol.rgb / weatherCol.a; + albedo.rgb *= albedo.rgb * albedo.rgb; + #endif + #ifdef NETHER + albedo.rgb = sqrt(netherCol.rgb / netherCol.a); + #endif + #ifdef END + albedo.rgb = endCol.rgb / endCol.a; + #endif + albedo.a = 1.0; + } + + if (albedo.a > 0.001 && lightningBolt < 0.5) { + vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0)); + + float metalness = 0.0; + float emission = float(entityColor.a > 0.05) * 0.125; + float subsurface = 0.0; + vec3 baseReflectance = vec3(0.04); + + emission *= dot(albedo.rgb, albedo.rgb) * 0.333; + + #ifndef ENTITY_FLASH + emission = 0.0; + #endif + + vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z); + #if defined TAA && !defined TAA_SELECTIVE + vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z)); + #else + vec3 viewPos = ToNDC(screenPos); + #endif + vec3 worldPos = ToWorld(viewPos); + + #ifdef ADVANCED_MATERIALS + float f0 = 0.0, porosity = 0.5, ao = 1.0; + vec3 normalMap = vec3(0.0, 0.0, 1.0); + + GetMaterials(smoothness, metalness, f0, emission, subsurface, porosity, ao, normalMap, + newCoord, dcdx, dcdy); + + #ifdef NORMAL_SKIP + normalMap = vec3(0.0, 0.0, 1.0); + #endif + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + if ((normalMap.x > -0.999 || normalMap.y > -0.999) && viewVector == viewVector && skipAdvMat < 0.5) + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + #endif + + #ifdef DYNAMIC_HANDLIGHT + float heldLightValue = max(float(heldBlockLightValue), float(heldBlockLightValue2)); + float handlight = clamp((heldLightValue - 2.0 * length(viewPos)) / 15.0, 0.0, 0.9333); + lightmap.x = max(lightmap.x, handlight); + #endif + + #ifdef TOON_LIGHTMAP + lightmap = floor(lightmap * 14.999 * (0.75 + 0.25 * color.a)) / 14.0; + lightmap = clamp(lightmap, vec2(0.0), vec2(1.0)); + #endif + + albedo.rgb = pow(albedo.rgb, vec3(2.2)); + + #ifdef WHITE_WORLD + albedo.rgb = vec3(0.35); + #endif + + float NoL = clamp(dot(newNormal, lightVec), 0.0, 1.0); + + float NoU = clamp(dot(newNormal, upVec), -1.0, 1.0); + float NoE = clamp(dot(newNormal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15; + vanillaDiffuse*= vanillaDiffuse; + + float parallaxShadow = 1.0; + #ifdef ADVANCED_MATERIALS + vec3 rawAlbedo = albedo.rgb * 0.999 + 0.001; + albedo.rgb *= ao; + + #ifdef REFLECTION_SPECULAR + albedo.rgb *= 1.0 - metalness * smoothness; + #endif + + float doParallax = 0.0; + #ifdef SELF_SHADOW + #ifdef OVERWORLD + doParallax = float(lightmap.y > 0.0 && NoL > 0.0); + #endif + #ifdef END + doParallax = float(NoL > 0.0); + #endif + + if (doParallax > 0.5) { + parallaxShadow = GetParallaxShadow(surfaceDepth, parallaxFade, newCoord, lightVec, + tbnMatrix); + } + #endif + #endif + + #ifdef MULTICOLORED_BLOCKLIGHT + blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos); + #endif + + vec3 shadow = vec3(0.0); + GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL, + vanillaDiffuse, parallaxShadow, emission, subsurface, 0.0); + + #ifdef ADVANCED_MATERIALS + skyOcclusion = lightmap.y; + + baseReflectance = mix(vec3(f0), rawAlbedo, metalness); + float fresnel = pow(clamp(1.0 + dot(newNormal, normalize(viewPos.xyz)), 0.0, 1.0), 5.0); + + fresnel3 = mix(baseReflectance, vec3(1.0), fresnel); + #if MATERIAL_FORMAT == 1 + if (f0 >= 0.9 && f0 < 1.0) { + baseReflectance = GetMetalCol(f0); + fresnel3 = ComplexFresnel(pow(fresnel, 0.2), f0); + #ifdef ALBEDO_METAL + fresnel3 *= rawAlbedo; + #endif + } + #endif + + float aoSquared = ao * ao; + shadow *= aoSquared; fresnel3 *= aoSquared; + albedo.rgb = albedo.rgb * (1.0 - fresnel3 * smoothness * smoothness * (1.0 - metalness)); + #endif + + #if (defined OVERWORLD || defined END) && (defined ADVANCED_MATERIALS || defined SPECULAR_HIGHLIGHT_ROUGH) + vec3 specularColor = GetSpecularColor(lightmap.y, metalness, baseReflectance); + + albedo.rgb += GetSpecularHighlight(newNormal, viewPos, smoothness, baseReflectance, + specularColor, shadow * vanillaDiffuse, 1.0); + #endif + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR && defined REFLECTION_ROUGH + normalMap = mix(vec3(0.0, 0.0, 1.0), normalMap, smoothness); + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + } + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; + #ifdef MULTICOLORED_BLOCKLIGHT + /* DRAWBUFFERS:08 */ + gl_FragData[1] = vec4(0.0,0.0,0.0,1.0); + + #if defined TAA_SELECTIVE && !(defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR) + /* DRAWBUFFERS:083 */ + gl_FragData[2] = vec4(0.0, 0.0, 0.25, 1.0); + #endif + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR + /* DRAWBUFFERS:08367 */ + gl_FragData[2] = vec4(smoothness, skyOcclusion, 0.25, 1.0); + gl_FragData[3] = vec4(EncodeNormal(newNormal), float(gl_FragCoord.z < 1.0), 1.0); + gl_FragData[4] = vec4(fresnel3, 1.0); + #endif + #else + #if defined TAA_SELECTIVE && !(defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR) + /* DRAWBUFFERS:03 */ + gl_FragData[1] = vec4(0.0, 0.0, 0.25, 1.0); + #endif + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR + /* DRAWBUFFERS:0367 */ + gl_FragData[1] = vec4(smoothness, skyOcclusion, 0.25, 1.0); + gl_FragData[2] = vec4(EncodeNormal(newNormal), float(gl_FragCoord.z < 1.0), 1.0); + gl_FragData[3] = vec4(fresnel3, 1.0); + #endif + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +#ifdef ADVANCED_MATERIALS +varying float dist; + +varying vec3 binormal, tangent; +varying vec3 viewVector; + +varying vec4 vTexCoord, vTexCoordAM; +#endif + +//Uniforms// +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float timeAngle; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferModelView, gbufferModelViewInverse; + +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth, viewHeight; +#endif + +//Attributes// +attribute vec4 mc_Entity; + +#ifdef ADVANCED_MATERIALS +attribute vec4 mc_midTexCoord; +attribute vec4 at_tangent; +#endif + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Includes// +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; + lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0)); + + normal = normalize(gl_NormalMatrix * gl_Normal); + + #ifdef ADVANCED_MATERIALS + tangent = normalize(gl_NormalMatrix * at_tangent.xyz); + binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w); + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz; + + dist = length(gl_ModelViewMatrix * gl_Vertex); + + vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st; + vec2 texMinMidCoord = texCoord - midCoord; + + vTexCoordAM.pq = abs(texMinMidCoord) * 2; + vTexCoordAM.st = min(texCoord, midCoord - texMinMidCoord); + + vTexCoord.xy = sign(texMinMidCoord) * 0.5 + 0.5; + #endif + + color = gl_Color; + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = normalize(gbufferModelView[0].xyz); + + #ifdef WORLD_CURVATURE + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + position.y -= WorldCurvature(position.xz); + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + #else + gl_Position = ftransform(); + #endif + + #if defined TAA && !defined TAA_SELECTIVE + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_entities_glowing.glsl b/shaders/program/gbuffers_entities_glowing.glsl new file mode 100644 index 0000000..ce9efb4 --- /dev/null +++ b/shaders/program/gbuffers_entities_glowing.glsl @@ -0,0 +1,454 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +#ifdef ADVANCED_MATERIALS +varying float dist; + +varying vec3 binormal, tangent; +varying vec3 viewVector; + +varying vec4 vTexCoord, vTexCoordAM; +#endif + +//Uniforms// +uniform int entityId; +uniform int frameCounter; +uniform int isEyeInWater; +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float nightVision; +uniform float rainStrength; +uniform float screenBrightness; +uniform float shadowFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; + +uniform vec4 entityColor; + +uniform mat4 gbufferProjectionInverse; +uniform mat4 gbufferModelViewInverse; +uniform mat4 shadowProjection; +uniform mat4 shadowModelView; + +uniform sampler2D texture; +uniform sampler2D noisetex; + +#ifdef ADVANCED_MATERIALS +uniform ivec2 atlasSize; + +uniform sampler2D specular; +uniform sampler2D normals; +#endif + +#ifdef DYNAMIC_HANDLIGHT +uniform int heldBlockLightValue; +uniform int heldBlockLightValue2; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +uniform mat4 gbufferPreviousModelView; +uniform mat4 gbufferPreviousProjection; +uniform vec3 previousCameraPosition; + +uniform sampler2D colortex9; +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +#ifdef ADVANCED_MATERIALS +vec2 dcdx = dFdx(texCoord); +vec2 dcdy = dFdy(texCoord); +#endif + +vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +//Includes// +#include "/lib/color/blocklightColor.glsl" +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/specularColor.glsl" +#include "/lib/util/spaceConversion.glsl" +#include "/lib/lighting/forwardLighting.glsl" +#include "/lib/surface/ggx.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef ADVANCED_MATERIALS +#include "/lib/util/encode.glsl" +#include "/lib/reflections/complexFresnel.glsl" +#include "/lib/surface/materialGbuffers.glsl" +#include "/lib/surface/parallax.glsl" +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +#include "/lib/lighting/coloredBlocklight.glsl" +#endif + +#ifdef NORMAL_SKIP +#undef PARALLAX +#undef SELF_SHADOW +#endif + +#if MC_VERSION <= 10710 +#undef PARALLAX +#undef SELF_SHADOW +#endif + +//Program// +void main() { + vec4 albedo = texture2D(texture, texCoord) * color; + vec3 newNormal = normal; + float smoothness = 0.0; + + #ifdef ADVANCED_MATERIALS + vec2 newCoord = vTexCoord.st * vTexCoordAM.pq + vTexCoordAM.st; + float surfaceDepth = 1.0; + float parallaxFade = clamp((dist - PARALLAX_DISTANCE) / 32.0, 0.0, 1.0); + float skipAdvMat = float(entityId == 10100); + + #ifdef PARALLAX + if (skipAdvMat < 0.5) { + newCoord = GetParallaxCoord(texCoord, parallaxFade, surfaceDepth); + albedo = texture2DGradARB(texture, newCoord, dcdx, dcdy) * color; + } + #endif + + float skyOcclusion = 0.0; + vec3 fresnel3 = vec3(0.0); + #endif + + #ifdef ENTITY_FLASH + albedo.rgb = mix(albedo.rgb, entityColor.rgb, entityColor.a); + #endif + + float lightningBolt = float(entityId == 10101); + if(lightningBolt > 0.5) { + #ifdef OVERWORLD + albedo.rgb = weatherCol.rgb / weatherCol.a; + albedo.rgb *= albedo.rgb * albedo.rgb; + #endif + #ifdef NETHER + albedo.rgb = sqrt(netherCol.rgb / netherCol.a); + #endif + #ifdef END + albedo.rgb = endCol.rgb / endCol.a; + #endif + albedo.a = 1.0; + } + + if (albedo.a > 0.001 && lightningBolt < 0.5) { + vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0)); + + float metalness = 0.0; + float emission = float(entityColor.a > 0.05); + float subsurface = 0.0; + vec3 baseReflectance = vec3(0.04); + + emission *= pow(max(max(albedo.r, albedo.g), albedo.b), 4.0) * 0.125; + + #ifndef ENTITY_FLASH + emission = 0.0; + #endif + + float correctedZ = (gl_FragCoord.z * 2.0 - 1.0) * 100.0 * 0.5 + 0.5; + vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), correctedZ); + #if defined TAA && !defined TAA_SELECTIVE + vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z)); + #else + vec3 viewPos = ToNDC(screenPos); + #endif + vec3 worldPos = ToWorld(viewPos); + + #ifdef ADVANCED_MATERIALS + float f0 = 0.0, porosity = 0.5, ao = 1.0; + vec3 normalMap = vec3(0.0, 0.0, 1.0); + + GetMaterials(smoothness, metalness, f0, emission, subsurface, porosity, ao, normalMap, + newCoord, dcdx, dcdy); + + #ifdef NORMAL_SKIP + normalMap = vec3(0.0, 0.0, 1.0); + #endif + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + if ((normalMap.x > -0.999 || normalMap.y > -0.999) && viewVector == viewVector && skipAdvMat < 0.5) + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + #endif + + #ifdef DYNAMIC_HANDLIGHT + float heldLightValue = max(float(heldBlockLightValue), float(heldBlockLightValue2)); + float handlight = clamp((heldLightValue - 2.0 * length(viewPos)) / 15.0, 0.0, 0.9333); + lightmap.x = max(lightmap.x, handlight); + #endif + + #ifdef TOON_LIGHTMAP + lightmap = floor(lightmap * 14.999 * (0.75 + 0.25 * color.a)) / 14.0; + lightmap = clamp(lightmap, vec2(0.0), vec2(1.0)); + #endif + + albedo.rgb = pow(albedo.rgb, vec3(2.2)); + + #ifdef WHITE_WORLD + albedo.rgb = vec3(0.35); + #endif + + float NoL = clamp(dot(newNormal, lightVec), 0.0, 1.0); + + float NoU = clamp(dot(newNormal, upVec), -1.0, 1.0); + float NoE = clamp(dot(newNormal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15; + vanillaDiffuse*= vanillaDiffuse; + + float parallaxShadow = 1.0; + #ifdef ADVANCED_MATERIALS + vec3 rawAlbedo = albedo.rgb * 0.999 + 0.001; + albedo.rgb *= ao; + + #ifdef REFLECTION_SPECULAR + albedo.rgb *= 1.0 - metalness * smoothness; + #endif + + float doParallax = 0.0; + #ifdef SELF_SHADOW + #ifdef OVERWORLD + doParallax = float(lightmap.y > 0.0 && NoL > 0.0); + #endif + #ifdef END + doParallax = float(NoL > 0.0); + #endif + + if (doParallax > 0.5) { + parallaxShadow = GetParallaxShadow(surfaceDepth, parallaxFade, newCoord, lightVec, + tbnMatrix); + } + #endif + #endif + + #ifdef MULTICOLORED_BLOCKLIGHT + blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos); + #endif + + vec3 shadow = vec3(0.0); + GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL, + vanillaDiffuse, parallaxShadow, emission, subsurface, 0.0); + + #ifdef ADVANCED_MATERIALS + skyOcclusion = lightmap.y; + + baseReflectance = mix(vec3(f0), rawAlbedo, metalness); + float fresnel = pow(clamp(1.0 + dot(newNormal, normalize(viewPos.xyz)), 0.0, 1.0), 5.0); + + fresnel3 = mix(baseReflectance, vec3(1.0), fresnel); + #if MATERIAL_FORMAT == 1 + if (f0 >= 0.9 && f0 < 1.0) { + baseReflectance = GetMetalCol(f0); + fresnel3 = ComplexFresnel(pow(fresnel, 0.2), f0); + #ifdef ALBEDO_METAL + fresnel3 *= rawAlbedo; + #endif + } + #endif + + float aoSquared = ao * ao; + shadow *= aoSquared; fresnel3 *= aoSquared; + albedo.rgb = albedo.rgb * (1.0 - fresnel3 * smoothness * smoothness * (1.0 - metalness)); + #endif + + #if (defined OVERWORLD || defined END) && (defined ADVANCED_MATERIALS || defined SPECULAR_HIGHLIGHT_ROUGH) + vec3 specularColor = GetSpecularColor(lightmap.y, metalness, baseReflectance); + + albedo.rgb += GetSpecularHighlight(newNormal, viewPos, smoothness, baseReflectance, + specularColor, shadow * vanillaDiffuse, 1.0); + #endif + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR && defined REFLECTION_ROUGH + normalMap = mix(vec3(0.0, 0.0, 1.0), normalMap, smoothness); + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + } + + /* DRAWBUFFERS:03 */ + gl_FragData[0] = albedo; + gl_FragData[1] = vec4(0.0, 0.0, 1.0, 1.0); + + #ifdef MULTICOLORED_BLOCKLIGHT + /* DRAWBUFFERS:038 */ + gl_FragData[2] = vec4(0.0,0.0,0.0,1.0); + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR + /* DRAWBUFFERS:03867 */ + gl_FragData[1] = vec4(smoothness, skyOcclusion, 1.0, 1.0); + gl_FragData[3] = vec4(EncodeNormal(newNormal), float(gl_FragCoord.z < 1.0), 1.0); + gl_FragData[4] = vec4(fresnel3, 1.0); + #endif + #else + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR + /* DRAWBUFFERS:0367 */ + gl_FragData[1] = vec4(smoothness, skyOcclusion, 1.0, 1.0); + gl_FragData[2] = vec4(EncodeNormal(newNormal), float(gl_FragCoord.z < 1.0), 1.0); + gl_FragData[3] = vec4(fresnel3, 1.0); + #endif + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +#ifdef ADVANCED_MATERIALS +varying float dist; + +varying vec3 binormal, tangent; +varying vec3 viewVector; + +varying vec4 vTexCoord, vTexCoordAM; +#endif + +//Uniforms// +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float timeAngle; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferModelView, gbufferModelViewInverse; + +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth, viewHeight; +#endif + +//Attributes// +attribute vec4 mc_Entity; + +#ifdef ADVANCED_MATERIALS +attribute vec4 mc_midTexCoord; +attribute vec4 at_tangent; +#endif + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Includes// +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; + lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0)); + + normal = normalize(gl_NormalMatrix * gl_Normal); + + #ifdef ADVANCED_MATERIALS + tangent = normalize(gl_NormalMatrix * at_tangent.xyz); + binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w); + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz; + + dist = length(gl_ModelViewMatrix * gl_Vertex); + + vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st; + vec2 texMinMidCoord = texCoord - midCoord; + + vTexCoordAM.pq = abs(texMinMidCoord) * 2; + vTexCoordAM.st = min(texCoord, midCoord - texMinMidCoord); + + vTexCoord.xy = sign(texMinMidCoord) * 0.5 + 0.5; + #endif + + color = gl_Color; + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = normalize(gbufferModelView[0].xyz); + + #ifdef WORLD_CURVATURE + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + position.y -= WorldCurvature(position.xz); + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + #else + gl_Position = ftransform(); + #endif + + gl_Position.z *= 0.01; + + #if defined TAA && !defined TAA_SELECTIVE + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_hand.glsl b/shaders/program/gbuffers_hand.glsl new file mode 100644 index 0000000..6a74e4d --- /dev/null +++ b/shaders/program/gbuffers_hand.glsl @@ -0,0 +1,467 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying float isMainHand; + +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +#ifdef ADVANCED_MATERIALS +varying float dist; + +varying vec3 binormal, tangent; +varying vec3 viewVector; + +varying vec4 vTexCoord, vTexCoordAM; +#endif + +//Uniforms// +uniform int frameCounter; +uniform int heldItemId, heldItemId2; +uniform int isEyeInWater; +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float nightVision; +uniform float rainStrength; +uniform float screenBrightness; +uniform float shadowFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferProjectionInverse; +uniform mat4 gbufferModelViewInverse; +uniform mat4 shadowProjection; +uniform mat4 shadowModelView; + +uniform sampler2D texture; +uniform sampler2D noisetex; + +#ifdef ADVANCED_MATERIALS +uniform ivec2 atlasSize; + +uniform sampler2D specular; +uniform sampler2D normals; +#endif + +#ifdef DYNAMIC_HANDLIGHT +uniform int heldBlockLightValue; +uniform int heldBlockLightValue2; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +uniform mat4 gbufferPreviousModelView; +uniform mat4 gbufferPreviousProjection; +uniform vec3 previousCameraPosition; + +uniform sampler2D colortex9; +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +#ifdef ADVANCED_MATERIALS +vec2 dcdx = dFdx(texCoord); +vec2 dcdy = dFdy(texCoord); +#endif + +vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +float GetHandItem(int id) { + return float((heldItemId == id && isMainHand > 0.5) || (heldItemId2 == id && isMainHand < 0.5)); +} + +//Includes// +#include "/lib/color/blocklightColor.glsl" +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/specularColor.glsl" +#include "/lib/util/spaceConversion.glsl" +#include "/lib/lighting/forwardLighting.glsl" +#include "/lib/surface/ggx.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef ADVANCED_MATERIALS +#include "/lib/util/encode.glsl" +#include "/lib/reflections/complexFresnel.glsl" +#include "/lib/surface/materialGbuffers.glsl" +#include "/lib/surface/parallax.glsl" +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +#include "/lib/lighting/coloredBlocklight.glsl" +#endif + +#ifdef NORMAL_SKIP +#undef PARALLAX +#undef SELF_SHADOW +#endif + +//Program// +void main() { + vec4 albedo = texture2D(texture, texCoord) * color; + vec3 newNormal = normal; + float smoothness = 0.0; + vec3 lightAlbedo = vec3(0.0); + + #ifdef ADVANCED_MATERIALS + vec2 newCoord = vTexCoord.st * vTexCoordAM.pq + vTexCoordAM.st; + float surfaceDepth = 1.0; + float skipAdvMat = float(heldItemId == 358 || (heldItemId2 == 358 && isMainHand < 0.5)); + + #ifdef PARALLAX + if (skipAdvMat < 0.5) { + newCoord = GetParallaxCoord(texCoord, 0.0, surfaceDepth); + albedo = texture2DGradARB(texture, newCoord, dcdx, dcdy) * color; + } + #endif + + float skyOcclusion = 0.0; + vec3 fresnel3 = vec3(0.0); + #endif + + if (albedo.a > 0.001) { + #ifdef TOON_LIGHTMAP + vec2 lightmap = floor(lmCoord * 14.999 * (0.75 + 0.25 * color.a)) / 14.0; + lightmap = clamp(lightmap, vec2(0.0), vec2(1.0)); + #else + vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0)); + #endif + lightmap.x = max(lightmap.x, GetHandItem(213)); + + float emissive = (GetHandItem(50) + GetHandItem(89) + GetHandItem(213)); + + float metalness = 0.0; + float emission = emissive; + float subsurface = 0.0; + vec3 baseReflectance = vec3(0.04); + + emission *= pow(max(max(albedo.r, albedo.g), albedo.b), 4.0) * 0.25; + + vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z + 0.38); + #if defined TAA && !defined TAA_SELECTIVE + vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z)); + #else + vec3 viewPos = ToNDC(screenPos); + #endif + vec3 worldPos = ToWorld(viewPos); + + #ifdef ADVANCED_MATERIALS + float f0 = 0.0, porosity = 0.5, ao = 1.0; + vec3 normalMap = vec3(0.0, 0.0, 1.0); + + GetMaterials(smoothness, metalness, f0, emission, subsurface, porosity, ao, normalMap, + newCoord, dcdx, dcdy); + + #ifdef NORMAL_SKIP + normalMap = vec3(0.0, 0.0, 1.0); + #endif + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + if ((normalMap.x > -0.999 || normalMap.y > -0.999) && viewVector == viewVector) + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + #endif + + #ifdef DYNAMIC_HANDLIGHT + float heldLightValue = max(float(heldBlockLightValue), float(heldBlockLightValue2)); + float handlight = clamp(heldLightValue / 15.0, 0.0, 0.9333); + lightmap.x = max(lightmap.x, handlight); + #endif + + #ifdef TOON_LIGHTMAP + lightmap = floor(lightmap * 14.999 * (0.75 + 0.25 * color.a)) / 14.0; + lightmap = clamp(lightmap, vec2(0.0), vec2(1.0)); + #endif + + albedo.rgb = pow(albedo.rgb, vec3(2.2)); + + float doRecolor = GetHandItem(89) + GetHandItem(213); + + float ec = GetLuminance(albedo.rgb) * 1.7; + #ifdef EMISSIVE_RECOLOR + if (doRecolor > 0.5) { + albedo.rgb = blocklightCol * pow(ec, 1.5) / (BLOCKLIGHT_I * BLOCKLIGHT_I); + albedo.rgb /= 0.7 * albedo.rgb + 0.7; + } + #endif + + #ifdef MULTICOLORED_BLOCKLIGHT + lightAlbedo = albedo.rgb + 0.00001; + lightAlbedo = sqrt(normalize(lightAlbedo) * emission * emissive); + #endif + + #ifdef WHITE_WORLD + albedo.rgb = vec3(0.35); + #endif + + float NoL = clamp(dot(newNormal, lightVec), 0.0, 1.0); + + float NoU = clamp(dot(newNormal, upVec), -1.0, 1.0); + float NoE = clamp(dot(newNormal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15; + vanillaDiffuse*= vanillaDiffuse; + + float parallaxShadow = 1.0; + #ifdef ADVANCED_MATERIALS + vec3 rawAlbedo = albedo.rgb * 0.999 + 0.001; + albedo.rgb *= ao * ao; + + #ifdef REFLECTION_SPECULAR + albedo.rgb *= 1.0 - metalness * smoothness; + #endif + + float doParallax = 0.0; + #ifdef SELF_SHADOW + #ifdef OVERWORLD + doParallax = float(lightmap.y > 0.0 && NoL > 0.0); + #endif + #ifdef END + doParallax = float(NoL > 0.0); + #endif + + if (doParallax > 0.5 && skipAdvMat < 0.5) { + parallaxShadow = GetParallaxShadow(surfaceDepth, 0.0, newCoord, lightVec, tbnMatrix); + } + #endif + #endif + + #ifdef MULTICOLORED_BLOCKLIGHT + blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos); + #endif + + vec3 shadow = vec3(0.0); + GetLighting(albedo.rgb, shadow, viewPos, worldPos, vec3(0.0), lightmap, 1.0, NoL, + vanillaDiffuse, parallaxShadow, emission, subsurface, 0.0); + + #ifdef ADVANCED_MATERIALS + skyOcclusion = lightmap.y; + + baseReflectance = mix(vec3(f0), rawAlbedo, metalness); + float fresnel = pow(clamp(1.0 + dot(newNormal, normalize(viewPos.xyz)), 0.0, 1.0), 5.0); + + fresnel3 = mix(baseReflectance, vec3(1.0), fresnel); + #if MATERIAL_FORMAT == 1 + if (f0 >= 0.9 && f0 < 1.0) { + baseReflectance = GetMetalCol(f0); + fresnel3 = ComplexFresnel(pow(fresnel, 0.2), f0); + #ifdef ALBEDO_METAL + fresnel3 *= rawAlbedo; + #endif + } + #endif + + float aoSquared = ao * ao; + shadow *= aoSquared; fresnel3 *= aoSquared; + albedo.rgb = albedo.rgb * (1.0 - fresnel3 * smoothness * smoothness * (1.0 - metalness)); + #endif + + #if (defined OVERWORLD || defined END) && (defined ADVANCED_MATERIALS || defined SPECULAR_HIGHLIGHT_ROUGH) + vec3 specularColor = GetSpecularColor(lightmap.y, metalness, baseReflectance); + + albedo.rgb += GetSpecularHighlight(newNormal, viewPos, smoothness, baseReflectance, + specularColor, shadow * vanillaDiffuse, 1.0); + #endif + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR && defined REFLECTION_ROUGH + normalMap = mix(vec3(0.0, 0.0, 1.0), normalMap, smoothness); + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + } + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; + #ifdef MULTICOLORED_BLOCKLIGHT + /* DRAWBUFFERS:08 */ + gl_FragData[1] = vec4(lightAlbedo,1.0); + + #if defined TAA_SELECTIVE && !(defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR) + /* DRAWBUFFERS:083 */ + gl_FragData[2] = vec4(0.0, 0.0, 0.25, 1.0); + #endif + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR + /* DRAWBUFFERS:08367 */ + gl_FragData[2] = vec4(smoothness, skyOcclusion, 0.25, 1.0); + gl_FragData[3] = vec4(EncodeNormal(newNormal), float(gl_FragCoord.z < 1.0), 1.0); + gl_FragData[4] = vec4(fresnel3, 1.0); + #endif + #else + #if defined TAA_SELECTIVE && !(defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR) + /* DRAWBUFFERS:03 */ + gl_FragData[1] = vec4(0.0, 0.0, 0.25, 1.0); + #endif + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR + /* DRAWBUFFERS:0367 */ + gl_FragData[1] = vec4(smoothness, skyOcclusion, 0.25, 1.0); + gl_FragData[2] = vec4(EncodeNormal(newNormal), float(gl_FragCoord.z < 1.0), 1.0); + gl_FragData[3] = vec4(fresnel3, 1.0); + #endif + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying float isMainHand; + +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +#ifdef ADVANCED_MATERIALS +varying float dist; + +varying vec3 binormal, tangent; +varying vec3 viewVector; + +varying vec4 vTexCoord, vTexCoordAM; +#endif + +//Uniforms// +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float timeAngle; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferModelView, gbufferModelViewInverse; +uniform mat4 gbufferProjection; + +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth, viewHeight; +#endif + +//Attributes// +attribute vec4 mc_Entity; + +#ifdef ADVANCED_MATERIALS +attribute vec4 mc_midTexCoord; +attribute vec4 at_tangent; +#endif + + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Includes// +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; + lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0)); + + normal = normalize(gl_NormalMatrix * gl_Normal); + + #ifdef ADVANCED_MATERIALS + binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w); + tangent = normalize(gl_NormalMatrix * at_tangent.xyz); + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz; + + dist = length(gl_ModelViewMatrix * gl_Vertex); + + vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st; + vec2 texMinMidCoord = texCoord - midCoord; + + vTexCoordAM.pq = abs(texMinMidCoord) * 2; + vTexCoordAM.st = min(texCoord, midCoord - texMinMidCoord); + + vTexCoord.xy = sign(texMinMidCoord) * 0.5 + 0.5; + #endif + + color = gl_Color; + + isMainHand = float(gl_ModelViewMatrix[3][0] > 0.0); + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = normalize(gbufferModelView[0].xyz); + + #ifdef WORLD_CURVATURE + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + if (gl_ProjectionMatrix[2][2] < -0.5) position.y -= WorldCurvature(position.xz); + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + #else + gl_Position = ftransform(); + #endif + + #if defined TAA && !defined TAA_SELECTIVE + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif + + #if MC_VERSION >= 11500 + isMainHand = float(gl_Position.x > 0.0); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_skybasic.glsl b/shaders/program/gbuffers_skybasic.glsl new file mode 100644 index 0000000..4b5c883 --- /dev/null +++ b/shaders/program/gbuffers_skybasic.glsl @@ -0,0 +1,166 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying float star; + +varying vec3 upVec, sunVec; + +//Uniforms// +uniform int frameCounter; +uniform int isEyeInWater; +uniform int moonPhase; +uniform int worldTime; + +uniform float blindFactor, darknessFactor; +uniform float far, near; +uniform float frameTimeCounter; +uniform float nightVision; +uniform float rainStrength; +uniform float shadowFade, voidFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferModelView; +uniform mat4 gbufferModelViewInverse; +uniform mat4 gbufferProjectionInverse; + +uniform sampler2D noisetex; + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +vec3 lightVec = sunVec * (1.0 - 2.0 * float(timeAngle > 0.5325 && timeAngle < 0.9675)); + +vec3 moonPhaseVecs[8] = vec3[8]( + vec3( 0.0 , 0.0 , 1.0 ), + vec3( 0.0 , -0.89, 0.45), + vec3( 0.0 , -1.0 , 0.0 ), + vec3( 0.0 , -0.45, -0.89), + vec3( 0.0 , 0.0 , -1.0 ), + vec3( 0.0 , 0.45, -0.89), + vec3( 0.0 , 1.0 , 0.0 ), + vec3( 0.0 , 0.89, 0.45) +); + +vec2 moonDiffuse[8] = vec2[8]( + vec2( 0.0 , 0.0 ), + vec2(-0.125, 1.0 ), + vec2(-0.2 , 0.625), + vec2(-0.8 , 0.375), + vec2(-0.75 , -0.25 ), + vec2(-0.8 , 0.375), + vec2(-0.2 , 0.625), + vec2(-0.125, 1.0 ) +); + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +//Includes// +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/skyColor.glsl" +#include "/lib/util/dither.glsl" +#include "/lib/atmospherics/weatherDensity.glsl" +#include "/lib/atmospherics/clouds.glsl" +#include "/lib/atmospherics/sky.glsl" +#include "/lib/atmospherics/sunmoon.glsl" + +//Program// +void main() { + vec3 albedo = vec3(0.0); + + #if defined OVERWORLD && !defined SKY_DEFERRED + vec4 screenPos = vec4(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z, 1.0); + vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0); + viewPos /= viewPos.w; + + albedo = GetSkyColor(viewPos.xyz, false); + + #ifdef ROUND_SUN_MOON + vec3 lightMA = mix(lightMorning, lightEvening, mefade); + vec3 sunColor = mix(lightMA, sqrt(lightDay * lightMA * LIGHT_DI), timeBrightness); + vec3 moonColor = lightNight * 1.25; + + RoundSunMoon(albedo, viewPos.xyz, sunColor, moonColor); + #endif + + #ifdef STARS + if (moonVisibility > 0.0) DrawStars(albedo.rgb, viewPos.xyz); + #endif + + float dither = Bayer8(gl_FragCoord.xy); + + #ifdef AURORA + albedo.rgb += DrawAurora(viewPos.xyz, dither, 24); + #endif + + SunGlare(albedo, viewPos.xyz, lightCol); + + albedo.rgb *= 1.0 + nightVision; + #ifdef CLASSIC_EXPOSURE + albedo.rgb *= 4.0 - 3.0 * eBS; + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + albedo.rgb = albedo.rgb + dither / vec3(128.0); + #endif + #endif + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = vec4(albedo, 1.0 - star); +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying float star; + +varying vec3 sunVec, upVec; + +//Uniforms// +uniform float timeAngle; + +uniform mat4 gbufferModelView; + +//Program// +void main() { + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + + gl_Position = ftransform(); + + star = float(gl_Color.r == gl_Color.g && gl_Color.g == gl_Color.b && gl_Color.r > 0.0); +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_skytextured.glsl b/shaders/program/gbuffers_skytextured.glsl new file mode 100644 index 0000000..69415a3 --- /dev/null +++ b/shaders/program/gbuffers_skytextured.glsl @@ -0,0 +1,175 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 upVec, sunVec; + +varying vec4 color; + +//Uniforms// +uniform int renderStage; + +uniform float frameTimeCounter; +uniform float nightVision; +uniform float rainStrength; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferProjectionInverse; + +uniform sampler2D texture; +uniform sampler2D gaux1; + +#ifndef MC_RENDER_STAGE_SUN +#define MC_RENDER_STAGE_SUN 1 +#endif + +#ifndef MC_RENDER_STAGE_MOON +#define MC_RENDER_STAGE_MOON 1 +#endif + +#ifndef MC_RENDER_STAGE_CUSTOM_SKY +#define MC_RENDER_STAGE_CUSTOM_SKY 1 +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +//Includes// +#include "/lib/color/dimensionColor.glsl" +#include "/lib/util/dither.glsl" + +//Program// +void main() { + vec4 albedo = texture2D(texture, texCoord); + + #ifdef OVERWORLD + albedo *= color; + albedo.rgb = pow(albedo.rgb, vec3(2.2)) * albedo.a; + + #if MC_VERSION >= 11605 + vec4 screenPos = vec4(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z, 1.0); + vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0); + viewPos /= viewPos.w; + + float VoU = dot(normalize(viewPos.xyz), upVec); + + float sunFade = smoothstep(0.0, 1.0, 1.0 - pow(1.0 - max(VoU * 0.975 + 0.025, 0.0), 8.0)); + sunFade *= sunFade; + + if (renderStage == MC_RENDER_STAGE_CUSTOM_SKY) { + albedo.rgb *= SKYBOX_INTENSITY * SKYBOX_INTENSITY; + albedo.a *= SKYBOX_OPACITY; + } + if (renderStage == MC_RENDER_STAGE_SUN) { + albedo.rgb *= SUN_INTENSITY * SUN_INTENSITY * sunFade; + } + if (renderStage == MC_RENDER_STAGE_MOON) { + albedo.rgb *= MOON_INTENSITY * MOON_INTENSITY * sunFade; + } + #else + albedo.rgb *= SKYBOX_INTENSITY * SKYBOX_INTENSITY; + albedo.a *= SKYBOX_OPACITY; + #endif + + #ifdef ROUND_SUN_MOON + if (renderStage == MC_RENDER_STAGE_SUN || renderStage == MC_RENDER_STAGE_MOON) { + albedo *= 0.0; + } + #endif + + #ifdef SKY_DESATURATION + vec3 desat = GetLuminance(albedo.rgb) * pow(lightNight, vec3(1.6)) * 4.0; + albedo.rgb = mix(desat, albedo.rgb, sunVisibility); + #endif + + #ifdef UNDERGROUND_SKY + albedo.rgb *= mix(clamp((cameraPosition.y - 48.0) / 16.0, 0.0, 1.0), 1.0, eBS); + #endif + #endif + + #ifdef END + albedo.rgb = pow(albedo.rgb, vec3(2.2)); + + #ifdef SKY_DESATURATION + albedo.rgb = GetLuminance(albedo.rgb) * endCol.rgb; + #endif + + albedo.rgb *= SKYBOX_INTENSITY * 0.02 * 16.0 / 16.0; + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +varying vec3 sunVec, upVec; + +varying vec4 color; + +//Uniforms// +uniform float timeAngle; + +uniform mat4 gbufferModelView; + +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth; +uniform float viewHeight; +#include "/lib/util/jitter.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + color = gl_Color; + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + + gl_Position = ftransform(); + + #ifdef TAA + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_spidereyes.glsl b/shaders/program/gbuffers_spidereyes.glsl new file mode 100644 index 0000000..996c68a --- /dev/null +++ b/shaders/program/gbuffers_spidereyes.glsl @@ -0,0 +1,92 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord; + +varying vec4 color; + +//Uniforms// +uniform sampler2D texture; + +//Program// +void main() { + vec4 albedo = texture2D(texture, texCoord) * color; + albedo.rgb = pow(albedo.rgb,vec3(2.2)) * 4.0; + + #ifdef WHITE_WORLD + albedo.rgb = vec3(2.0); + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; + + #ifdef ADVANCED_MATERIALS + /* DRAWBUFFERS:0367 */ + gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0); + gl_FragData[2] = vec4(0.0, 0.0, 0.0, 1.0); + gl_FragData[3] = vec4(0.0, 0.0, 0.0, 1.0); + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord; + +varying vec4 color; + +//Uniforms// +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth; +uniform float viewHeight; +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +uniform mat4 gbufferModelView; +uniform mat4 gbufferModelViewInverse; +#endif + +//Includes// +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + color = gl_Color; + + #ifdef WORLD_CURVATURE + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + position.y -= WorldCurvature(position.xz); + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + #else + gl_Position = ftransform(); + #endif + + #if defined TAA && !defined TAA_SELECTIVE + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_terrain.glsl b/shaders/program/gbuffers_terrain.glsl new file mode 100644 index 0000000..fe587ca --- /dev/null +++ b/shaders/program/gbuffers_terrain.glsl @@ -0,0 +1,709 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying float mat, recolor; + +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec, northVec; + +varying vec4 color; + +varying vec4 glColor; + +#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS + varying float dist; + + varying vec3 binormal, tangent; + + varying vec3 viewVector; + + varying vec4 vTexCoord, vTexCoordAM; + + flat varying vec2 absMidCoordPos; + varying vec2 signMidCoordPos; + +#endif + +//Uniforms// +uniform int frameCounter; +uniform int isEyeInWater; +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float nightVision; +uniform float rainStrength; +uniform float screenBrightness; +uniform float shadowFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferProjectionInverse; +uniform mat4 gbufferModelViewInverse; +uniform mat4 shadowProjection; +uniform mat4 shadowModelView; + +uniform sampler2D texture; + +uniform sampler2D noisetex; + +#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS + uniform ivec2 atlasSize; + vec2 atlasSizeM = atlasSize; + + uniform sampler2D specular; + uniform sampler2D normals; + + #ifdef REFLECTION_RAIN + uniform float wetness; + + uniform mat4 gbufferModelView; + #endif +#endif + +#ifdef DYNAMIC_HANDLIGHT +uniform int heldBlockLightValue; +uniform int heldBlockLightValue2; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +uniform mat4 gbufferPreviousModelView; +uniform mat4 gbufferPreviousProjection; +uniform vec3 previousCameraPosition; + +uniform sampler2D colortex9; +#endif + +//Common Variables// + +float NdotU = dot(normal, upVec); +float NdotUmax0 = max(NdotU, 0.0); + +const float OSIEBCA = 1.0 / 255.0; +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +vec4 debugNormals; + +vec2 mipx; +vec2 mipy; +float mipDelta; +float miplevel; + +#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS +vec2 dcdx = dFdx(texCoord); +vec2 dcdy = dFdy(texCoord); +#endif + +vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + +#if defined GENERATED_NORMALS + mat3 tbnMatrix = mat3( + tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z + ); + + vec2 midCoordPos = absMidCoordPos * signMidCoordPos; +#endif + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +float max0(float x) { + return max(x, 0.0); +} + +float min1(float x) { + return min(x, 1.0); +} + +float pow2(float x) { + return x * x; +} +vec2 pow2(vec2 x) { + return x * x; +} + +vec3 pow2(vec3 x) { + return x * x; +} +float pow1_5(float x) { // Faster pow(x, 1.5) approximation (that isn't accurate at all) if x is between 0 and 1 + return x - x * pow2(1.0 - x); // Thanks to SixthSurge +} +vec2 pow1_5(vec2 x) { + return x - x * pow2(1.0 - x); +} +vec3 pow1_5(vec3 x) { + return x - x * pow2(1.0 - x); +} + +bool CheckForColor(vec3 albedo, vec3 check) { // Thanks to Builderb0y + vec3 dif = albedo - check * 0.003921568; + return dif == clamp(dif, vec3(-0.001), vec3(0.001)); +} + +float GetMaxColorDif(vec3 color) { + vec3 dif = abs(vec3(color.r - color.g, color.g - color.b, color.r - color.b)); + return max(dif.r, max(dif.g, dif.b)); +} + +float smoothstep1(float x) { + return x * x * (3.0 - 2.0 * x); +} +vec2 smoothstep1(vec2 x) { + return x * x * (3.0 - 2.0 * x); +} +vec3 smoothstep1(vec3 x) { + return x * x * (3.0 - 2.0 * x); +} +float sqrt1(float x) { // Faster sqrt() approximation (that isn't accurate at all) if x is between 0 and 1 + return x * (2.0 - x); // Thanks to Builderb0y +} +vec2 sqrt1(vec2 x) { + return x * (2.0 - x); +} +vec3 sqrt1(vec3 x) { + return x * (2.0 - x); +} +vec4 sqrt1(vec4 x) { + return x * (2.0 - x); +} +vec3 ViewToPlayer(vec3 pos) { + return mat3(gbufferModelViewInverse) * pos + gbufferModelViewInverse[3].xyz; +} + +float sqrt3(float x) { + x = 1.0 - x; + x *= x; + x *= x; + x *= x; + return 1.0 - x; +} +vec2 sqrt3(vec2 x) { + x = 1.0 - x; + x *= x; + x *= x; + x *= x; + return 1.0 - x; +} +vec3 sqrt3(vec3 x) { + x = 1.0 - x; + x *= x; + x *= x; + x *= x; + return 1.0 - x; +} +vec4 sqrt3(vec4 x) { + x = 1.0 - x; + x *= x; + x *= x; + x *= x; + return 1.0 - x; +} + +//Includes// +#include "/lib/color/blocklightColor.glsl" +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/specularColor.glsl" +#include "/lib/util/spaceConversion.glsl" +#include "/lib/lighting/forwardLighting.glsl" +#include "/lib/surface/ggx.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#if defined ADVANCED_MATERIALS || defined GENERATED_NORMALS + #include "/lib/util/encode.glsl" + #include "/lib/reflections/complexFresnel.glsl" + #include "/lib/surface/directionalLightmap.glsl" + #include "/lib/surface/materialGbuffers.glsl" + #include "/lib/surface/parallax.glsl" + + #ifdef GENERATED_NORMALS + #include "/lib/surface/generatedNormals.glsl" + #endif + + #ifdef REFLECTION_RAIN + #include "/lib/reflections/rainPuddles.glsl" + #endif +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +#include "/lib/lighting/coloredBlocklight.glsl" +#endif + +//Program// +void main() { + vec4 albedo = texture2D(texture, texCoord) * vec4(color.rgb, 1.0); + vec3 newNormal = normal; + float smoothnessD = 0.0, materialMask = 0.0, skyLightFactor = 0.0; + float smoothness = 0.0; + vec3 lightAlbedo = vec3(0.0); + int subsurfaceMode = 0; + float smoothnessG = 0.0, highlightMult = 1.0, emission = 0.0; + vec2 lmCoordM = lmCoord; + + #ifdef ADVANCED_MATERIALS + vec2 newCoord = vTexCoord.st * vTexCoordAM.pq + vTexCoordAM.st; + float surfaceDepth = 1.0; + float parallaxFade = clamp((dist - PARALLAX_DISTANCE) / 32.0, 0.0, 1.0); + float skipAdvMat = float(mat > 3.98 && mat < 4.02); + + #ifdef PARALLAX + if(skipAdvMat < 0.5) { + newCoord = GetParallaxCoord(texCoord, parallaxFade, surfaceDepth); + albedo = texture2DGradARB(texture, newCoord, dcdx, dcdy) * vec4(color.rgb, 1.0); + } + #endif + + float skyOcclusion = 0.0; + vec3 fresnel3 = vec3(0.0); + #endif + + if (albedo.a > 0.001) { + vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0)); + + float foliage = float(mat > 0.98 && mat < 1.02); + float leaves = float(mat > 1.98 && mat < 2.02); + float emissive = float(mat > 2.98 && mat < 3.02); + float lava = float(mat > 3.98 && mat < 4.02); + float candle = float(mat > 4.98 && mat < 5.02); + + float metalness = 0.0; + float emission = (emissive + candle + lava); + float subsurface = 0.0; + float basicSubsurface = (foliage + candle) * 0.5 + leaves; + vec3 baseReflectance = vec3(0.04); + + emission *= pow(max(max(albedo.r, albedo.g), albedo.b), 4.0) * 0.4; + + vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z); + #ifdef TAA + vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z)); + #else + vec3 viewPos = ToNDC(screenPos); + #endif + vec3 worldPos = ToWorld(viewPos); + + vec3 playerPos = ViewToPlayer(viewPos); + float lViewPos = length(viewPos); + + bool noSmoothLighting = false, noDirectionalShading = false, noVanillaAO = false, centerShadowBias = false, noGeneratedNormals = false, doTileRandomisation = true; + + #ifdef ADVANCED_MATERIALS + float f0 = 0.0, porosity = 0.5, ao = 1.0; + vec3 normalMap = vec3(0.0, 0.0, 1.0); + GetMaterials(smoothness, metalness, f0, emission, subsurface, porosity, ao, normalMap, + newCoord, dcdx, dcdy); + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + #ifndef GENERATED_NORMALS + if ((normalMap.x > -0.999 || normalMap.y > -0.999) && viewVector == viewVector) + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + #endif + #endif + + #ifdef GENERATED_NORMALS + // #include "/lib/materials/materialHandling/terrainMaterials.glsl" + GenerateNormals(newNormal, albedo.rgb); + #endif + debugNormals = vec4(newNormal , 1.0); + + + #ifdef DYNAMIC_HANDLIGHT + float heldLightValue = max(float(heldBlockLightValue), float(heldBlockLightValue2)); + float handlight = clamp((heldLightValue - 2.0 * length(viewPos)) / 15.0, 0.0, 0.9333); + lightmap.x = max(lightmap.x, handlight); + #endif + + #ifdef TOON_LIGHTMAP + lightmap = floor(lightmap * 14.999 * (0.75 + 0.25 * color.a)) / 14.0; + lightmap = clamp(lightmap, vec2(0.0), vec2(1.0)); + #endif + + albedo.rgb = pow(albedo.rgb, vec3(2.2)); + + #ifdef EMISSIVE_RECOLOR + float ec = GetLuminance(albedo.rgb) * 1.7; + if (recolor > 0.5) { + albedo.rgb = blocklightCol * pow(ec, 1.5) / (BLOCKLIGHT_I * BLOCKLIGHT_I); + albedo.rgb /= 0.7 * albedo.rgb + 0.7; + } + if (lava > 0.5) { + albedo.rgb = pow(blocklightCol * ec / BLOCKLIGHT_I, vec3(2.0)); + albedo.rgb /= 0.5 * albedo.rgb + 0.5; + } + #endif + + #ifdef MULTICOLORED_BLOCKLIGHT + lightAlbedo = albedo.rgb + 0.00001; + if (lava > 0.5) { + #ifndef MCBL_LEGACY_COLOR + lightAlbedo = pow(lightAlbedo, vec3(0.25)); + #else + lightAlbedo = sqrt(lightAlbedo) * 0.98 + 0.02; + #endif + } + lightAlbedo = sqrt(normalize(lightAlbedo) * emission); + #endif + + #ifdef WHITE_WORLD + albedo.rgb = vec3(0.35); + #endif + + vec3 outNormal = newNormal; + #ifdef NORMAL_PLANTS + if (foliage > 0.5){ + newNormal = upVec; + + #ifdef ADVANCED_MATERIALS + newNormal = normalize(mix(outNormal, newNormal, normalMap.z * normalMap.z)); + #endif + } + #endif + + + + float NoL = clamp(dot(newNormal, lightVec), 0.0, 1.0); + + float NoU = clamp(dot(newNormal, upVec), -1.0, 1.0); + float NoE = clamp(dot(newNormal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15; + vanillaDiffuse*= vanillaDiffuse; + + #ifndef NORMAL_PLANTS + if (foliage > 0.5) vanillaDiffuse *= 1.8; + #endif + + float parallaxShadow = 1.0; + #ifdef ADVANCED_MATERIALS + vec3 rawAlbedo = albedo.rgb * 0.999 + 0.001; + albedo.rgb *= ao * ao; + + #ifdef REFLECTION_SPECULAR + albedo.rgb *= 1.0 - metalness * smoothness; + #endif + + float doParallax = 0.0; + #ifdef SELF_SHADOW + float parallaxNoL = dot(outNormal, lightVec); + #ifdef OVERWORLD + doParallax = float(lightmap.y > 0.0 && parallaxNoL > 0.0); + #endif + #ifdef END + doParallax = float(parallaxNoL > 0.0); + #endif + + if (doParallax > 0.5 && skipAdvMat < 0.5) { + parallaxShadow = GetParallaxShadow(surfaceDepth, parallaxFade, newCoord, lightVec, + tbnMatrix); + } + #endif + + #ifdef DIRECTIONAL_LIGHTMAP + mat3 lightmapTBN = GetLightmapTBN(viewPos); + lightmap.x = DirectionalLightmap(lightmap.x, lmCoord.x, outNormal, lightmapTBN); + lightmap.y = DirectionalLightmap(lightmap.y, lmCoord.y, outNormal, lightmapTBN); + #endif + #endif + + #ifdef MULTICOLORED_BLOCKLIGHT + blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos); + #endif + + vec3 shadow = vec3(0.0); + GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, color.a, NoL, + vanillaDiffuse, parallaxShadow, emission, subsurface, basicSubsurface); + + #ifdef ADVANCED_MATERIALS + float puddles = 0.0; + #ifdef REFLECTION_RAIN + float puddlesNoU = dot(outNormal, upVec); + + puddles = GetPuddles(worldPos, newCoord, lightmap.y, puddlesNoU, wetness); + puddles *= 1.0 - lava; + + ApplyPuddleToMaterial(puddles, albedo, smoothness, f0, porosity); + + if (puddles > 0.001 && rainStrength > 0.001) { + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + vec3 puddleNormal = GetPuddleNormal(worldPos, viewPos, tbnMatrix); + outNormal = normalize( + mix(outNormal, puddleNormal, puddles * sqrt(1.0 - porosity) * rainStrength) + ); + } + #endif + + skyOcclusion = lightmap.y; + + baseReflectance = mix(vec3(f0), rawAlbedo, metalness); + float fresnel = pow(clamp(1.0 + dot(outNormal, normalize(viewPos.xyz)), 0.0, 1.0), 5.0); + + fresnel3 = mix(baseReflectance, vec3(1.0), fresnel); + #if MATERIAL_FORMAT == 1 + if (f0 >= 0.9 && f0 < 1.0) { + baseReflectance = GetMetalCol(f0); + fresnel3 = ComplexFresnel(pow(fresnel, 0.2), f0); + #ifdef ALBEDO_METAL + fresnel3 *= rawAlbedo; + #endif + } + #endif + + float aoSquared = ao * ao; + shadow *= aoSquared; fresnel3 *= aoSquared; + albedo.rgb = albedo.rgb * (1.0 - fresnel3 * smoothness * smoothness * (1.0 - metalness)); + #endif + + #if (defined OVERWORLD || defined END) && (defined ADVANCED_MATERIALS || defined SPECULAR_HIGHLIGHT_ROUGH) + vec3 specularColor = GetSpecularColor(lightmap.y, metalness, baseReflectance); + + + albedo.rgb += GetSpecularHighlight(newNormal, viewPos, smoothness, baseReflectance, + specularColor, shadow * vanillaDiffuse, color.a); + #endif + + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR && defined REFLECTION_ROUGH + // newNormal = outNormal; + // if ((normalMap.x > -0.999 || normalMap.y > -0.999) && viewVector == viewVector) { + // normalMap = mix(vec3(0.0, 0.0, 1.0), normalMap, smoothness); + // newNormal = mix(normalMap * tbnMatrix, newNormal, 1.0 - pow(1.0 - puddles, 4.0)); + // newNormal = clamp(normalize(newNormal), vec3(-1.0), vec3(1.0)); + // } + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + } else albedo.a = 0.0; + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; + + #ifdef MULTICOLORED_BLOCKLIGHT + /* DRAWBUFFERS:08 */ + gl_FragData[1] = vec4(lightAlbedo, 1.0); + + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR + /* DRAWBUFFERS:08367 */ + gl_FragData[2] = vec4(smoothness, skyOcclusion, 0.0, 1.0); + gl_FragData[3] = vec4(newNormal, 1.0); + gl_FragData[4] = vec4(fresnel3, 1.0); + #endif + #else + #if defined ADVANCED_MATERIALS && defined REFLECTION_SPECULAR + /* DRAWBUFFERS:0367 */ + gl_FragData[1] = vec4(smoothness, skyOcclusion, 0.0, 1.0); + gl_FragData[2] = vec4(newNormal, 1.0); + gl_FragData[3] = vec4(fresnel3, 1.0); + #endif + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying float mat, recolor; + +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec, northVec; + +varying vec4 color; + +#ifdef ADVANCED_MATERIALS + varying float dist; + + varying vec2 signMidCoordPos; + flat varying vec2 absMidCoordPos; + + varying vec3 binormal, tangent; + varying vec3 viewVector; + + varying vec4 vTexCoord, vTexCoordAM; +#endif + +//Uniforms// +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float timeAngle; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferModelView, gbufferModelViewInverse; + +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth, viewHeight; +#endif + +//Attributes// +attribute vec4 mc_Entity; +attribute vec4 mc_midTexCoord; + +#ifdef ADVANCED_MATERIALS +attribute vec4 at_tangent; +#endif + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Includes// +#include "/lib/vertex/waving.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +vec3 GetSunVector() { + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + #ifdef OVERWORLD + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + return normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + #elif defined END + float ang = 0.0; + return normalize((gbufferModelView * vec4(vec3(0.0, sunRotationData * 2000.0), 1.0)).xyz); + #else + return vec3(0.0); + #endif +} + + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; + lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0)); + + int blockID = int(mod(max(mc_Entity.x - 10000, 0), 10000)); + + normal = normalize(gl_NormalMatrix * gl_Normal); + + #ifdef ADVANCED_MATERIALS + binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w); + tangent = normalize(gl_NormalMatrix * at_tangent.xyz); + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz; + + if (mc_Entity.x == 0) + viewVector /= 0.0; + + dist = length(gl_ModelViewMatrix * gl_Vertex); + + vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st; + vec2 texMinMidCoord = texCoord - midCoord; + + vTexCoordAM.pq = abs(texMinMidCoord) * 2; + vTexCoordAM.st = min(texCoord, midCoord - texMinMidCoord); + signMidCoordPos = sign(texMinMidCoord); + absMidCoordPos = abs(texMinMidCoord); + + vTexCoord.xy = sign(texMinMidCoord) * 0.5 + 0.5; + #endif + + color = gl_Color; + + mat = 0.0; recolor = 0.0; + + if (blockID >= 100 && blockID < 200) + mat = 1.0; + if (blockID == 105 || blockID == 106){ + mat = 2.0; + color.rgb *= 1.225; + } + if (blockID >= 200 && blockID < 300) + mat = 3.0; + if (blockID == 203){ + mat = 4.0; + lmCoord.x += 0.0667; + } + if (blockID == 208) + mat = 5.0; + + if (blockID == 201 || blockID == 205 || blockID == 206) + recolor = 1.0; + + if (blockID == 202) + lmCoord.x -= 0.0667; + + if (color.a < 0.1) + color.a = 1.0; + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = GetSunVector(); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = normalize(gbufferModelView[0].xyz); + northVec = normalize(gbufferModelView[2].xyz); + + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + + float istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t ? 1.0 : 0.0; + position.xyz = WavingBlocks(position.xyz, blockID, istopv); + + #ifdef WORLD_CURVATURE + position.y -= WorldCurvature(position.xz); + #endif + + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + + #ifdef TAA + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_textured.glsl b/shaders/program/gbuffers_textured.glsl new file mode 100644 index 0000000..6f07ffb --- /dev/null +++ b/shaders/program/gbuffers_textured.glsl @@ -0,0 +1,316 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +//Uniforms// +uniform int frameCounter; +uniform int isEyeInWater; +uniform int worldTime; + +uniform float blindFactor, darknessFactor, nightVision; +uniform float far, near; +uniform float frameTimeCounter; +uniform float rainStrength; +uniform float screenBrightness; +uniform float shadowFade, voidFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferProjectionInverse; +uniform mat4 gbufferModelViewInverse; +uniform mat4 shadowProjection; +uniform mat4 shadowModelView; + +uniform sampler2D texture; +uniform sampler2D noisetex; + +#ifdef SOFT_PARTICLES +uniform sampler2D depthtex0; +#endif + +#ifdef DYNAMIC_HANDLIGHT +uniform int heldBlockLightValue; +uniform int heldBlockLightValue2; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +uniform mat4 gbufferPreviousModelView; +uniform mat4 gbufferPreviousProjection; +uniform vec3 previousCameraPosition; + +uniform sampler2D colortex9; +#endif + +#ifdef DISTANT_HORIZONS +uniform float dhFarPlane; +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +#ifdef SOFT_PARTICLES +float GetLinearDepth(float depth) { + return (2.0 * near) / (far + near - depth * (far - near)); +} +#endif + +//Includes// +#include "/lib/color/blocklightColor.glsl" +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/skyColor.glsl" +#include "/lib/util/dither.glsl" +#include "/lib/util/spaceConversion.glsl" +#include "/lib/atmospherics/weatherDensity.glsl" +#include "/lib/atmospherics/sky.glsl" +#include "/lib/atmospherics/fog.glsl" +#include "/lib/lighting/forwardLighting.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +#include "/lib/lighting/coloredBlocklight.glsl" +#endif + +//Program// +void main() { + vec4 albedo = texture2D(texture, texCoord) * color; + + if (albedo.a > 0.001) { + vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0)); + + vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z); + #if defined TAA && !defined TAA_SELECTIVE + vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z)); + #else + vec3 viewPos = ToNDC(screenPos); + #endif + vec3 worldPos = ToWorld(viewPos); + + #ifdef DYNAMIC_HANDLIGHT + float heldLightValue = max(float(heldBlockLightValue), float(heldBlockLightValue2)); + float handlight = clamp((heldLightValue - 2.0 * length(viewPos)) / 15.0, 0.0, 0.9333); + lightmap.x = max(lightmap.x, handlight); + #endif + + #ifdef TOON_LIGHTMAP + lightmap = floor(lightmap * 14.999 * (0.75 + 0.25 * color.a)) / 14.0; + lightmap = clamp(lightmap, vec2(0.0), vec2(1.0)); + #endif + + albedo.rgb = pow(albedo.rgb, vec3(2.2)); + + #ifdef WHITE_WORLD + albedo.rgb = vec3(0.35); + #endif + + float NoL = 1.0; + //NoL = clamp(dot(normal, lightVec) * 1.01 - 0.01, 0.0, 1.0); + + float NoU = clamp(dot(normal, upVec), -1.0, 1.0); + float NoE = clamp(dot(normal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15; + vanillaDiffuse*= vanillaDiffuse; + + #ifdef MULTICOLORED_BLOCKLIGHT + blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos); + #endif + + vec3 shadow = vec3(0.0); + GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL, + 1.0, 1.0, 0.0, 0.0, 0.0); + + #if defined FOG && MC_VERSION >= 11500 + Fog(albedo.rgb, viewPos); + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + } + + #ifdef SOFT_PARTICLES + float linearZ = GetLinearDepth(gl_FragCoord.z) * (far - near); + float backZ = texture2D(depthtex0, gl_FragCoord.xy / vec2(viewWidth, viewHeight)).r; + float linearBackZ = GetLinearDepth(backZ) * (far - near); + + float difference = clamp(linearBackZ - linearZ, 0.0, 1.0); + difference = difference * difference * (3.0 - 2.0 * difference); + + float opaqueThreshold = fract(Bayer8(gl_FragCoord.xy) + frameTimeCounter * 8.0); + + if (albedo.a > 0.999) albedo.a *= float(difference > opaqueThreshold); + else albedo.a *= difference; + #endif + + /* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; + + #ifdef MULTICOLORED_BLOCKLIGHT + /* DRAWBUFFERS:08 */ + gl_FragData[1] = vec4(0.0,0.0,0.0,1.0); + + #if defined TAA_SELECTIVE && !defined ADVANCED_MATERIALS + /* DRAWBUFFERS:083 */ + gl_FragData[2] = vec4(0.0, 0.0, 0.25, 1.0); + #endif + + #ifdef ADVANCED_MATERIALS + /* DRAWBUFFERS:08367 */ + gl_FragData[2] = vec4(0.0, 0.0, 0.25, 1.0); + gl_FragData[3] = vec4(0.0, 0.0, 0.0, 1.0); + gl_FragData[4] = vec4(0.0, 0.0, 0.0, 1.0); + #endif + #else + #if defined TAA_SELECTIVE && !defined ADVANCED_MATERIALS + /* DRAWBUFFERS:03 */ + gl_FragData[1] = vec4(0.0, 0.0, 0.25, 1.0); + #endif + + #ifdef ADVANCED_MATERIALS + /* DRAWBUFFERS:0367 */ + gl_FragData[1] = vec4(0.0, 0.0, 0.25, 1.0); + gl_FragData[2] = vec4(0.0, 0.0, 0.0, 1.0); + gl_FragData[3] = vec4(0.0, 0.0, 0.0, 1.0); + #endif + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 normal; +varying vec3 sunVec, upVec, eastVec; + +varying vec4 color; + +//Uniforms// +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float timeAngle; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferModelView, gbufferModelViewInverse; + +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth, viewHeight; +#endif + +#ifdef SOFT_PARTICLES +uniform float far, near; +#endif + +//Attributes// +attribute vec4 mc_Entity; +attribute vec4 mc_midTexCoord; + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Common Functions// +#ifdef SOFT_PARTICLES +float GetLinearDepth(float depth) { + return (2.0 * near) / (far + near - depth * (far - near)); +} + +float GetLogarithmicDepth(float depth) { + return -(2.0 * near / depth - (far + near)) / (far - near); +} +#endif + +//Includes// +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; + lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0)); + + normal = normalize(gl_NormalMatrix * gl_Normal); + + color = gl_Color; + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = normalize(gbufferModelView[0].xyz); + + #ifdef WORLD_CURVATURE + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + position.y -= WorldCurvature(position.xz); + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + #else + gl_Position = ftransform(); + #endif + + #ifdef SOFT_PARTICLES + gl_Position.z = GetLinearDepth(gl_Position.z / gl_Position.w) * (far - near); + gl_Position.z -= 0.25; + gl_Position.z = GetLogarithmicDepth(gl_Position.z / (far - near)) * gl_Position.w; + #endif + + #if defined TAA && !defined TAA_SELECTIVE + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_water.glsl b/shaders/program/gbuffers_water.glsl new file mode 100644 index 0000000..77a8dd8 --- /dev/null +++ b/shaders/program/gbuffers_water.glsl @@ -0,0 +1,775 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying float mat; +varying float dist; + +varying vec2 texCoord, lmCoord; + +varying vec3 normal, binormal, tangent; +varying vec3 sunVec, upVec, eastVec; +varying vec3 viewVector; + +varying vec4 color; + +#ifdef ADVANCED_MATERIALS +varying vec4 vTexCoord, vTexCoordAM; +#endif + +//Uniforms// +uniform int frameCounter; +uniform int isEyeInWater; +uniform int worldTime; + +uniform float blindFactor, darknessFactor, nightVision; +uniform float far, near; +uniform float frameTimeCounter; +uniform float rainStrength; +uniform float screenBrightness; +uniform float shadowFade, voidFade; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform vec3 cameraPosition, previousCameraPosition; + +uniform mat4 gbufferProjection, gbufferPreviousProjection, gbufferProjectionInverse; +uniform mat4 gbufferModelView, gbufferPreviousModelView, gbufferModelViewInverse; +uniform mat4 shadowProjection; +uniform mat4 shadowModelView; + +uniform sampler2D texture; +uniform sampler2D gaux2; +uniform sampler2D depthtex1; +uniform sampler2D depthtex2; +uniform sampler2D noisetex; + +#ifdef ADVANCED_MATERIALS +uniform ivec2 atlasSize; + +uniform sampler2D specular; +uniform sampler2D normals; + +#ifdef REFLECTION_RAIN +uniform float wetness; +#endif +#endif + +#ifdef DYNAMIC_HANDLIGHT +uniform int heldBlockLightValue; +uniform int heldBlockLightValue2; +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +uniform sampler2D colortex8; +uniform sampler2D colortex9; +#endif + +#if CLOUDS == 2 +uniform sampler2D gaux1; +#endif + +#ifdef DISTANT_HORIZONS +uniform float dhFarPlane; +#endif + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp((dot( sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); +float moonVisibility = clamp((dot(-sunVec, upVec) + 0.05) * 10.0, 0.0, 1.0); + +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +#ifdef ADVANCED_MATERIALS +vec2 dcdx = dFdx(texCoord); +vec2 dcdy = dFdy(texCoord); +#endif + +vec3 lightVec = sunVec * ((timeAngle < 0.5325 || timeAngle > 0.9675) ? 1.0 : -1.0); + +//Common Functions// +float GetLuminance(vec3 color) { + return dot(color,vec3(0.299, 0.587, 0.114)); +} + +float GetWaterHeightMap(vec3 worldPos, vec2 offset) { + float noise = 0.0; + + vec2 wind = vec2(frametime) * 0.5 * WATER_SPEED; + + worldPos.xz += worldPos.y * 0.2; + + #if WATER_NORMALS == 1 + offset /= 256.0; + float noiseA = texture2D(noisetex, (worldPos.xz - wind) / 256.0 + offset).g; + float noiseB = texture2D(noisetex, (worldPos.xz + wind) / 48.0 + offset).g; + #elif WATER_NORMALS == 2 + offset /= 256.0; + float noiseA = texture2D(noisetex, (worldPos.xz - wind) / 256.0 + offset).r; + float noiseB = texture2D(noisetex, (worldPos.xz + wind) / 96.0 + offset).r; + noiseA *= noiseA; noiseB *= noiseB; + #endif + + #if WATER_NORMALS > 0 + noise = mix(noiseA, noiseB, WATER_DETAIL); + #endif + + return noise * WATER_BUMP; +} + +vec3 GetParallaxWaves(vec3 worldPos, vec3 viewVector) { + vec3 parallaxPos = worldPos; + + for(int i = 0; i < 4; i++) { + float height = -1.25 * GetWaterHeightMap(parallaxPos, vec2(0.0)) + 0.25; + parallaxPos.xz += height * viewVector.xy / dist; + } + return parallaxPos; +} + +vec3 GetWaterNormal(vec3 worldPos, vec3 viewPos, vec3 viewVector) { + vec3 waterPos = worldPos + cameraPosition; + + #if WATER_PIXEL > 0 + waterPos = floor(waterPos * WATER_PIXEL) / WATER_PIXEL; + #endif + + #ifdef WATER_PARALLAX + waterPos = GetParallaxWaves(waterPos, viewVector); + #endif + + float normalOffset = WATER_SHARPNESS; + + float fresnel = pow(clamp(1.0 + dot(normalize(normal), normalize(viewPos)), 0.0, 1.0), 8.0); + float normalStrength = 0.35 * (1.0 - fresnel); + + float h1 = GetWaterHeightMap(waterPos, vec2( normalOffset, 0.0)); + float h2 = GetWaterHeightMap(waterPos, vec2(-normalOffset, 0.0)); + float h3 = GetWaterHeightMap(waterPos, vec2(0.0, normalOffset)); + float h4 = GetWaterHeightMap(waterPos, vec2(0.0, -normalOffset)); + + float xDelta = (h2 - h1) / normalOffset; + float yDelta = (h4 - h3) / normalOffset; + + vec3 normalMap = vec3(xDelta, yDelta, 1.0 - (xDelta * xDelta + yDelta * yDelta)); + return normalMap * normalStrength + vec3(0.0, 0.0, 1.0 - normalStrength); +} + +//Includes// +#include "/lib/color/blocklightColor.glsl" +#include "/lib/color/dimensionColor.glsl" +#include "/lib/color/skyColor.glsl" +#include "/lib/color/specularColor.glsl" +#include "/lib/color/waterColor.glsl" +#include "/lib/util/dither.glsl" +#include "/lib/util/spaceConversion.glsl" +#include "/lib/atmospherics/weatherDensity.glsl" +#include "/lib/atmospherics/sky.glsl" +#include "/lib/atmospherics/clouds.glsl" +#include "/lib/atmospherics/fog.glsl" +#include "/lib/atmospherics/waterFog.glsl" +#include "/lib/lighting/forwardLighting.glsl" +#include "/lib/reflections/raytrace.glsl" +#include "/lib/reflections/simpleReflections.glsl" +#include "/lib/surface/ggx.glsl" + +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef ADVANCED_MATERIALS +#include "/lib/reflections/complexFresnel.glsl" +#include "/lib/surface/directionalLightmap.glsl" +#include "/lib/surface/materialGbuffers.glsl" +#include "/lib/surface/parallax.glsl" + +#ifdef REFLECTION_RAIN +#include "/lib/reflections/rainPuddles.glsl" +#endif +#endif + +#ifdef MULTICOLORED_BLOCKLIGHT +#include "/lib/lighting/coloredBlocklight.glsl" +#endif + +//Program// +void main() { + vec4 albedo = texture2D(texture, texCoord) * vec4(color.rgb, 1.0); + vec3 newNormal = normal; + float smoothness = 0.0; + vec3 lightAlbedo = vec3(0.0); + + #ifdef ADVANCED_MATERIALS + vec2 newCoord = vTexCoord.st * vTexCoordAM.pq + vTexCoordAM.st; + float surfaceDepth = 1.0; + float parallaxFade = clamp((dist - PARALLAX_DISTANCE) / 32.0, 0.0, 1.0); + float skipAdvMat = float(mat > 0.98 && mat < 1.02); + + #ifdef PARALLAX + if(skipAdvMat < 0.5) { + newCoord = GetParallaxCoord(texCoord, parallaxFade, surfaceDepth); + albedo = texture2DGradARB(texture, newCoord, dcdx, dcdy) * vec4(color.rgb, 1.0); + } + #endif + #endif + + vec3 vlAlbedo = vec3(1.0); + vec3 refraction = vec3(0.0); + + float cloudBlendOpacity = 1.0; + + if (albedo.a > 0.001) { + vec2 lightmap = clamp(lmCoord, vec2(0.0), vec2(1.0)); + + float water = float(mat > 0.98 && mat < 1.02); + float glass = float(mat > 1.98 && mat < 2.02); + float translucent = float(mat > 2.98 && mat < 3.02); + float portal = float(mat > 3.98 && mat < 4.02); + + float metalness = 0.0; + float emission = portal; + float subsurface = 0.0; + float basicSubsurface = water; + vec3 baseReflectance = vec3(0.04); + + emission *= pow(max(max(albedo.r, albedo.g), albedo.b), 4.0) * 0.4; + + #ifndef REFLECTION_TRANSLUCENT + glass = 0.0; + translucent = 0.0; + #endif + + vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z); + #ifdef TAA + vec3 viewPos = ToNDC(vec3(TAAJitter(screenPos.xy, -0.5), screenPos.z)); + #else + vec3 viewPos = ToNDC(screenPos); + #endif + vec3 worldPos = ToWorld(viewPos); + + float dither = Bayer8(gl_FragCoord.xy); + + #if CLOUDS == 2 + float cloudViewLength = texture2D(gaux1, screenPos.xy).r * (far * 2.0); + + float viewLength = length(viewPos); + cloudBlendOpacity = step(viewLength, cloudViewLength); + + if (cloudBlendOpacity == 0) { + discard; + } + // albedo.rgb *= fract(viewLength); + #endif + + vec3 normalMap = vec3(0.0, 0.0, 1.0); + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + #if WATER_NORMALS == 1 || WATER_NORMALS == 2 + if (water > 0.5) { + normalMap = GetWaterNormal(worldPos, viewPos, viewVector); + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + } + #endif + + #ifdef ADVANCED_MATERIALS + float f0 = 0.0, porosity = 0.5, ao = 1.0, skyOcclusion = 0.0; + if (water < 0.5) { + GetMaterials(smoothness, metalness, f0, emission, subsurface, porosity, ao, normalMap, + newCoord, dcdx, dcdy); + + if ((normalMap.x > -0.999 || normalMap.y > -0.999) && viewVector == viewVector) + newNormal = clamp(normalize(normalMap * tbnMatrix), vec3(-1.0), vec3(1.0)); + } + #endif + + #if REFRACTION == 1 + refraction = vec3((newNormal.xy - normal.xy) * 0.5 + 0.5, float(albedo.a < 0.95) * water); + #elif REFRACTION == 2 + refraction = vec3((newNormal.xy - normal.xy) * 0.5 + 0.5, float(albedo.a < 0.95)); + #endif + + #ifdef DYNAMIC_HANDLIGHT + float heldLightValue = max(float(heldBlockLightValue), float(heldBlockLightValue2)); + float handlight = clamp((heldLightValue - 2.0 * length(viewPos)) / 15.0, 0.0, 0.9333); + lightmap.x = max(lightmap.x, handlight); + #endif + + #ifdef TOON_LIGHTMAP + lightmap = floor(lightmap * 14.999 * (0.75 + 0.25 * color.a)) / 14.0; + lightmap = clamp(lightmap, vec2(0.0), vec2(1.0)); + #endif + + albedo.rgb = pow(albedo.rgb, vec3(2.2)); + + vlAlbedo = albedo.rgb; + + #ifdef MULTICOLORED_BLOCKLIGHT + vec3 opaquelightAlbedo = texture2D(colortex8, screenPos.xy).rgb; + if (water < 0.5) { + opaquelightAlbedo *= vlAlbedo; + } + lightAlbedo = albedo.rgb + 0.00001; + + if (portal > 0.5) { + lightAlbedo = lightAlbedo * 0.95 + 0.05; + } + + lightAlbedo = normalize(lightAlbedo + 0.00001) * emission; + lightAlbedo = mix(opaquelightAlbedo, sqrt(lightAlbedo), albedo.a); + #endif + + #ifdef WHITE_WORLD + albedo.rgb = vec3(0.35); + #endif + + if (water > 0.5) { + #if WATER_MODE == 0 + albedo.rgb = waterColor.rgb * waterColor.a; + #elif WATER_MODE == 1 + // do nothing + #elif WATER_MODE == 2 + float waterLuma = length(albedo.rgb / pow(color.rgb, vec3(2.2))) * 2.0; + albedo.rgb = waterLuma * waterColor.rgb * waterColor.a; + #elif WATER_MODE == 3 + albedo.rgb = color.rgb * color.rgb * 0.35; + #endif + #if WATER_ALPHA_MODE == 0 + albedo.a = waterAlpha; + #endif + vlAlbedo = sqrt(albedo.rgb); + baseReflectance = vec3(0.02); + } + + vlAlbedo = mix(vec3(1.0), vlAlbedo, sqrt(albedo.a)) * (1.0 - pow(albedo.a, 64.0)); + + float NoL = clamp(dot(newNormal, lightVec), 0.0, 1.0); + + float NoU = clamp(dot(newNormal, upVec), -1.0, 1.0); + float NoE = clamp(dot(newNormal, eastVec), -1.0, 1.0); + float vanillaDiffuse = (0.25 * NoU + 0.75) + (0.667 - abs(NoE)) * (1.0 - abs(NoU)) * 0.15; + vanillaDiffuse*= vanillaDiffuse; + + float parallaxShadow = 1.0; + #ifdef ADVANCED_MATERIALS + vec3 rawAlbedo = albedo.rgb * 0.999 + 0.001; + albedo.rgb *= ao; + + #ifdef REFLECTION_SPECULAR + albedo.rgb *= 1.0 - metalness * smoothness; + #endif + + #ifdef SELF_SHADOW + if (lightmap.y > 0.0 && NoL > 0.0 && water < 0.5) { + parallaxShadow = GetParallaxShadow(surfaceDepth, parallaxFade, newCoord, lightVec, + tbnMatrix); + } + #endif + + #ifdef DIRECTIONAL_LIGHTMAP + mat3 lightmapTBN = GetLightmapTBN(viewPos); + lightmap.x = DirectionalLightmap(lightmap.x, lmCoord.x, newNormal, lightmapTBN); + lightmap.y = DirectionalLightmap(lightmap.y, lmCoord.y, newNormal, lightmapTBN); + #endif + #endif + + #ifdef MULTICOLORED_BLOCKLIGHT + blocklightCol = ApplyMultiColoredBlocklight(blocklightCol, screenPos); + #endif + + vec3 shadow = vec3(0.0); + GetLighting(albedo.rgb, shadow, viewPos, worldPos, normal, lightmap, 1.0, NoL, + vanillaDiffuse, parallaxShadow, emission, subsurface, basicSubsurface); + + #ifdef ADVANCED_MATERIALS + float puddles = 0.0; + #ifdef REFLECTION_RAIN + if (water < 0.5) { + puddles = GetPuddles(worldPos, newCoord, lightmap.y, NoU, wetness); + } + + ApplyPuddleToMaterial(puddles, albedo, smoothness, f0, porosity); + + if (puddles > 0.001 && rainStrength > 0.001) { + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + vec3 puddleNormal = GetPuddleNormal(worldPos, viewPos, tbnMatrix); + newNormal = normalize( + mix(newNormal, puddleNormal, puddles * sqrt(1.0 - porosity) * rainStrength) + ); + } + #endif + #endif + + float fresnel = pow(clamp(1.0 + dot(newNormal, normalize(viewPos)), 0.0, 1.0), 5.0); + + if (water > 0.5 || ((translucent + glass) > 0.5 && albedo.a < 0.95)) { + #if REFLECTION > 0 + vec4 reflection = vec4(0.0); + vec3 skyReflection = vec3(0.0); + float reflectionMask = 0.0; + + fresnel = fresnel * 0.98 + 0.02; + fresnel*= max(1.0 - isEyeInWater * 0.5 * water, 0.5); + // fresnel = 1.0; + + #if REFLECTION == 2 + reflection = SimpleReflection(viewPos, newNormal, dither, reflectionMask); + reflection.rgb = pow(reflection.rgb * 2.0, vec3(8.0)); + #endif + + if (reflection.a < 1.0) { + #ifdef OVERWORLD + vec3 skyRefPos = reflect(normalize(viewPos), newNormal); + skyReflection = GetSkyColor(skyRefPos, true); + + #ifdef AURORA + skyReflection += DrawAurora(skyRefPos * 100.0, dither, 12); + #endif + + #if CLOUDS == 1 + vec4 cloud = DrawCloudSkybox(skyRefPos * 100.0, 1.0, dither, lightCol, ambientCol, true); + skyReflection = mix(skyReflection, cloud.rgb, cloud.a); + #endif + #if CLOUDS == 2 + vec3 cameraPos = GetReflectedCameraPos(worldPos, newNormal); + float cloudViewLength = 0.0; + + vec4 cloud = DrawCloudVolumetric(skyRefPos * 8192.0, cameraPos, 1.0, dither, lightCol, ambientCol, cloudViewLength, true); + skyReflection = mix(skyReflection, cloud.rgb, cloud.a); + #endif + + #ifdef CLASSIC_EXPOSURE + skyReflection *= 4.0 - 3.0 * eBS; + #endif + + float waterSkyOcclusion = lightmap.y; + #if REFLECTION_SKY_FALLOFF > 1 + waterSkyOcclusion = clamp(1.0 - (1.0 - waterSkyOcclusion) * REFLECTION_SKY_FALLOFF, 0.0, 1.0); + #endif + waterSkyOcclusion *= waterSkyOcclusion; + skyReflection *= waterSkyOcclusion; + #endif + + #ifdef NETHER + skyReflection = netherCol.rgb * 0.04; + #endif + + #ifdef END + skyReflection = endCol.rgb * 0.01; + #endif + + skyReflection *= clamp(1.0 - isEyeInWater, 0.0, 1.0); + } + + reflection.rgb = max(mix(skyReflection, reflection.rgb, reflection.a), vec3(0.0)); + + #if defined OVERWORLD || defined END + vec3 specularColor = GetSpecularColor(lightmap.y, 0.0, vec3(1.0)); + + vec3 specular = GetSpecularHighlight(newNormal, viewPos, 0.9, vec3(0.02), + specularColor, shadow, color.a); + #if ALPHA_BLEND == 0 + float specularAlpha = pow(mix(albedo.a, 1.0, fresnel), 2.2) * fresnel; + #else + float specularAlpha = mix(albedo.a , 1.0, fresnel) * fresnel; + #endif + + reflection.rgb += specular * (1.0 - reflectionMask) / specularAlpha; + #endif + + albedo.rgb = mix(albedo.rgb, reflection.rgb, fresnel); + albedo.a = mix(albedo.a, 1.0, fresnel); + #endif + }else{ + #ifdef ADVANCED_MATERIALS + skyOcclusion = lightmap.y; + #if REFLECTION_SKY_FALLOFF > 1 + skyOcclusion = clamp(1.0 - (1.0 - skyOcclusion) * REFLECTION_SKY_FALLOFF, 0.0, 1.0); + #endif + skyOcclusion *= skyOcclusion; + + baseReflectance = mix(vec3(f0), rawAlbedo, metalness); + + #ifdef REFLECTION_SPECULAR + vec3 fresnel3 = mix(baseReflectance, vec3(1.0), fresnel); + #if MATERIAL_FORMAT == 0 + if (f0 >= 0.9 && f0 < 1.0) { + baseReflectance = GetMetalCol(f0); + fresnel3 = ComplexFresnel(pow(fresnel, 0.2), f0); + #ifdef ALBEDO_METAL + fresnel3 *= rawAlbedo; + #endif + } + #endif + + float aoSquared = ao * ao; + shadow *= aoSquared; fresnel3 *= aoSquared * smoothness * smoothness; + + if (smoothness > 0.0) { + vec4 reflection = vec4(0.0); + vec3 skyReflection = vec3(0.0); + float reflectionMask = 0.0; + + float ssrMask = clamp(length(fresnel3) * 400.0 - 1.0, 0.0, 1.0); + if(ssrMask > 0.0) reflection = SimpleReflection(viewPos, newNormal, dither, reflectionMask); + reflection.rgb = pow(reflection.rgb * 2.0, vec3(8.0)); + reflection.a *= ssrMask; + + if (reflection.a < 1.0) { + #ifdef OVERWORLD + vec3 skyRefPos = reflect(normalize(viewPos.xyz), newNormal); + skyReflection = GetSkyColor(skyRefPos, true); + + #ifdef AURORA + skyReflection += DrawAurora(skyRefPos * 100.0, dither, 12); + #endif + + #if CLOUDS == 1 + vec4 cloud = DrawCloudSkybox(skyRefPos * 100.0, 1.0, dither, lightCol, ambientCol, false); + skyReflection = mix(skyReflection, cloud.rgb, cloud.a); + #endif + #if CLOUDS == 2 + vec3 cameraPos = GetReflectedCameraPos(worldPos, newNormal); + float cloudViewLength = 0.0; + + vec4 cloud = DrawCloudVolumetric(skyRefPos * 8192.0, cameraPos, 1.0, dither, lightCol, ambientCol, cloudViewLength, true); + skyReflection = mix(skyReflection, cloud.rgb, cloud.a); + #endif + + #ifdef CLASSIC_EXPOSURE + skyReflection *= 4.0 - 3.0 * eBS; + #endif + + skyReflection = mix(vanillaDiffuse * minLightCol, skyReflection, skyOcclusion); + #endif + + #ifdef NETHER + skyReflection = netherCol.rgb * 0.04; + #endif + + #ifdef END + skyReflection = endCol.rgb * 0.01; + #endif + } + + reflection.rgb = max(mix(skyReflection, reflection.rgb, reflectionMask), vec3(0.0)); + + albedo.rgb = albedo.rgb * (1.0 - fresnel3 * (1.0 - metalness)) + + reflection.rgb * fresnel3; + albedo.a = mix(albedo.a, 1.0, GetLuminance(fresnel3)); + } + #endif + #endif + + #if defined OVERWORLD || defined END + vec3 specularColor = GetSpecularColor(lightmap.y, metalness, baseReflectance); + + albedo.rgb += GetSpecularHighlight(newNormal, viewPos, smoothness, baseReflectance, + specularColor, shadow * vanillaDiffuse, color.a); + #endif + } + + #if WATER_FOG == 1 + if((isEyeInWater == 0 && water > 0.5) || (isEyeInWater == 1 && water < 0.5)) { + float opaqueDepth = texture2D(depthtex1, screenPos.xy).r; + vec3 opaqueScreenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), opaqueDepth); + #ifdef TAA + vec3 opaqueViewPos = ToNDC(vec3(TAAJitter(opaqueScreenPos.xy, -0.5), opaqueScreenPos.z)); + #else + vec3 opaqueViewPos = ToNDC(opaqueScreenPos); + #endif + + vec4 waterFog = GetWaterFog(opaqueViewPos - viewPos.xyz); + albedo = mix(waterFog, vec4(albedo.rgb, 1.0), albedo.a); + } + #endif + + Fog(albedo.rgb, viewPos); + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + #endif + } + albedo.a *= cloudBlendOpacity; + + /* DRAWBUFFERS:01 */ + gl_FragData[0] = albedo; + gl_FragData[1] = vec4(vlAlbedo, 1.0); + + #ifdef MULTICOLORED_BLOCKLIGHT + /* DRAWBUFFERS:018 */ + gl_FragData[2] = vec4(lightAlbedo, 1.0); + #if REFRACTION > 0 + /* DRAWBUFFERS:0186 */ + gl_FragData[3] = vec4(refraction, 1.0); + #endif + #else + #if REFRACTION > 0 + /* DRAWBUFFERS:016 */ + gl_FragData[2] = vec4(refraction, 1.0); + #endif + #endif +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying float mat; +varying float dist; + +varying vec2 texCoord, lmCoord; + +varying vec3 normal, binormal, tangent; +varying vec3 sunVec, upVec, eastVec; +varying vec3 viewVector; + +varying vec4 color; + +#ifdef ADVANCED_MATERIALS +varying vec4 vTexCoord, vTexCoordAM; +#endif + +//Uniforms// +uniform int worldTime; + +uniform float frameTimeCounter; +uniform float timeAngle; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferModelView, gbufferModelViewInverse; + +#ifdef TAA +uniform int frameCounter; + +uniform float viewWidth, viewHeight; +#endif + +//Attributes// +attribute vec4 mc_Entity; +attribute vec4 mc_midTexCoord; +attribute vec4 at_tangent; + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Common Functions// +float WavingWater(vec3 worldPos) { + worldPos += cameraPosition; + float fractY = fract(worldPos.y + 0.005); + + float wave = sin(6.2831854 * (frametime * 0.7 + worldPos.x * 0.14 + worldPos.z * 0.07)) + + sin(6.2831854 * (frametime * 0.5 + worldPos.x * 0.10 + worldPos.z * 0.20)); + if (fractY > 0.01) return wave * 0.0125; + + return 0.0; +} + +//Includes// +#ifdef TAA +#include "/lib/util/jitter.glsl" +#endif + +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; + lmCoord = clamp((lmCoord - 0.03125) * 1.06667, vec2(0.0), vec2(0.9333, 1.0)); + + int blockID = int(mod(max(mc_Entity.x - 10000, 0), 10000)); + + normal = normalize(gl_NormalMatrix * gl_Normal); + binormal = normalize(gl_NormalMatrix * cross(at_tangent.xyz, gl_Normal.xyz) * at_tangent.w); + tangent = normalize(gl_NormalMatrix * at_tangent.xyz); + + mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x, + tangent.y, binormal.y, normal.y, + tangent.z, binormal.z, normal.z); + + viewVector = tbnMatrix * (gl_ModelViewMatrix * gl_Vertex).xyz; + + dist = length(gl_ModelViewMatrix * gl_Vertex); + + #ifdef ADVANCED_MATERIALS + vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st; + vec2 texMinMidCoord = texCoord - midCoord; + + vTexCoordAM.pq = abs(texMinMidCoord) * 2; + vTexCoordAM.st = min(texCoord, midCoord - texMinMidCoord); + + vTexCoord.xy = sign(texMinMidCoord) * 0.5 + 0.5; + #endif + + color = gl_Color; + + if(color.a < 0.1) color.a = 1.0; + + mat = 0.0; + + if (blockID == 300 || blockID == 304) mat = 1.0; + if (blockID == 301) mat = 2.0; + if (blockID == 302) mat = 3.0; + if (blockID == 303) mat = 4.0; + + const vec2 sunRotationData = vec2( + cos(sunPathRotation * 0.01745329251994), + -sin(sunPathRotation * 0.01745329251994) + ); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + eastVec = normalize(gbufferModelView[0].xyz); + + vec4 position = gbufferModelViewInverse * gl_ModelViewMatrix * gl_Vertex; + + #ifdef WAVING_WATER + float istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t ? 1.0 : 0.0; + if (blockID == 300 || blockID == 302 || blockID == 304) position.y += WavingWater(position.xyz); + #endif + + #ifdef WORLD_CURVATURE + position.y -= WorldCurvature(position.xz); + #endif + + gl_Position = gl_ProjectionMatrix * gbufferModelView * position; + if (mat == 0.0) gl_Position.z -= 0.00001; + + #ifdef TAA + gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); + #endif +} + +#endif \ No newline at end of file diff --git a/shaders/program/gbuffers_weather.glsl b/shaders/program/gbuffers_weather.glsl new file mode 100644 index 0000000..2600fd4 --- /dev/null +++ b/shaders/program/gbuffers_weather.glsl @@ -0,0 +1,126 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 upVec, sunVec; + +//Uniforms// +uniform int isEyeInWater; +uniform int worldTime; + +uniform float nightVision; +uniform float rainStrength; +uniform float timeAngle, timeBrightness; +uniform float viewWidth, viewHeight; + +uniform ivec2 eyeBrightnessSmooth; + +uniform mat4 gbufferProjectionInverse; + +uniform sampler2D texture; +uniform sampler2D depthtex0; + +//Common Variables// +float eBS = eyeBrightnessSmooth.y / 240.0; +float sunVisibility = clamp(dot(sunVec, upVec) + 0.05, 0.0, 0.1) * 10.0; + +//Common Functions// +void Defog(inout vec3 albedo, float fogDensity) { + float z = texture2D(depthtex0,gl_FragCoord.xy/vec2(viewWidth,viewHeight)).r; + if (z == 1.0) return; + + vec4 screenPos = vec4(gl_FragCoord.xy / vec2(viewWidth, viewHeight), z, 1.0); + vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0); + viewPos /= viewPos.w; + + float fog = length(viewPos) * fogDensity / 256.0; + float clearDay = sunVisibility * (1.0 - rainStrength); + fog *= (0.5 * rainStrength + 1.0) / (3.0 * clearDay + 1.0); + fog = 1.0 - exp(-2.0 * pow(fog, 0.25 * clearDay + 1.25) * eBS); + albedo.rgb /= 1.0 - fog; +} + +//Includes// +#include "/lib/color/lightColor.glsl" +#include "/lib/color/blocklightColor.glsl" +#include "/lib/atmospherics/weatherDensity.glsl" + +//Program// +void main() { + #if defined NETHER || defined END + discard; + #endif + + vec4 albedo = vec4(0.0); + + albedo.a = texture2D(texture, texCoord).a; + + if (albedo.a > 0.001) { + albedo.rgb = texture2D(texture, texCoord).rgb; + + albedo.a *= 0.25 * rainStrength * length(albedo.rgb / 3.0) * float(albedo.a > 0.1); + albedo.rgb = sqrt(albedo.rgb); + albedo.rgb *= (ambientCol + lmCoord.x * lmCoord.x * blocklightCol) * WEATHER_OPACITY; + + #if MC_VERSION < 10800 + albedo.a *= 4.0; + albedo.rgb *= 0.525; + #endif + + #if defined FOG && MC_VERSION < 11500 + if (gl_FragCoord.z > 0.991) Defog(albedo.rgb, fogDensity); + #endif + + #if ALPHA_BLEND == 0 + albedo.rgb = sqrt(max(albedo.rgb, vec3(0.0))); + albedo.a *= 1.4; + #endif + } + +/* DRAWBUFFERS:0 */ + gl_FragData[0] = albedo; +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying vec2 texCoord, lmCoord; + +varying vec3 sunVec, upVec; + +//Uniforms// +uniform float timeAngle; + +uniform mat4 gbufferModelView; + +//Program// +void main() { + texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + + lmCoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; + lmCoord = clamp(lmCoord * 2.0 - 1.0, 0.0, 1.0); + + const vec2 sunRotationData = vec2(cos(sunPathRotation * 0.01745329251994), -sin(sunPathRotation * 0.01745329251994)); + float ang = fract(timeAngle - 0.25); + ang = (ang + (cos(ang * 3.14159265358979) * -0.5 + 0.5 - ang) / 3.0) * 6.28318530717959; + sunVec = normalize((gbufferModelView * vec4(vec3(-sin(ang), cos(ang) * sunRotationData) * 2000.0, 1.0)).xyz); + + upVec = normalize(gbufferModelView[1].xyz); + + gl_Position = ftransform(); +} + +#endif \ No newline at end of file diff --git a/shaders/program/shadow.glsl b/shaders/program/shadow.glsl new file mode 100644 index 0000000..f2d1c3d --- /dev/null +++ b/shaders/program/shadow.glsl @@ -0,0 +1,243 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// +varying float mat; + +varying vec2 texCoord; + +#ifdef WATER_CAUSTICS +varying vec3 worldPos; +#endif + +varying vec4 color; + +//Uniforms// +uniform int blockEntityId; + +uniform sampler2D tex; + +#ifdef WATER_CAUSTICS +uniform int worldTime; + +uniform float frameTimeCounter; + +uniform sampler2D noisetex; +#endif + +//Common Variables// +#ifdef WATER_CAUSTICS +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +float GetWaterHeightMap(vec3 worldPos, vec2 offset) { + float noise = 0.0; + + vec2 wind = vec2(frametime) * 0.5 * WATER_SPEED; + + worldPos.xz -= worldPos.y * 0.2; + + #if WATER_NORMALS == 1 + offset /= 256.0; + float noiseA = texture2D(noisetex, (worldPos.xz - wind) / 256.0 + offset).g; + float noiseB = texture2D(noisetex, (worldPos.xz + wind) / 48.0 + offset).g; + #elif WATER_NORMALS == 2 + offset /= 256.0; + float noiseA = texture2D(noisetex, (worldPos.xz - wind) / 256.0 + offset).r; + float noiseB = texture2D(noisetex, (worldPos.xz + wind) / 96.0 + offset).r; + noiseA *= noiseA; noiseB *= noiseB; + #endif + + #if WATER_NORMALS > 0 + noise = mix(noiseA, noiseB, WATER_DETAIL); + #endif + + return noise * WATER_CAUSTICS_STRENGTH; +} +#endif + +#ifdef WATER_SHADOW_COLOR +#include "/lib/color/waterColor.glsl" +#endif + +//Program// +void main() { + #if MC_VERSION >= 11300 + if (blockEntityId == 10205) discard; + #endif + + vec4 albedo = texture2D(tex, texCoord.xy); + albedo.rgb *= color.rgb; + + float premult = float(mat > 0.98 && mat < 1.02); + float water = float(mat > 1.98 && mat < 2.02); + float disable = float(mat > 2.98 && mat < 3.02); + if (albedo.a < 0.01 || disable > 0.5) discard; + + if (water > 0.5) { + #if !defined WATER_SHADOW_COLOR && !defined WATER_CAUSTICS + discard; + #else + #ifdef WATER_SHADOW_COLOR + #if WATER_MODE == 0 + albedo.rgb = pow(waterColor.rgb / waterColor.a, vec3(0.25)); + #elif WATER_MODE == 1 + albedo.rgb = sqrt(albedo.rgb); + #elif WATER_MODE == 2 + float waterLuma = length(albedo.rgb * albedo.rgb / pow(color.rgb, vec3(2.2))) * 2.0; + albedo.rgb = sqrt(waterLuma * sqrt(waterColor.rgb / waterColor.a)); + #elif WATER_MODE == 3 + albedo.rgb = sqrt(color.rgb * 0.59); + #endif + + #if WATER_ALPHA_MODE == 0 + albedo.a = waterAlpha; + #endif + #else + albedo.rgb = vec3(1.0); + #endif + + #ifdef WATER_CAUSTICS + float normalOffset = WATER_SHARPNESS + 0.2; + + float normalStrength = 0.35; + + float h0 = GetWaterHeightMap(worldPos, vec2(0.0)); + float h1 = GetWaterHeightMap(worldPos, vec2( normalOffset, 0.0)); + float h2 = GetWaterHeightMap(worldPos, vec2(-normalOffset, 0.0)); + float h3 = GetWaterHeightMap(worldPos, vec2(0.0, normalOffset)); + float h4 = GetWaterHeightMap(worldPos, vec2(0.0, -normalOffset)); + + float xDeltaA = (h1 - h0) / normalOffset; + float xDeltaB = (h2 - h0) / normalOffset; + float yDeltaA = (h3 - h0) / normalOffset; + float yDeltaB = (h4 - h0) / normalOffset; + + float height = max((xDeltaA * -xDeltaB + yDeltaA * -yDeltaB), 0.0); + + #if WATER_NORMALS == 1 + height *= 48.0; + #elif WATER_NORMALS == 2 + height *= 24.0; + #endif + + #ifdef WATER_SHADOW_COLOR + height /= length(albedo.rgb); + #endif + + height /= sqrt(height * height / 9.0 + 1.0); + + albedo.rgb *= 1.0 + height; + #endif + #endif + } + + #ifdef SHADOW_COLOR + albedo.rgb = mix(vec3(1.0), albedo.rgb, 1.0 - pow(1.0 - albedo.a, 1.5)); + albedo.rgb *= 1.0 - pow(albedo.a, 96.0); + #else + if ((premult > 0.5 && albedo.a < 0.98)) albedo.a = 0.0; + #endif + + #ifdef WATER_CAUSTICS + albedo.rgb *= 0.25; + #endif + + gl_FragData[0] = albedo; +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// +varying float mat; + +varying vec2 texCoord; + +#ifdef WATER_CAUSTICS +varying vec3 worldPos; +#endif + +varying vec4 color; + +//Uniforms// +uniform int worldTime; + +uniform float frameTimeCounter; + +uniform vec3 cameraPosition; + +uniform mat4 gbufferModelView, gbufferModelViewInverse; +uniform mat4 shadowProjection, shadowProjectionInverse; +uniform mat4 shadowModelView, shadowModelViewInverse; + +//Attributes// +attribute vec4 mc_Entity; +attribute vec4 mc_midTexCoord; + +//Common Variables// +#ifdef WORLD_TIME_ANIMATION +float frametime = float(worldTime) * 0.05 * ANIMATION_SPEED; +#else +float frametime = frameTimeCounter * ANIMATION_SPEED; +#endif + +//Includes// +#include "/lib/vertex/waving.glsl" + +#ifdef WORLD_CURVATURE +#include "/lib/vertex/worldCurvature.glsl" +#endif + +//Program// +void main() { + texCoord = gl_MultiTexCoord0.xy; + + int blockID = int(mod(max(mc_Entity.x - 10000, 0), 10000)); + + color = gl_Color; + + mat = 0; + if (blockID == 301 || blockID == 302) mat = 1; + if (blockID == 300 || blockID == 304) mat = 2; + + #ifndef SHADOW_VEGETATION + if (blockID >= 100 && blockID <= 104) mat = 3; + #endif + + vec4 position = shadowModelViewInverse * shadowProjectionInverse * ftransform(); + + #ifdef WATER_CAUSTICS + worldPos = position.xyz + cameraPosition.xyz; + #endif + + float istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t ? 1.0 : 0.0; + position.xyz = WavingBlocks(position.xyz, blockID, istopv); + + #ifdef WORLD_CURVATURE + position.y -= WorldCurvature(position.xz); + #endif + + gl_Position = shadowProjection * shadowModelView * position; + + float dist = sqrt(gl_Position.x * gl_Position.x + gl_Position.y * gl_Position.y); + float distortFactor = dist * shadowMapBias + (1.0 - shadowMapBias); + + gl_Position.xy *= 1.0 / distortFactor; + gl_Position.z = gl_Position.z * 0.2; +} + +#endif \ No newline at end of file diff --git a/shaders/program/template.glsl b/shaders/program/template.glsl new file mode 100644 index 0000000..7a9a55d --- /dev/null +++ b/shaders/program/template.glsl @@ -0,0 +1,55 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +//Settings// +#include "/lib/settings.glsl" + +//Fragment Shader/////////////////////////////////////////////////////////////////////////////////// +#ifdef FSH + +//Varyings// + +//Uniforms// + +//Attributes// + +//Optifine Constants// + +//Common Variables// + +//Common Functions// + +//Includes// + +//Program// +void main() { + +} + +#endif + +//Vertex Shader///////////////////////////////////////////////////////////////////////////////////// +#ifdef VSH + +//Varyings// + +//Uniforms// + +//Attributes// + +//Optifine Constants// + +//Common Variables// + +//Common Functions// + +//Includes// + +//Program// +void main() { + +} + +#endif diff --git a/shaders/shaders.properties b/shaders/shaders.properties new file mode 100644 index 0000000..b67aee2 --- /dev/null +++ b/shaders/shaders.properties @@ -0,0 +1,220 @@ +#BSL Shaders Shader Properties + +#Profiles +profile.MINIMUM=!AO !LIGHT_SHAFT !SHADOW !SHADOW_COLOR !SHADOW_FILTER shadowMapResolution=512 shadowDistance=128.0 +profile.LOW=profile.MINIMUM SHADOW shadowMapResolution=1024 shadowDistance=128.0 +profile.MEDIUM=profile.LOW AO SHADOW_FILTER shadowMapResolution=1536 shadowDistance=192.0 +profile.HIGH=profile.MEDIUM LIGHT_SHAFT SHADOW_COLOR shadowMapResolution=2048 shadowDistance=256.0 +profile.ULTRA=profile.HIGH shadowMapResolution=3072 shadowDistance=512.0 + +#Force Video Settings +dynamicHandLight=true +oldHandLight=false +oldLighting=false +particles.ordering=mixed +separateAo=true +shadow.culling=true +underwaterOverlay=false +vignette=false + +#Screen Setup +screen= ABOUT [LIGHTING] [MATERIAL] [ATMOSPHERICS] [WATER] [CAMERA] [ANTIALIASING] [COLOR] [CGT] [EXTRAS] [ANIMATION] + +screen.LIGHTING= SHADOW [SHADOW_CONFIG] shadowMapResolution shadowDistance SHADOW_FILTER SHADOW_COLOR AO AO_STRENGTH DESATURATION DESATURATION_FACTOR MULTICOLORED_BLOCKLIGHT [MCBL] DYNAMIC_HANDLIGHT WHITE_WORLD +screen.SHADOW_CONFIG= SHADOW_ENTITY SHADOW_BLOCK_ENTITY SHADOW_VEGETATION SHADOW_CLOUD sunPathRotation SHADOW_BIAS SHADOW_PIXEL +screen.MCBL= MCBL_ANTI_BLEED MCBL_LEGACY_COLOR + +screen.MATERIAL= ADVANCED_MATERIALS MATERIAL_FORMAT [SPECULAR] [NORMALS] SSS BASIC_SSS EMISSIVE REFRACTION ALBEDO_BALANCING ALPHA_BLEND ENTITY_FLASH +screen.SPECULAR= REFLECTION REFLECTION_TRANSLUCENT REFLECTION_SPECULAR REFLECTION_ROUGH REFLECTION_RAIN REFLECTION_RAIN_AMOUNT REFLECTION_PREVIOUS SPECULAR_HIGHLIGHT_ROUGH ALBEDO_METAL REFLECTION_MODE REFLECTION_SKY_FALLOFF REFLECTION_SKYBOX +screen.NORMALS= PARALLAX PARALLAX_DEPTH PARALLAX_QUALITY PARALLAX_DISTANCE SELF_SHADOW SELF_SHADOW_ANGLE SELF_SHADOW_QUALITY SELF_SHADOW_STRENGTH GENERATED_NORMALS [GENERATED_NORMAL_SETTINGS] DIRECTIONAL_LIGHTMAP DIRECTIONAL_LIGHTMAP_STRENGTH NORMAL_DAMPENING NORMAL_PLANTS + +screen.GENERATED_NORMAL_SETTINGS= GENERATED_NORMAL_MULT GENERATED_NORMAL_THRESHOLD GENERATED_NORMAL_CLAMP GENERATED_NORMAL_RESOLUTION + +screen.ATMOSPHERICS= [CLOUDS] [FOG] [SKY] [SKYBOX] LIGHT_SHAFT LIGHT_SHAFT_STRENGTH WEATHER_PERBIOME WEATHER_OPACITY +screen.SKY= SKY_DENSITY_D SKY_EXPOSURE_D SKY_DENSITY_N SKY_EXPOSURE_N SKY_DENSITY_W SKY_EXPOSURE_W SKY_HORIZON_N SKY_HORIZON_F SKY_DESATURATION SKY_GROUND UNDERGROUND_SKY SHADER_END_SKY SKY_DEFERRED +screen.CLOUDS= CLOUDS CLOUD_BASE CLOUD_DENSITY CLOUD_AMOUNT CLOUD_HEIGHT CLOUD_THICKNESS CLOUD_DETAIL CLOUD_SPEED CLOUD_OPACITY CLOUD_BRIGHTNESS CLOUD_VOLUMETRIC_SCALE +screen.FOG= FOG_DENSITY [FOG_DENSITY] FOG_HEIGHT [FOG_HEIGHT] FAR_VANILLA_FOG [FOG_VANILLA] +screen.FOG_DENSITY= FOG_DENSITY_NIGHT FOG_DENSITY_WEATHER FOG_DENSITY_COLD FOG_DENSITY_DRY FOG_DENSITY_DAMP FOG_DENSITY_INDOOR FOG_DENSITY_DH +screen.FOG_HEIGHT= FOG_HEIGHT_Y FOG_HEIGHT_FALLOFF +screen.FOG_VANILLA= FAR_VANILLA_FOG_STYLE FOG_DENSITY_VANILLA FOG_VANILLA_CLOUD +screen.SKYBOX= ROUND_SUN_MOON ROUND_SUN_MOON_SIZE STARS AURORA SKYBOX_INTENSITY SKYBOX_OPACITY SUN_INTENSITY MOON_INTENSITY + +screen.WATER= WATER_MODE WATER_ALPHA_MODE WATER_NORMALS WATER_PARALLAX WATER_SHADOW_COLOR WATER_CAUSTICS WATER_DETAIL WATER_SHARPNESS WATER_BUMP WATER_SPEED WATER_FOG WATER_FOG_DENSITY WATER_CAUSTICS_STRENGTH WATER_PIXEL + +screen.CAMERA= DOF DOF_STRENGTH MOTION_BLUR MOTION_BLUR_STRENGTH BLOOM BLOOM_STRENGTH BLOOM_CONTRAST BLOOM_RADIUS LENS_FLARE LENS_FLARE_STRENGTH VIGNETTE VIGNETTE_STRENGTH DIRTY_LENS CHROMATIC_ABERRATION UNDERWATER_DISTORTION + +screen.ANTIALIASING= FXAA TAA FXAA_SUBPIXEL FXAA_EDGE_SENSITIVITY TAA_MODE TAA_SELECTIVE + +screen.COLOR= [LIGHT_COLOR] [BLOCKLIGHT_COLOR] [SKY_COLOR] [WATER_COLOR] [WEATHER_COLOR] [AURORA_COLOR] [NETHER_COLOR] [END_COLOR] +screen.LIGHT_COLOR= [LIGHT_M] [AMBIENT_M] [LIGHT_D] [AMBIENT_D] [LIGHT_E] [AMBIENT_E] [LIGHT_N] [AMBIENT_N] [MINLIGHT] +screen.LIGHT_M= LIGHT_MR LIGHT_MG LIGHT_MB LIGHT_MI +screen.LIGHT_D= LIGHT_DR LIGHT_DG LIGHT_DB LIGHT_DI +screen.LIGHT_E= LIGHT_ER LIGHT_EG LIGHT_EB LIGHT_EI +screen.LIGHT_N= LIGHT_NR LIGHT_NG LIGHT_NB LIGHT_NI +screen.AMBIENT_M= AMBIENT_MR AMBIENT_MG AMBIENT_MB AMBIENT_MI +screen.AMBIENT_D= AMBIENT_DR AMBIENT_DG AMBIENT_DB AMBIENT_DI +screen.AMBIENT_E= AMBIENT_ER AMBIENT_EG AMBIENT_EB AMBIENT_EI +screen.AMBIENT_N= AMBIENT_NR AMBIENT_NG AMBIENT_NB AMBIENT_NI +screen.MINLIGHT= MINLIGHT_R MINLIGHT_G MINLIGHT_B MINLIGHT_I +screen.BLOCKLIGHT_COLOR= BLOCKLIGHT_R BLOCKLIGHT_G BLOCKLIGHT_B BLOCKLIGHT_I EMISSIVE_RECOLOR +screen.SKY_COLOR= SKY_R SKY_G SKY_B SKY_I SKY_VANILLA SKY_VANILLA_USE_FOG +screen.WATER_COLOR= WATER_R WATER_G WATER_B WATER_I WATER_A WATER_F +screen.WEATHER_COLOR= [WEATHER_R] [WEATHER_C] [WEATHER_D] [WEATHER_B] [WEATHER_S] [WEATHER_M] [WEATHER_V] [WEATHER_J] +screen.WEATHER_R= WEATHER_RR WEATHER_RG WEATHER_RB WEATHER_RI +screen.WEATHER_C= WEATHER_CR WEATHER_CG WEATHER_CB WEATHER_CI +screen.WEATHER_D= WEATHER_DR WEATHER_DG WEATHER_DB WEATHER_DI +screen.WEATHER_B= WEATHER_BR WEATHER_BG WEATHER_BB WEATHER_BI +screen.WEATHER_S= WEATHER_SR WEATHER_SG WEATHER_SB WEATHER_SI +screen.WEATHER_M= WEATHER_MR WEATHER_MG WEATHER_MB WEATHER_MI +screen.WEATHER_V= WEATHER_VR WEATHER_VG WEATHER_VB WEATHER_VI +screen.WEATHER_J= WEATHER_JR WEATHER_JG WEATHER_JB WEATHER_JI +screen.AURORA_COLOR= [AURORA_L] [AURORA_H] +screen.AURORA_L= AURORA_LR AURORA_LG AURORA_LB AURORA_LI +screen.AURORA_H= AURORA_HR AURORA_HG AURORA_HB AURORA_HI +screen.NETHER_COLOR= [NETHER_N] [NETHER_V] [NETHER_C] [NETHER_W] [NETHER_B] NETHER_VANILLA +screen.NETHER_N= NETHER_NR NETHER_NG NETHER_NB NETHER_NI +screen.NETHER_V= NETHER_VR NETHER_VG NETHER_VB NETHER_VI +screen.NETHER_C= NETHER_CR NETHER_CG NETHER_CB NETHER_CI +screen.NETHER_W= NETHER_WR NETHER_WG NETHER_WB NETHER_WI +screen.NETHER_B= NETHER_BR NETHER_BG NETHER_BB NETHER_BI +screen.END_COLOR= END_R END_G END_B END_I + +screen.CGT= EXPOSURE AUTO_EXPOSURE CLASSIC_EXPOSURE [EXPOSURE_CONFIG] COLOR_GRADING [COLOR_GRADING_CONFIG] TONEMAP_LOWER_CURVE TONEMAP_UPPER_CURVE TONEMAP_WHITE_CURVE TONEMAP_WHITE_PATH SATURATION VIBRANCE +screen.EXPOSURE_CONFIG= AUTO_EXPOSURE_RADIUS AUTO_EXPOSURE_SPEED +screen.COLOR_GRADING_CONFIG= [CG_R] [CG_G] [CG_B] [CG_T] +screen.CG_R= CG_RR CG_RG CG_RB CG_RI CG_RM CG_RC +screen.CG_G= CG_GR CG_GG CG_GB CG_GI CG_GM CG_GC +screen.CG_B= CG_BR CG_BG CG_BB CG_BI CG_BM CG_BC +screen.CG_T= CG_TR CG_TG CG_TB CG_TI CG_TM + +screen.EXTRAS= OUTLINE TOON_LIGHTMAP RETRO_FILTER RETRO_FILTER_SIZE WORLD_CURVATURE WORLD_CURVATURE_SIZE + +screen.ANIMATION= WORLD_TIME_ANIMATION ANIMATION_SPEED WAVING_GRASS WAVING_CROP WAVING_PLANT WAVING_TALL_PLANT WAVING_LEAF WAVING_VINE WAVING_WATER WAVING_LAVA WAVING_FIRE WAVING_LANTERN + +#Set Sliders +sliders=shadowMapResolution shadowDistance sunPathRotation SHADOW_PIXEL AO_STRENGTH DESATURATION_FACTOR REFLECTION_RAIN_AMOUNT REFLECTION_SKY_FALLOFF PARALLAX_DEPTH PARALLAX_QUALITY PARALLAX_DISTANCE SELF_SHADOW_ANGLE SELF_SHADOW_QUALITY SELF_SHADOW_STRENGTH DIRECTIONAL_LIGHTMAP_STRENGTH DOF_STRENGTH MOTION_BLUR_STRENGTH BLOOM_STRENGTH BLOOM_CONTRAST BLOOM_RADIUS LENS_FLARE_STRENGTH VIGNETTE_STRENGTH EXPOSURE AUTO_EXPOSURE_RADIUS AUTO_EXPOSURE_SPEED TONEMAP_LOWER_CURVE TONEMAP_UPPER_CURVE TONEMAP_WHITE_CURVE TONEMAP_WHITE_PATH SATURATION VIBRANCE CG_RR CG_RG CG_RB CG_RI CG_RM CG_RC CG_GR CG_GG CG_GB CG_GI CG_GM CG_GC CG_BR CG_BG CG_BB CG_BI CG_BM CG_BC CG_TR CG_TG CG_TB CG_TI CG_TM FXAA_SUBPIXEL FXAA_EDGE_SENSITIVITY LIGHT_MR LIGHT_MG LIGHT_MB LIGHT_MI LIGHT_DR LIGHT_DG LIGHT_DB LIGHT_DI LIGHT_ER LIGHT_EG LIGHT_EB LIGHT_EI LIGHT_NR LIGHT_NG LIGHT_NB LIGHT_NI AMBIENT_MR AMBIENT_MG AMBIENT_MB AMBIENT_MI AMBIENT_DR AMBIENT_DG AMBIENT_DB AMBIENT_DI AMBIENT_ER AMBIENT_EG AMBIENT_EB AMBIENT_EI AMBIENT_NR AMBIENT_NG AMBIENT_NB AMBIENT_NI MINLIGHT_R MINLIGHT_G MINLIGHT_B MINLIGHT_I BLOCKLIGHT_R BLOCKLIGHT_G BLOCKLIGHT_B BLOCKLIGHT_I SKY_R SKY_G SKY_B SKY_I WATER_R WATER_G WATER_B WATER_I WATER_A WATER_F WEATHER_RR WEATHER_RG WEATHER_RB WEATHER_RI WEATHER_CR WEATHER_CG WEATHER_CB WEATHER_CI WEATHER_DR WEATHER_DG WEATHER_DB WEATHER_DI WEATHER_BR WEATHER_BG WEATHER_BB WEATHER_BI WEATHER_SR WEATHER_SG WEATHER_SB WEATHER_SI WEATHER_MR WEATHER_MG WEATHER_MB WEATHER_MI WEATHER_VR WEATHER_VG WEATHER_VB WEATHER_VI WEATHER_JR WEATHER_JG WEATHER_JB WEATHER_JI AURORA_LR AURORA_LG AURORA_LB AURORA_LI AURORA_HR AURORA_HG AURORA_HB AURORA_HI NETHER_NR NETHER_NG NETHER_NB NETHER_NI NETHER_VR NETHER_VG NETHER_VB NETHER_VI NETHER_CR NETHER_CG NETHER_CB NETHER_CI NETHER_WR NETHER_WG NETHER_WB NETHER_WI NETHER_BR NETHER_BG NETHER_BB NETHER_BI END_R END_G END_B END_I CLOUD_DENSITY CLOUD_AMOUNT CLOUD_HEIGHT CLOUD_THICKNESS CLOUD_DETAIL CLOUD_OPACITY CLOUD_SPEED CLOUD_BRIGHTNESS CLOUD_VOLUMETRIC_SCALE SKY_DENSITY_D SKY_EXPOSURE_D SKY_DENSITY_N SKY_EXPOSURE_N SKY_DENSITY_W SKY_EXPOSURE_W SKY_HORIZON_N SKY_HORIZON_F SKYBOX_INTENSITY SKYBOX_OPACITY SUN_INTENSITY MOON_INTENSITY FOG_DENSITY FOG_DENSITY_NIGHT FOG_DENSITY_WEATHER FOG_DENSITY_COLD FOG_DENSITY_DRY FOG_DENSITY_DAMP FOG_DENSITY_INDOOR FOG_DENSITY_DH FOG_HEIGHT_Y FOG_HEIGHT_FALLOFF FOG_DENSITY_VANILLA LIGHT_SHAFT_STRENGTH ROUND_SUN_MOON_SIZE WEATHER_OPACITY WATER_SHARPNESS WATER_DETAIL WATER_BUMP WATER_SPEED WATER_FOG_DENSITY WATER_CAUSTICS_STRENGTH WATER_PIXEL RETRO_FILTER_SIZE WORLD_CURVATURE_SIZE ANIMATION_SPEED GENERATED_NORMAL_MULT GENERATED_NORMAL_THRESHOLD GENERATED_NORMAL_CLAMP GENERATED_NORMAL_RESOLUTION + +#Program Toggle +program.world0/shadow.enabled=SHADOW +program.world-1/shadow.enabled=SHADOW +program.world1/shadow.enabled=SHADOW +program.world0/deferred.enabled=AO +program.world-1/deferred.enabled=AO +program.world1/deferred.enabled=AO +program.world0/composite1.enabled=LIGHT_SHAFT +program.world1/composite1.enabled=LIGHT_SHAFT +program.world0/composite2.enabled=MOTION_BLUR +program.world-1/composite2.enabled=MOTION_BLUR +program.world1/composite2.enabled=MOTION_BLUR +program.world0/composite3.enabled=DOF +program.world-1/composite3.enabled=DOF +program.world1/composite3.enabled=DOF +program.world0/composite6.enabled=FXAA && !RETRO_FILTER +program.world-1/composite6.enabled=FXAA && !RETRO_FILTER +program.world1/composite6.enabled=FXAA && !RETRO_FILTER +program.world0/composite7.enabled=TAA && !RETRO_FILTER +program.world-1/composite7.enabled=TAA && !RETRO_FILTER +program.world1/composite7.enabled=TAA && !RETRO_FILTER + +#Disable Fast Leaves +alphaTest.gbuffers_terrain=GREATER 0.1 + +#Allow Low Opacity +alphaTest.gbuffers_clouds=GREATER 0.005 +alphaTest.gbuffers_hand=GREATER 0.005 +alphaTest.gbuffers_water=GREATER 0.001 +alphaTest.gbuffers_weather=GREATER 0.0001 + +#Enable Beacon Beam Depth +beacon.beam.depth=true + +#Custom Texture +texture.noise=tex/noise.png +texture.composite.depthtex2=tex/dirt.png + +#Custom Time Uniform +#variable.float.tAmin=frac(sunAngle - 0.033333333) +#variable.float.tAlin=if(tAmin < 0.433333333, tAmin * 1.15384615385, tAmin * 0.882352941176 + 0.117647058824) +#variable.float.hA=if(tAlin > 0.5, 1.0, 0.0) +#variable.float.tAfrc=frac(tAlin * 2.0) +#variable.float.tAfrs=tAfrc * tAfrc * (3.0 - 2.0 * tAfrc) +#variable.float.tAmix=if(hA < 0.5, 0.3, -0.1) +#uniform.float.timeAngle=(tAfrc * (1.0 - tAmix) + tAfrs * tAmix + hA) * 0.5 +#uniform.float.shadowFade=clamp(1.0 - (abs(abs(sunAngle - 0.5) - 0.25) - 0.23) * 100.0, 0.0, 1.0) +uniform.float.timeAngle=worldTime / 24000 +variable.float.shadowFadeOut1=clamp((worldTime - 12330) / 230, 0.0, 1.0) +variable.float.shadowFadeIn1=clamp((worldTime - 13010) / 220, 0.0, 1.0) +variable.float.shadowFadeOut2=clamp((worldTime - 22770) / 220, 0.0, 1.0) +variable.float.shadowFadeIn2=clamp((worldTime - 23440) / 230, 0.0, 1.0) +uniform.float.shadowFade=1.0 - (shadowFadeOut1 - shadowFadeIn1 + shadowFadeOut2 - shadowFadeIn2) +uniform.float.timeBrightness=max(sin(timeAngle * 6.28318530718), 0.0) + +#Custom Blindness Uniform +variable.float.blindFactorSqrt=clamp(blindness * 2.0 - 1.0, 0.0, 1.0) +uniform.float.blindFactor=blindFactorSqrt * blindFactorSqrt + +#Custom Biome Uniforms +variable.float.yCold1=if(cameraPosition.y >= 93.0, 1, 0) +variable.float.yCold2=if(cameraPosition.y >= 123.0, 1, 0) +variable.float.yCold3=if(cameraPosition.y >= 153.0, 1, 0) + +#if MC_VERSION >= 11800 +uniform.float.isCold=smooth(1, if(in(biome, BIOME_GROVE, BIOME_FROZEN_OCEAN, BIOME_FROZEN_RIVER, BIOME_SNOWY_PLAINS, BIOME_SNOWY_BEACH, BIOME_SNOWY_TAIGA, BIOME_ICE_SPIKES), 1, 0), 10, 10) + \ + smooth(11, if(in(biome, BIOME_WINDSWEPT_HILLS, BIOME_STONY_SHORE, BIOME_WINDSWEPT_FOREST, BIOME_WINDSWEPT_GRAVELLY_HILLS), 1, 0) * yCold1, 10, 10) + \ + smooth(12, if(in(biome, BIOME_TAIGA, BIOME_OLD_GROWTH_PINE_TAIGA), 1, 0) * yCold2, 10, 10) + \ + smooth(13, if(in(biome, BIOME_OLD_GROWTH_SPRUCE_TAIGA), 1, 0) * yCold3, 10, 10) +uniform.float.isDesert=smooth(2, if(in(biome, BIOME_DESERT), 1, 0), 10, 10) +uniform.float.isMesa=smooth(3, if(in(biome, BIOME_BADLANDS, BIOME_WOODED_BADLANDS, BIOME_ERODED_BADLANDS), 1, 0), 10, 10) +uniform.float.isSwamp=smooth(4, if(in(biome, BIOME_SWAMP, BIOME_MANGROVE_SWAMP), 1, 0), 10, 10) +uniform.float.isMushroom=smooth(5, if(in(biome, BIOME_MUSHROOM_FIELDS), 1, 0), 10, 10) +uniform.float.isSavanna=smooth(6, if(in(biome, BIOME_SAVANNA, BIOME_SAVANNA_PLATEAU), 1, 0), 10, 10) +uniform.float.isJungle=smooth(7, if(in(biome, BIOME_JUNGLE, BIOME_SPARSE_JUNGLE, BIOME_BAMBOO_JUNGLE), 1, 0), 10, 10) + +uniform.float.isValley=smooth(8, if(in(biome, BIOME_SOUL_SAND_VALLEY), 1, 0), 10, 10) +uniform.float.isCrimson=smooth(9, if(in(biome, BIOME_CRIMSON_FOREST), 1, 0), 10, 10) +uniform.float.isWarped=smooth(10, if(in(biome, BIOME_WARPED_FOREST), 1, 0), 10, 10) +uniform.float.isBasalt=smooth(11, if(in(biome, BIOME_BASALT_DELTAS), 1, 0), 10, 10) + +uniform.float.voidFade=clamp((cameraPosition.y + 70.0) / 8.0, 0.0, 1.0) +#else +uniform.float.isCold=smooth(1, if(in(biome, 10, 11, 12, 13, 26, 30, 31, 140, 158), 1, 0), 10, 10) + \ + smooth(11, if(in(biome, 3, 25, 34, 131, 162), 1, 0) * yCold1, 10, 10) + \ + smooth(12, if(in(biome, 5, 19, 32, 33, 133), 1, 0) * yCold2, 10, 10) + \ + smooth(13, if(in(biome, 160, 161), 1, 0) * yCold3, 10, 10) +uniform.float.isDesert=smooth(2, if(in(biome, 2, 17, 130), 1, 0), 10, 10) +uniform.float.isMesa=smooth(3, if(in(biome, 37, 38, 39, 165, 166, 167), 1, 0), 10, 10) +uniform.float.isSwamp=smooth(4, if(in(biome, 6, 134), 1, 0), 10, 10) +uniform.float.isMushroom=smooth(5, if(in(biome, 14, 15), 1, 0), 10, 10) +uniform.float.isSavanna=smooth(6, if(in(biome, 35, 36, 163, 164), 1, 0), 10, 10) +uniform.float.isJungle=smooth(7, if(in(biome, 21, 22, 23, 48, 49, 149, 151), 1, 0), 10, 10) + +uniform.float.isValley=smooth(8, if(in(biome, 170), 1, 0), 10, 10) +uniform.float.isCrimson=smooth(9, if(in(biome, 171), 1, 0), 10, 10) +uniform.float.isWarped=smooth(10, if(in(biome, 172), 1, 0), 10, 10) +uniform.float.isBasalt=smooth(11, if(in(biome, 173), 1, 0), 10, 10) + +uniform.float.voidFade=clamp((cameraPosition.y + 6.0) / 8.0, 0.0, 1.0) +#endif + +#Frame Jitter Uniform +uniform.float.framemod8 = frameCounter % 8 +uniform.float.framemod2 = frameCounter % 2 + +#Disable Frustum Culling When Necessary +#ifdef WORLD_CURVATURE +frustum.culling=false +#endif + +#Disable Entity Shadows If Disabled +#ifndef SHADOW_ENTITY +shadowEntities=false +#endif +#ifndef SHADOW_BLOCK_ENTITY +shadowBlockEntities=false +#endif + +#Disable Distant Horizons Shadow +#ifdef DISTANT_HORIZONS +dhShadow.enabled = false +blend.dh_water=SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE ONE_MINUS_SRC_ALPHA +#endif \ No newline at end of file diff --git a/shaders/tex/dirt.png b/shaders/tex/dirt.png new file mode 100644 index 0000000..14dd337 Binary files /dev/null and b/shaders/tex/dirt.png differ diff --git a/shaders/tex/dirt.png.mcmeta b/shaders/tex/dirt.png.mcmeta new file mode 100644 index 0000000..1902a88 --- /dev/null +++ b/shaders/tex/dirt.png.mcmeta @@ -0,0 +1,7 @@ +{ + "texture": + { + "blur": true, + "clamp": true + } +} \ No newline at end of file diff --git a/shaders/tex/noise.png b/shaders/tex/noise.png new file mode 100644 index 0000000..71fb2f2 Binary files /dev/null and b/shaders/tex/noise.png differ diff --git a/shaders/tex/noise.png.mcmeta b/shaders/tex/noise.png.mcmeta new file mode 100644 index 0000000..33f3199 --- /dev/null +++ b/shaders/tex/noise.png.mcmeta @@ -0,0 +1,7 @@ +{ + "texture": + { + "blur": true, + "clamp": false + } +} \ No newline at end of file diff --git a/shaders/world-1/composite.fsh b/shaders/world-1/composite.fsh new file mode 100644 index 0000000..5f664eb --- /dev/null +++ b/shaders/world-1/composite.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define FSH + +#include "/program/composite.glsl" diff --git a/shaders/world-1/composite.vsh b/shaders/world-1/composite.vsh new file mode 100644 index 0000000..8d2a9b8 --- /dev/null +++ b/shaders/world-1/composite.vsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define VSH + +#include "/program/composite.glsl" diff --git a/shaders/world-1/composite2.fsh b/shaders/world-1/composite2.fsh new file mode 100644 index 0000000..b40b215 --- /dev/null +++ b/shaders/world-1/composite2.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/composite2.glsl" diff --git a/shaders/world-1/composite2.vsh b/shaders/world-1/composite2.vsh new file mode 100644 index 0000000..a2ed581 --- /dev/null +++ b/shaders/world-1/composite2.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/composite2.glsl" diff --git a/shaders/world-1/composite3.fsh b/shaders/world-1/composite3.fsh new file mode 100644 index 0000000..1fc27f0 --- /dev/null +++ b/shaders/world-1/composite3.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/composite3.glsl" diff --git a/shaders/world-1/composite3.vsh b/shaders/world-1/composite3.vsh new file mode 100644 index 0000000..65dffeb --- /dev/null +++ b/shaders/world-1/composite3.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/composite3.glsl" diff --git a/shaders/world-1/composite4.fsh b/shaders/world-1/composite4.fsh new file mode 100644 index 0000000..6b7303f --- /dev/null +++ b/shaders/world-1/composite4.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define FSH + +#include "/program/composite4.glsl" diff --git a/shaders/world-1/composite4.vsh b/shaders/world-1/composite4.vsh new file mode 100644 index 0000000..b1ca20b --- /dev/null +++ b/shaders/world-1/composite4.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/composite4.glsl" diff --git a/shaders/world-1/composite5.fsh b/shaders/world-1/composite5.fsh new file mode 100644 index 0000000..11ebad2 --- /dev/null +++ b/shaders/world-1/composite5.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/composite5.glsl" diff --git a/shaders/world-1/composite5.vsh b/shaders/world-1/composite5.vsh new file mode 100644 index 0000000..9acb4d1 --- /dev/null +++ b/shaders/world-1/composite5.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/composite5.glsl" diff --git a/shaders/world-1/composite6.fsh b/shaders/world-1/composite6.fsh new file mode 100644 index 0000000..44b161d --- /dev/null +++ b/shaders/world-1/composite6.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/composite6.glsl" diff --git a/shaders/world-1/composite6.vsh b/shaders/world-1/composite6.vsh new file mode 100644 index 0000000..c8209b5 --- /dev/null +++ b/shaders/world-1/composite6.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/composite6.glsl" diff --git a/shaders/world-1/composite7.fsh b/shaders/world-1/composite7.fsh new file mode 100644 index 0000000..9afaf1b --- /dev/null +++ b/shaders/world-1/composite7.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/composite7.glsl" diff --git a/shaders/world-1/composite7.vsh b/shaders/world-1/composite7.vsh new file mode 100644 index 0000000..b662b8e --- /dev/null +++ b/shaders/world-1/composite7.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/composite7.glsl" diff --git a/shaders/world-1/deferred.fsh b/shaders/world-1/deferred.fsh new file mode 100644 index 0000000..d24779e --- /dev/null +++ b/shaders/world-1/deferred.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/deferred.glsl" diff --git a/shaders/world-1/deferred.vsh b/shaders/world-1/deferred.vsh new file mode 100644 index 0000000..10c9b6a --- /dev/null +++ b/shaders/world-1/deferred.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/deferred.glsl" diff --git a/shaders/world-1/deferred1.fsh b/shaders/world-1/deferred1.fsh new file mode 100644 index 0000000..c0d5151 --- /dev/null +++ b/shaders/world-1/deferred1.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/deferred1.glsl" diff --git a/shaders/world-1/deferred1.vsh b/shaders/world-1/deferred1.vsh new file mode 100644 index 0000000..4c71c36 --- /dev/null +++ b/shaders/world-1/deferred1.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/deferred1.glsl" diff --git a/shaders/world-1/dh_terrain.fsh b/shaders/world-1/dh_terrain.fsh new file mode 100644 index 0000000..02138b7 --- /dev/null +++ b/shaders/world-1/dh_terrain.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/dh_terrain.glsl" diff --git a/shaders/world-1/dh_terrain.vsh b/shaders/world-1/dh_terrain.vsh new file mode 100644 index 0000000..d5d3501 --- /dev/null +++ b/shaders/world-1/dh_terrain.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/dh_terrain.glsl" diff --git a/shaders/world-1/dh_water.fsh b/shaders/world-1/dh_water.fsh new file mode 100644 index 0000000..d20dfa7 --- /dev/null +++ b/shaders/world-1/dh_water.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/dh_water.glsl" diff --git a/shaders/world-1/dh_water.vsh b/shaders/world-1/dh_water.vsh new file mode 100644 index 0000000..e8a49e2 --- /dev/null +++ b/shaders/world-1/dh_water.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/dh_water.glsl" diff --git a/shaders/world-1/final.fsh b/shaders/world-1/final.fsh new file mode 100644 index 0000000..3b99346 --- /dev/null +++ b/shaders/world-1/final.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/final.glsl" diff --git a/shaders/world-1/final.vsh b/shaders/world-1/final.vsh new file mode 100644 index 0000000..ca9cd49 --- /dev/null +++ b/shaders/world-1/final.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/final.glsl" diff --git a/shaders/world-1/gbuffers_armor_glint.fsh b/shaders/world-1/gbuffers_armor_glint.fsh new file mode 100644 index 0000000..e7fd8a0 --- /dev/null +++ b/shaders/world-1/gbuffers_armor_glint.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define FSH + +#include "/program/gbuffers_armor_glint.glsl" diff --git a/shaders/world-1/gbuffers_armor_glint.vsh b/shaders/world-1/gbuffers_armor_glint.vsh new file mode 100644 index 0000000..4c6ae7e --- /dev/null +++ b/shaders/world-1/gbuffers_armor_glint.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_armor_glint.glsl" diff --git a/shaders/world-1/gbuffers_basic.fsh b/shaders/world-1/gbuffers_basic.fsh new file mode 100644 index 0000000..64b2794 --- /dev/null +++ b/shaders/world-1/gbuffers_basic.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define FSH + +#include "/program/gbuffers_basic.glsl" diff --git a/shaders/world-1/gbuffers_basic.vsh b/shaders/world-1/gbuffers_basic.vsh new file mode 100644 index 0000000..28fbce1 --- /dev/null +++ b/shaders/world-1/gbuffers_basic.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_basic.glsl" diff --git a/shaders/world-1/gbuffers_beaconbeam.fsh b/shaders/world-1/gbuffers_beaconbeam.fsh new file mode 100644 index 0000000..f34d21a --- /dev/null +++ b/shaders/world-1/gbuffers_beaconbeam.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define FSH + +#include "/program/gbuffers_beaconbeam.glsl" diff --git a/shaders/world-1/gbuffers_beaconbeam.vsh b/shaders/world-1/gbuffers_beaconbeam.vsh new file mode 100644 index 0000000..65768c4 --- /dev/null +++ b/shaders/world-1/gbuffers_beaconbeam.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_beaconbeam.glsl" diff --git a/shaders/world-1/gbuffers_block.fsh b/shaders/world-1/gbuffers_block.fsh new file mode 100644 index 0000000..b9f4755 --- /dev/null +++ b/shaders/world-1/gbuffers_block.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/gbuffers_block.glsl" diff --git a/shaders/world-1/gbuffers_block.vsh b/shaders/world-1/gbuffers_block.vsh new file mode 100644 index 0000000..9c6dfd4 --- /dev/null +++ b/shaders/world-1/gbuffers_block.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_block.glsl" diff --git a/shaders/world-1/gbuffers_clouds.fsh b/shaders/world-1/gbuffers_clouds.fsh new file mode 100644 index 0000000..bc28026 --- /dev/null +++ b/shaders/world-1/gbuffers_clouds.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define FSH + +#include "/program/gbuffers_clouds.glsl" diff --git a/shaders/world-1/gbuffers_clouds.vsh b/shaders/world-1/gbuffers_clouds.vsh new file mode 100644 index 0000000..96d56a3 --- /dev/null +++ b/shaders/world-1/gbuffers_clouds.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_clouds.glsl" diff --git a/shaders/world-1/gbuffers_damagedblock.fsh b/shaders/world-1/gbuffers_damagedblock.fsh new file mode 100644 index 0000000..63f9495 --- /dev/null +++ b/shaders/world-1/gbuffers_damagedblock.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define FSH + +#include "/program/gbuffers_damagedblock.glsl" diff --git a/shaders/world-1/gbuffers_damagedblock.vsh b/shaders/world-1/gbuffers_damagedblock.vsh new file mode 100644 index 0000000..766fd06 --- /dev/null +++ b/shaders/world-1/gbuffers_damagedblock.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_damagedblock.glsl" diff --git a/shaders/world-1/gbuffers_entities.fsh b/shaders/world-1/gbuffers_entities.fsh new file mode 100644 index 0000000..71de4a5 --- /dev/null +++ b/shaders/world-1/gbuffers_entities.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/gbuffers_entities.glsl" diff --git a/shaders/world-1/gbuffers_entities.vsh b/shaders/world-1/gbuffers_entities.vsh new file mode 100644 index 0000000..5454492 --- /dev/null +++ b/shaders/world-1/gbuffers_entities.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_entities.glsl" diff --git a/shaders/world-1/gbuffers_entities_glowing.fsh b/shaders/world-1/gbuffers_entities_glowing.fsh new file mode 100644 index 0000000..32823af --- /dev/null +++ b/shaders/world-1/gbuffers_entities_glowing.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/gbuffers_entities_glowing.glsl" diff --git a/shaders/world-1/gbuffers_entities_glowing.vsh b/shaders/world-1/gbuffers_entities_glowing.vsh new file mode 100644 index 0000000..0da3b96 --- /dev/null +++ b/shaders/world-1/gbuffers_entities_glowing.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_entities_glowing.glsl" diff --git a/shaders/world-1/gbuffers_hand.fsh b/shaders/world-1/gbuffers_hand.fsh new file mode 100644 index 0000000..afb3d6f --- /dev/null +++ b/shaders/world-1/gbuffers_hand.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/gbuffers_hand.glsl" diff --git a/shaders/world-1/gbuffers_hand.vsh b/shaders/world-1/gbuffers_hand.vsh new file mode 100644 index 0000000..6a3a6ac --- /dev/null +++ b/shaders/world-1/gbuffers_hand.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_hand.glsl" diff --git a/shaders/world-1/gbuffers_spidereyes.fsh b/shaders/world-1/gbuffers_spidereyes.fsh new file mode 100644 index 0000000..1b0060e --- /dev/null +++ b/shaders/world-1/gbuffers_spidereyes.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define FSH + +#include "/program/gbuffers_spidereyes.glsl" diff --git a/shaders/world-1/gbuffers_spidereyes.vsh b/shaders/world-1/gbuffers_spidereyes.vsh new file mode 100644 index 0000000..859fc82 --- /dev/null +++ b/shaders/world-1/gbuffers_spidereyes.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_spidereyes.glsl" diff --git a/shaders/world-1/gbuffers_terrain.fsh b/shaders/world-1/gbuffers_terrain.fsh new file mode 100644 index 0000000..b12ba8a --- /dev/null +++ b/shaders/world-1/gbuffers_terrain.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/gbuffers_terrain.glsl" diff --git a/shaders/world-1/gbuffers_terrain.vsh b/shaders/world-1/gbuffers_terrain.vsh new file mode 100644 index 0000000..73a94b4 --- /dev/null +++ b/shaders/world-1/gbuffers_terrain.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_terrain.glsl" diff --git a/shaders/world-1/gbuffers_textured.fsh b/shaders/world-1/gbuffers_textured.fsh new file mode 100644 index 0000000..6580ba9 --- /dev/null +++ b/shaders/world-1/gbuffers_textured.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define FSH + +#include "/program/gbuffers_textured.glsl" diff --git a/shaders/world-1/gbuffers_textured.vsh b/shaders/world-1/gbuffers_textured.vsh new file mode 100644 index 0000000..f1b6874 --- /dev/null +++ b/shaders/world-1/gbuffers_textured.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_textured.glsl" diff --git a/shaders/world-1/gbuffers_water.fsh b/shaders/world-1/gbuffers_water.fsh new file mode 100644 index 0000000..b1b404a --- /dev/null +++ b/shaders/world-1/gbuffers_water.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define NETHER +#define FSH + +#include "/program/gbuffers_water.glsl" diff --git a/shaders/world-1/gbuffers_water.vsh b/shaders/world-1/gbuffers_water.vsh new file mode 100644 index 0000000..d0419bc --- /dev/null +++ b/shaders/world-1/gbuffers_water.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_water.glsl" diff --git a/shaders/world-1/gbuffers_weather.fsh b/shaders/world-1/gbuffers_weather.fsh new file mode 100644 index 0000000..d00387d --- /dev/null +++ b/shaders/world-1/gbuffers_weather.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define FSH + +#include "/program/gbuffers_weather.glsl" diff --git a/shaders/world-1/gbuffers_weather.vsh b/shaders/world-1/gbuffers_weather.vsh new file mode 100644 index 0000000..2b1a52a --- /dev/null +++ b/shaders/world-1/gbuffers_weather.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define NETHER +#define VSH + +#include "/program/gbuffers_weather.glsl" diff --git a/shaders/world0/composite.fsh b/shaders/world0/composite.fsh new file mode 100644 index 0000000..dfbfc6b --- /dev/null +++ b/shaders/world0/composite.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/composite.glsl" diff --git a/shaders/world0/composite.vsh b/shaders/world0/composite.vsh new file mode 100644 index 0000000..17ddc5a --- /dev/null +++ b/shaders/world0/composite.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/composite.glsl" diff --git a/shaders/world0/composite1.fsh b/shaders/world0/composite1.fsh new file mode 100644 index 0000000..88d2f4a --- /dev/null +++ b/shaders/world0/composite1.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/composite1.glsl" diff --git a/shaders/world0/composite1.vsh b/shaders/world0/composite1.vsh new file mode 100644 index 0000000..d9a70e6 --- /dev/null +++ b/shaders/world0/composite1.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/composite1.glsl" diff --git a/shaders/world0/composite2.fsh b/shaders/world0/composite2.fsh new file mode 100644 index 0000000..e660c15 --- /dev/null +++ b/shaders/world0/composite2.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/composite2.glsl" diff --git a/shaders/world0/composite2.vsh b/shaders/world0/composite2.vsh new file mode 100644 index 0000000..c5a433c --- /dev/null +++ b/shaders/world0/composite2.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/composite2.glsl" diff --git a/shaders/world0/composite3.fsh b/shaders/world0/composite3.fsh new file mode 100644 index 0000000..2777e5a --- /dev/null +++ b/shaders/world0/composite3.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/composite3.glsl" diff --git a/shaders/world0/composite3.vsh b/shaders/world0/composite3.vsh new file mode 100644 index 0000000..a4a7e21 --- /dev/null +++ b/shaders/world0/composite3.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/composite3.glsl" diff --git a/shaders/world0/composite4.fsh b/shaders/world0/composite4.fsh new file mode 100644 index 0000000..f989062 --- /dev/null +++ b/shaders/world0/composite4.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/composite4.glsl" diff --git a/shaders/world0/composite4.vsh b/shaders/world0/composite4.vsh new file mode 100644 index 0000000..9095f1f --- /dev/null +++ b/shaders/world0/composite4.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/composite4.glsl" diff --git a/shaders/world0/composite5.fsh b/shaders/world0/composite5.fsh new file mode 100644 index 0000000..b68ec8a --- /dev/null +++ b/shaders/world0/composite5.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/composite5.glsl" diff --git a/shaders/world0/composite5.vsh b/shaders/world0/composite5.vsh new file mode 100644 index 0000000..7344ecd --- /dev/null +++ b/shaders/world0/composite5.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/composite5.glsl" diff --git a/shaders/world0/composite6.fsh b/shaders/world0/composite6.fsh new file mode 100644 index 0000000..0a2a9a0 --- /dev/null +++ b/shaders/world0/composite6.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/composite6.glsl" diff --git a/shaders/world0/composite6.vsh b/shaders/world0/composite6.vsh new file mode 100644 index 0000000..8d84614 --- /dev/null +++ b/shaders/world0/composite6.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/composite6.glsl" diff --git a/shaders/world0/composite7.fsh b/shaders/world0/composite7.fsh new file mode 100644 index 0000000..d1ceb35 --- /dev/null +++ b/shaders/world0/composite7.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/composite7.glsl" diff --git a/shaders/world0/composite7.vsh b/shaders/world0/composite7.vsh new file mode 100644 index 0000000..6cfe741 --- /dev/null +++ b/shaders/world0/composite7.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/composite7.glsl" diff --git a/shaders/world0/deferred.fsh b/shaders/world0/deferred.fsh new file mode 100644 index 0000000..e39026a --- /dev/null +++ b/shaders/world0/deferred.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/deferred.glsl" diff --git a/shaders/world0/deferred.vsh b/shaders/world0/deferred.vsh new file mode 100644 index 0000000..2f983d8 --- /dev/null +++ b/shaders/world0/deferred.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/deferred.glsl" diff --git a/shaders/world0/deferred1.fsh b/shaders/world0/deferred1.fsh new file mode 100644 index 0000000..63d7238 --- /dev/null +++ b/shaders/world0/deferred1.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/deferred1.glsl" diff --git a/shaders/world0/deferred1.vsh b/shaders/world0/deferred1.vsh new file mode 100644 index 0000000..257d33c --- /dev/null +++ b/shaders/world0/deferred1.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/deferred1.glsl" diff --git a/shaders/world0/dh_terrain.fsh b/shaders/world0/dh_terrain.fsh new file mode 100644 index 0000000..41b1ee7 --- /dev/null +++ b/shaders/world0/dh_terrain.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/dh_terrain.glsl" diff --git a/shaders/world0/dh_terrain.vsh b/shaders/world0/dh_terrain.vsh new file mode 100644 index 0000000..b6f76f9 --- /dev/null +++ b/shaders/world0/dh_terrain.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/dh_terrain.glsl" diff --git a/shaders/world0/dh_water.fsh b/shaders/world0/dh_water.fsh new file mode 100644 index 0000000..f89566b --- /dev/null +++ b/shaders/world0/dh_water.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/dh_water.glsl" diff --git a/shaders/world0/dh_water.vsh b/shaders/world0/dh_water.vsh new file mode 100644 index 0000000..c204eae --- /dev/null +++ b/shaders/world0/dh_water.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/dh_water.glsl" diff --git a/shaders/world0/final.fsh b/shaders/world0/final.fsh new file mode 100644 index 0000000..5cac197 --- /dev/null +++ b/shaders/world0/final.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/final.glsl" diff --git a/shaders/world0/final.vsh b/shaders/world0/final.vsh new file mode 100644 index 0000000..bf3912c --- /dev/null +++ b/shaders/world0/final.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/final.glsl" diff --git a/shaders/world0/gbuffers_armor_glint.fsh b/shaders/world0/gbuffers_armor_glint.fsh new file mode 100644 index 0000000..c395834 --- /dev/null +++ b/shaders/world0/gbuffers_armor_glint.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_armor_glint.glsl" diff --git a/shaders/world0/gbuffers_armor_glint.vsh b/shaders/world0/gbuffers_armor_glint.vsh new file mode 100644 index 0000000..de1272f --- /dev/null +++ b/shaders/world0/gbuffers_armor_glint.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_armor_glint.glsl" diff --git a/shaders/world0/gbuffers_basic.fsh b/shaders/world0/gbuffers_basic.fsh new file mode 100644 index 0000000..8a19227 --- /dev/null +++ b/shaders/world0/gbuffers_basic.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_basic.glsl" diff --git a/shaders/world0/gbuffers_basic.vsh b/shaders/world0/gbuffers_basic.vsh new file mode 100644 index 0000000..79d67c7 --- /dev/null +++ b/shaders/world0/gbuffers_basic.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_basic.glsl" diff --git a/shaders/world0/gbuffers_beaconbeam.fsh b/shaders/world0/gbuffers_beaconbeam.fsh new file mode 100644 index 0000000..3998454 --- /dev/null +++ b/shaders/world0/gbuffers_beaconbeam.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_beaconbeam.glsl" diff --git a/shaders/world0/gbuffers_beaconbeam.vsh b/shaders/world0/gbuffers_beaconbeam.vsh new file mode 100644 index 0000000..83ae835 --- /dev/null +++ b/shaders/world0/gbuffers_beaconbeam.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_beaconbeam.glsl" diff --git a/shaders/world0/gbuffers_block.fsh b/shaders/world0/gbuffers_block.fsh new file mode 100644 index 0000000..dc30631 --- /dev/null +++ b/shaders/world0/gbuffers_block.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_block.glsl" diff --git a/shaders/world0/gbuffers_block.vsh b/shaders/world0/gbuffers_block.vsh new file mode 100644 index 0000000..12d33f9 --- /dev/null +++ b/shaders/world0/gbuffers_block.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_block.glsl" diff --git a/shaders/world0/gbuffers_clouds.fsh b/shaders/world0/gbuffers_clouds.fsh new file mode 100644 index 0000000..63a2c53 --- /dev/null +++ b/shaders/world0/gbuffers_clouds.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_clouds.glsl" diff --git a/shaders/world0/gbuffers_clouds.vsh b/shaders/world0/gbuffers_clouds.vsh new file mode 100644 index 0000000..8e51049 --- /dev/null +++ b/shaders/world0/gbuffers_clouds.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_clouds.glsl" diff --git a/shaders/world0/gbuffers_damagedblock.fsh b/shaders/world0/gbuffers_damagedblock.fsh new file mode 100644 index 0000000..6e53b18 --- /dev/null +++ b/shaders/world0/gbuffers_damagedblock.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_damagedblock.glsl" diff --git a/shaders/world0/gbuffers_damagedblock.vsh b/shaders/world0/gbuffers_damagedblock.vsh new file mode 100644 index 0000000..e8aca2c --- /dev/null +++ b/shaders/world0/gbuffers_damagedblock.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_damagedblock.glsl" diff --git a/shaders/world0/gbuffers_entities.fsh b/shaders/world0/gbuffers_entities.fsh new file mode 100644 index 0000000..037178e --- /dev/null +++ b/shaders/world0/gbuffers_entities.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_entities.glsl" diff --git a/shaders/world0/gbuffers_entities.vsh b/shaders/world0/gbuffers_entities.vsh new file mode 100644 index 0000000..8bd0c22 --- /dev/null +++ b/shaders/world0/gbuffers_entities.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_entities.glsl" diff --git a/shaders/world0/gbuffers_entities_glowing.fsh b/shaders/world0/gbuffers_entities_glowing.fsh new file mode 100644 index 0000000..33dba8d --- /dev/null +++ b/shaders/world0/gbuffers_entities_glowing.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_entities_glowing.glsl" diff --git a/shaders/world0/gbuffers_entities_glowing.vsh b/shaders/world0/gbuffers_entities_glowing.vsh new file mode 100644 index 0000000..1d87920 --- /dev/null +++ b/shaders/world0/gbuffers_entities_glowing.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_entities_glowing.glsl" diff --git a/shaders/world0/gbuffers_hand.fsh b/shaders/world0/gbuffers_hand.fsh new file mode 100644 index 0000000..4ad164e --- /dev/null +++ b/shaders/world0/gbuffers_hand.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_hand.glsl" diff --git a/shaders/world0/gbuffers_hand.vsh b/shaders/world0/gbuffers_hand.vsh new file mode 100644 index 0000000..72f94e6 --- /dev/null +++ b/shaders/world0/gbuffers_hand.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_hand.glsl" diff --git a/shaders/world0/gbuffers_skybasic.fsh b/shaders/world0/gbuffers_skybasic.fsh new file mode 100644 index 0000000..70a39f5 --- /dev/null +++ b/shaders/world0/gbuffers_skybasic.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_skybasic.glsl" diff --git a/shaders/world0/gbuffers_skybasic.vsh b/shaders/world0/gbuffers_skybasic.vsh new file mode 100644 index 0000000..0e97aae --- /dev/null +++ b/shaders/world0/gbuffers_skybasic.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_skybasic.glsl" diff --git a/shaders/world0/gbuffers_skytextured.fsh b/shaders/world0/gbuffers_skytextured.fsh new file mode 100644 index 0000000..4721307 --- /dev/null +++ b/shaders/world0/gbuffers_skytextured.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_skytextured.glsl" diff --git a/shaders/world0/gbuffers_skytextured.vsh b/shaders/world0/gbuffers_skytextured.vsh new file mode 100644 index 0000000..3d80e27 --- /dev/null +++ b/shaders/world0/gbuffers_skytextured.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_skytextured.glsl" diff --git a/shaders/world0/gbuffers_spidereyes.fsh b/shaders/world0/gbuffers_spidereyes.fsh new file mode 100644 index 0000000..1a8ffb5 --- /dev/null +++ b/shaders/world0/gbuffers_spidereyes.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_spidereyes.glsl" diff --git a/shaders/world0/gbuffers_spidereyes.vsh b/shaders/world0/gbuffers_spidereyes.vsh new file mode 100644 index 0000000..4fc4f2f --- /dev/null +++ b/shaders/world0/gbuffers_spidereyes.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_spidereyes.glsl" diff --git a/shaders/world0/gbuffers_terrain.fsh b/shaders/world0/gbuffers_terrain.fsh new file mode 100644 index 0000000..249c453 --- /dev/null +++ b/shaders/world0/gbuffers_terrain.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_terrain.glsl" diff --git a/shaders/world0/gbuffers_terrain.vsh b/shaders/world0/gbuffers_terrain.vsh new file mode 100644 index 0000000..c224a12 --- /dev/null +++ b/shaders/world0/gbuffers_terrain.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_terrain.glsl" diff --git a/shaders/world0/gbuffers_textured.fsh b/shaders/world0/gbuffers_textured.fsh new file mode 100644 index 0000000..66b8372 --- /dev/null +++ b/shaders/world0/gbuffers_textured.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_textured.glsl" diff --git a/shaders/world0/gbuffers_textured.vsh b/shaders/world0/gbuffers_textured.vsh new file mode 100644 index 0000000..70947d9 --- /dev/null +++ b/shaders/world0/gbuffers_textured.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_textured.glsl" diff --git a/shaders/world0/gbuffers_water.fsh b/shaders/world0/gbuffers_water.fsh new file mode 100644 index 0000000..2c76858 --- /dev/null +++ b/shaders/world0/gbuffers_water.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_water.glsl" diff --git a/shaders/world0/gbuffers_water.vsh b/shaders/world0/gbuffers_water.vsh new file mode 100644 index 0000000..4bdf3fc --- /dev/null +++ b/shaders/world0/gbuffers_water.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_water.glsl" diff --git a/shaders/world0/gbuffers_weather.fsh b/shaders/world0/gbuffers_weather.fsh new file mode 100644 index 0000000..42faf11 --- /dev/null +++ b/shaders/world0/gbuffers_weather.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/gbuffers_weather.glsl" diff --git a/shaders/world0/gbuffers_weather.vsh b/shaders/world0/gbuffers_weather.vsh new file mode 100644 index 0000000..e538c35 --- /dev/null +++ b/shaders/world0/gbuffers_weather.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/gbuffers_weather.glsl" diff --git a/shaders/world0/shadow.fsh b/shaders/world0/shadow.fsh new file mode 100644 index 0000000..c5b1424 --- /dev/null +++ b/shaders/world0/shadow.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define FSH + +#include "/program/shadow.glsl" diff --git a/shaders/world0/shadow.vsh b/shaders/world0/shadow.vsh new file mode 100644 index 0000000..3d56746 --- /dev/null +++ b/shaders/world0/shadow.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define OVERWORLD +#define VSH + +#include "/program/shadow.glsl" diff --git a/shaders/world1/composite.fsh b/shaders/world1/composite.fsh new file mode 100644 index 0000000..d1da9a2 --- /dev/null +++ b/shaders/world1/composite.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/composite.glsl" diff --git a/shaders/world1/composite.vsh b/shaders/world1/composite.vsh new file mode 100644 index 0000000..b3685b8 --- /dev/null +++ b/shaders/world1/composite.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/composite.glsl" diff --git a/shaders/world1/composite1.fsh b/shaders/world1/composite1.fsh new file mode 100644 index 0000000..f63d139 --- /dev/null +++ b/shaders/world1/composite1.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/composite1.glsl" diff --git a/shaders/world1/composite1.vsh b/shaders/world1/composite1.vsh new file mode 100644 index 0000000..c30cb04 --- /dev/null +++ b/shaders/world1/composite1.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/composite1.glsl" diff --git a/shaders/world1/composite2.fsh b/shaders/world1/composite2.fsh new file mode 100644 index 0000000..5e24923 --- /dev/null +++ b/shaders/world1/composite2.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/composite2.glsl" diff --git a/shaders/world1/composite2.vsh b/shaders/world1/composite2.vsh new file mode 100644 index 0000000..b4cffb8 --- /dev/null +++ b/shaders/world1/composite2.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/composite2.glsl" diff --git a/shaders/world1/composite3.fsh b/shaders/world1/composite3.fsh new file mode 100644 index 0000000..5908dfb --- /dev/null +++ b/shaders/world1/composite3.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/composite3.glsl" diff --git a/shaders/world1/composite3.vsh b/shaders/world1/composite3.vsh new file mode 100644 index 0000000..3d324b5 --- /dev/null +++ b/shaders/world1/composite3.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/composite3.glsl" diff --git a/shaders/world1/composite4.fsh b/shaders/world1/composite4.fsh new file mode 100644 index 0000000..66add38 --- /dev/null +++ b/shaders/world1/composite4.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/composite4.glsl" diff --git a/shaders/world1/composite4.vsh b/shaders/world1/composite4.vsh new file mode 100644 index 0000000..b0ea707 --- /dev/null +++ b/shaders/world1/composite4.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/composite4.glsl" diff --git a/shaders/world1/composite5.fsh b/shaders/world1/composite5.fsh new file mode 100644 index 0000000..617de1f --- /dev/null +++ b/shaders/world1/composite5.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/composite5.glsl" diff --git a/shaders/world1/composite5.vsh b/shaders/world1/composite5.vsh new file mode 100644 index 0000000..5186e6b --- /dev/null +++ b/shaders/world1/composite5.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/composite5.glsl" diff --git a/shaders/world1/composite6.fsh b/shaders/world1/composite6.fsh new file mode 100644 index 0000000..f32c6d1 --- /dev/null +++ b/shaders/world1/composite6.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/composite6.glsl" diff --git a/shaders/world1/composite6.vsh b/shaders/world1/composite6.vsh new file mode 100644 index 0000000..dce41d4 --- /dev/null +++ b/shaders/world1/composite6.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/composite6.glsl" diff --git a/shaders/world1/composite7.fsh b/shaders/world1/composite7.fsh new file mode 100644 index 0000000..a7490ee --- /dev/null +++ b/shaders/world1/composite7.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/composite7.glsl" diff --git a/shaders/world1/composite7.vsh b/shaders/world1/composite7.vsh new file mode 100644 index 0000000..524bcfa --- /dev/null +++ b/shaders/world1/composite7.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/composite7.glsl" diff --git a/shaders/world1/deferred.fsh b/shaders/world1/deferred.fsh new file mode 100644 index 0000000..418d2fb --- /dev/null +++ b/shaders/world1/deferred.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/deferred.glsl" diff --git a/shaders/world1/deferred.vsh b/shaders/world1/deferred.vsh new file mode 100644 index 0000000..ff3b18e --- /dev/null +++ b/shaders/world1/deferred.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/deferred.glsl" diff --git a/shaders/world1/deferred1.fsh b/shaders/world1/deferred1.fsh new file mode 100644 index 0000000..9337b28 --- /dev/null +++ b/shaders/world1/deferred1.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/deferred1.glsl" diff --git a/shaders/world1/deferred1.vsh b/shaders/world1/deferred1.vsh new file mode 100644 index 0000000..2c6c3e4 --- /dev/null +++ b/shaders/world1/deferred1.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/deferred1.glsl" diff --git a/shaders/world1/dh_terrain.fsh b/shaders/world1/dh_terrain.fsh new file mode 100644 index 0000000..b9581be --- /dev/null +++ b/shaders/world1/dh_terrain.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/dh_terrain.glsl" diff --git a/shaders/world1/dh_terrain.vsh b/shaders/world1/dh_terrain.vsh new file mode 100644 index 0000000..c35b298 --- /dev/null +++ b/shaders/world1/dh_terrain.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/dh_terrain.glsl" diff --git a/shaders/world1/dh_water.fsh b/shaders/world1/dh_water.fsh new file mode 100644 index 0000000..9223a0a --- /dev/null +++ b/shaders/world1/dh_water.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/dh_water.glsl" diff --git a/shaders/world1/dh_water.vsh b/shaders/world1/dh_water.vsh new file mode 100644 index 0000000..e05e21a --- /dev/null +++ b/shaders/world1/dh_water.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/dh_water.glsl" diff --git a/shaders/world1/final.fsh b/shaders/world1/final.fsh new file mode 100644 index 0000000..0eba5d2 --- /dev/null +++ b/shaders/world1/final.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/final.glsl" diff --git a/shaders/world1/final.vsh b/shaders/world1/final.vsh new file mode 100644 index 0000000..46ca810 --- /dev/null +++ b/shaders/world1/final.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/final.glsl" diff --git a/shaders/world1/gbuffers_armor_glint.fsh b/shaders/world1/gbuffers_armor_glint.fsh new file mode 100644 index 0000000..6275ba3 --- /dev/null +++ b/shaders/world1/gbuffers_armor_glint.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/gbuffers_armor_glint.glsl" diff --git a/shaders/world1/gbuffers_armor_glint.vsh b/shaders/world1/gbuffers_armor_glint.vsh new file mode 100644 index 0000000..0585332 --- /dev/null +++ b/shaders/world1/gbuffers_armor_glint.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_armor_glint.glsl" diff --git a/shaders/world1/gbuffers_basic.fsh b/shaders/world1/gbuffers_basic.fsh new file mode 100644 index 0000000..a54e29f --- /dev/null +++ b/shaders/world1/gbuffers_basic.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/gbuffers_basic.glsl" diff --git a/shaders/world1/gbuffers_basic.vsh b/shaders/world1/gbuffers_basic.vsh new file mode 100644 index 0000000..5b99b69 --- /dev/null +++ b/shaders/world1/gbuffers_basic.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_basic.glsl" diff --git a/shaders/world1/gbuffers_beaconbeam.fsh b/shaders/world1/gbuffers_beaconbeam.fsh new file mode 100644 index 0000000..6038dad --- /dev/null +++ b/shaders/world1/gbuffers_beaconbeam.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/gbuffers_beaconbeam.glsl" diff --git a/shaders/world1/gbuffers_beaconbeam.vsh b/shaders/world1/gbuffers_beaconbeam.vsh new file mode 100644 index 0000000..0f6a773 --- /dev/null +++ b/shaders/world1/gbuffers_beaconbeam.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_beaconbeam.glsl" diff --git a/shaders/world1/gbuffers_block.fsh b/shaders/world1/gbuffers_block.fsh new file mode 100644 index 0000000..eca2d68 --- /dev/null +++ b/shaders/world1/gbuffers_block.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/gbuffers_block.glsl" diff --git a/shaders/world1/gbuffers_block.vsh b/shaders/world1/gbuffers_block.vsh new file mode 100644 index 0000000..dafd023 --- /dev/null +++ b/shaders/world1/gbuffers_block.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_block.glsl" diff --git a/shaders/world1/gbuffers_clouds.fsh b/shaders/world1/gbuffers_clouds.fsh new file mode 100644 index 0000000..a678150 --- /dev/null +++ b/shaders/world1/gbuffers_clouds.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/gbuffers_clouds.glsl" diff --git a/shaders/world1/gbuffers_clouds.vsh b/shaders/world1/gbuffers_clouds.vsh new file mode 100644 index 0000000..46a7d1b --- /dev/null +++ b/shaders/world1/gbuffers_clouds.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_clouds.glsl" diff --git a/shaders/world1/gbuffers_damagedblock.fsh b/shaders/world1/gbuffers_damagedblock.fsh new file mode 100644 index 0000000..848f8e1 --- /dev/null +++ b/shaders/world1/gbuffers_damagedblock.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/gbuffers_damagedblock.glsl" diff --git a/shaders/world1/gbuffers_damagedblock.vsh b/shaders/world1/gbuffers_damagedblock.vsh new file mode 100644 index 0000000..eb600fd --- /dev/null +++ b/shaders/world1/gbuffers_damagedblock.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_damagedblock.glsl" diff --git a/shaders/world1/gbuffers_entities.fsh b/shaders/world1/gbuffers_entities.fsh new file mode 100644 index 0000000..ddb7622 --- /dev/null +++ b/shaders/world1/gbuffers_entities.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/gbuffers_entities.glsl" diff --git a/shaders/world1/gbuffers_entities.vsh b/shaders/world1/gbuffers_entities.vsh new file mode 100644 index 0000000..5438023 --- /dev/null +++ b/shaders/world1/gbuffers_entities.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_entities.glsl" diff --git a/shaders/world1/gbuffers_entities_glowing.fsh b/shaders/world1/gbuffers_entities_glowing.fsh new file mode 100644 index 0000000..e2da620 --- /dev/null +++ b/shaders/world1/gbuffers_entities_glowing.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/gbuffers_entities_glowing.glsl" diff --git a/shaders/world1/gbuffers_entities_glowing.vsh b/shaders/world1/gbuffers_entities_glowing.vsh new file mode 100644 index 0000000..2b06cbc --- /dev/null +++ b/shaders/world1/gbuffers_entities_glowing.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_entities_glowing.glsl" diff --git a/shaders/world1/gbuffers_hand.fsh b/shaders/world1/gbuffers_hand.fsh new file mode 100644 index 0000000..01bbbb6 --- /dev/null +++ b/shaders/world1/gbuffers_hand.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/gbuffers_hand.glsl" diff --git a/shaders/world1/gbuffers_hand.vsh b/shaders/world1/gbuffers_hand.vsh new file mode 100644 index 0000000..ae3dd9e --- /dev/null +++ b/shaders/world1/gbuffers_hand.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_hand.glsl" diff --git a/shaders/world1/gbuffers_skybasic.fsh b/shaders/world1/gbuffers_skybasic.fsh new file mode 100644 index 0000000..fb0e121 --- /dev/null +++ b/shaders/world1/gbuffers_skybasic.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/gbuffers_skybasic.glsl" diff --git a/shaders/world1/gbuffers_skybasic.vsh b/shaders/world1/gbuffers_skybasic.vsh new file mode 100644 index 0000000..e7e8b75 --- /dev/null +++ b/shaders/world1/gbuffers_skybasic.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_skybasic.glsl" diff --git a/shaders/world1/gbuffers_skytextured.fsh b/shaders/world1/gbuffers_skytextured.fsh new file mode 100644 index 0000000..15d852d --- /dev/null +++ b/shaders/world1/gbuffers_skytextured.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/gbuffers_skytextured.glsl" diff --git a/shaders/world1/gbuffers_skytextured.vsh b/shaders/world1/gbuffers_skytextured.vsh new file mode 100644 index 0000000..0c46a64 --- /dev/null +++ b/shaders/world1/gbuffers_skytextured.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_skytextured.glsl" diff --git a/shaders/world1/gbuffers_spidereyes.fsh b/shaders/world1/gbuffers_spidereyes.fsh new file mode 100644 index 0000000..74f752c --- /dev/null +++ b/shaders/world1/gbuffers_spidereyes.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/gbuffers_spidereyes.glsl" diff --git a/shaders/world1/gbuffers_spidereyes.vsh b/shaders/world1/gbuffers_spidereyes.vsh new file mode 100644 index 0000000..405aaf7 --- /dev/null +++ b/shaders/world1/gbuffers_spidereyes.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_spidereyes.glsl" diff --git a/shaders/world1/gbuffers_terrain.fsh b/shaders/world1/gbuffers_terrain.fsh new file mode 100644 index 0000000..3d0766d --- /dev/null +++ b/shaders/world1/gbuffers_terrain.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/gbuffers_terrain.glsl" diff --git a/shaders/world1/gbuffers_terrain.vsh b/shaders/world1/gbuffers_terrain.vsh new file mode 100644 index 0000000..106993d --- /dev/null +++ b/shaders/world1/gbuffers_terrain.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_terrain.glsl" diff --git a/shaders/world1/gbuffers_textured.fsh b/shaders/world1/gbuffers_textured.fsh new file mode 100644 index 0000000..514a78a --- /dev/null +++ b/shaders/world1/gbuffers_textured.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/gbuffers_textured.glsl" diff --git a/shaders/world1/gbuffers_textured.vsh b/shaders/world1/gbuffers_textured.vsh new file mode 100644 index 0000000..78c96ea --- /dev/null +++ b/shaders/world1/gbuffers_textured.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_textured.glsl" diff --git a/shaders/world1/gbuffers_water.fsh b/shaders/world1/gbuffers_water.fsh new file mode 100644 index 0000000..d6e75a1 --- /dev/null +++ b/shaders/world1/gbuffers_water.fsh @@ -0,0 +1,13 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#extension GL_ARB_shader_texture_lod : enable + +#define END +#define FSH + +#include "/program/gbuffers_water.glsl" diff --git a/shaders/world1/gbuffers_water.vsh b/shaders/world1/gbuffers_water.vsh new file mode 100644 index 0000000..9ad64c5 --- /dev/null +++ b/shaders/world1/gbuffers_water.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_water.glsl" diff --git a/shaders/world1/gbuffers_weather.fsh b/shaders/world1/gbuffers_weather.fsh new file mode 100644 index 0000000..ee02711 --- /dev/null +++ b/shaders/world1/gbuffers_weather.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/gbuffers_weather.glsl" diff --git a/shaders/world1/gbuffers_weather.vsh b/shaders/world1/gbuffers_weather.vsh new file mode 100644 index 0000000..d093cf5 --- /dev/null +++ b/shaders/world1/gbuffers_weather.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/gbuffers_weather.glsl" diff --git a/shaders/world1/shadow.fsh b/shaders/world1/shadow.fsh new file mode 100644 index 0000000..6cc9507 --- /dev/null +++ b/shaders/world1/shadow.fsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define FSH + +#include "/program/shadow.glsl" diff --git a/shaders/world1/shadow.vsh b/shaders/world1/shadow.vsh new file mode 100644 index 0000000..72fd7df --- /dev/null +++ b/shaders/world1/shadow.vsh @@ -0,0 +1,11 @@ +/* +BSL Shaders v8 Series by Capt Tatsu +https://bitslablab.com +*/ + +#version 120 + +#define END +#define VSH + +#include "/program/shadow.glsl"