diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/FG1000.nas b/Aircraft/Instruments-3d/FG1000/Nasal/FG1000.nas index 9542fa901..597d61630 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/FG1000.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/FG1000.nas @@ -109,7 +109,7 @@ addMFD : func(index=nil, targetcanvas=nil) { "name" : "MFD Canvas", "size" : [1024, 768], "view" : [1024, 768], - "mipmapping": 0, + "mipmapping": 1, }); } @@ -135,7 +135,7 @@ addPFD : func(index=nil, targetcanvas=nil) { "name" : "PFD Canvas", "size" : [1024, 768], "view" : [1024, 768], - "mipmapping": 0, + "mipmapping": 1, }); } diff --git a/Aircraft/ufo/ufo.nas b/Aircraft/ufo/ufo.nas index f113a5ba4..d7f7ba9cb 100644 --- a/Aircraft/ufo/ufo.nas +++ b/Aircraft/ufo/ufo.nas @@ -439,7 +439,8 @@ var modelmgr = { if (KbdAlt.getValue() and KbdCtrl.getValue()) { # Provide information on the selected point var geod = geodinfo(me.mouse_coord.lat(), me.mouse_coord.lon()); var landclass = string.join(" ", geod[1].names); - var str = sprintf("lat:%.4f lon:%.4f alt:%.0fm class(es): %s", + var str = sprintf("%s: lat:%.4f lon:%.4f alt:%.0fm class(es): %s", + geod[1].region, me.mouse_coord.lat(), me.mouse_coord.lon(), me.mouse_coord.alt(), landclass); gui.popupTip(str, 3); diff --git a/Compositor/Classic/classic.xml b/Compositor/Classic/classic.xml new file mode 100644 index 000000000..db92d28a7 --- /dev/null +++ b/Compositor/Classic/classic.xml @@ -0,0 +1,88 @@ + + + + + Classic + + + sun-shadowmap-atlas + 2d + /sim/rendering/shadows/sun-atlas-size + /sim/rendering/shadows/sun-atlas-size + depth24 + clamp-to-border + clamp-to-border + clamp-to-border + linear + linear + 1.0 1.0 1.0 1.0 + true + + /sim/rendering/shadows/enabled + + + + + csm0 + 0.1 + 3.0 + + 0.0 + 0.0 + 0.5 + 0.5 + + + + csm1 + 3.0 + 50.0 + + 0.5 + 0.0 + 0.5 + 0.5 + + + + csm2 + 50.0 + 150.0 + + 0.0 + 0.5 + 0.5 + 0.5 + + + + csm3 + 150.0 + 1500.0 + + 0.5 + 0.5 + 0.5 + 0.5 + + + + + far + 100.0 + + + near + 0xfff7ff + + depth + 100.0 + + diff --git a/Compositor/Classic/common-scene.xml b/Compositor/Classic/common-scene.xml new file mode 100644 index 000000000..e5941b7e8 --- /dev/null +++ b/Compositor/Classic/common-scene.xml @@ -0,0 +1,16 @@ + + + + scene + csm0 + csm1 + csm2 + csm3 + + sun-shadowmap-atlas + 10 + + /sim/rendering/shadows/enabled + + + diff --git a/Compositor/ALS/csm.xml b/Compositor/Classic/csm-pass.xml similarity index 64% rename from Compositor/ALS/csm.xml rename to Compositor/Classic/csm-pass.xml index 5e8473269..0b37b40fb 100644 --- a/Compositor/ALS/csm.xml +++ b/Compositor/Classic/csm-pass.xml @@ -1,13 +1,13 @@ - shadow-map - FGLightSource - als-shadow + csm + classic-shadow 0x000004 + false - /sim/rendering/als/shadows/enabled + /sim/rendering/shadows/enabled sun-shadowmap-atlas diff --git a/Compositor/Effects/airfield.eff b/Compositor/Effects/airfield.eff deleted file mode 100644 index 1ea18f283..000000000 --- a/Compositor/Effects/airfield.eff +++ /dev/null @@ -1,891 +0,0 @@ - - - Effects/airfield - Effects/terrain-default - - - Textures/Terrain/airport_grass2.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/void.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/void.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 5.0 - 4.0 - 4.0 - 0 - 0 - 1 - 1.0 - 0.0 - 1.0 - - - als-lighting - - - - - 2.0 - /sim/rendering/shaders/transition - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - smooth - back - - -1 - RenderBin - - - Shaders/ALS/terrain-writedepth.vert - Shaders/ALS/terrain-writedepth.frag - - 0 0 0 0 - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[13]/image - - - texture[13]/type - - - texture[13]/filter - - - texture[13]/wrap-s - - - texture[13]/wrap-t - - - texture[13]/internal-format - - - - 1 - - texture[14]/image - - - texture[14]/type - - - texture[14]/filter - - - texture[14]/wrap-s - - - texture[14]/wrap-t - - - texture[14]/internal-format - - - - 2 - - texture[15]/image - - - texture[15]/type - - - texture[15]/filter - - - texture[15]/wrap-s - - - texture[15]/wrap-t - - - texture[15]/internal-format - - - - Shaders/ALS/terrain-ultra.vert - Shaders/ALS/filters.vert - Shaders/ALS/shadows-include.vert - Shaders/ALS/airfield.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - Shaders/ALS/shadows-include.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - dust_cover_factor - float - - dust_cover_factor - - - - wetness - float - - wetness - - - - fogstructure - float - - fogstructure - - - - grit_alpha - float - - grit_alpha - - - - overlay_bias - float - - overlay_bias - - - - overlay_alpha - float - - overlay_alpha - - - - base_layer_magnification - float - - base_layer_magnification - - - - overlay_layer_magnification - float - - overlay_layer_magnification - - - - grain_layer_magnification - float - - grain_layer_magnification - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - season - float - - season - - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - use_overlay - int - - use_overlay - - - - use_grain - int - - use_grain - - - - use_color_overlay - int - - use_color_overlay - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - raise_vertex - bool - - raise_vertex - - - - texture - sampler-2d - 0 - - - overlay_texture - sampler-2d - 1 - - - grain_texture - sampler-2d - 2 - - - colorMode - int - 2 - - - - - shadow_tex - sampler-2d - 10 - - - shadows_enabled - bool - - shadows_enabled - - - - sun_atlas_size - int - - sun_atlas_size - - - - - lequal - false - - - - diff --git a/Compositor/Effects/birdswarm.eff b/Compositor/Effects/birdswarm.eff deleted file mode 100644 index 7cb079038..000000000 --- a/Compositor/Effects/birdswarm.eff +++ /dev/null @@ -1,235 +0,0 @@ - - - Effects/birdswarm - - - Models/Effects/Birds/birds_in_flight.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 0.9 - 0.8 - 0.82 - 0.7 - 0.3 - 0.25 - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /environment/mean-terrain-elevation-m - - - /sim/rendering/eye-altitude-m - - - /environment/terminator-relative-position-m - - - /rendering/scene/scattering - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - 111 - DepthSortedBin - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - false - - false - - Shaders/ALS/birds.vert - Shaders/ALS/birds.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - - - color_base_r - float - - color_base_r - - - - color_base_g - float - - color_base_g - - - - color_base_b - float - - color_base_b - - - - color_alt_r - float - - color_alt_r - - - - color_alt_g - float - - color_alt_g - - - - color_alt_b - float - - color_alt_b - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - eye_alt - float - - eye_alt - - - - terminator - float - - terminator - - - - texture - sampler-2d - 0 - - - texture - sampler-2d - 0 - - - - diff --git a/Compositor/Effects/bowwave.eff b/Compositor/Effects/bowwave.eff deleted file mode 100644 index 86a0b49e0..000000000 --- a/Compositor/Effects/bowwave.eff +++ /dev/null @@ -1,1094 +0,0 @@ - - - Effects/bowwave - Effects/model-default - - - /Textures/Water/water-reflection.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - /Textures/Water/perlin-noise-nm.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - /Textures/Water/waves-ver10-dudv.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - /Textures/Water/water-reflection-grey.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - /Textures/Water/sea_foam.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - /Textures/Water/bowwave3.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - /Textures/Water/bowwave_normal.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - /rendering/scene/saturation - - - /environment/config/enabled - - - /rendering/scene/overcast - - - /environment/clouds/layer[0]/coverage-type - - - /environment/clouds/layer[1]/coverage-type - - - /environment/clouds/layer[2]/coverage-type - - - /environment/clouds/layer[3]/coverage-type - - - /environment/clouds/layer[4]/coverage-type - - - /environment/sea/surface/wind-from-east-fps - - - /environment/sea/surface/wind-from-north-fps - - - /environment/Vinson/spd-kt - - - /environment/Vinson/hdg-deg - - smooth - transparent - true - - 6 - DepthSortedBin - - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/surface/scattering - - - /environment/terminator-relative-position-m - - - /environment/mean-terrain-elevation-m - - - /rendering/scene/overcast - - - /sim/rendering/eye-altitude-m - - - /environment/cloud-self-shading - - - /environment/moonlight - - - /sim/rendering/shaders/skydome - - - /sim/rendering/shaders/landmass - - - - /environment/sea/color_r - - - /environment/sea/color_g - - - /environment/sea/color_b - - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/water - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - noise - - - Shaders/Default/water-orig.vert - Shaders/Default/water-orig.frag - - - texture - sampler-3d - 0 - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/water - - 2.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - noise - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - 7 - - texture[7]/image - - - texture[7]/type - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - texture[7]/internal-format - - - - - Shaders/Default/wake.vert - Shaders/Default/include_fog.frag - Shaders/Default/bowwave.frag - - - water_reflection - sampler-2d - 0 - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - water_reflection_grey - sampler-2d - 4 - - - sea_foam - sampler-2d - 5 - - - alpha_tex - sampler-2d - 6 - - - bowwave_nmap - sampler-2d - 7 - - - saturation - float - - - saturation - - - - CloudCover0 - float - - cloud-cover0 - - - - CloudCover1 - float - - cloud-cover1 - - - - CloudCover2 - float - - cloud-cover2 - - - - CloudCover3 - float - - cloud-cover3 - - - - CloudCover4 - float - - cloud-cover4 - - - - Status - int - - status - - - - - Overcast - float - - overcast - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - spd - float - - speed-kt - - - - hdg - float - - heading-deg - - - - Noise - sampler-3d - 1 - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - - als-lighting - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/water - - 2.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - noise - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - 7 - - texture[7]/image - - - texture[7]/type - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - texture[7]/internal-format - - - - Shaders/ALS/wake.vert - Shaders/ALS/bowwave.frag - - - water_reflection - sampler-2d - 0 - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - water_reflection_grey - sampler-2d - 4 - - - sea_foam - sampler-2d - 5 - - - alpha_tex - sampler-2d - 6 - - - bowwave_nmap - sampler-2d - 7 - - - saturation - float - - - saturation - - - - Status - int - - status - - - - - Overcast - float - - overcast - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - spd - float - - speed-kt - - - - hdg - float - - heading-deg - - - - Noise - sampler-3d - 1 - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - sea_r - float - - sea_r - - - - sea_g - float - - sea_g - - - - sea_b - float - - sea_b - - - - quality_level - int - - quality_level - - - - - - diff --git a/Compositor/Effects/building.eff b/Compositor/Effects/building.eff deleted file mode 100644 index 5ddeec3e7..000000000 --- a/Compositor/Effects/building.eff +++ /dev/null @@ -1,407 +0,0 @@ - - - Effects/building - Effects/model-combined-deferred - - - 2d - Textures/buildings.png - linear-mipmap-linear - repeat - clamp - normalized - - - 1 - 0 - 1.0 - - Textures/buildings-normalmap_orig.png - 2d - linear-mipmap-linear - repeat - clamp - normalized - - - - Textures/buildings-lightmap.png - 2d - linear-mipmap-linear - clamp - clamp - normalized - - 1 - 0 - - /sim/time/sun-angle-rad - - 0.3 0.3 0.3 - - - 1 - 1 - -0.15 - 0 - 0.0 - 0.0 - 0.0 - - cubemap - - Aircraft/Generic/Effects/CubeMaps/buildings/N.png - Aircraft/Generic/Effects/CubeMaps/buildings/S.png - Aircraft/Generic/Effects/CubeMaps/buildings/W.png - Aircraft/Generic/Effects/CubeMaps/buildings/E.png - Aircraft/Generic/Effects/CubeMaps/buildings/U.png - Aircraft/Generic/Effects/CubeMaps/buildings/D.png - - - - 0.0 - 0 - 0.0 0.0 0.0 - 0.0 - - true - 1 - 0.6 0.6 0.6 1.0 - 1.0 1.0 1.0 1.0 - 0.0 0.0 0.0 1.0 - 0.02 0.02 0.02 1.0 - 0.1 - ambient-and-diffuse - ambient-and-diffuse - - - 0 - - 0 - 0 - 0 - - flat - back - opaque - - /environment/ground-visibility-m - /environment/visibility-m - /environment/ground-haze-thickness-m - /rendering/scene/scattering - /environment/surface/scattering - /environment/terminator-relative-position-m - /sim/rendering/shaders/skydome - /environment/mean-terrain-elevation-m - /rendering/scene/overcast - /sim/rendering/eye-altitude-m - /environment/snow-level-m - /environment/surface/dust-cover-factor - /sim/rendering/shaders/skydome - /environment/fog-structure - /environment/surface/delta-T-structure - - 1 - - - - - - - 4 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - Shaders/ALS/building-model-ultra.vert - - instancePosition - 10 - - - instanceScale - 11 - - - attrib1 - 12 - - - attrib2 - 13 - - - - - - - - - - Shaders/ALS/building-default.vert - Shaders/ALS/terrain-base.frag - Shaders/ALS/hazes.frag - Shaders/ALS/filters.frag - Shaders/ALS/noise.frag - - instancePosition - 10 - - - instanceScale - 11 - - - attrib1 - 12 - - - attrib2 - 13 - - - - - - - - - - - true - 1 - 0.6 0.6 0.6 1.0 - 1.0 1.0 1.0 1.0 - 0.0 0.0 0.0 1.0 - 0.02 0.02 0.02 1.0 - 0.1 - ambient-and-diffuse - ambient-and-diffuse - - - 4 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - Shaders/Default/building-ubershader.vert - - instancePosition - 10 - - - instanceScale - 11 - - - attrib1 - 12 - - - attrib2 - 13 - - - - - - - - - - vertex-program-two-side - - - Shaders/Default/building-default.vert - Shaders/Default/include_fog.frag - - Shaders/Default/default.frag - - instancePosition - 10 - - - instanceScale - 11 - - - attrib1 - 12 - - - attrib2 - 13 - - - - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - off - - - 2 - RenderBin - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - - 0 - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - vertex-program-two-side - - - Shaders/Default/building-default.vert - Shaders/Default/include_fog.frag - - Shaders/Default/default.frag - - instancePosition - 10 - - - instanceScale - 11 - - - attrib1 - 12 - - - attrib2 - 13 - - - - fogType - int - - fogtype - - - - texture - sampler-2d - 0 - - - dataBuffer - sampler-1d - 1 - - - colorMode - int - - material/color-mode-uniform - - - - - - diff --git a/Compositor/Effects/bumpspec.eff b/Compositor/Effects/bumpspec.eff deleted file mode 100644 index 79c6c3293..000000000 --- a/Compositor/Effects/bumpspec.eff +++ /dev/null @@ -1,5 +0,0 @@ - - - Effects/bumpspec - Effects/model-default - diff --git a/Compositor/Effects/chrome.eff b/Compositor/Effects/chrome.eff deleted file mode 100644 index 8a7776411..000000000 --- a/Compositor/Effects/chrome.eff +++ /dev/null @@ -1,125 +0,0 @@ - - - Effects/chrome - - - transparent - - /rendering/scene/chrome-light - - - - false - - blend/active - blend/source - blend/destination - - shade-model - cull-face - rendering-hint - - 0 - texture[0]/type - texture[0]/image - texture[0]/filter - texture[0]/wrap-s - texture[0]/wrap-t - - - modulate - constant - src-color - texture1 - src-color - chrome-light - - - - 1 - chrome-texture - linear-mipmap-linear - repeat - repeat - - interpolate - texture0 - src-color - previous - src-color - texture0 - src-alpha - - replace - texture1 - src-alpha - - - sphere-map - - - - - - als-lighting - - false - - blend/active - blend/source - blend/destination - - shade-model - cull-face - rendering-hint - - 0 - texture[0]/type - texture[0]/image - texture[0]/filter - texture[0]/wrap-s - texture[0]/wrap-t - - - modulate - constant - src-color - texture1 - src-color - chrome-light - - - - 1 - chrome-texture - linear-mipmap-linear - repeat - repeat - - interpolate - texture0 - src-color - previous - src-color - texture0 - src-alpha - - replace - texture1 - src-alpha - - - sphere-map - - - - - diff --git a/Compositor/Effects/chute.eff b/Compositor/Effects/chute.eff deleted file mode 100644 index a3e6480d6..000000000 --- a/Compositor/Effects/chute.eff +++ /dev/null @@ -1,460 +0,0 @@ - - - Effects/chute - Effects/model-default - - 1.0 - 0.0 - 0.0 - 0.0 - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - 10 - DepthSortedBin - - - rendering-hint - - - - 0 - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - vertex-program-two-side - - - Shaders/ALS/chute.vert - Shaders/ALS/model-base.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - chute_force - float - - chute_force - - - - chute_fold - float - - chute_fold - - - - chute_bend - float - - chute_bend - - - - chute_projection_z - float - - chute_projection_z - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - geo_light_r - float - - geo_light_r - - - - geo_light_g - float - - geo_light_g - - - - geo_light_b - float - - geo_light_b - - - - geo_light_x - float - - geo_light_x - - - - geo_light_y - float - - geo_light_y - - - - geo_light_z - float - - geo_light_z - - - - geo_light_radius - float - - geo_light_radius - - - - geo_ambience - float - - geo_ambience - - - - texture - sampler-2d - 0 - - - colorMode - int - - material/color-mode-uniform - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - use_geo_light - int - - use_geo_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - - diff --git a/Compositor/Effects/cityLM.eff b/Compositor/Effects/cityLM.eff deleted file mode 100644 index 7ed569c00..000000000 --- a/Compositor/Effects/cityLM.eff +++ /dev/null @@ -1,35 +0,0 @@ - - - Effects/cityLM - Effects/model-combined-deferred - - - 1 - 1 - - /Textures/osm2city/atlas_facades_LM.png - repeat - repeat - - - /environment/lightmap-factor - - 1. 0.88 0.6 - - /scenery/osm2city/lightmap-factor - - - 0.564 0.409 0.172 - 0 - 0 - 1 - 1 - - - diff --git a/Compositor/Effects/cliffs.eff b/Compositor/Effects/cliffs.eff deleted file mode 100644 index f890f5265..000000000 --- a/Compositor/Effects/cliffs.eff +++ /dev/null @@ -1,791 +0,0 @@ - - - Effects/cliffs - Effects/terrain-default - - - 0.71 0.49 0.40 - 0.42 0.38 0.37 - 0.4 - 0.0 - 1.0 - 0.6 - 7.0 - 0.8 - 1.0 - 0 - - - - - - - als-lighting - - - - - 6.0 - /sim/rendering/shaders/landmass - - - 6.0 - /sim/rendering/shaders/transition - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - Shaders/ALS/terrain-ultra.vert - Shaders/ALS/filters.vert - Shaders/ALS/cliffs.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - - - intrinsic_wetness - float - - intrinsic_wetness - - - - slopeline_strength - float - - slopeline_strength - - - - rock_strata - int - - rock_strata - - - - transition_model - float - - transition_model - - - - overlay_bias - float - - overlay-bias - - - - crack_depth - float - - crack-depth - - - - crack_pattern_stretch - float - - crack-pattern-stretch - - - - grain_fade_power - float - - grain-fade-power - - - - rock_brightness - float - - rock-brightness - - - - dust_resistance - float - - dust_resistance - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - eye_lat - float - - eye_lat - - - - eye_lon - float - - eye_lon - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - dust_cover_factor - float - - dust_cover_factor - - - - lichen_cover_factor - float - - lichen_cover_factor - - - - wetness - float - - wetness - - - - fogstructure - float - - fogstructure - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - contrast - float - - contrast - - - - overlay_alpha - float - - overlay-alpha - - - - base_color - float-vec3 - - base-color - - - - overlay_color - float-vec3 - - overlay-color - - - - air_pollution - float - - air_pollution - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - wind_effects - int - - wind_effects - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - colorMode - int - 2 - - - - lequal - - - - - diff --git a/Compositor/Effects/cloud-impostor.eff b/Compositor/Effects/cloud-impostor.eff deleted file mode 100644 index fc8953ae5..000000000 --- a/Compositor/Effects/cloud-impostor.eff +++ /dev/null @@ -1,328 +0,0 @@ - - - Effects/cloud-impostor - - - - - /sim/rendering/clouds3d-vis-range - - - /environment/terminator-relative-position-m - - - /sim/rendering/eye-altitude-m - - - /environment/cloud-self-shading - - - /environment/moonlight - - - /environment/air-pollution-norm - - - /environment/visibility-m - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /environment/surface/delta-T-cloud - - - /sim/rendering/als-filters/grey-factor - - - /sim/rendering/als-filters/black-factor - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /sim/startup/xsize - - - /sim/startup/ysize - - - - - - /sim/rendering/clouds3d-enable - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 9 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/Default/cloud-static.vert - Shaders/Default/cloud-static.frag - - - baseTexture - sampler-2d - 0 - - - terminator - float - - terminator - - - - altitude - float - - altitude - - - true - - - - als-lighting - - - /sim/rendering/clouds3d-enable - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 9 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/ALS/cloud-impostor.vert - Shaders/ALS/filters.vert - Shaders/ALS/cloud-static.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - baseTexture - sampler-2d - 0 - - - range - float - - range - - - - terminator - float - - terminator - - - - altitude - float - - altitude - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - visibility - float - - visibility - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - true - - - diff --git a/Compositor/Effects/cloud-models.eff b/Compositor/Effects/cloud-models.eff deleted file mode 100644 index f24edb0f6..000000000 --- a/Compositor/Effects/cloud-models.eff +++ /dev/null @@ -1,151 +0,0 @@ - - - Effects/cloud-models - - - white - - - - - - - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - - texture[0]/active - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - modulate - - - - - diff --git a/Compositor/Effects/cloud-noctilucent.eff b/Compositor/Effects/cloud-noctilucent.eff deleted file mode 100644 index ab9194c41..000000000 --- a/Compositor/Effects/cloud-noctilucent.eff +++ /dev/null @@ -1,196 +0,0 @@ - - - Effects/cloud-noctilucent - - - - - /environment/terminator-relative-position-m - - - /sim/rendering/eye-altitude-m - - - /environment/cloud-self-shading - - - /environment/moonlight - - - - - - /sim/rendering/clouds3d-enable - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 9 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/Default/cloud-static.vert - Shaders/Default/cloud-static.frag - - - baseTexture - sampler-2d - 0 - - - terminator - float - - terminator - - - - altitude - float - - altitude - - - true - - - - als-lighting - - - /sim/rendering/clouds3d-enable - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 9 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/ALS/cloud-noctilucent.vert - Shaders/ALS/filters.vert - Shaders/ALS/cloud-static.frag - - - baseTexture - sampler-2d - 0 - - - terminator - float - - terminator - - - - altitude - float - - altitude - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - true - - - diff --git a/Compositor/Effects/cloud-static.eff b/Compositor/Effects/cloud-static.eff deleted file mode 100644 index a0cda73b9..000000000 --- a/Compositor/Effects/cloud-static.eff +++ /dev/null @@ -1,489 +0,0 @@ - - - Effects/cloud-static - - - - - /environment/terminator-relative-position-m - - - /sim/rendering/eye-altitude-m - - - /environment/cloud-self-shading - - - /environment/moonlight - - - /environment/scattering-phenomena/ring-factor - - - /environment/scattering-phenomena/rainbow-factor - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /environment/surface/delta-T-cloud - - - /sim/rendering/als-filters/grey-factor - - - /sim/rendering/als-filters/black-factor - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /sim/startup/xsize - - - /sim/startup/ysize - - - - - - /sim/rendering/clouds3d-enable - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 9 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/Default/cloud-static.vert - Shaders/Default/cloud-static.frag - - - baseTexture - sampler-2d - 0 - - - terminator - float - - terminator - - - - altitude - float - - altitude - - - true - - - - als-lighting - - - /sim/rendering/clouds3d-enable - - 1.0 - - - - 1.0 - /sim/rendering/shaders/clouds - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 9 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/ALS/cloud-static-detailed.vert - Shaders/ALS/cloud-static-detailed.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - baseTexture - sampler-2d - 0 - - - terminator - float - - terminator - - - - altitude - float - - altitude - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - ring_factor - float - - ring-factor - - - - rainbow_factor - float - - rainbow-factor - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - true - - - - als-lighting - - - /sim/rendering/clouds3d-enable - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 9 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/ALS/cloud-static.vert - Shaders/ALS/filters.vert - Shaders/ALS/cloud-static.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - baseTexture - sampler-2d - 0 - - - terminator - float - - terminator - - - - altitude - float - - altitude - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - true - - - diff --git a/Compositor/Effects/cloud.eff b/Compositor/Effects/cloud.eff deleted file mode 100644 index 91409c1e5..000000000 --- a/Compositor/Effects/cloud.eff +++ /dev/null @@ -1,629 +0,0 @@ - - - Effects/cloud - - - - - /sim/rendering/clouds3d-vis-range - - - /sim/rendering/clouds3d-detail-range - - - /rendering/scene/scattering - - - /environment/terminator-relative-position-m - - - /sim/rendering/eye-altitude-m - - - /environment/cloud-self-shading - - - /environment/moonlight - - - /environment/air-pollution-norm - - - /environment/visibility-m - - - /environment/lightning/flash - - - /environment/lightning/lightning-pos-x - - - /environment/lightning/lightning-pos-y - - - /environment/lightning/lightning-range - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /environment/surface/delta-T-cloud - - - /sim/rendering/als-filters/grey-factor - - - /sim/rendering/als-filters/black-factor - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /sim/startup/xsize - - - /sim/startup/ysize - - - - - - 1.0 - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 10 - DepthSortedBin - - - 0 - 2d - - texture[0]/image - - clamp - clamp - - - Shaders/Default/3dcloud.vert - Shaders/Default/3dcloud.frag - - usrAttr1 - 10 - - - usrAttr2 - 11 - - - - baseTexture - sampler-2d - 0 - - - range - float - - range - - - - detail_range - float - - detail - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - altitude - float - - altitude - - - - - - - als-lighting - - - - 1.0 - - - - 1.0 - /sim/rendering/shaders/clouds - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 10 - DepthSortedBin - - - 0 - 2d - - texture[0]/image - - clamp - clamp - - - Shaders/ALS/3dcloud-detailed.vert - Shaders/ALS/3dcloud-detailed.frag - Shaders/ALS/filters.frag - Shaders/ALS/noise.frag - - usrAttr1 - 10 - - - usrAttr2 - 11 - - - - baseTexture - sampler-2d - 0 - - - range - float - - range - - - - detail_range - float - - detail - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - altitude - float - - altitude - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - visibility - float - - visibility - - - - flash - float - - flash - - - - lightning_pos_x - float - - lightning-pos-x - - - - lightning_pos_y - float - - lightning-pos-y - - - - lightning_range - float - - lightning-range - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - - - als-lighting - - - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 10 - DepthSortedBin - - - 0 - 2d - - texture[0]/image - - clamp - clamp - - - Shaders/ALS/3dcloud.vert - Shaders/ALS/filters.vert - Shaders/ALS/3dcloud.frag - Shaders/ALS/filters.frag - Shaders/ALS/noise.frag - - usrAttr1 - 10 - - - usrAttr2 - 11 - - - - baseTexture - sampler-2d - 0 - - - range - float - - range - - - - detail_range - float - - detail - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - altitude - float - - altitude - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - visibility - float - - visibility - - - - flash - float - - flash - - - - lightning_pos_x - float - - lightning-pos-x - - - - lightning_pos_y - float - - lightning-pos-y - - - - lightning_range - float - - lightning-range - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - - diff --git a/Compositor/Effects/clouds-box.eff b/Compositor/Effects/clouds-box.eff deleted file mode 100644 index 47d0af162..000000000 --- a/Compositor/Effects/clouds-box.eff +++ /dev/null @@ -1,82 +0,0 @@ - - - Effects/clouds-thin - - - - - - - - /sim/rendering/shaders/quality-level - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 10 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/Default/clouds-box.vert - Shaders/Default/clouds-box.frag - - - - baseTexture - sampler-2d - 0 - - false - - - diff --git a/Compositor/Effects/clouds-layered.eff b/Compositor/Effects/clouds-layered.eff deleted file mode 100644 index 208f2ffe9..000000000 --- a/Compositor/Effects/clouds-layered.eff +++ /dev/null @@ -1,74 +0,0 @@ - - - Effects/clouds-layered - - - - - - - - /sim/rendering/shaders/quality-level - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 10 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/Default/clouds-layered.vert - Shaders/Default/clouds-layered.frag - - - baseTexture - sampler-2d - 0 - - true - - - diff --git a/Compositor/Effects/clouds-thick.eff b/Compositor/Effects/clouds-thick.eff deleted file mode 100644 index 0a0abda6a..000000000 --- a/Compositor/Effects/clouds-thick.eff +++ /dev/null @@ -1,74 +0,0 @@ - - - Effects/clouds-thick - - - - - - - - /sim/rendering/shaders/quality-level - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 10 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/Default/clouds-thick.vert - Shaders/Default/clouds-thick.frag - - - baseTexture - sampler-2d - 0 - - false - - - diff --git a/Compositor/Effects/clouds-thin.eff b/Compositor/Effects/clouds-thin.eff deleted file mode 100644 index 08d1f2351..000000000 --- a/Compositor/Effects/clouds-thin.eff +++ /dev/null @@ -1,82 +0,0 @@ - - - Effects/clouds-thin - - - - - - - - /sim/rendering/shaders/quality-level - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 10 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/Default/clouds-thin.vert - Shaders/Default/clouds-thin.frag - - - - baseTexture - sampler-2d - 0 - - false - - - diff --git a/Compositor/Effects/clouds-thinlayer.eff b/Compositor/Effects/clouds-thinlayer.eff deleted file mode 100644 index 4f79ab762..000000000 --- a/Compositor/Effects/clouds-thinlayer.eff +++ /dev/null @@ -1,74 +0,0 @@ - - - Effects/clouds-layered - - - - - - - - /sim/rendering/shaders/quality-level - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 10 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/Default/clouds-thinlayer.vert - Shaders/Default/clouds-thinlayer.frag - - - baseTexture - sampler-2d - 0 - - true - - - diff --git a/Compositor/Effects/crop.eff b/Compositor/Effects/crop.eff deleted file mode 100644 index 9a351f308..000000000 --- a/Compositor/Effects/crop.eff +++ /dev/null @@ -1,153 +0,0 @@ - - - Effects/crop - Effects/terrain-default - - - Textures/Terrain/crop.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/crop-colors.png - 1d - linear-mipmap-linear - mirror - normalized - - - /environment/snow-level-m - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/crop - - 0.0 - /sim/rendering/rembrandt/enabled - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - noise - - - 1 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 2 - - texture[3]/type - - - texture[3]/image - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/internal-format - - - - Shaders/Default/crop.vert - Shaders/Default/include_fog.frag - Shaders/Default/crop.frag - - - NoiseTex - sampler-3d - 0 - - - SampleTex - sampler-2d - 1 - - - ColorsTex - sampler-1d - 2 - - - snowlevel - float - - snow-level - - - - - diff --git a/Compositor/Effects/cropgrass.eff b/Compositor/Effects/cropgrass.eff deleted file mode 100644 index 04390c172..000000000 --- a/Compositor/Effects/cropgrass.eff +++ /dev/null @@ -1,25 +0,0 @@ - - - Effects/cropgrass - Effects/crop - - - Textures/Terrain/cropgrass.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/cropgrass-colors.png - 1d - linear-mipmap-linear - mirror - normalized - - - /environment/snow-level-m - - - diff --git a/Compositor/Effects/dirt-runway.eff b/Compositor/Effects/dirt-runway.eff deleted file mode 100644 index 099c2c679..000000000 --- a/Compositor/Effects/dirt-runway.eff +++ /dev/null @@ -1,928 +0,0 @@ - - - Effects/dirt-runway - Effects/runway - - - Textures/Terrain/sand_hires_ochre.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/airport_grass2.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/grain_texture.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 0.5 - 0.5 - 0.0 - 0.0 - 0.0 - 0.5 - 0.2 - 1.0 - 1 - 0.3 - 100.0 - 30.0 - 30.0 - 1.0 - - - als-lighting - - - - - 4.0 - /sim/rendering/shaders/landmass - - - 3.0 - /sim/rendering/shaders/transition - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[16]/type - - - texture[16]/image - - - texture[16]/filter - - - texture[16]/wrap-s - - - texture[16]/wrap-t - - - texture[16]/internal-format - - - - 4 - - texture[4]/type - - - texture[4]/image - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[17]/type - - - texture[17]/image - - - texture[17]/filter - - - texture[17]/wrap-s - - - texture[17]/wrap-t - - - texture[17]/internal-format - - - - 6 - - texture[18]/type - - - texture[18]/image - - - texture[18]/filter - - - texture[18]/wrap-s - - - texture[18]/wrap-t - - - texture[18]/internal-format - - - - 7 - - texture[11]/type - - - texture[11]/image - - - texture[11]/filter - - - texture[11]/wrap-s - - - texture[11]/wrap-t - - - texture[11]/internal-format - - - - Shaders/ALS/terrain-ultra.vert - Shaders/ALS/filters.vert - Shaders/ALS/drunway.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - dust_cover_factor - float - - dust_cover_factor - - - - lichen_cover_factor - float - - lichen_cover_factor - - - - size_base - float - - size_base - - - - size_overlay - float - - size_overlay - - - - size_grain - float - - size_grain - - - - grain_strength - float - - grain_strength - - - - strength_05m - float - - strength_05m - - - - strength_1m - float - - strength_1m - - - - strength_2m - float - - strength_2m - - - - strength_5m - float - - strength_5m - - - - strength_10m - float - - strength_10m - - - - filter_transition - float - - filter_transition - - - - filter_threshold - float - - filter_threshold - - - - relief_strength - float - - relief_strength - - - - bias_center_strength - float - - bias_center_strength - - - - wetness - float - - wetness - - - - fogstructure - float - - fogstructure - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - bias_center - int - - bias_center - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - raise_vertex - bool - - raise_vertex - - - - texture - sampler-2d - 0 - - - NormalTex - sampler-2d - 4 - - - mix_texture - sampler-2d - 5 - - - grain_texture - sampler-2d - 6 - - - detail_texture - sampler-2d - 7 - - - colorMode - int - 2 - - - - lequal - - - - - diff --git a/Compositor/Effects/flutter.eff b/Compositor/Effects/flutter.eff deleted file mode 100644 index 3a5e2d0ea..000000000 --- a/Compositor/Effects/flutter.eff +++ /dev/null @@ -1,535 +0,0 @@ - - - Effects/flutter - Effects/model-default - - true - - 1 - - - smooth - - 0.0 - 0.08 - - /environment/sea/surface/wind-from-east-fps - - - /environment/sea/surface/wind-from-north-fps - - 0.0 - 0.0 - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/terminator-relative-position-m - - - /sim/rendering/shaders/skydome - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/generic - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - - 0 - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - 1 - noise - - - vertex-program-two-side - - - - Shaders/Default/flutter.vert - Shaders/Default/include_fog.frag - Shaders/Default/default.frag - - - - colorMode - int - - material/color-mode-uniform - - - - - Offset - float - - offset - - - - AmpFactor - float - - amplitude-factor - - - - Noise - sampler-3d - 1 - - - WindE - float - - windE - - - - WindN - float - - windN - - - - spd - float - - speed-kt - - - - hdg - float - - heading-deg - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - - 0 - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - 1 - noise - - - vertex-program-two-side - - - Shaders/ALS/flutter.vert - Shaders/ALS/terrain-base.frag - Shaders/ALS/hazes.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - colorMode - int - - material/color-mode-uniform - - - - Offset - float - - offset - - - - AmpFactor - float - - amplitude-factor - - - - Noise - sampler-3d - 1 - - - WindE - float - - windE - - - - WindN - float - - windN - - - - spd - float - - speed-kt - - - - hdg - float - - heading-deg - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - - diff --git a/Compositor/Effects/forest.eff b/Compositor/Effects/forest.eff deleted file mode 100644 index 4d3203d10..000000000 --- a/Compositor/Effects/forest.eff +++ /dev/null @@ -1,348 +0,0 @@ - - - Effects/forest - Effects/terrain-default - - - Textures/Terrain/rock.png - linear-mipmap-linear - repeat - repeat - normalized - 2d - - - Textures/Terrain/forest-colors.png - linear-mipmap-linear - mirror - normalized - 1d - - - Textures/Terrain/forest.png - linear-mipmap-linear - repeat - repeat - normalized - 2d - - - Textures/Terrain/forest-relief.png - linear-mipmap-linear - repeat - repeat - normalized - 2d - - - /environment/snow-level-m - - 0.04 - 15.0 - - /sim/rendering/shaders/transition - - - 0.12 - 0.86 - 0.22 - - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/terminator-relative-position-m - - - /sim/rendering/shaders/skydome - - - - - 6 - 7 - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/transition - - 0.0 - /sim/rendering/rembrandt/enabled - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - noise - - - 1 - - texture[2]/type - - - texture[2]/image - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/type - - - texture[3]/image - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/internal-format - - - - 2 - - texture[4]/type - - - texture[4]/image - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/type - - - texture[5]/image - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - - Shaders/Default/forest.vert - Shaders/Default/include_fog.frag - Shaders/Default/forest.frag - - tangent - 6 - - - binormal - 7 - - - - NoiseTex - sampler-3d - 0 - - - SampleTex - sampler-2d - 1 - - - SampleTex2 - sampler-2d - 2 - - - ColorsTex - sampler-1d - 3 - - - NormalTex - sampler-2d - 5 - - - depth_factor - float - - depth-factor - - - - snowlevel - float - - snow-level - - - - quality_level - float - - quality-level - - - - red - float - - season-red - - - - green - float - - season-green - - - - blue - float - - season-blue - - - - alpha - float - 0.0 - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - diff --git a/Compositor/Effects/glacier.eff b/Compositor/Effects/glacier.eff deleted file mode 100644 index c7afffdd6..000000000 --- a/Compositor/Effects/glacier.eff +++ /dev/null @@ -1,348 +0,0 @@ - - - Effects/glacier - Effects/terrain-default - - - Textures/Terrain/rock.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/forest-colors.png - 1d - linear-mipmap-linear - mirror - normalized - - - Textures/Terrain/forest.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/forest-relief.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - /environment/snow-level-m - - 0.01 - 15.0 - - /sim/rendering/shaders/transition - - - 0.12 - 0.86 - 0.22 - - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/terminator-relative-position-m - - - /sim/rendering/shaders/skydome - - - - - 6 - 7 - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/transition - - 0.0 - /sim/rendering/rembrandt/enabled - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - noise - - - 1 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/internal-format - - - - 2 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - - Shaders/Default/forest.vert - Shaders/Default/include_fog.frag - Shaders/Default/forest.frag - - tangent - 6 - - - binormal - 7 - - - - NoiseTex - sampler-3d - 0 - - - SampleTex - sampler-2d - 1 - - - SampleTex2 - sampler-2d - 2 - - - ColorsTex - sampler-1d - 3 - - - NormalTex - sampler-2d - 5 - - - depth_factor - float - - depth-factor - - - - snowlevel - float - - snow-level - - - - quality_level - float - - quality-level - - - - red - float - - season-red - - - - green - float - - season-green - - - - blue - float - - season-blue - - - - alpha - float - 0.0 - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - diff --git a/Compositor/Effects/glass.eff b/Compositor/Effects/glass.eff deleted file mode 100644 index 7bb63adf0..000000000 --- a/Compositor/Effects/glass.eff +++ /dev/null @@ -1,694 +0,0 @@ - - - Effects/glass - Effects/model-default - - - Aircraft/Generic/Effects/window_frost.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - - white - - - - cubemap - - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_py.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_ny.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_pz.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png - - - - - cubemap - - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_py.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_ny.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_pz.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png - - - 1.0 1.0 1.0 1.0 - 1.0 1.0 1.0 - - /environment/aircraft-effects/splash-vector-x - - - /environment/aircraft-effects/splash-vector-y - - - /environment/aircraft-effects/splash-vector-z - - - /environment/rain-norm - - - /environment/aircraft-effects/ground-splash-norm - - - /environment/aircraft-effects/frost-level - - 0 - - /environment/aircraft-effects/fog-level - - - /environment/aircraft-effects/use-wipers - - - /environment/aircraft-effects/use-overlay - - - /environment/aircraft-effects/overlay-alpha - - 0.5 - 0 - 1.0 - 0 - 0 - 0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - - - - - - true - - false - - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - 111 - DepthSortedBin - - - 0 - - texture[0]/active - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - modulate - - - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - false - - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - 111 - DepthSortedBin - - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - - texture[1]/type - - - texture[1]/image - - - texture[1]/filter - - - texture[1]/wrap-s - - - texture[1]/wrap-t - - - texture[1]/internal-format - - - - 2 - - texture[2]/type - - - texture[2]/image - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/type - - - texture[3]/images - - - - 4 - - texture[4]/type - - - texture[4]/images - - - - vertex-program-two-side - - - Shaders/ALS/glass.vert - Shaders/ALS/glass.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - tint - float-vec4 - - glass-tint - - - - overlay_color - float-vec3 - - overlay-color - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - - - splash_x - float - - splash-x - - - - splash_y - float - - splash-y - - - - splash_z - float - - splash-z - - - - rain_norm - float - - rnorm - - - - ground_splash_norm - float - - gsnorm - - - - frost_level - float - - frost-level - - - - fog_level - float - - fog-level - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - overcast - float - - overcast - - - - hazeLayerAltitude - float - - lthickness - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - reflection_strength - float - - reflection-strength - - - - overlay_alpha - float - - overlay-alpha - - - - overlay_glare - float - - overlay-glare - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - texture - sampler-2d - 0 - - - frost_texture - sampler-2d - 1 - - - func_texture - sampler-2d - 2 - - - cube_texture - sampler-cube - 3 - - - cube_light_texture - sampler-cube - 4 - - - use_reflection - int - - use-reflection - - - - use_mask - int - - use-mask - - - - use_wipers - int - - use-wipers - - - - use_overlay - int - - use-overlay - - - - use_reflection_lightmap - int - - use-reflection-lightmap - - - - lightmap_multi - int - - lightmap-multi - - - - adaptive_mapping - int - - surface-mapping-scheme - - - - colorMode - int - - material/color-mode-uniform - - - - - diff --git a/Compositor/Effects/grass.eff b/Compositor/Effects/grass.eff deleted file mode 100644 index ba97f835d..000000000 --- a/Compositor/Effects/grass.eff +++ /dev/null @@ -1,1181 +0,0 @@ - - - Effects/grass - Effects/airfield - - - Textures/Terrain/airport-grass-autumn.png - 2d - nearest-mipmap-nearest - nearest - repeat - repeat - normalized - - 0.3 - 1.0 - 2 - 0 - 0.0 - - /environment/sea/surface/wind-from-east-fps - - - /environment/sea/surface/wind-from-north-fps - - - /environment/aircraft-effects/wash-x - - - /environment/aircraft-effects/wash-y - - - /environment/aircraft-effects/wash-strength - - - - als-lighting - - - - 2.0 - /sim/rendering/shaders/transition - - - 1.0 - /sim/rendering/shaders/vegetation-effects - - - 0.0 - /sim/rendering/rembrandt/enabled - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - GL_EXT_geometry_shader4 - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - smooth - back - - -1 - RenderBin - - - Shaders/ALS/terrain-writedepth.vert - Shaders/ALS/terrain-writedepth.frag - - 0 0 0 0 - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[13]/image - - - texture[13]/type - - - texture[13]/filter - - - texture[13]/wrap-s - - - texture[13]/wrap-t - - - texture[13]/internal-format - - - - 1 - - texture[14]/image - - - texture[14]/type - - - texture[14]/filter - - - texture[14]/wrap-s - - - texture[14]/wrap-t - - - texture[14]/internal-format - - - - 2 - - texture[15]/image - - - texture[15]/type - - - texture[15]/filter - - - texture[15]/wrap-s - - - texture[15]/wrap-t - - - texture[15]/internal-format - - - - Shaders/ALS/terrain-ultra.vert - Shaders/ALS/filters.vert - Shaders/ALS/shadows-include.vert - Shaders/ALS/airfield.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - Shaders/ALS/shadows-include.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - dust_cover_factor - float - - dust_cover_factor - - - - wetness - float - - wetness - - - - fogstructure - float - - fogstructure - - - - grit_alpha - float - - grit_alpha - - - - overlay_bias - float - - overlay_bias - - - - overlay_alpha - float - - overlay_alpha - - - - base_layer_magnification - float - - base_layer_magnification - - - - overlay_layer_magnification - float - - overlay_layer_magnification - - - - grain_layer_magnification - float - - grain_layer_magnification - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - season - float - - season - - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - use_overlay - int - - use_overlay - - - - use_grain - int - - use_grain - - - - use_color_overlay - int - - use_color_overlay - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - raise_vertex - bool - - raise_vertex - - - - texture - sampler-2d - 0 - - - overlay_texture - sampler-2d - 1 - - - grain_texture - sampler-2d - 2 - - - colorMode - int - 2 - - - - - shadow_tex - sampler-2d - 10 - - - shadows_enabled - bool - - shadows_enabled - - - - sun_atlas_size - int - - sun_atlas_size - - - - - lequal - false - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - smooth - back - - - - - render-bin/bin-number - - - render-bin/bin-name - - - - 8 - - texture[20]/type - - - texture[20]/image - - - texture[20]/filter - - - texture[20]/mag-filter - - - texture[20]/wrap-s - - - texture[20]/wrap-t - - - texture[20]/internal-format - - - - Shaders/ALS/grass.vert - Shaders/ALS/grass.geom - Shaders/ALS/grass.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - Shaders/ALS/shadows-include.frag - 96 - triangles - triangle-strip - - - colorTex - sampler-2d - 8 - - - visibility - float - - visibility - - - - scattering - float - - scattering - - - - wind_x - float - - windE - - - - wind_y - float - - windN - - - - wash_x - float - - wash-x - - - - wash_y - float - - wash-y - - - - wash_strength - float - - wash-strength - - - - overlay_bias - float - - overlay_bias - - - - max_height - float - - max_grass_height - - - - grass_density - float - - grass_density - - - - grass_modulate_height_min - float - - grass_modulate_height_min - - - - season - float - - season - - - - grass_modulate_by_overlay - int - - grass_modulate_by_overlay - - - - grass_groups - int - - grass_groups - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - wind_effects - int - - wind_effects - - - - - shadow_tex - sampler-2d - 10 - - - shadows_enabled - bool - - shadows_enabled - - - - sun_atlas_size - int - - sun_atlas_size - - - - - true - src-alpha - one-minus-src-alpha - - - false - - - - diff --git a/Compositor/Effects/herbtundra.eff b/Compositor/Effects/herbtundra.eff deleted file mode 100644 index 1b3367dc1..000000000 --- a/Compositor/Effects/herbtundra.eff +++ /dev/null @@ -1,347 +0,0 @@ - - - Effects/herbtundra - Effects/terrain-default - - - Textures/Terrain/rock.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/forest-colors.png - 1d - linear-mipmap-linear - mirror - normalized - - - Textures/Terrain/forest.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/forest-relief.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - /environment/snow-level-m - - 0.01 - 15.0 - - 0.12 - 0.86 - 0.22 - - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/terminator-relative-position-m - - - /sim/rendering/shaders/skydome - - - - /sim/rendering/shaders/transition - - - - 6 - 7 - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/transition - - 0.0 - /sim/rendering/rembrandt/enabled - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - noise - - - 1 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/internal-format - - - - 2 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - Shaders/Default/forest.vert - Shaders/Default/include_fog.frag - Shaders/Default/forest.frag - - tangent - 6 - - - binormal - 7 - - - - NoiseTex - sampler-3d - 0 - - - SampleTex - sampler-2d - 1 - - - SampleTex2 - sampler-2d - 2 - - - ColorsTex - sampler-1d - 3 - - - NormalTex - sampler-2d - 5 - - - depth_factor - float - - depth-factor - - - - snowlevel - float - - snow-level - - - - quality_level - float - - quality-level - - - - red - float - - season-red - - - - green - float - - season-green - - - - blue - float - - season-blue - - - - alpha - float - 0.0 - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - diff --git a/Compositor/Effects/hud.eff b/Compositor/Effects/hud.eff deleted file mode 100644 index 06d39ed85..000000000 --- a/Compositor/Effects/hud.eff +++ /dev/null @@ -1,719 +0,0 @@ - - - Effects/hud - Effects/model-default - - - Aircraft/Generic/Effects/window_frost.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - - Aircraft/Generic/Effects/hud-glass.rgb - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - - cubemap - - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_py.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_ny.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_pz.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png - - - - - cubemap - - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_py.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_ny.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_pz.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png - - - 0.95 1.0 0.95 1.0 - 0.8 1.0 0.9 - - /environment/aircraft-effects/splash-vector-x - - - /environment/aircraft-effects/splash-vector-y - - - /environment/aircraft-effects/splash-vector-z - - - /environment/rain-norm - - - /environment/aircraft-effects/ground-splash-norm - - - /environment/aircraft-effects/frost-level - - 0 - - /environment/aircraft-effects/fog-level - - - /environment/aircraft-effects/use-wipers - - 1 - 0.35 - 0.4 - 0 - 1.0 - 1 - 0 - 0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 0.0006 - 2.5 - 1.0 - - - - - - true - - false - - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - 111 - DepthSortedBin - - - 0 - - texture[0]/active - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - modulate - - - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - false - - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - 111 - DepthSortedBin - - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - - texture[1]/type - - - texture[1]/image - - - texture[1]/filter - - - texture[1]/wrap-s - - - texture[1]/wrap-t - - - texture[1]/internal-format - - - - 2 - - texture[2]/type - - - texture[2]/image - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/type - - - texture[3]/images - - - - 4 - - texture[4]/type - - - texture[4]/images - - - - vertex-program-two-side - - - Shaders/ALS/hud.vert - Shaders/ALS/hud.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - tint - float-vec4 - - glass-tint - - - - overlay_color - float-vec3 - - overlay-color - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - - - splash_x - float - - splash-x - - - - splash_y - float - - splash-y - - - - splash_z - float - - splash-z - - - - rain_norm - float - - rnorm - - - - ground_splash_norm - float - - gsnorm - - - - frost_level - float - - frost-level - - - - fog_level - float - - fog-level - - - - sample_res - float - - sample-res - - - - sample_far - float - - sample-far - - - - hud_brightness - float - - hud-brightness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - overcast - float - - overcast - - - - hazeLayerAltitude - float - - lthickness - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - reflection_strength - float - - reflection-strength - - - - overlay_alpha - float - - overlay-alpha - - - - overlay_glare - float - - overlay-glare - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - texture - sampler-2d - 0 - - - frost_texture - sampler-2d - 1 - - - func_texture - sampler-2d - 2 - - - cube_texture - sampler-cube - 3 - - - cube_light_texture - sampler-cube - 4 - - - use_reflection - int - - use-reflection - - - - use_mask - int - - use-mask - - - - use_wipers - int - - use-wipers - - - - use_overlay - int - - use-overlay - - - - use_reflection_lightmap - int - - use-reflection-lightmap - - - - lightmap_multi - int - - lightmap-multi - - - - adaptive_mapping - int - - surface-mapping-scheme - - - - colorMode - int - - material/color-mode-uniform - - - - - diff --git a/Compositor/Effects/landmass-nowood.eff b/Compositor/Effects/landmass-nowood.eff deleted file mode 100644 index cd8b228a0..000000000 --- a/Compositor/Effects/landmass-nowood.eff +++ /dev/null @@ -1,8 +0,0 @@ - - - Effects/landmass-nowood - Effects/landmass - - 0.0 - - diff --git a/Compositor/Effects/landmass-scrub.eff b/Compositor/Effects/landmass-scrub.eff deleted file mode 100644 index 0557590db..000000000 --- a/Compositor/Effects/landmass-scrub.eff +++ /dev/null @@ -1,16 +0,0 @@ - - - Effects/landmass-scrub - Effects/landmass - - - Textures/Terrain/shrubcover-relief.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 1.0 - - diff --git a/Compositor/Effects/landmass.eff b/Compositor/Effects/landmass.eff deleted file mode 100644 index 2a83b5190..000000000 --- a/Compositor/Effects/landmass.eff +++ /dev/null @@ -1,578 +0,0 @@ - - - Effects/landmass - Effects/terrain-default - - - Textures/Terrain/forest-relief.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - /environment/snow-level-m - - 0.01 - 15.0 - - /sim/rendering/shaders/landmass - - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/terminator-relative-position-m - - - /sim/rendering/shaders/skydome - - - - - 6 - 7 - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/landmass - - 4.0 - /sim/rendering/shaders/landmass - - - 0.0 - /sim/rendering/rembrandt/enabled - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - GL_EXT_geometry_shader4 - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - noise - - - 1 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - - Shaders/Default/landmass-g.vert - Shaders/Default/landmass.geom - Shaders/Default/include_fog.frag - Shaders/Default/landmass.frag - 18 - triangles - triangle-strip - - tangent - 6 - - - binormal - 7 - - - - NoiseTex - sampler-3d - 0 - - - BaseTex - sampler-2d - 1 - - - NormalTex - sampler-2d - 2 - - - depth_factor - float - - depth-factor - - - - snowlevel - float - - snow-level - - - - canopy_height - float - - canopy-height - - - - quality_level - float - - quality-level - - - - lequal - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/landmass - - 0.0 - /sim/rendering/rembrandt/enabled - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - noise - - - 1 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - - Shaders/Default/landmass.vert - Shaders/Default/include_fog.frag - Shaders/Default/landmass.frag - - tangent - 6 - - - binormal - 7 - - - - NoiseTex - sampler-3d - 0 - - - BaseTex - sampler-2d - 1 - - - NormalTex - sampler-2d - 2 - - - depth_factor - float - - depth-factor - - - - snowlevel - float - - snow-level - - - - quality_level - float - - quality-level - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - diff --git a/Compositor/Effects/lfeat.eff b/Compositor/Effects/lfeat.eff deleted file mode 100644 index 239c15e92..000000000 --- a/Compositor/Effects/lfeat.eff +++ /dev/null @@ -1,96 +0,0 @@ - - - Effects/lfeat - Effects/runway - - - - 1.0 1.0 1.0 1.0 - - - 1.0 1.0 1.0 1.0 - - - 1.0 1.0 1.0 1.0 - - - 0.0 0.0 0.0 1.0 - - 1.2 - - true - true - - - als-lighting - - - false - - - - true - - false - - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - 7 - DepthSortedBin - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - modulate - - - - -0.5 - -2.0 - - - - diff --git a/Compositor/Effects/light-cone.eff b/Compositor/Effects/light-cone.eff deleted file mode 100644 index 08b152aa6..000000000 --- a/Compositor/Effects/light-cone.eff +++ /dev/null @@ -1,4 +0,0 @@ - - - Effects/light-cone - diff --git a/Compositor/Effects/light-point.eff b/Compositor/Effects/light-point.eff deleted file mode 100644 index ff33d0dbf..000000000 --- a/Compositor/Effects/light-point.eff +++ /dev/null @@ -1,4 +0,0 @@ - - - Effects/light-point - diff --git a/Compositor/Effects/light-spot.eff b/Compositor/Effects/light-spot.eff deleted file mode 100644 index 0d1739ec6..000000000 --- a/Compositor/Effects/light-spot.eff +++ /dev/null @@ -1,4 +0,0 @@ - - - Effects/light-spot - diff --git a/Compositor/Effects/lightning.eff b/Compositor/Effects/lightning.eff deleted file mode 100644 index 6e966e362..000000000 --- a/Compositor/Effects/lightning.eff +++ /dev/null @@ -1,9 +0,0 @@ - - - - Effects/lightning - Effects/rain-layer - - 1 - - diff --git a/Compositor/Effects/material-diffuse.eff b/Compositor/Effects/material-diffuse.eff deleted file mode 100644 index ab3c32e02..000000000 --- a/Compositor/Effects/material-diffuse.eff +++ /dev/null @@ -1,11 +0,0 @@ - - - Effects/material-diffuse - - - 1 - - - - Effects/model-default - diff --git a/Compositor/Effects/material-off.eff b/Compositor/Effects/material-off.eff deleted file mode 100644 index 4b52522ab..000000000 --- a/Compositor/Effects/material-off.eff +++ /dev/null @@ -1,11 +0,0 @@ - - - Effects/material-off - - - 0 - - - - Effects/model-default - diff --git a/Compositor/Effects/model-combined-deferred.eff b/Compositor/Effects/model-combined-deferred.eff deleted file mode 100644 index b6f18c375..000000000 --- a/Compositor/Effects/model-combined-deferred.eff +++ /dev/null @@ -1,5 +0,0 @@ - - - Effects/model-combined-deferred - Effects/model-combined - diff --git a/Compositor/Effects/model-combined-transparent.eff b/Compositor/Effects/model-combined-transparent.eff deleted file mode 100644 index c2ae01ceb..000000000 --- a/Compositor/Effects/model-combined-transparent.eff +++ /dev/null @@ -1,114 +0,0 @@ - - - - Effects/model-combined-transparent - Effects/model-combined - - - - - /sim/rendering/shaders/model - 0.0 - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - false - - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - 111 - DepthSortedBin - - - 0 - - texture[0]/active - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - modulate - - - - - - diff --git a/Compositor/Effects/model-combined.eff b/Compositor/Effects/model-combined.eff deleted file mode 100644 index 5562e23b5..000000000 --- a/Compositor/Effects/model-combined.eff +++ /dev/null @@ -1,2025 +0,0 @@ - - - - Effects/model-combined - Effects/model-default - - - - - 0 - 0 - 1.0 - - Aircraft/Generic/Effects/null_bumpspec.png - 2d - linear-mipmap-linear - clamp - clamp - normalized - - - 0 - 0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 0 - 0.0 - - Aircraft/Generic/Effects/greymap.png - 2d - linear-mipmap-linear - clamp - clamp - normalized - - - 0 - 0.0 - 0 - 0.0 - 1 - 0 - - Aircraft/Generic/Effects/ReflectMaps/reflectmap.png - 2d - linear-mipmap-linear - clamp - clamp - normalized - - - - cubemap - - - - - - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_py.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_ny.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_pz.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png - - - - - 0.1 - - Aircraft/Generic/Effects/Gradients.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - 0.01 - 0.25 - - - 0 - 10 - - Textures/Terrain/void.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - - 0 - 0 - - 0 - 0 - 0.0 0.0 0.0 - 0.0 - 0.0 0.0 0.0 - 0.0 - 0.0 0.0 0.0 - 0.0 - 0 - 1.0 - - 0.05 - opaque - false - - 1 - RenderBin - - - smooth - - orientation/model/heading-deg - - - orientation/model/pitch-deg - - - orientation/model/roll-deg - - - position/model/longitude-deg - - - position/model/latitude-deg - - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/terminator-relative-position-m - - - /sim/rendering/shaders/skydome - - - /environment/surface/wetness - - - /environment/rain-norm - - - /environment/snow-level-m - - - /environment/surface/snow-thickness-factor - - - /local-weather/cloud-shadows/cloudpos-x[0] - - - /local-weather/cloud-shadows/cloudpos-y[0] - - - /local-weather/cloud-shadows/cloudpos-x[1] - - - /local-weather/cloud-shadows/cloudpos-y[1] - - - /local-weather/cloud-shadows/cloudpos-x[2] - - - /local-weather/cloud-shadows/cloudpos-y[2] - - - /local-weather/cloud-shadows/cloudpos-x[3] - - - /local-weather/cloud-shadows/cloudpos-y[3] - - - /local-weather/cloud-shadows/cloudpos-x[4] - - - /local-weather/cloud-shadows/cloudpos-y[4] - - - /local-weather/cloud-shadows/cloudpos-x[5] - - - /local-weather/cloud-shadows/cloudpos-y[5] - - - /local-weather/cloud-shadows/cloudpos-x[6] - - - /local-weather/cloud-shadows/cloudpos-y[6] - - - /local-weather/cloud-shadows/cloudpos-x[7] - - - /local-weather/cloud-shadows/cloudpos-y[7] - - - /local-weather/cloud-shadows/cloudpos-x[8] - - - /local-weather/cloud-shadows/cloudpos-y[8] - - - /local-weather/cloud-shadows/cloudpos-x[9] - - - /local-weather/cloud-shadows/cloudpos-y[9] - - - /local-weather/cloud-shadows/cloudpos-x[10] - - - /local-weather/cloud-shadows/cloudpos-y[10] - - - /local-weather/cloud-shadows/cloudpos-x[11] - - - /local-weather/cloud-shadows/cloudpos-y[11] - - - /local-weather/cloud-shadows/cloudpos-x[12] - - - /local-weather/cloud-shadows/cloudpos-y[12] - - - /local-weather/cloud-shadows/cloudpos-x[13] - - - /local-weather/cloud-shadows/cloudpos-y[13] - - - /local-weather/cloud-shadows/cloudpos-x[14] - - - /local-weather/cloud-shadows/cloudpos-y[14] - - - /local-weather/cloud-shadows/cloudpos-x[15] - - - /local-weather/cloud-shadows/cloudpos-y[15] - - - /local-weather/cloud-shadows/cloudpos-x[16] - - - /local-weather/cloud-shadows/cloudpos-y[16] - - - /local-weather/cloud-shadows/cloudpos-x[17] - - - /local-weather/cloud-shadows/cloudpos-y[17] - - - /local-weather/cloud-shadows/cloudpos-x[18] - - - /local-weather/cloud-shadows/cloudpos-y[18] - - - /local-weather/cloud-shadows/cloudpos-x[19] - - - /local-weather/cloud-shadows/cloudpos-y[19] - - - /local-weather/cloud-shadows/cloud-shadow-flag - - - /sim/rendering/rembrandt/enabled - - 0 - - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/model - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - transparent - - - transparent - - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - - 1 - noise - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - - 5 - - texture[5]/type - - - - - - - texture[5]/images - - - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - vertex-program-two-side - - - Shaders/Default/ubershader.vert - Shaders/Default/include_fog.frag - Shaders/Default/ubershader.frag - - - BaseTex - sampler-2d - 0 - - - ReflNoiseTex - sampler-3d - 1 - - - NormalTex - sampler-2d - 2 - - - LightMapTex - sampler-2d - 3 - - - ReflMapTex - sampler-2d - 4 - - - Environment - sampler-cube - 5 - - - ReflGradientsTex - sampler-2d - 6 - - - - - nmap_enabled - int - - normalmap-enabled - - - - - nmap_dds - int - - normalmap-dds - - - - nmap_tile - float - - normalmap-tiling - - - - - - lightmap_enabled - int - - lightmap-enabled - - - - - lightmap_multi - int - - lightmap-multi - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - - - - refl_enabled - int - - reflection-enabled - - - - - refl_correction - float - - reflection-correction - - - - - refl_map - int - - reflect-map-enabled - - - - - refl_dynamic - int - - reflection-dynamic - - - - - refl_rainbow - float - - reflection-rainbow - - - - - refl_fresnel - float - - reflection-fresnel - - - - - refl_noise - float - - reflection-noise - - - - - dirt_enabled - int - - dirt-enabled - - - - dirt_multi - int - - dirt-multi - - - - dirt_r_color - float-vec3 - - dirt-color[0] - - - - dirt_r_factor - float - - dirt-factor[0] - - - - dirt_g_color - float-vec3 - - dirt-color[1] - - - - dirt_g_factor - float - - dirt-factor[1] - - - - dirt_b_color - float-vec3 - - dirt-color[2] - - - - dirt_b_factor - float - - dirt-factor[2] - - - - - amb_correction - float - - ambient-correction - - - - lonDeg - float - - pos-lon - - - - latDeg - float - - pos-lat - - - - - - fogType - int - - fogtype - - - - - rembrandt_enabled - int - - rembrandt - - - - - - als-lighting - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/model - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - transparent - - - transparent - - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - - 1 - noise - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - - 5 - - texture[5]/type - - - - - - - texture[5]/images - - - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - - 7 - - texture[7]/image - - - texture[7]/type - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - texture[7]/internal-format - - - - vertex-program-two-side - - - Shaders/ALS/model-ultra.vert - Shaders/ALS/shadows-include.vert - Shaders/ALS/model-ultra.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - Shaders/ALS/shadows-include.frag - - - BaseTex - sampler-2d - 0 - - - ReflNoiseTex - sampler-3d - 1 - - - NormalTex - sampler-2d - 2 - - - LightMapTex - sampler-2d - 3 - - - ReflMapTex - sampler-2d - 4 - - - Environment - sampler-cube - 5 - - - ReflGradientsTex - sampler-2d - 6 - - - GrainTex - sampler-2d - 7 - - - - - nmap_enabled - int - - normalmap-enabled - - - - - nmap_dds - int - - normalmap-dds - - - - nmap_tile - float - - normalmap-tiling - - - - - - lightmap_enabled - int - - lightmap-enabled - - - - - lightmap_multi - int - - lightmap-multi - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - - - darkmap_factor - float - - darkmap-factor - - - - - refl_enabled - int - - reflection-enabled - - - - - refl_correction - float - - reflection-correction - - - - - refl_fresnel_factor - float - - reflection-fresnel-factor - - - - - refl_map - int - - reflect-map-enabled - - - - - refl_type - int - - reflection-type - - - - - refl_dynamic - int - - reflection-dynamic - - - - - refl_rainbow - float - - reflection-rainbow - - - - - refl_fresnel - float - - reflection-fresnel - - - - - refl_noise - float - - reflection-noise - - - - - dirt_enabled - int - - dirt-enabled - - - - dirt_multi - int - - dirt-multi - - - - dirt_r_color - float-vec3 - - dirt-color[0] - - - - dirt_r_factor - float - - dirt-factor[0] - - - - dirt_g_color - float-vec3 - - dirt-color[1] - - - - dirt_g_factor - float - - dirt-factor[1] - - - - dirt_b_color - float-vec3 - - dirt-color[2] - - - - dirt_b_factor - float - - dirt-factor[2] - - - - dirt_modulates_reflection - int - - dirt-modulates-reflection - - - - dirt_reflection_factor - float - - dirt-reflection-factor - - - - - grain_texture_enabled - int - - grain-texture-enabled - - - - grain_magnification - float - - grain-magnification - - - - - rain_enabled - int - - rain-enabled - - - - snow_enabled - int - - snow-enabled - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - - amb_correction - float - - ambient-correction - - - - hdg - float - - model-hdg - - - - pitch - float - - model-pitch - - - - roll - float - - model-roll - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - rain_norm - float - - rnorm - - - - wetness - float - - wetness - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - darkmap_enabled - int - - darkmap-enabled - - - - building_flag - int - - building-flag - - - - - rembrandt_enabled - int - - rembrandt - - - - - shadow_tex - sampler-2d - 10 - - - shadows_enabled - bool - - shadows_enabled - - - - sun_atlas_size - int - - sun_atlas_size - - - - - - diff --git a/Compositor/Effects/model-default.eff b/Compositor/Effects/model-default.eff deleted file mode 100644 index 72e1c2abc..000000000 --- a/Compositor/Effects/model-default.eff +++ /dev/null @@ -1,830 +0,0 @@ - - - Effects/model-default - - - - white - - false - - 1 - - - 0 - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/surface/scattering - - - /environment/terminator-relative-position-m - - - /environment/mean-terrain-elevation-m - - - /rendering/scene/overcast - - - /sim/rendering/eye-altitude-m - - - /environment/cloud-self-shading - - - /environment/moonlight - - - /sim/rendering/shaders/skydome - - - /environment/air-pollution-norm - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /environment/surface/delta-T-structure - - - /sim/rendering/als-filters/grey-factor - - - /sim/rendering/als-filters/black-factor - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /sim/startup/xsize - - - /sim/startup/ysize - - - /sim/current-view/pitch-offset-deg - - - /sim/current-view/heading-offset-deg - - - /sim/current-view/field-of-view - - - /sim/rendering/als-secondary-lights/use-searchlight - - - /sim/rendering/als-secondary-lights/use-landing-light - - - /sim/rendering/als-secondary-lights/use-alt-landing-light - - - /sim/rendering/als-secondary-lights/landing-light1-offset-deg - - - /sim/rendering/als-secondary-lights/landing-light2-offset-deg - - - /sim/rendering/als-secondary-lights/landing-light3-offset-deg - - 0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - - /sim/rendering/shaders/landmass - - - /sim/rendering/shaders/transition - - - - - /sim/rendering/als/shadows/enabled - - - /sim/rendering/als/shadows/sun-atlas-size - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/generic - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - - 0 - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - vertex-program-two-side - - - - - Shaders/Default/default.vert - Shaders/Default/include_fog.frag - - Shaders/Default/default.frag - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - texture - sampler-2d - 0 - - - colorMode - int - - material/color-mode-uniform - - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - - texture[0]/active - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - modulate - - - - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - - rendering-hint - - - - 0 - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - vertex-program-two-side - - - Shaders/ALS/generic-base.vert - Shaders/ALS/shadows-include.vert - Shaders/ALS/model-base.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - Shaders/ALS/shadows-include.frag - Shaders/ALS/clustered-include.frag - - PointLightBlock - 5 - - - SpotLightBlock - 6 - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - geo_light_r - float - - geo_light_r - - - - geo_light_g - float - - geo_light_g - - - - geo_light_b - float - - geo_light_b - - - - geo_light_x - float - - geo_light_x - - - - geo_light_y - float - - geo_light_y - - - - geo_light_z - float - - geo_light_z - - - - geo_light_radius - float - - geo_light_radius - - - - geo_ambience - float - - geo_ambience - - - - texture - sampler-2d - 0 - - - colorMode - int - - material/color-mode-uniform - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - use_geo_light - int - - use_geo_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - - shadow_tex - sampler-2d - 10 - - - shadows_enabled - bool - - shadows_enabled - - - - sun_atlas_size - int - - sun_atlas_size - - - - - - diff --git a/Compositor/Effects/model-interior-display.eff b/Compositor/Effects/model-interior-display.eff deleted file mode 100644 index 17085e4c0..000000000 --- a/Compositor/Effects/model-interior-display.eff +++ /dev/null @@ -1,901 +0,0 @@ - - - Effects/model-interior-display - Effects/model-interior - - - 2d - linear-mipmap-linear - clamp - clamp - normalized - Aircraft/Generic/Effects/dust-effect-overlay.png - - 0.0007 - 3.0 - 1.0 - - - - - - als-lighting - - - - 2.0 - /sim/rendering/shaders/model - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - 3 - - texture[3]/type - - - texture[3]/image - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - - 4 - - texture[4]/type - - - texture[4]/images - - - - 5 - - texture[5]/type - - - texture[5]/image - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - - 7 - - texture[7]/type - - - texture[7]/image - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - - vertex-program-two-side - - - Shaders/ALS/model-interior-detailed.vert - Shaders/ALS/model-interior-display.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - offset_vec - float-vec3 - - opacity-cube-center - - - - scale_vec - float-vec3 - - opacity-cube-scale - - - - angle - float - - opacity-cube-angle - - - - tag_color - float-vec3 - - implicit-lightmap-tag-color - - - - emit_color - float-vec3 - - implicit-lightmap-emit-color - - - - light_filter_one - float-vec3 - - light-filter-one - - - - light_filter_two - float-vec3 - - light-filter-two - - - - light_radius - float - - light-radius - - - - threshold_low - float - - implicit-lightmap-threshold-low - - - - threshold_high - float - - implicit-lightmap-threshold-high - - - - emit_intensity - float - - implicit-lightmap-intensity - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - - - grain_magnification - float - - grain-magnification - - - - irradiance_map_strength - float - - irradiance-map-strength - - - - ra_irradiance_map_strength - float - - ra-irradiance-map-strength - - - - residual_ambience_r - float - - residual-ambience-r - - - - residual_ambience_g - float - - residual-ambience-g - - - - residual_ambience_b - float - - residual-ambience-b - - - - sample_res - float - - sample-res - - - - dirt_factor - float - - dirt-factor - - - - contrast - float - - contrast - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - texture - sampler-2d - 0 - - - lightmap_texture - sampler-2d - 3 - - - cube_texture - sampler-cube - 4 - - - dust_texture - sampler-2d - 5 - - - grain_texture - sampler-2d - 7 - - - colorMode - int - - material/color-mode-uniform - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - implicit_lightmap_enabled - int - - implicit-lightmap-enabled - - - - use_flashlight - int - - use-flashlight - - - - lightmap_enabled - int - - lightmap-enabled - - - - lightmap_multi - int - - lightmap-multi - - - - irradiance_map_type - int - - irradiance-map-type - - - - ra_irradiance_map_type - int - - ra-irradiance-map-type - - - - grain_texture_enabled - int - - grain-texture-enabled - - - - - diff --git a/Compositor/Effects/model-interior.eff b/Compositor/Effects/model-interior.eff deleted file mode 100644 index 338b38498..000000000 --- a/Compositor/Effects/model-interior.eff +++ /dev/null @@ -1,1053 +0,0 @@ - - - Effects/model-interior - Effects/model-default - - - Aircraft/Generic/Effects/greymap.png - 2d - linear-mipmap-linear - clamp - clamp - normalized - - - cubemap - - Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_px.png - Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_nx.png - Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_py.png - Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_nx.png - Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_pz.png - Aircraft/Generic/Effects/CubeMaps/real.fair-sky/fair-sky_nz.png - - - - Textures/Terrain/void.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 0.0 0.0 0.0 - 1.0 1.0 1.0 - 0.0 - 0 - 1.0 1.0 1.0 - 0.5 - 1.5 - 1.0 1.0 1.0 - 0.0 - 0.5 0.5 0.5 - 0.9 0.2 0.2 - 9.6 - - /sim/rendering/als-secondary-lights/use-flashlight - - 0 - 0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 0 - 10.0 - 0 - 0.0 - 0.0 - 0.0 - 0.0 - 0 - 0.0 - - - als-lighting - - - - 2.0 - /sim/rendering/shaders/model - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - 3 - - texture[3]/type - - - texture[3]/image - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - - 4 - - texture[4]/type - - - texture[4]/images - - - - 7 - - texture[7]/type - - - texture[7]/image - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - - vertex-program-two-side - - - Shaders/ALS/model-interior-detailed.vert - Shaders/ALS/model-interior-detailed.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - offset_vec - float-vec3 - - opacity-cube-center - - - - scale_vec - float-vec3 - - opacity-cube-scale - - - - angle - float - - opacity-cube-angle - - - - tag_color - float-vec3 - - implicit-lightmap-tag-color - - - - emit_color - float-vec3 - - implicit-lightmap-emit-color - - - - light_filter_one - float-vec3 - - light-filter-one - - - - light_filter_two - float-vec3 - - light-filter-two - - - - light_radius - float - - light-radius - - - - threshold_low - float - - implicit-lightmap-threshold-low - - - - threshold_high - float - - implicit-lightmap-threshold-high - - - - emit_intensity - float - - implicit-lightmap-intensity - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - - - grain_magnification - float - - grain-magnification - - - - irradiance_map_strength - float - - irradiance-map-strength - - - - ra_irradiance_map_strength - float - - ra-irradiance-map-strength - - - - residual_ambience_r - float - - residual-ambience-r - - - - residual_ambience_g - float - - residual-ambience-g - - - - residual_ambience_b - float - - residual-ambience-b - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - texture - sampler-2d - 0 - - - lightmap_texture - sampler-2d - 3 - - - cube_texture - sampler-cube - 4 - - - grain_texture - sampler-2d - 7 - - - colorMode - int - - material/color-mode-uniform - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - implicit_lightmap_enabled - int - - implicit-lightmap-enabled - - - - use_flashlight - int - - use-flashlight - - - - lightmap_enabled - int - - lightmap-enabled - - - - lightmap_multi - int - - lightmap-multi - - - - irradiance_map_type - int - - irradiance-map-type - - - - ra_irradiance_map_type - int - - ra-irradiance-map-type - - - - grain_texture_enabled - int - - grain-texture-enabled - - - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - 4 - - texture[4]/type - - - texture[4]/images - - - - vertex-program-two-side - - - Shaders/ALS/shadows-include.vert - Shaders/ALS/generic-base.vert - Shaders/ALS/model-interior-base.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - offset_vec - float-vec3 - - opacity-cube-center - - - - scale_vec - float-vec3 - - opacity-cube-scale - - - - angle - float - - opacity-cube-angle - - - - tag_color - float-vec3 - - implicit-lightmap-tag-color - - - - emit_color - float-vec3 - - implicit-lightmap-emit-color - - - - light_filter_one - float-vec3 - - light-filter-one - - - - light_filter_two - float-vec3 - - light-filter-two - - - - light_radius - float - - light-radius - - - - threshold_low - float - - implicit-lightmap-threshold-low - - - - threshold_high - float - - implicit-lightmap-threshold-high - - - - emit_intensity - float - - implicit-lightmap-intensity - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - texture - sampler-2d - 0 - - - cube_texture - sampler-cube - 4 - - - colorMode - int - - material/color-mode-uniform - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - implicit_lightmap_enabled - int - - implicit-lightmap-enabled - - - - use_flashlight - int - - use-flashlight - - - - - diff --git a/Compositor/Effects/model-transparent.eff b/Compositor/Effects/model-transparent.eff deleted file mode 100644 index 21784e500..000000000 --- a/Compositor/Effects/model-transparent.eff +++ /dev/null @@ -1,196 +0,0 @@ - - - Effects/model-transparent - - - - white - - false - - 1 - - - - - - true - - false - - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - 111 - DepthSortedBin - - - 0 - - texture[0]/active - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - modulate - - - - - - - als-lighting - - true - - false - - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - 111 - DepthSortedBin - - - 0 - - texture[0]/active - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - modulate - - - - vertex-program-two-side - - - Shaders/ALS/model-transparent.vert - Shaders/ALS/model-transparent.frag - - - texture - sampler-2d - 0 - - - colorMode - int - - material/color-mode-uniform - - - - - diff --git a/Compositor/Effects/model-wingflex-organic.eff b/Compositor/Effects/model-wingflex-organic.eff deleted file mode 100644 index f0e1344f5..000000000 --- a/Compositor/Effects/model-wingflex-organic.eff +++ /dev/null @@ -1,1962 +0,0 @@ - - - Effects/model-wingflex-organic - Effects/model-default - - - - - 0 - 0 - 1.0 - - Aircraft/Generic/Effects/null_bumpspec.png - 2d - linear-mipmap-linear - clamp - clamp - normalized - - - 0 - 0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 1.0 - 1.0 1.0 1.0 - 0 - 0.0 - - Aircraft/Generic/Effects/greymap.png - 2d - linear-mipmap-linear - clamp - clamp - normalized - - - 0 - 0.0 - 0 - 0 - - Aircraft/Generic/Effects/ReflectMaps/reflectmap.png - 2d - linear-mipmap-linear - clamp - clamp - normalized - - - - cubemap - - - - - - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_py.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_ny.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_pz.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png - - - - - 0.1 - - Aircraft/Generic/Effects/Gradients.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - 0.01 - 0.25 - - - 0 - 10 - - Textures/Terrain/void.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - - 0 - - 0 - 0 - 0.0 0.0 0.0 - 0.0 - 0.0 0.0 0.0 - 0.0 - 0.0 0.0 0.0 - 0.0 - - 0.05 - opaque - false - - 1 - RenderBin - - - smooth - - orientation/model/heading-deg - - - orientation/model/pitch-deg - - - orientation/model/roll-deg - - - position/model/longitude-deg - - - position/model/latitude-deg - - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/terminator-relative-position-m - - - /sim/rendering/shaders/skydome - - - /environment/surface/wetness - - - /environment/rain-norm - - 0.0 - 0.0 - 0.0 - - /local-weather/cloud-shadows/cloudpos-x[0] - - - /local-weather/cloud-shadows/cloudpos-y[0] - - - /local-weather/cloud-shadows/cloudpos-x[1] - - - /local-weather/cloud-shadows/cloudpos-y[1] - - - /local-weather/cloud-shadows/cloudpos-x[2] - - - /local-weather/cloud-shadows/cloudpos-y[2] - - - /local-weather/cloud-shadows/cloudpos-x[3] - - - /local-weather/cloud-shadows/cloudpos-y[3] - - - /local-weather/cloud-shadows/cloudpos-x[4] - - - /local-weather/cloud-shadows/cloudpos-y[4] - - - /local-weather/cloud-shadows/cloudpos-x[5] - - - /local-weather/cloud-shadows/cloudpos-y[5] - - - /local-weather/cloud-shadows/cloudpos-x[6] - - - /local-weather/cloud-shadows/cloudpos-y[6] - - - /local-weather/cloud-shadows/cloudpos-x[7] - - - /local-weather/cloud-shadows/cloudpos-y[7] - - - /local-weather/cloud-shadows/cloudpos-x[8] - - - /local-weather/cloud-shadows/cloudpos-y[8] - - - /local-weather/cloud-shadows/cloudpos-x[9] - - - /local-weather/cloud-shadows/cloudpos-y[9] - - - /local-weather/cloud-shadows/cloudpos-x[10] - - - /local-weather/cloud-shadows/cloudpos-y[10] - - - /local-weather/cloud-shadows/cloudpos-x[11] - - - /local-weather/cloud-shadows/cloudpos-y[11] - - - /local-weather/cloud-shadows/cloudpos-x[12] - - - /local-weather/cloud-shadows/cloudpos-y[12] - - - /local-weather/cloud-shadows/cloudpos-x[13] - - - /local-weather/cloud-shadows/cloudpos-y[13] - - - /local-weather/cloud-shadows/cloudpos-x[14] - - - /local-weather/cloud-shadows/cloudpos-y[14] - - - /local-weather/cloud-shadows/cloudpos-x[15] - - - /local-weather/cloud-shadows/cloudpos-y[15] - - - /local-weather/cloud-shadows/cloudpos-x[16] - - - /local-weather/cloud-shadows/cloudpos-y[16] - - - /local-weather/cloud-shadows/cloudpos-x[17] - - - /local-weather/cloud-shadows/cloudpos-y[17] - - - /local-weather/cloud-shadows/cloudpos-x[18] - - - /local-weather/cloud-shadows/cloudpos-y[18] - - - /local-weather/cloud-shadows/cloudpos-x[19] - - - /local-weather/cloud-shadows/cloudpos-y[19] - - - /local-weather/cloud-shadows/cloud-shadow-flag - - - /sim/rendering/rembrandt/enabled - - 0 - - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/model - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - transparent - - - transparent - - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - - 1 - noise - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - - 5 - - texture[5]/type - - - - - - - texture[5]/images - - - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - vertex-program-two-side - - - Shaders/Default/ubershader.vert - Shaders/Default/include_fog.frag - Shaders/Default/ubershader.frag - - - BaseTex - sampler-2d - 0 - - - ReflNoiseTex - sampler-3d - 1 - - - NormalTex - sampler-2d - 2 - - - LightMapTex - sampler-2d - 3 - - - ReflMapTex - sampler-2d - 4 - - - Environment - sampler-cube - 5 - - - ReflGradientsTex - sampler-2d - 6 - - - - - nmap_enabled - int - - normalmap-enabled - - - - - nmap_dds - int - - normalmap-dds - - - - nmap_tile - float - - normalmap-tiling - - - - - - lightmap_enabled - int - - lightmap-enabled - - - - - lightmap_multi - int - - lightmap-multi - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - - - - refl_enabled - int - - reflection-enabled - - - - - refl_correction - float - - reflection-correction - - - - - refl_map - int - - reflect-map-enabled - - - - - refl_dynamic - int - - reflection-dynamic - - - - - refl_rainbow - float - - reflection-rainbow - - - - - refl_fresnel - float - - reflection-fresnel - - - - - refl_noise - float - - reflection-noise - - - - - dirt_enabled - int - - dirt-enabled - - - - dirt_multi - int - - dirt-multi - - - - dirt_r_color - float-vec3 - - dirt-color[0] - - - - dirt_r_factor - float - - dirt-factor[0] - - - - dirt_g_color - float-vec3 - - dirt-color[1] - - - - dirt_g_factor - float - - dirt-factor[1] - - - - dirt_b_color - float-vec3 - - dirt-color[2] - - - - dirt_b_factor - float - - dirt-factor[2] - - - - - amb_correction - float - - ambient-correction - - - - lonDeg - float - - pos-lon - - - - latDeg - float - - pos-lat - - - - - - fogType - int - - fogtype - - - - - rembrandt_enabled - int - - rembrandt - - - - - - als-lighting - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/model - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - transparent - - - transparent - - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - - 1 - noise - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - - 5 - - texture[5]/type - - - - - - - texture[5]/images - - - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - - 7 - - texture[7]/image - - - texture[7]/type - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - texture[7]/internal-format - - - - vertex-program-two-side - - - Shaders/ALS/model-wingflex-organic.vert - Shaders/ALS/model-ultra.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - BaseTex - sampler-2d - 0 - - - ReflNoiseTex - sampler-3d - 1 - - - NormalTex - sampler-2d - 2 - - - LightMapTex - sampler-2d - 3 - - - ReflMapTex - sampler-2d - 4 - - - Environment - sampler-cube - 5 - - - ReflGradientsTex - sampler-2d - 6 - - - GrainTex - sampler-2d - 7 - - - wingflex_alpha - float - - wingflex-alpha - - - - wingflex_trailing_alpha - float - - wingflex-trailing-alpha - - - - wingsweep_factor - float - - wingsweep-factor - - - - - - nmap_enabled - int - - normalmap-enabled - - - - - nmap_dds - int - - normalmap-dds - - - - nmap_tile - float - - normalmap-tiling - - - - - - lightmap_enabled - int - - lightmap-enabled - - - - - lightmap_multi - int - - lightmap-multi - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - - - darkmap_factor - float - - darkmap-factor - - - - - refl_enabled - int - - reflection-enabled - - - - - refl_correction - float - - reflection-correction - - - - - refl_map - int - - reflect-map-enabled - - - - - refl_dynamic - int - - reflection-dynamic - - - - - refl_rainbow - float - - reflection-rainbow - - - - - refl_fresnel - float - - reflection-fresnel - - - - - refl_noise - float - - reflection-noise - - - - - dirt_enabled - int - - dirt-enabled - - - - dirt_multi - int - - dirt-multi - - - - dirt_r_color - float-vec3 - - dirt-color[0] - - - - dirt_r_factor - float - - dirt-factor[0] - - - - dirt_g_color - float-vec3 - - dirt-color[1] - - - - dirt_g_factor - float - - dirt-factor[1] - - - - dirt_b_color - float-vec3 - - dirt-color[2] - - - - dirt_b_factor - float - - dirt-factor[2] - - - - - grain_texture_enabled - int - - grain-texture-enabled - - - - grain_magnification - float - - grain-magnification - - - - - rain_enabled - int - - rain-enabled - - - - - amb_correction - float - - ambient-correction - - - - hdg - float - - model-hdg - - - - pitch - float - - model-pitch - - - - roll - float - - model-roll - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - rain_norm - float - - rnorm - - - - wetness - float - - wetness - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - darkmap_enabled - int - - darkmap-enabled - - - - building_flag - int - - building-flag - - - - - rembrandt_enabled - int - - rembrandt - - - - - diff --git a/Compositor/Effects/planet-aurora.eff b/Compositor/Effects/planet-aurora.eff deleted file mode 100644 index 88b85f015..000000000 --- a/Compositor/Effects/planet-aurora.eff +++ /dev/null @@ -1,279 +0,0 @@ - - - Effects/aurora - - - white - - true - - 1 - - - - /environment/aurora/strength - - - /environment/aurora/ray-factor - - - /environment/aurora/upper-alt-factor - - - /environment/aurora/penetration-factor - - - /environment/aurora/patchiness - - - /environment/aurora/afterglow - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /environment/surface/delta-T-cloud - - - /sim/rendering/als-filters/grey-factor - - - /sim/rendering/als-filters/black-factor - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /sim/startup/xsize - - - /sim/startup/ysize - - 0.0 - - - als-lighting - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - src-alpha - one-minus-src-alpha - - - shade-model - - - - rendering-hint - - - false - - - 111 - DepthSortedBin - - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - vertex-program-two-side - - - Shaders/ALS/planet-aurora.vert - Shaders/ALS/planet-aurora.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - texture - sampler-2d - 0 - - - strength - float - - strength - - - - ray_factor - float - - ray_factor - - - - upper_alt_factor - float - - upper_alt_factor - - - - penetration_factor - float - - penetration_factor - - - - patchiness - float - - patchiness - - - - afterglow - float - - afterglow - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - arc_id - float - - arc_id - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - diff --git a/Compositor/Effects/planet-cloudlayer.eff b/Compositor/Effects/planet-cloudlayer.eff deleted file mode 100644 index fc98be6db..000000000 --- a/Compositor/Effects/planet-cloudlayer.eff +++ /dev/null @@ -1,442 +0,0 @@ - - - Effects/planet-cloudlayer - - - white - - - Models/Astro/cloud_structure.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - false - - 1 - - - - /environment/visibility-m - - - /earthview/overlay-texture-flag - - - /earthview/cloud-normal-flag - - - /earthview/shade-effect - - - /earthview/cloudcover-bias - - - /sim/time/sun-angle-rad - - - /environment/moonlight - - - /environment/air-pollution-norm - - - /earthview/roi-x1 - - - /earthview/roi-y1 - - - /earthview/lightning - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /environment/surface/delta-T-cloud - - - /sim/rendering/als-filters/grey-factor - - - /sim/rendering/als-filters/black-factor - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /sim/startup/xsize - - - /sim/startup/ysize - - - - 15 - 6 - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - - texture[0]/active - - 0 - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - modulate - - - - - - - als-lighting - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - src-alpha - one-minus-src-alpha - - smooth - - cull-face - - transparent - - 110 - DepthSortedBin - - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - 1 - - texture[1]/image - - - texture[1]/type - - - texture[1]/filter - - - texture[1]/wrap-s - - - texture[1]/wrap-t - - - texture[1]/internal-format - - - - Shaders/ALS/planet.vert - Shaders/ALS/planet-cloudlayer.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - tangent - 6 - - - normal - 15 - - - - texture - sampler-2d - 0 - - - structure_texture - sampler-2d - 1 - - - use_overlay - bool - - use-overlay-textures - - - - use_cloud_normals - bool - - use-cloud-normals - - - - colorMode - int - - material/color-mode-uniform - - - - visibility - float - - visibility - - - - shade_effect - float - - shade-effect - - - - cloudcover_bias - float - - cloudcover-bias - - - - air_pollution - float - - air_pollution - - - - sun_angle - float - - sun-angle - - - - moonlight - float - - moonlight - - - - lightning - float - - lightning - - - - roi_x1 - float - - roi_x1 - - - - roi_y1 - float - - roi_y1 - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - diff --git a/Compositor/Effects/planet.eff b/Compositor/Effects/planet.eff deleted file mode 100644 index c983ce20b..000000000 --- a/Compositor/Effects/planet.eff +++ /dev/null @@ -1,760 +0,0 @@ - - - Effects/planet - - - white - - - Textures/Terrain/void.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/grain_texture.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/void.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - false - - 1 - - - - /environment/visibility-m - - - /environment/air-pollution-norm - - - /earthview/cloudsphere-flag - - - /earthview/cloud-shadow-flag - - - /earthview/overlay-texture-flag - - - /sim/time/sun-angle-rad - - - /environment/moonlight - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /environment/surface/delta-T-cloud - - - /sim/rendering/als-filters/grey-factor - - - /sim/rendering/als-filters/black-factor - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /sim/startup/xsize - - - /sim/startup/ysize - - - - 15 - 6 - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - - texture[0]/active - - 0 - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - modulate - - - - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - /earthview/normal-flag - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - transparent - - - false - - - shade-model - - - cull-face - - - rendering-hint - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - 1 - - texture[1]/image - - - texture[1]/type - - - texture[1]/filter - - - texture[1]/wrap-s - - - texture[1]/wrap-t - - - texture[1]/internal-format - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - Shaders/ALS/planet.vert - Shaders/ALS/planet-high.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - tangent - 6 - - - normal - 15 - - - - texture - sampler-2d - 0 - - - shadowtex - sampler-2d - 1 - - - grain_texture - sampler-2d - 2 - - - normal_texture - sampler-2d - 3 - - - colorMode - int - - material/color-mode-uniform - - - - visibility - float - - visibility - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - sun_angle - float - - sun-angle - - - - use_clouds - bool - - use-clouds - - - - use_overlay - bool - - use-overlay-textures - - - - use_cloud_shadows - bool - - use-cloud-shadows - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - - als-lighting - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - transparent - - - false - - - shade-model - - - cull-face - - - rendering-hint - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - 1 - - texture[1]/image - - - texture[1]/type - - - texture[1]/filter - - - texture[1]/wrap-s - - - texture[1]/wrap-t - - - texture[1]/internal-format - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - Shaders/ALS/planet.vert - Shaders/ALS/planet.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - tangent - 6 - - - normal - 15 - - - - texture - sampler-2d - 0 - - - shadowtex - sampler-2d - 1 - - - grain_texture - sampler-2d - 2 - - - colorMode - int - - material/color-mode-uniform - - - - visibility - float - - visibility - - - - air_pollution - float - - air_pollution - - - - sun_angle - float - - sun-angle - - - - use_clouds - bool - - use-clouds - - - - use_overlay - bool - - use-overlay-textures - - - - use_cloud_shadows - bool - - use-cloud-shadows - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - diff --git a/Compositor/Effects/procedural-light.eff b/Compositor/Effects/procedural-light.eff deleted file mode 100644 index 3f4cef61f..000000000 --- a/Compositor/Effects/procedural-light.eff +++ /dev/null @@ -1,300 +0,0 @@ - - - Effects/procedural-light - - - white - - 1.0 - 0.0 - 0.0 - 1.0 - 1.0 - 1.0 - 1.0 - -1.0 - 0.0 - 0.0 - false - false - 0.2 - 0.4 - 0.7 - 0.5 - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /environment/mean-terrain-elevation-m - - - /sim/rendering/eye-altitude-m - - - /environment/terminator-relative-position-m - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - 111 - DepthSortedBin - - - - 0 - - texture[0]/active - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - false - - false - - Shaders/ALS/light.vert - Shaders/ALS/light.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - - - light_color_base_r - float - - light_color_base_r - - - - light_color_base_g - float - - light_color_base_g - - - - light_color_base_b - float - - light_color_base_b - - - - light_color_center_r - float - - light_color_center_r - - - - light_color_center_g - float - - light_color_center_g - - - - light_color_center_b - float - - light_color_center_b - - - - intensity_scale - float - - intensity_scale - - - - pointing_x - float - - pointing_x - - - - pointing_y - float - - pointing_y - - - - pointing_z - float - - pointing_z - - - - inner_angle - float - - inner_angle - - - - outer_angle - float - - outer_angle - - - - zero_angle - float - - zero_angle - - - - outer_gain - float - - outer_gain - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - eye_alt - float - - eye_alt - - - - terminator - float - - terminator - - - - texture - sampler-2d - 0 - - - is_directional - bool - - is_directional - - - - is_strobe - bool - - is_strobe - - - - - diff --git a/Compositor/Effects/rain-layer.eff b/Compositor/Effects/rain-layer.eff deleted file mode 100644 index 1e00aeb16..000000000 --- a/Compositor/Effects/rain-layer.eff +++ /dev/null @@ -1,342 +0,0 @@ - - - Effects/rain-layer - - - - - /sim/rendering/clouds3d-vis-range - - - /rendering/scene/scattering - - - /environment/terminator-relative-position-m - - - /environment/lightning/flash - - - /environment/lightning/lightning-pos-x - - - /environment/lightning/lightning-pos-y - - - /environment/lightning/lightning-range - - 0 - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /environment/surface/delta-T-cloud - - - /sim/rendering/als-filters/grey-factor - - - /sim/rendering/als-filters/black-factor - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /sim/startup/xsize - - - /sim/startup/ysize - - - - - - /sim/rendering/clouds3d-enable - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 9 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/Default/rain-layer.vert - Shaders/Default/rain-layer.frag - - - baseTexture - sampler-2d - 0 - - - range - float - - range - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - true - - - - als-lighting - - - /sim/rendering/clouds3d-enable - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 9 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - Shaders/ALS/rain-layer.vert - Shaders/ALS/rain-layer.frag - Shaders/ALS/filters.frag - Shaders/ALS/noise.frag - - - baseTexture - sampler-2d - 0 - - - range - float - - range - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - flash - float - - flash - - - - lightning_pos_x - float - - lightning-pos-x - - - - lightning_pos_y - float - - lightning-pos-y - - - - lightning_range - float - - lightning-range - - - - is_lightning - bool - - is-lightning - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - - diff --git a/Compositor/Effects/reflect.eff b/Compositor/Effects/reflect.eff deleted file mode 100644 index 591069e1e..000000000 --- a/Compositor/Effects/reflect.eff +++ /dev/null @@ -1,5 +0,0 @@ - - - Effects/reflect - Effects/model-default - diff --git a/Compositor/Effects/road-high.eff b/Compositor/Effects/road-high.eff deleted file mode 100644 index 4552c4ad3..000000000 --- a/Compositor/Effects/road-high.eff +++ /dev/null @@ -1,9 +0,0 @@ - - - Effects/road-high - Effects/road - - 1.2 - 3.0 - - diff --git a/Compositor/Effects/road-low.eff b/Compositor/Effects/road-low.eff deleted file mode 100644 index 4039bec1e..000000000 --- a/Compositor/Effects/road-low.eff +++ /dev/null @@ -1,9 +0,0 @@ - - - Effects/road-low - Effects/road - - 0.3 - 0.2 - - diff --git a/Compositor/Effects/road-mid.eff b/Compositor/Effects/road-mid.eff deleted file mode 100644 index 511078705..000000000 --- a/Compositor/Effects/road-mid.eff +++ /dev/null @@ -1,9 +0,0 @@ - - - Effects/road-mid - Effects/road - - 0.8 - 0.25 - - diff --git a/Compositor/Effects/road.eff b/Compositor/Effects/road.eff deleted file mode 100644 index f26061bf3..000000000 --- a/Compositor/Effects/road.eff +++ /dev/null @@ -1,1164 +0,0 @@ - - - - Effects/road - Effects/model-combined-deferred - - - Textures/Terrain/grain_texture.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Cars/cars.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Cars/cars-metadata.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 0 - 50 - 1 - 0 - 0.941 0.682 0.086 - - /environment/snow-level-m - - - /environment/surface/snow-thickness-factor - - - /sim/rendering/osm/road-traffic-enabled - - - /sim/rendering/osm/road-traffic-density - - - /sim/rendering/osm/road-traffic-direction - - - /sim/rendering/osm/road-traffic-daily-variation - - - /environment/lightmap-factor - - - - 6 - 7 - - - als-lighting - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/model - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - transparent - - - transparent - - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - - 1 - - texture[9]/image - - - texture[9]/type - - - texture[9]/filter - - - texture[9]/wrap-s - - - texture[9]/wrap-t - - - texture[9]/internal-format - - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - - 3 - - texture[8]/image - - - texture[8]/type - - - texture[8]/filter - - - texture[8]/wrap-s - - - texture[8]/wrap-t - - - texture[8]/internal-format - - - - - 5 - - texture[5]/type - - - - - - - texture[5]/images - - - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - - 7 - - texture[7]/image - - - texture[7]/type - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - texture[7]/internal-format - - - - vertex-program-two-side - - - Shaders/ALS/model-ultra.vert - Shaders/ALS/road-ultra.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - tangent - 6 - - - binormal - 7 - - - - BaseTex - sampler-2d - 0 - - - CarMetaTex - sampler-2d - 1 - - - NormalTex - sampler-2d - 2 - - - CarTex - sampler-2d - 3 - - - ReflMapTex - sampler-2d - 4 - - - Environment - sampler-cube - 5 - - - ReflGradientsTex - sampler-2d - 6 - - - GrainTex - sampler-2d - 7 - - - - - nmap_enabled - int - - normalmap-enabled - - - - - nmap_dds - int - - normalmap-dds - - - - nmap_tile - float - - normalmap-tiling - - - - - refl_enabled - int - - reflection-enabled - - - - - refl_correction - float - - reflection-correction - - - - - refl_fresnel_factor - float - - reflection-fresnel-factor - - - - - refl_map - int - - reflect-map-enabled - - - - - refl_type - int - - reflection-type - - - - - refl_dynamic - int - - reflection-dynamic - - - - - refl_rainbow - float - - reflection-rainbow - - - - - refl_fresnel - float - - reflection-fresnel - - - - - refl_noise - float - - reflection-noise - - - - - dirt_enabled - int - - dirt-enabled - - - - dirt_multi - int - - dirt-multi - - - - dirt_r_color - float-vec3 - - dirt-color[0] - - - - dirt_r_factor - float - - dirt-factor[0] - - - - dirt_g_color - float-vec3 - - dirt-color[1] - - - - dirt_g_factor - float - - dirt-factor[1] - - - - dirt_b_color - float-vec3 - - dirt-color[2] - - - - dirt_b_factor - float - - dirt-factor[2] - - - - - road_traffic_enabled - int - - road-traffic-enabled - - - - road_traffic_density - float - - road-traffic-density - - - - road_traffic_variation - float - - road-traffic-variation - - - - road_traffic_direction - int - - road-traffic-direction - - - - - streetlight_color - float-vec3 - - lightmap-color - - - - streetlight_factor - float - - road-light-factor - - - - - grain_texture_enabled - int - - grain-texture-enabled - - - - grain_magnification - float - - grain-magnification - - - - - rain_enabled - int - - rain-enabled - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - - amb_correction - float - - ambient-correction - - - - hdg - float - - model-hdg - - - - pitch - float - - model-pitch - - - - roll - float - - model-roll - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - rain_norm - float - - rnorm - - - - wetness - float - - wetness - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - diff --git a/Compositor/Effects/rock.eff b/Compositor/Effects/rock.eff deleted file mode 100644 index f21507865..000000000 --- a/Compositor/Effects/rock.eff +++ /dev/null @@ -1,791 +0,0 @@ - - - Effects/rock - Effects/terrain-default - - - 0.9 0.95 0.94 - 0.9 0.95 0.94 - 0.4 - 0.0 - 1.0 - 0.6 - 7.0 - 1.0 - 1.0 - 0 - - - - - - - als-lighting - - - - - 6.0 - /sim/rendering/shaders/landmass - - - 6.0 - /sim/rendering/shaders/transition - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - Shaders/ALS/terrain-ultra.vert - Shaders/ALS/filters.vert - Shaders/ALS/rock.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - - - intrinsic_wetness - float - - intrinsic_wetness - - - - slopeline_strength - float - - slopeline_strength - - - - rock_strata - int - - rock_strata - - - - transition_model - float - - transition_model - - - - overlay_bias - float - - overlay-bias - - - - crack_depth - float - - crack-depth - - - - crack_pattern_stretch - float - - crack-pattern-stretch - - - - grain_fade_power - float - - grain-fade-power - - - - rock_brightness - float - - rock-brightness - - - - dust_resistance - float - - dust_resistance - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - eye_lat - float - - eye_lat - - - - eye_lon - float - - eye_lon - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - dust_cover_factor - float - - dust_cover_factor - - - - lichen_cover_factor - float - - lichen_cover_factor - - - - wetness - float - - wetness - - - - fogstructure - float - - fogstructure - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - contrast - float - - contrast - - - - overlay_alpha - float - - overlay-alpha - - - - base_color - float-vec3 - - base-color - - - - overlay_color - float-vec3 - - overlay-color - - - - air_pollution - float - - air_pollution - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - wind_effects - int - - wind_effects - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - colorMode - int - 2 - - - - lequal - - - - - diff --git a/Compositor/Effects/runway-dds.eff b/Compositor/Effects/runway-dds.eff deleted file mode 100644 index 257e9e29d..000000000 --- a/Compositor/Effects/runway-dds.eff +++ /dev/null @@ -1,11 +0,0 @@ - - - Effects/runway-dds - Effects/runway - - - Textures/Runway/rwy-normalmap.dds - - 1.0 - - diff --git a/Compositor/Effects/runway.eff b/Compositor/Effects/runway.eff deleted file mode 100644 index 3d2eaa7be..000000000 --- a/Compositor/Effects/runway.eff +++ /dev/null @@ -1,1588 +0,0 @@ - - - Effects/runway - Effects/terrain-default - - - Textures/Runway/rwy-normalmap.png - linear-mipmap-linear - repeat - repeat - normalized - 2d - - - cubemap - - - - - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_py.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_ny.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_pz.png - Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png - - - - 2d - Aircraft/Generic/Effects/Rainbow.png - linear-mipmap-linear - repeat - repeat - normalized - - - 2d - Aircraft/Generic/Effects/FresnelLookUp.png - linear-mipmap-linear - repeat - repeat - normalized - - - 2d - Textures/Runway/rwy-reflect.png - linear-mipmap-linear - repeat - repeat - normalized - - transparent - smooth - 0.01 - 0.01 - 0.15 - -0.15 - 0.0 - false - back - - /environment/rain-norm - - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/surface/scattering - - - /environment/terminator-relative-position-m - - - /environment/mean-terrain-elevation-m - - - /rendering/scene/overcast - - - /sim/rendering/eye-altitude-m - - - /environment/snow-level-m - - - /environment/surface/dust-cover-factor - - - /environment/surface/lichen-cover-factor - - - /environment/surface/snow-thickness-factor - - - /environment/surface/wetness - - 1.0 - - /sim/rendering/als-secondary-lights/num-lightspots - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-x-m - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-y-m - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-z-m - - - /sim/rendering/als-secondary-lights/lightspot/stretch - - - /sim/rendering/als-secondary-lights/lightspot/dir - - - /sim/rendering/als-secondary-lights/lightspot/size - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-r - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-g - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-b - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[1] - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[1] - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[1] - - - /sim/rendering/als-secondary-lights/lightspot/stretch[1] - - - /sim/rendering/als-secondary-lights/lightspot/dir[1] - - - /sim/rendering/als-secondary-lights/lightspot/size[1] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-r[1] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-g[1] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-b[1] - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[2] - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[2] - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[2] - - - /sim/rendering/als-secondary-lights/lightspot/size[2] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-r[2] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-g[2] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-b[2] - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[3] - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[3] - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[3] - - - /sim/rendering/als-secondary-lights/lightspot/size[3] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-r[3] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-g[3] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-b[3] - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[4] - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[4] - - - /sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[4] - - - /sim/rendering/als-secondary-lights/lightspot/size[4] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-r[4] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-g[4] - - - /sim/rendering/als-secondary-lights/lightspot/lightspot-b[4] - - - /sim/rendering/shaders/skydome - - - /environment/fog-structure - - - /environment/cloud-self-shading - - - /environment/moonlight - - - /environment/surface/delta-T-rock - - - /sim/rendering/shaders/landmass - - - /sim/rendering/shaders/transition - - false - 0 - - - - 6 - 7 - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/generic - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - - texture[8]/type - - - texture[8]/image - - - texture[8]/filter - - - texture[8]/wrap-s - - - texture[8]/wrap-t - - - texture[8]/internal-format - - - - 2 - noise - - - 4 - - texture[4]/type - - - texture[4]/image - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/type - - - - - - texture[5]/images - - - - 6 - - texture[6]/type - - - texture[6]/image - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - - 7 - - texture[7]/type - - - texture[7]/image - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - - vertex-program-two-side - - - cull-face - - - - Shaders/Default/reflect-bump-spec.vert - Shaders/Default/include_fog.frag - Shaders/Default/runway.frag - - tangent - 6 - - - binormal - 7 - - - - BaseTex - sampler-2d - 0 - - - Map - sampler-2d - 1 - - - Noise - sampler-3d - 2 - - - NormalTex - sampler-2d - 4 - - - Environment - sampler-cube - 5 - - - Rainbow - sampler-2d - 6 - - - Fresnel - sampler-2d - 7 - - - - rainbowiness - float - - rainbowiness - - - - - fresneliness - float - - fresneliness - - - - - noisiness - float - - noisiness - - - - - spec_adjust - float - - rnorm - - - - - ambient_correction - float - - ambient_correction - - - - - reflect_map - float - - reflect_map - - - - - normalmap_dds - float - - normalmap_dds - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - als-lighting - - - - - 4.0 - /sim/rendering/shaders/landmass - - - 3.0 - /sim/rendering/shaders/transition - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 4 - - texture[4]/type - - - texture[4]/image - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - Shaders/ALS/terrain-ultra.vert - Shaders/ALS/filters.vert - Shaders/ALS/shadows-include.vert - Shaders/ALS/runway.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - Shaders/ALS/lightspot.frag - Shaders/ALS/shadows-include.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - dust_cover_factor - float - - dust_cover_factor - - - - lichen_cover_factor - float - - lichen_cover_factor - - - - wetness - float - - wetness - - - - rain_norm - float - - rnorm - - - - fogstructure - float - - fogstructure - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - uvstretch - float - - uvstretch - - - - air_pollution - float - - air_pollution - - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - eyerel_x1 - float - - eyerel_x1 - - - - eyerel_y1 - float - - eyerel_y1 - - - - eyerel_z1 - float - - eyerel_z1 - - - - lightspot_project1 - float - - lightspot_project1 - - - - lightspot_dir1 - float - - lightspot_dir1 - - - - lightspot_size1 - float - - lightspot_size1 - - - - lightspot_r1 - float - - lightspot_r1 - - - - lightspot_g1 - float - - lightspot_g1 - - - - lightspot_b1 - float - - lightspot_b1 - - - - eyerel_x2 - float - - eyerel_x2 - - - - eyerel_y2 - float - - eyerel_y2 - - - - eyerel_z2 - float - - eyerel_z2 - - - - lightspot_project2 - float - - lightspot_project2 - - - - lightspot_dir2 - float - - lightspot_dir2 - - - - lightspot_size2 - float - - lightspot_size2 - - - - lightspot_r2 - float - - lightspot_r2 - - - - lightspot_g2 - float - - lightspot_g2 - - - - lightspot_b2 - float - - lightspot_b2 - - - - eyerel_x3 - float - - eyerel_x3 - - - - eyerel_y3 - float - - eyerel_y3 - - - - eyerel_z3 - float - - eyerel_z3 - - - - lightspot_size3 - float - - lightspot_size3 - - - - lightspot_r3 - float - - lightspot_r3 - - - - lightspot_g3 - float - - lightspot_g3 - - - - lightspot_b3 - float - - lightspot_b3 - - - - eyerel_x4 - float - - eyerel_x4 - - - - eyerel_y4 - float - - eyerel_y4 - - - - eyerel_z4 - float - - eyerel_z4 - - - - lightspot_size4 - float - - lightspot_size4 - - - - lightspot_r4 - float - - lightspot_r4 - - - - lightspot_g4 - float - - lightspot_g4 - - - - lightspot_b4 - float - - lightspot_b4 - - - - eyerel_x5 - float - - eyerel_x5 - - - - eyerel_y5 - float - - eyerel_y5 - - - - eyerel_z5 - float - - eyerel_z5 - - - - lightspot_size5 - float - - lightspot_size5 - - - - lightspot_r5 - float - - lightspot_r5 - - - - lightspot_g5 - float - - lightspot_g5 - - - - lightspot_b5 - float - - lightspot_b5 - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - num_lightspots - int - - num_lightspots - - - - overlay_flag - int - - overlay_flag - - - - raise_vertex - bool - - raise_vertex - - - - texture - sampler-2d - 0 - - - NormalTex - sampler-2d - 4 - - - colorMode - int - 2 - - - - - shadow_tex - sampler-2d - 10 - - - shadows_enabled - bool - - shadows_enabled - - - - sun_atlas_size - int - - sun_atlas_size - - - - - - greater - 0.4 - - - - diff --git a/Compositor/Effects/shadow-vol.eff b/Compositor/Effects/shadow-vol.eff deleted file mode 100644 index da4367a4e..000000000 --- a/Compositor/Effects/shadow-vol.eff +++ /dev/null @@ -1,4 +0,0 @@ - - - Effects/shadow-vol - diff --git a/Compositor/Effects/shadow.eff b/Compositor/Effects/shadow.eff deleted file mode 100644 index 791d6b477..000000000 --- a/Compositor/Effects/shadow.eff +++ /dev/null @@ -1,4 +0,0 @@ - - - Effects/shadow - diff --git a/Compositor/Effects/skydome.eff b/Compositor/Effects/skydome.eff deleted file mode 100644 index 4a2838489..000000000 --- a/Compositor/Effects/skydome.eff +++ /dev/null @@ -1,463 +0,0 @@ - - - Effects/skydome - - - /sim/rendering/mie - - - /sim/rendering/rayleigh - - - /sim/rendering/dome-density - - - /rendering/scene/overcast - - - /rendering/scene/saturation - - - /rendering/scene/scattering - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/scattering-phenomena/ice-hexagonal-column-factor - - - /environment/scattering-phenomena/ice-hexagonal-sheet-factor - - - /environment/scattering-phenomena/parhelic-factor - - - /environment/scattering-phenomena/ring-factor - - - /environment/aurora/strength - - - /environment/aurora/vsize - - - /environment/aurora/hsize - - - /environment/aurora/ray-factor - - - /environment/aurora/penetration-factor - - - /environment/ground-haze-thickness-m - - - /environment/terminator-relative-position-m - - - /environment/mean-terrain-elevation-m - - - /environment/cloud-self-shading - - - /local-weather/config/small-scale-persistence - - - /sim/startup/xsize - - - /sim/startup/ysize - - - /sim/current-view/pitch-offset-deg - - - /sim/current-view/heading-offset-deg - - - /sim/current-view/field-of-view - - - /sim/rendering/als-secondary-lights/use-searchlight - - - /sim/rendering/als-secondary-lights/use-landing-light - - - /sim/rendering/als-secondary-lights/use-alt-landing-light - - - /sim/rendering/als-secondary-lights/landing-light1-offset-deg - - - /sim/rendering/als-secondary-lights/landing-light2-offset-deg - - - /sim/rendering/als-secondary-lights/landing-light3-offset-deg - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /sim/rendering/als-filters/grey-factor - - - /sim/rendering/als-filters/black-factor - - -50.0 - - /environment/air-pollution-norm - - - - - - false - smooth - back - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - smooth - back - - Shaders/ALS/skydome.vert - Shaders/ALS/skydome.frag - Shaders/ALS/noise.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - - - mK - float - - mie - - - - rK - float - - rayleigh - - - - density - float - - density - - - - overcast - float - - overcast - - - - saturation - float - - saturation - - - - scattering - float - - scattering - - - - visibility - float - - visibility - - - - hazeLayerAltitude - float - - lthickness - - - - terminator - float - - terminator - - - - avisibility - float - - avisibility - - - - terrain_alt - float - - terrain_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - air_pollution - float - - air_pollution - - - - ice_hex_col - float - - ice_hex_col - - - - parhelic - float - - parhelic - - - - ring - float - - ring - - - - ice_hex_sheet - float - - ice_hex_sheet - - - - aurora_strength - float - - aurora_strength - - - - aurora_vsize - float - - aurora_vsize - - - - aurora_hsize - float - - aurora_hsize - - - - aurora_ray_factor - float - - aurora_ray_factor - - - - aurora_penetration_factor - float - - aurora_penetration_factor - - - - horizon_roughness - float - - horizon_roughness - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - diff --git a/Compositor/Effects/space-combined.eff b/Compositor/Effects/space-combined.eff deleted file mode 100644 index 39a7cde81..000000000 --- a/Compositor/Effects/space-combined.eff +++ /dev/null @@ -1,963 +0,0 @@ - - - - Effects/space-combined - Effects/model-combined - - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0 - - - als-lighting - - - Shaders/ALS/space-ultra.vert - Shaders/ALS/space-ultra.frag - Shaders/ALS/color_temperature.frag - - - BaseTex - sampler-2d - 0 - - - ReflNoiseTex - sampler-3d - 1 - - - NormalTex - sampler-2d - 2 - - - LightMapTex - sampler-2d - 3 - - - ReflMapTex - sampler-2d - 4 - - - Environment - sampler-cube - 5 - - - ReflGradientsTex - sampler-2d - 6 - - - GrainTex - sampler-2d - 7 - - - - - nmap_enabled - int - - normalmap-enabled - - - - - nmap_dds - int - - normalmap-dds - - - - nmap_tile - float - - normalmap-tiling - - - - - - lightmap_enabled - int - - lightmap-enabled - - - - - lightmap_multi - int - - lightmap-multi - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - - - darkmap_factor - float - - darkmap-factor - - - - - refl_enabled - int - - reflection-enabled - - - - - refl_correction - float - - reflection-correction - - - - - refl_map - int - - reflect-map-enabled - - - - - refl_type - int - - reflection-type - - - - - refl_dynamic - int - - reflection-dynamic - - - - - refl_rainbow - float - - reflection-rainbow - - - - - refl_fresnel - float - - reflection-fresnel - - - - - refl_noise - float - - reflection-noise - - - - - dirt_enabled - int - - dirt-enabled - - - - dirt_multi - int - - dirt-multi - - - - dirt_r_color - float-vec3 - - dirt-color[0] - - - - dirt_r_factor - float - - dirt-factor[0] - - - - dirt_g_color - float-vec3 - - dirt-color[1] - - - - dirt_g_factor - float - - dirt-factor[1] - - - - dirt_b_color - float-vec3 - - dirt-color[2] - - - - dirt_b_factor - float - - dirt-factor[2] - - - - dirt_modulates_reflection - int - - dirt-modulates-reflection - - - - dirt_reflection_factor - float - - dirt-reflection-factor - - - - - grain_texture_enabled - int - - grain-texture-enabled - - - - grain_magnification - float - - grain-magnification - - - - - rain_enabled - int - - rain-enabled - - - - - amb_correction - float - - ambient-correction - - - - hdg - float - - model-hdg - - - - pitch - float - - model-pitch - - - - roll - float - - model-roll - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - rain_norm - float - - rnorm - - - - wetness - float - - wetness - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - darkmap_enabled - int - - darkmap-enabled - - - - geo_light_r - float - - geo_light_r - - - - geo_light_g - float - - geo_light_g - - - - geo_light_b - float - - geo_light_b - - - - geo_light_x - float - - geo_light_x - - - - geo_light_y - float - - geo_light_y - - - - geo_light_z - float - - geo_light_z - - - - geo_light_radius - float - - geo_light_radius - - - - geo_ambience - float - - geo_ambience - - - - use_geo_light - int - - use_geo_light - - - - - - als-lighting - - - Shaders/ALS/space-base.vert - Shaders/ALS/space-base.frag - - - - diff --git a/Compositor/Effects/space.eff b/Compositor/Effects/space.eff deleted file mode 100644 index 14130c699..000000000 --- a/Compositor/Effects/space.eff +++ /dev/null @@ -1,15 +0,0 @@ - - - - Effects/space - Effects/model-default - - als-lighting - - - Shaders/ALS/space-base.vert - Shaders/ALS/space-base.frag - - - - diff --git a/Compositor/Effects/surface-lights-directional.eff b/Compositor/Effects/surface-lights-directional.eff deleted file mode 100644 index e900b1e5f..000000000 --- a/Compositor/Effects/surface-lights-directional.eff +++ /dev/null @@ -1,365 +0,0 @@ - - - Effects/surface-lights-directional - - - - light-sprite - clamp - clamp - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /sim/rendering/eye-altitude-m - - - /environment/terminator-relative-position-m - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - - - - - /sim/rendering/point-sprites - - - 2.0 - - - - GL_ARB_point_sprite - GL_ARB_point_parameters - - - - - - - 8 - DepthSortedBin - - false - - false - - - src-alpha - one-minus-src-alpha - - - gequal - 0.1 - - back - - point - - - - min-size - - - max-size - - - size - - - attenuation - - - - 0 - true - - texture[0]/type - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - - - - - /sim/rendering/point-sprites - - - 2.0 - - - GL_ARB_point_sprite - - - - - - 8 - DepthSortedBin - - false - - false - - - src-alpha - one-minus-src-alpha - - back - - point - - - 0 - true - - texture[0]/type - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - - - - - - - 2.0 - - - GL_ARB_point_parameters - - - - - - - min-size - - - max-size - - - size - - - attenuation - - - - 8 - DepthSortedBin - - - false - - - src-alpha - one-minus-src-alpha - - false - back - - point - - - - - - - - 8 - DepthSortedBin - - false - - false - - - src-alpha - one-minus-src-alpha - - back - - point - - - - - als-lighting - - - - /sim/rendering/point-sprites - - - 2.0 - - - - GL_ARB_point_sprite - GL_ARB_point_parameters - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - 8 - DepthSortedBin - - false - - src-alpha - one-minus-src-alpha - - - false - - - back - - point - - - - min-size - - - max-size - - - size - - - attenuation - - - - 0 - true - - texture[0]/type - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - Shaders/ALS/surface-light.vert - Shaders/ALS/surface-light.frag - Shaders/ALS/noise.frag - - - size - float - - size - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - eye_alt - float - - eye_alt - - - - max_size - float - - max-size - - - - is_directional - bool - - false - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - texture - sampler-2d - 0 - - - terminator - float - - terminator - - - true - - - diff --git a/Compositor/Effects/surface-lights.eff b/Compositor/Effects/surface-lights.eff deleted file mode 100644 index 6266d1fe8..000000000 --- a/Compositor/Effects/surface-lights.eff +++ /dev/null @@ -1,376 +0,0 @@ - - - Effects/surface-lights - - - - light-sprite - clamp - clamp - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /sim/rendering/eye-altitude-m - - - /environment/terminator-relative-position-m - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - - - - - /sim/rendering/point-sprites - - - 2.0 - - - - GL_ARB_point_sprite - GL_ARB_point_parameters - - - - - - - 8 - DepthSortedBin - - false - - false - - - src-alpha - one-minus-src-alpha - - - gequal - 0.1 - - back - - point - - - - min-size - - - max-size - - - size - - - attenuation - - - - 0 - true - - texture[0]/type - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - - - - - /sim/rendering/point-sprites - - - 2.0 - - - GL_ARB_point_sprite - - - - - - 8 - DepthSortedBin - - false - - false - - - src-alpha - one-minus-src-alpha - - - cull-face - - - point - - - 0 - true - - texture[0]/type - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - - - - - - - 2.0 - - - GL_ARB_point_parameters - - - - - - - min-size - - - max-size - - - size - - - attenuation - - - - 8 - DepthSortedBin - - - false - - - src-alpha - one-minus-src-alpha - - false - - cull-face - - - point - point - - - - - - - - 8 - DepthSortedBin - - false - - false - - - src-alpha - one-minus-src-alpha - - - cull-face - - - point - - - - - als-lighting - - - - /sim/rendering/point-sprites - - - 2.0 - - - - GL_ARB_point_sprite - GL_ARB_point_parameters - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - 8 - DepthSortedBin - - false - - src-alpha - one-minus-src-alpha - - - false - - - - cull-face - - - point - point - - - - min-size - - - max-size - - - size - - - attenuation - - - - 0 - true - - texture[0]/type - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - Shaders/ALS/surface-light.vert - Shaders/ALS/surface-light.frag - Shaders/ALS/noise.frag - - - size - float - - size - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - eye_alt - float - - eye_alt - - - - max_size - float - - max-size - - - - is_directional - bool - - light-directional - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - texture - sampler-2d - 0 - - - terminator - float - - terminator - - - true - - - diff --git a/Compositor/Effects/terrain-default.eff b/Compositor/Effects/terrain-default.eff deleted file mode 100644 index 95b9db10b..000000000 --- a/Compositor/Effects/terrain-default.eff +++ /dev/null @@ -1,2312 +0,0 @@ - - - Effects/terrain-default - - - - - 0.2 .2 0.2 1.0 - - - .8 .8 .8 1.0 - - - 0.0 0.0 0.0 1.0 - - - 0.0 0.0 0.0 1.0 - - 1.2 - - - Textures/Terrain/unknown.png - 2d - linear-mipmap-linear - - repeat - repeat - - - normalized - - - Textures/Terrain/snow3.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/void.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/void.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/rock_alt.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/grain_texture.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/void.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - false - - 0 - RenderBin - - 0 - 0.5 - 0.0 - 0.5 - 0.0 - 1.0 - 1.0 - 1.0 - 0 - false - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/surface/scattering - - - /environment/terminator-relative-position-m - - - /environment/mean-terrain-elevation-m - - - /rendering/scene/overcast - - - /sim/rendering/eye-altitude-m - - - /environment/snow-level-m - - - /environment/surface/snow-thickness-factor - - - /environment/surface/dust-cover-factor - - - /environment/surface/lichen-cover-factor - - - /environment/surface/wetness - - - /sim/rendering/shaders/skydome - - - /environment/fog-structure - - - /environment/cloud-self-shading - - - /environment/moonlight - - - /environment/season - - - /environment/air-pollution-norm - - - /environment/surface/delta-T-soil - - - /sim/rendering/shaders/wind-effects - - - /environment/sea/surface/wind-from-east-fps - - - /environment/sea/surface/wind-from-north-fps - - - /sim/startup/xsize - - - /sim/startup/ysize - - - /sim/current-view/pitch-offset-deg - - - /sim/current-view/heading-offset-deg - - - /sim/current-view/field-of-view - - - /sim/rendering/als-secondary-lights/use-searchlight - - - /sim/rendering/als-secondary-lights/use-landing-light - - - /sim/rendering/als-secondary-lights/use-alt-landing-light - - - /sim/rendering/als-secondary-lights/landing-light1-offset-deg - - - /sim/rendering/als-secondary-lights/landing-light2-offset-deg - - - /sim/rendering/als-secondary-lights/landing-light3-offset-deg - - - /sim/rendering/shaders/landmass - - - /sim/rendering/shaders/transition - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /sim/rendering/als-filters/grey-factor - - - /sim/rendering/als-filters/black-factor - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /local-weather/cloud-shadows/cloudpos-x[0] - - - /local-weather/cloud-shadows/cloudpos-y[0] - - - /local-weather/cloud-shadows/cloudpos-x[1] - - - /local-weather/cloud-shadows/cloudpos-y[1] - - - /local-weather/cloud-shadows/cloudpos-x[2] - - - /local-weather/cloud-shadows/cloudpos-y[2] - - - /local-weather/cloud-shadows/cloudpos-x[3] - - - /local-weather/cloud-shadows/cloudpos-y[3] - - - /local-weather/cloud-shadows/cloudpos-x[4] - - - /local-weather/cloud-shadows/cloudpos-y[4] - - - /local-weather/cloud-shadows/cloudpos-x[5] - - - /local-weather/cloud-shadows/cloudpos-y[5] - - - /local-weather/cloud-shadows/cloudpos-x[6] - - - /local-weather/cloud-shadows/cloudpos-y[6] - - - /local-weather/cloud-shadows/cloudpos-x[7] - - - /local-weather/cloud-shadows/cloudpos-y[7] - - - /local-weather/cloud-shadows/cloudpos-x[8] - - - /local-weather/cloud-shadows/cloudpos-y[8] - - - /local-weather/cloud-shadows/cloudpos-x[9] - - - /local-weather/cloud-shadows/cloudpos-y[9] - - - /local-weather/cloud-shadows/cloudpos-x[10] - - - /local-weather/cloud-shadows/cloudpos-y[10] - - - /local-weather/cloud-shadows/cloudpos-x[11] - - - /local-weather/cloud-shadows/cloudpos-y[11] - - - /local-weather/cloud-shadows/cloudpos-x[12] - - - /local-weather/cloud-shadows/cloudpos-y[12] - - - /local-weather/cloud-shadows/cloudpos-x[13] - - - /local-weather/cloud-shadows/cloudpos-y[13] - - - /local-weather/cloud-shadows/cloudpos-x[14] - - - /local-weather/cloud-shadows/cloudpos-y[14] - - - /local-weather/cloud-shadows/cloudpos-x[15] - - - /local-weather/cloud-shadows/cloudpos-y[15] - - - /local-weather/cloud-shadows/cloudpos-x[16] - - - /local-weather/cloud-shadows/cloudpos-y[16] - - - /local-weather/cloud-shadows/cloudpos-x[17] - - - /local-weather/cloud-shadows/cloudpos-y[17] - - - /local-weather/cloud-shadows/cloudpos-x[18] - - - /local-weather/cloud-shadows/cloudpos-y[18] - - - /local-weather/cloud-shadows/cloudpos-x[19] - - - /local-weather/cloud-shadows/cloudpos-y[19] - - - /local-weather/cloud-shadows/nearest-cloudpos-x - - - /local-weather/cloud-shadows/nearest-cloudpos-y - - - /local-weather/cloud-shadows/cloud-shadow-flag - - - - /sim/rendering/als/shadows/enabled - - - /sim/rendering/als/shadows/sun-atlas-size - - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/generic - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - Shaders/Default/include_fog.vert - Shaders/Default/default.vert - Shaders/Default/default.frag - Shaders/Default/include_fog.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - texture - sampler-2d - 0 - - - colorMode - int - 2 - - - - lequal - - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - modulate - - - - - - als-lighting - - - - - 6.0 - /sim/rendering/shaders/landmass - - - 6.0 - /sim/rendering/shaders/transition - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 2 - - texture[13]/image - - - texture[13]/type - - - texture[13]/filter - - - texture[13]/wrap-s - - - texture[13]/wrap-t - - - texture[13]/internal-format - - - - 3 - - texture[15]/type - - - texture[15]/image - - - texture[15]/filter - - - texture[15]/wrap-s - - - texture[15]/wrap-t - - - texture[15]/internal-format - - - - 4 - - texture[14]/type - - - texture[14]/image - - - texture[14]/filter - - - texture[14]/wrap-s - - - texture[14]/wrap-t - - - texture[14]/internal-format - - - - 5 - - texture[12]/type - - - texture[12]/image - - - texture[12]/filter - - - texture[12]/wrap-s - - - texture[12]/wrap-t - - - texture[12]/internal-format - - - - 7 - - texture[11]/type - - - texture[11]/image - - - texture[11]/filter - - - texture[11]/wrap-s - - - texture[11]/wrap-t - - - texture[11]/internal-format - - - - Shaders/ALS/terrain-ultra.vert - Shaders/ALS/filters.vert - Shaders/ALS/shadows-include.vert - Shaders/ALS/terrain-ultra.frag - Shaders/ALS/noise.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - Shaders/ALS/shadows-include.frag - - - grain_strength - float - - grain_strength - - - - intrinsic_wetness - float - - intrinsic_wetness - - - - transition_model - float - - transition_model - - - - hires_overlay_bias - float - - hires_overlay_bias - - - - dot_density - float - - dot_density - - - - dot_size - float - - dot_size - - - - dust_resistance - float - - dust_resistance - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - eye_lat - float - - eye_lat - - - - eye_lon - float - - eye_lon - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - dust_cover_factor - float - - dust_cover_factor - - - - lichen_cover_factor - float - - lichen_cover_factor - - - - wetness - float - - wetness - - - - fogstructure - float - - fogstructure - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - season - float - - season - - - - air_pollution - float - - air_pollution - - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - wind_effects - int - - wind_effects - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - rock_strata - int - - rock_strata - - - - raise_vertex - bool - - raise_vertex - - - - texture - sampler-2d - 0 - - - mix_texture - sampler-2d - 5 - - - detail_texture - sampler-2d - 7 - - - grain_texture - sampler-2d - 4 - - - dot_texture - sampler-2d - 3 - - - gradient_texture - sampler-2d - 2 - - - colorMode - int - 2 - - - - - shadow_tex - sampler-2d - 10 - - - shadows_enabled - bool - - shadows_enabled - - - - sun_atlas_size - int - - sun_atlas_size - - - - - lequal - - - - - - als-lighting - - - - - 4.0 - /sim/rendering/shaders/landmass - - - 3.0 - /sim/rendering/shaders/transition - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 5 - - texture[12]/type - - - texture[12]/image - - - texture[12]/filter - - - texture[12]/wrap-s - - - texture[12]/wrap-t - - - texture[12]/internal-format - - - - 7 - - texture[11]/type - - - texture[11]/image - - - texture[11]/filter - - - texture[11]/wrap-s - - - texture[11]/wrap-t - - - texture[11]/internal-format - - - - Shaders/ALS/terrain-detailed.vert - Shaders/ALS/filters.vert - Shaders/ALS/shadows-include.vert - Shaders/ALS/terrain-detailed.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - Shaders/ALS/filters.frag - Shaders/ALS/shadows-include.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - transition_model - float - - transition_model - - - - hires_overlay_bias - float - - hires_overlay_bias - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - dust_cover_factor - float - - dust_cover_factor - - - - lichen_cover_factor - float - - lichen_cover_factor - - - - wetness - float - - wetness - - - - fogstructure - float - - fogstructure - - - - cloud_self_shading - float - - cloud_self_shading - - - - air_pollution - float - - air_pollution - - - - moonlight - float - - moonlight - - - - season - float - - season - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - texture - sampler-2d - 0 - - - mix_texture - sampler-2d - 5 - - - detail_texture - sampler-2d - 7 - - - colorMode - int - 2 - - - - - shadow_tex - sampler-2d - 10 - - - shadows_enabled - bool - - shadows_enabled - - - - sun_atlas_size - int - - sun_atlas_size - - - - - lequal - false --> - - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - Shaders/ALS/generic-base.vert - Shaders/ALS/shadows-include.vert - Shaders/ALS/terrain-base.frag - Shaders/ALS/hazes.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - Shaders/ALS/shadows-include.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - texture - sampler-2d - 0 - - - colorMode - int - 2 - - - - - shadow_tex - sampler-2d - 10 - - - shadows_enabled - bool - - shadows_enabled - - - - sun_atlas_size - int - - sun_atlas_size - - - - - lequal - - - - - diff --git a/Compositor/Effects/terrain-overlay.eff b/Compositor/Effects/terrain-overlay.eff deleted file mode 100644 index 9a54806f9..000000000 --- a/Compositor/Effects/terrain-overlay.eff +++ /dev/null @@ -1,1287 +0,0 @@ - - - Effects/terrain-overlay - Effects/terrain-default - - - Textures/Terrain/void.png - 2d - nearest-mipmap-nearest - nearest - repeat - repeat - normalized - - - Textures/Terrain/void.png - 2d - nearest-mipmap-nearest - nearest - repeat - repeat - normalized - - 1.5 - 1.0 - 1.0 - 0.5 - 0.5 - 0.5 - 0.5 - 0.8 - 0.0 - 0 - 0 - - - als-lighting - - - - - 6.0 - /sim/rendering/shaders/landmass - - - 6.0 - /sim/rendering/shaders/transition - - - 1.0 - /sim/rendering/shaders/vegetation-effects - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - GL_EXT_geometry_shader4 - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 2 - - texture[13]/image - - - texture[13]/type - - - texture[13]/filter - - - texture[13]/wrap-s - - - texture[13]/wrap-t - - - texture[13]/internal-format - - - - 3 - - texture[15]/type - - - texture[15]/image - - - texture[15]/filter - - - texture[15]/wrap-s - - - texture[15]/wrap-t - - - texture[15]/internal-format - - - - 4 - - texture[14]/type - - - texture[14]/image - - - texture[14]/filter - - - texture[14]/wrap-s - - - texture[14]/wrap-t - - - texture[14]/internal-format - - - - 5 - - texture[12]/type - - - texture[12]/image - - - texture[12]/filter - - - texture[12]/wrap-s - - - texture[12]/wrap-t - - - texture[12]/internal-format - - - - 7 - - texture[11]/type - - - texture[11]/image - - - texture[11]/filter - - - texture[11]/wrap-s - - - texture[11]/wrap-t - - - texture[11]/internal-format - - - - Shaders/ALS/terrain-ultra.vert - Shaders/ALS/filters.vert - Shaders/ALS/shadows-include.vert - Shaders/ALS/terrain-ultra.frag - Shaders/ALS/noise.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - Shaders/ALS/shadows-include.frag - - - grain_strength - float - - grain_strength - - - - intrinsic_wetness - float - - intrinsic_wetness - - - - transition_model - float - - transition_model - - - - hires_overlay_bias - float - - hires_overlay_bias - - - - dot_density - float - - dot_density - - - - dot_size - float - - dot_size - - - - dust_resistance - float - - dust_resistance - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - eye_lat - float - - eye_lat - - - - eye_lon - float - - eye_lon - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - dust_cover_factor - float - - dust_cover_factor - - - - lichen_cover_factor - float - - lichen_cover_factor - - - - wetness - float - - wetness - - - - fogstructure - float - - fogstructure - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - season - float - - season - - - - air_pollution - float - - air_pollution - - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - wind_effects - int - - wind_effects - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - rock_strata - int - - rock_strata - - - - raise_vertex - bool - - raise_vertex - - - - texture - sampler-2d - 0 - - - mix_texture - sampler-2d - 5 - - - detail_texture - sampler-2d - 7 - - - grain_texture - sampler-2d - 4 - - - dot_texture - sampler-2d - 3 - - - gradient_texture - sampler-2d - 2 - - - colorMode - int - 2 - - - - lequal - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - smooth - - back - - - - render-bin/bin-number - - - render-bin/bin-name - - - - 7 - - texture[20]/type - - - texture[20]/image - - - texture[20]/filter - - - texture[20]/mag-filter - - - texture[20]/wrap-s - - - texture[20]/wrap-t - - - texture[20]/internal-format - - - - 8 - - texture[21]/type - - - texture[21]/image - - - texture[21]/filter - - - texture[21]/mag-filter - - - texture[21]/wrap-s - - - texture[21]/wrap-t - - - texture[21]/internal-format - - - - Shaders/ALS/grass.vert - Shaders/ALS/terrain-overlay.geom - Shaders/ALS/terrain-overlay.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - Shaders/ALS/cloud-shadowfunc.frag - 96 - triangles - triangle-strip - - - overlayPrimaryTex - sampler-2d - 7 - - - overlaySecondaryTex - sampler-2d - 8 - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - scattering - float - - scattering - - - - overlay_bias - float - - overlay_bias - - - - overlay_max_height - float - - max_overlay_height - - - - overlay_hardness - float - - overlay_hardness - - - - overlay_secondary_hardness - float - - overlay_secondary_hardness - - - - overlay_density - float - - overlay_density - - - - overlay_secondary_density - float - - overlay_secondary_density - - - - overlay_scale - float - - overlay_scale - - - - overlay_brightness_top - float - - overlay_brightness_top - - - - overlay_brightness_bottom - float - - overlay_brightness_bottom - - - - overlay_steepness_factor - float - - overlay_steepness_factor - - - - season - float - - season - - - - dust_cover_factor - float - - dust_cover_factor - - - - wetness - float - - wetness - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - - cloudpos_n_x - float - - cloudpos_n_x - - - - cloudpos_n_y - float - - cloudpos_n_y - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - overlay_autumn_flag - int - - overlay_autumn_flag - - - - overlay_secondary_flag - int - - overlay_secondary_flag - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - true - src-alpha - one-minus-src-alpha - - - false - - - - diff --git a/Compositor/Effects/thrust-flame.eff b/Compositor/Effects/thrust-flame.eff deleted file mode 100644 index b51a23470..000000000 --- a/Compositor/Effects/thrust-flame.eff +++ /dev/null @@ -1,300 +0,0 @@ - - - Effects/thrust-flame - - - white - - 0.2 - 0.1 - 0.5 - 1.0 - 0.5 - 0.2 - 0.1 - 0.95 - 0.55 - 0.0 - 1.0 - 0.8 - 0.3 - 1.0 - 0.8 - 0.3 - 0.0 - 0.0 - 1 - 1 - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /environment/mean-terrain-elevation-m - - - /sim/rendering/eye-altitude-m - - - - als-lighting - - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - 111 - DepthSortedBin - - - - 0 - - texture[0]/active - - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - false - - false - - Shaders/ALS/thrustflame.vert - Shaders/ALS/thrustflame.frag - Shaders/ALS/noise.frag - - - flame_radius_fraction - float - - flame_radius_fraction - - - - thrust_collimation - float - - thrust_collimation - - - - thrust_density - float - - thrust_density - - - - base_flame_density - float - - base_flame_density - - - - shock_frequency - float - - shock_frequency - - - - noise_strength - float - - noise_strength - - - - noise_scale - float - - noise_scale - - - - random_seed - float - - random_seed - - - - flame_color_low_r - float - - flame_color_low_r - - - - flame_color_low_g - float - - flame_color_low_g - - - - flame_color_low_b - float - - flame_color_low_b - - - - flame_color_high_r - float - - flame_color_high_r - - - - flame_color_high_g - float - - flame_color_high_g - - - - flame_color_high_b - float - - flame_color_high_b - - - - base_flame_r - float - - base_flame_r - - - - base_flame_g - float - - base_flame_g - - - - base_flame_b - float - - base_flame_b - - - - deflection_coeff - float - - deflection_coeff - - - - use_shocks - int - - use_shocks - - - - use_noise - int - - use_noise - - - - texture - sampler-2d - 0 - - - colorMode - int - - material/color-mode-uniform - - - - - diff --git a/Compositor/Effects/transition-base-dirt.eff b/Compositor/Effects/transition-base-dirt.eff deleted file mode 100644 index 419250c9b..000000000 --- a/Compositor/Effects/transition-base-dirt.eff +++ /dev/null @@ -1,17 +0,0 @@ - - - Effects/transition-base-dirt - Effects/transition - - - Textures/Terrain/dirt3.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 1.0 - 0.0 - - diff --git a/Compositor/Effects/transition-base-grass-inverse.eff b/Compositor/Effects/transition-base-grass-inverse.eff deleted file mode 100644 index 4d8e1b05f..000000000 --- a/Compositor/Effects/transition-base-grass-inverse.eff +++ /dev/null @@ -1,17 +0,0 @@ - - - Effects/transition-base-rock - Effects/transition - - - Textures/Terrain/herbtundra.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 1.0 - 1.0 - - diff --git a/Compositor/Effects/transition-base-grass-rock.eff b/Compositor/Effects/transition-base-grass-rock.eff deleted file mode 100644 index dde692705..000000000 --- a/Compositor/Effects/transition-base-grass-rock.eff +++ /dev/null @@ -1,33 +0,0 @@ - - - Effects/transition-base-grass-rock - Effects/transition - - - Textures/Terrain/grass10c.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/rock7.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain.winter/mixedforest1c.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 2.0 - 0.0 - - diff --git a/Compositor/Effects/transition-base-rock.eff b/Compositor/Effects/transition-base-rock.eff deleted file mode 100644 index 34651b2eb..000000000 --- a/Compositor/Effects/transition-base-rock.eff +++ /dev/null @@ -1,17 +0,0 @@ - - - Effects/transition-base-rock - Effects/transition - - - Textures/Terrain/rock7.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 1.0 - 0.0 - - diff --git a/Compositor/Effects/transition.eff b/Compositor/Effects/transition.eff deleted file mode 100644 index d1619bd72..000000000 --- a/Compositor/Effects/transition.eff +++ /dev/null @@ -1,373 +0,0 @@ - - - - Effects/transition - Effects/terrain-default - - - Textures/Terrain/transition1.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/transition2.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/snow3.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - /environment/rain-norm - - - /environment/snow-level-m - - - /environment/clouds/layer[0]/coverage-type - - - /environment/clouds/layer[1]/coverage-type - - - /environment/clouds/layer[2]/coverage-type - - - /environment/clouds/layer[3]/coverage-type - - - /environment/clouds/layer[4]/coverage-type - - 2.0 - 0.0 - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/terminator-relative-position-m - - - /sim/rendering/shaders/skydome - - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/transition - - 0.0 - /sim/rendering/rembrandt/enabled - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - - texture[2]/type - - - texture[2]/image - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 2 - - texture[3]/type - - - texture[3]/image - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - 3 - - texture[4]/type - - - texture[4]/image - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 4 - noise - - - - Shaders/Default/transition.vert - Shaders/Default/include_fog.frag - Shaders/Default/transition.frag - - - BaseTex - sampler-2d - 0 - - - SecondTex - sampler-2d - 1 - - - ThirdTex - sampler-2d - 2 - - - SnowTex - sampler-2d - 3 - - - NoiseTex - sampler-3d - 4 - - - RainNorm - float - - rain-norm - - - - SnowLevel - float - - snow-level - - - - Transitions - float - - transitions - - - - InverseSlope - float - - inverse - - - - CloudCover0 - float - - cloud-cover0 - - - - CloudCover1 - float - - cloud-cover1 - - - - CloudCover2 - float - - cloud-cover2 - - - - CloudCover3 - float - - cloud-cover3 - - - - CloudCover4 - float - - cloud-cover4 - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - diff --git a/Compositor/Effects/tree-european-deciduous.eff b/Compositor/Effects/tree-european-deciduous.eff deleted file mode 100644 index 1163749d8..000000000 --- a/Compositor/Effects/tree-european-deciduous.eff +++ /dev/null @@ -1,8 +0,0 @@ - - - Effects/tree-european-deciduous - Effects/tree - - 8 - - diff --git a/Compositor/Effects/tree-european-mixed.eff b/Compositor/Effects/tree-european-mixed.eff deleted file mode 100644 index 5204bef21..000000000 --- a/Compositor/Effects/tree-european-mixed.eff +++ /dev/null @@ -1,8 +0,0 @@ - - - Effects/tree-european-mixed - Effects/tree - - 4 - - diff --git a/Compositor/Effects/tree-forest.eff b/Compositor/Effects/tree-forest.eff deleted file mode 100644 index 92645ea2b..000000000 --- a/Compositor/Effects/tree-forest.eff +++ /dev/null @@ -1,10 +0,0 @@ - - - Effects/tree-forest - Effects/tree - - true - true - true - - diff --git a/Compositor/Effects/tree-grass.eff b/Compositor/Effects/tree-grass.eff deleted file mode 100644 index 761b32167..000000000 --- a/Compositor/Effects/tree-grass.eff +++ /dev/null @@ -1,9 +0,0 @@ - - - Effects/tree-grass - Effects/tree - - false - false - - diff --git a/Compositor/Effects/tree.eff b/Compositor/Effects/tree.eff deleted file mode 100644 index 8b8451ebe..000000000 --- a/Compositor/Effects/tree.eff +++ /dev/null @@ -1,2558 +0,0 @@ - - - - - Effects/tree - - - - - 0 - 200.0 - 1.5 - true - true - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/surface/scattering - - - /environment/terminator-relative-position-m - - - /sim/rendering/shaders/skydome - - - /environment/mean-terrain-elevation-m - - - /rendering/scene/overcast - - - /sim/rendering/eye-altitude-m - - - /environment/snow-level-m - - - /environment/tree-season - - - /environment/season - - - /environment/surface/dust-cover-factor - - - /sim/rendering/shaders/skydome - - - /environment/fog-structure - - - /environment/air-pollution-norm - - - /environment/cloud-self-shading - - - /sim/rendering/shaders/landmass - - - /sim/rendering/shaders/transition - - - /sim/rendering/shaders/wind-effects - - - /sim/rendering/shaders/forest - - - /environment/sea/surface/wind-from-east-fps - - - /environment/sea/surface/wind-from-north-fps - - - /sim/startup/xsize - - - /sim/startup/ysize - - - /sim/current-view/pitch-offset-deg - - - /sim/current-view/heading-offset-deg - - - /sim/current-view/field-of-view - - - /sim/rendering/als-secondary-lights/use-searchlight - - - /sim/rendering/als-secondary-lights/use-landing-light - - - /sim/rendering/als-secondary-lights/use-alt-landing-light - - - /sim/rendering/als-secondary-lights/landing-light1-offset-deg - - - /sim/rendering/als-secondary-lights/landing-light2-offset-deg - - - /sim/rendering/als-secondary-lights/landing-light3-offset-deg - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /sim/rendering/als-filters/grey-factor - - - /sim/rendering/als-filters/black-factor - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /environment/surface/delta-T-vegetation - - - /sim/rendering/random-vegetation-optimize - - false - - /local-weather/cloud-shadows/cloudpos-x[0] - - - /local-weather/cloud-shadows/cloudpos-y[0] - - - /local-weather/cloud-shadows/cloudpos-x[1] - - - /local-weather/cloud-shadows/cloudpos-y[1] - - - /local-weather/cloud-shadows/cloudpos-x[2] - - - /local-weather/cloud-shadows/cloudpos-y[2] - - - /local-weather/cloud-shadows/cloudpos-x[3] - - - /local-weather/cloud-shadows/cloudpos-y[3] - - - /local-weather/cloud-shadows/cloudpos-x[4] - - - /local-weather/cloud-shadows/cloudpos-y[4] - - - /local-weather/cloud-shadows/cloudpos-x[5] - - - /local-weather/cloud-shadows/cloudpos-y[5] - - - /local-weather/cloud-shadows/cloudpos-x[6] - - - /local-weather/cloud-shadows/cloudpos-y[6] - - - /local-weather/cloud-shadows/cloudpos-x[7] - - - /local-weather/cloud-shadows/cloudpos-y[7] - - - /local-weather/cloud-shadows/cloudpos-x[8] - - - /local-weather/cloud-shadows/cloudpos-y[8] - - - /local-weather/cloud-shadows/cloudpos-x[9] - - - /local-weather/cloud-shadows/cloudpos-y[9] - - - /local-weather/cloud-shadows/cloudpos-x[10] - - - /local-weather/cloud-shadows/cloudpos-y[10] - - - /local-weather/cloud-shadows/cloudpos-x[11] - - - /local-weather/cloud-shadows/cloudpos-y[11] - - - /local-weather/cloud-shadows/cloudpos-x[12] - - - /local-weather/cloud-shadows/cloudpos-y[12] - - - /local-weather/cloud-shadows/cloudpos-x[13] - - - /local-weather/cloud-shadows/cloudpos-y[13] - - - /local-weather/cloud-shadows/cloudpos-x[14] - - - /local-weather/cloud-shadows/cloudpos-y[14] - - - /local-weather/cloud-shadows/cloudpos-x[15] - - - /local-weather/cloud-shadows/cloudpos-y[15] - - - /local-weather/cloud-shadows/cloudpos-x[16] - - - /local-weather/cloud-shadows/cloudpos-y[16] - - - /local-weather/cloud-shadows/cloudpos-x[17] - - - /local-weather/cloud-shadows/cloudpos-y[17] - - - /local-weather/cloud-shadows/cloudpos-x[18] - - - /local-weather/cloud-shadows/cloudpos-y[18] - - - /local-weather/cloud-shadows/cloudpos-x[19] - - - /local-weather/cloud-shadows/cloudpos-y[19] - - - /local-weather/cloud-shadows/cloud-shadow-flag - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/random-vegetation - - 1.0 - - - - - - true - - 1.0 1.0 1.0 1.0 - 1.0 1.0 1.0 1.0 - off - - - gequal - 0.33 - - - 0 - 2d - - texture[0]/image - - clamp - clamp - - - - Shaders/Default/tree.vert - Shaders/Default/include_fog.frag - Shaders/Default/tree.frag - - - baseTexture - sampler-2d - 0 - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - season - float - - season - - - - - - true - - 1.0 1.0 1.0 1.0 - 1.0 1.0 1.0 1.0 - off - - - 2 - RenderBin - - - less - 0.33 - - - src-alpha - one-minus-src-alpha - - - false - - - 0 - 2d - - texture[0]/image - - clamp - clamp - - - - Shaders/Default/tree.vert - Shaders/Default/include_fog.frag - Shaders/Default/tree.frag - - - baseTexture - sampler-2d - 0 - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - season - float - - season - - - - - - - - /sim/rendering/random-vegetation - /sim/rendering/multi-sample-buffers - - 1.0 - /sim/rendering/multi-samples - - GL_ARB_multisample - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - 1.0 - - - - - - true - - 1.0 1.0 1.0 1.0 - 1.0 1.0 1.0 1.0 - off - - true - - 0 - 2d - - texture[0]/image - - clamp - clamp - - - - Shaders/Default/tree.vert - Shaders/Default/include_fog.frag - Shaders/Default/tree.frag - - - baseTexture - sampler-2d - 0 - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - season - float - - season - - - - - - - als-lighting - - - /sim/rendering/random-vegetation - /sim/rendering/multi-sample-buffers - /sim/rendering/random-vegetation-shadows - - 1.0 - /sim/rendering/multi-samples - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - GL_ARB_multisample - - 2.0 - - - - - - true - - 1.0 1.0 1.0 1.0 - 1.0 1.0 1.0 1.0 - off - - - 0 - 2d - - texture[0]/image - - clamp - clamp - - true - - Shaders/ALS/tree-shadow.vert - Shaders/ALS/noise.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/tree-shadow.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/hazes.frag - Shaders/ALS/filters.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - cloud_self_shading - float - - cloud_self_shading - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - dust_cover_factor - float - - dust_cover_factor - - - - snow_level - float - - snow_level - - - - season - float - - season - - - - cseason - float - - cseason - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - air_pollution - float - - air_pollution - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - num_deciduous_trees - int - - num_deciduous_trees - - - - use_forest_effect - bool - - use_forest_effect - - - - use_tree_shadows - bool - - use_tree_shadows - - - - use_optimization - bool - - use_optimization - - - - tree_patches - bool - - tree_patches - - - - forest_effect_size - float - - forest_effect_size - - - - forest_effect_shape - float - - forest_effect_shape - - - - texture - sampler-2d - 0 - - - colorMode - int - 2 - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - wind_effects - int - - wind_effects - - - - forest_effects - int - - forest_effects - - - - - - als-lighting - - - /sim/rendering/random-vegetation - /sim/rendering/multi-sample-buffers - - 1.0 - /sim/rendering/multi-samples - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - GL_ARB_multisample - - - - true - - 1.0 1.0 1.0 1.0 - 1.0 1.0 1.0 1.0 - off - - - 0 - 2d - - texture[0]/image - - clamp - clamp - - true - - Shaders/ALS/tree.vert - Shaders/ALS/noise.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/tree.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/hazes.frag - Shaders/ALS/filters.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - cloud_self_shading - float - - cloud_self_shading - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - dust_cover_factor - float - - dust_cover_factor - - - - snow_level - float - - snow_level - - - - season - float - - season - - - - cseason - float - - cseason - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - air_pollution - float - - air_pollution - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - num_deciduous_trees - int - - num_deciduous_trees - - - - use_forest_effect - bool - - use_forest_effect - - - - forest_effect_size - float - - forest_effect_size - - - - forest_effect_shape - float - - forest_effect_shape - - - - texture - sampler-2d - 0 - - - colorMode - int - 2 - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - wind_effects - int - - wind_effects - - - - forest_effects - int - - forest_effects - - - - - - als-lighting - - - /sim/rendering/random-vegetation - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - 1.0 1.0 1.0 1.0 - 1.0 1.0 1.0 1.0 - off - - - 0 - 2d - - texture[0]/image - - clamp - clamp - - - gequal - 0.1 - - - Shaders/ALS/tree.vert - Shaders/ALS/noise.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/tree.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/hazes.frag - Shaders/ALS/filters.frag - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - cloud_self_shading - float - - cloud_self_shading - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - dust_cover_factor - float - - dust_cover_factor - - - - snow_level - float - - snow_level - - - - season - float - - season - - - - cseason - float - - cseason - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - air_pollution - float - - air_pollution - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - num_deciduous_trees - int - - num_deciduous_trees - - - - use_forest_effect - bool - - use_forest_effect - - - - forest_effect_size - float - - forest_effect_size - - - - forest_effect_shape - float - - forest_effect_shape - - - - texture - sampler-2d - 0 - - - colorMode - int - 2 - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - wind_effects - int - - wind_effects - - - - forest_effects - int - - forest_effects - - - - - diff --git a/Compositor/Effects/urban.eff b/Compositor/Effects/urban.eff deleted file mode 100644 index ca3deeaa1..000000000 --- a/Compositor/Effects/urban.eff +++ /dev/null @@ -1,2191 +0,0 @@ - - - Effects/urban - Effects/terrain-default - - - /environment/snow-level-m - - 0.008 - 1 1 0.50 - - /sim/rendering/random-buildings - - - /sim/rendering/osm-buildings - - - /sim/rendering/shaders/urban - - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/terminator-relative-position-m - - - /sim/rendering/shaders/skydome - - 0 - 0.4 - 0 - 1000.0 - 1.0 - - - - 15 - 6 - 7 - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/urban - - 4.0 - /sim/rendering/shaders/urban - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - GL_ATI_shader_texture_lod - - GL_ARB_shader_texture_lod - - GL_EXT_gpu_shader4 - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 2 - noise - - - 3 - - texture[2]/image - - - texture[2]/type - - nearest-mipmap-nearest - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - average - average - average - min - - - - - Shaders/Default/urban.vert - Shaders/Default/include_fog.frag - Shaders/Default/urban.frag - - tangent - 6 - - - binormal - 7 - - - normal - 15 - - - - BaseTex - sampler-2d - 0 - - - NormalTex - sampler-2d - 1 - - - NoiseTex - sampler-3d - 2 - - - QDMTex - sampler-2d - 3 - - - depth_factor - float - - depth-factor - - - - tile_size - float - - xsize - - - - night_color - float-vec3 - - night-color - - - - quality_level - float - - quality-level - - - - snowlevel - float - - snow-level - - - - max_lod_level - float - - max-lod-level - - - - random_buildings - bool - - random-buildings - - - - osm_buildings - bool - - osm-buildings - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/urban - - 1.0 - /sim/rendering/shaders/urban - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 2 - noise - - - - Shaders/Default/urban.vert - Shaders/Default/include_fog.frag - Shaders/Default/urban.frag - - tangent - 6 - - - binormal - 7 - - - normal - 15 - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - BaseTex - sampler-2d - 0 - - - NormalTex - sampler-2d - 1 - - - NoiseTex - sampler-3d - 2 - - - depth_factor - float - - depth-factor - - - - tile_size - float - - xsize - - - - night_color - float-vec3 - - night-color - - - - quality_level - float - - quality-level - - - - snowlevel - float - - snow-level - - - - - - als-lighting - - - /sim/rendering/shaders/urban - - 4.0 - /sim/rendering/shaders/urban - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - GL_ATI_shader_texture_lod - - GL_ARB_shader_texture_lod - - GL_EXT_gpu_shader4 - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 2 - - texture[2]/image - - - texture[2]/type - - nearest-mipmap-nearest - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - average - average - average - min - - - - 3 - - texture[11]/image - - - texture[11]/type - - - texture[11]/filter - - - texture[11]/wrap-s - - - texture[11]/wrap-t - - - texture[11]/internal-format - - - - 4 - - texture[13]/image - - - texture[13]/type - - - texture[13]/filter - - - texture[13]/wrap-s - - - texture[13]/wrap-t - - - texture[13]/internal-format - - - - Shaders/ALS/urban.vert - Shaders/ALS/urban.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - - tangent - 6 - - - normal - 15 - - - - BaseTex - sampler-2d - 0 - - - NormalTex - sampler-2d - 1 - - - QDMTex - sampler-2d - 2 - - - BackgroundTex - sampler-2d - 3 - - - GradientTex - sampler-2d - 4 - - - depth_factor - float - - depth-factor - - - - tile_size - float - - xsize - - - - urban_domain_size - float - - urban_domain_size - - - - urban_domain_fraction - float - - urban_domain_fraction - - - - night_color - float-vec3 - - night-color - - - - blend_bias - float - - blend_bias - - - - quality_level - float - - quality-level - - - - gquality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - urban_blend - int - - urban_blend - - - - urban_domains - int - - urban_domains - - - - snowlevel - float - - snow-level - - - - max_lod_level - float - - max-lod-level - - - - random_buildings - bool - - random-buildings - - - - osm_buildings - bool - - osm-buildings - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - snowlevel - float - - snow_level - - - - dust_cover_factor - float - - dust_cover_factor - - - - wetness - float - - wetness - - - - fogstructure - float - - fogstructure - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - air_pollution - float - - air_pollution - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - - - als-lighting - - - /sim/rendering/shaders/urban - - 1.0 - /sim/rendering/shaders/urban - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 2 - - texture[11]/image - - - texture[11]/type - - - texture[11]/filter - - - texture[11]/wrap-s - - - texture[11]/wrap-t - - - texture[11]/internal-format - - - - 3 - - texture[13]/image - - - texture[13]/type - - - texture[13]/filter - - - texture[13]/wrap-s - - - texture[13]/wrap-t - - - texture[13]/internal-format - - - - Shaders/ALS/urban.vert - Shaders/ALS/urban.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - - tangent - 6 - - - - normal - 15 - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - snowlevel - float - - snow_level - - - - dust_cover_factor - float - - dust_cover_factor - - - - wetness - float - - wetness - - - - fogstructure - float - - fogstructure - - - - air_pollution - float - - air_pollution - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - urban_domain_size - float - - urban_domain_size - - - - urban_domain_fraction - float - - urban_domain_fraction - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - use_filtering - bool - - use_filtering - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - urban_blend - int - - urban_blend - - - - urban_domains - int - - urban_domains - - - - - BaseTex - sampler-2d - 0 - - - NormalTex - sampler-2d - 1 - - - BackgroundTex - sampler-2d - 2 - - - GradientTex - sampler-2d - 3 - - - depth_factor - float - - depth-factor - - - - tile_size - float - - xsize - - - - night_color - float-vec3 - - night-color - - - - blend_bias - float - - blend_bias - - - - quality_level - float - - quality-level - - - - snowlevel - float - - snow-level - - - - cloud_self_shading - float - - cloud_self_shading - - - - moonlight - float - - moonlight - - - - random_buildings - bool - - random-buildings - - - - osm_buildings - bool - - osm-buildings - - - - - diff --git a/Compositor/Effects/water-dds.eff b/Compositor/Effects/water-dds.eff deleted file mode 100644 index c34c7ffaa..000000000 --- a/Compositor/Effects/water-dds.eff +++ /dev/null @@ -1,56 +0,0 @@ - - - Effects/water-dds - Effects/water - - - Textures/Water/water-reflection.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/waves-ver10-nm.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/water_sine_nmap.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/water-reflection-grey.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/sea_foam.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/perlin-noise-nm.dds - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 1.0 - - diff --git a/Compositor/Effects/water-inland.eff b/Compositor/Effects/water-inland.eff deleted file mode 100644 index 3db15d05d..000000000 --- a/Compositor/Effects/water-inland.eff +++ /dev/null @@ -1,2063 +0,0 @@ - - - Effects/water-inland - Effects/terrain-default - - - Textures/Water/water-reflection.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/waves-ver10-nm.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/water_sine_nmap.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/water-reflection-grey.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/sea_foam.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/perlin-noise-nm.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Globe/ocean_depth_1.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/packice-overlay.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 0.0 - - /rendering/scene/saturation - - - /environment/config/enabled - - - /rendering/scene/overcast - - - /environment/clouds/layer[0]/coverage-type - - - /environment/clouds/layer[1]/coverage-type - - - /environment/clouds/layer[2]/coverage-type - - - /environment/clouds/layer[3]/coverage-type - - - /environment/clouds/layer[4]/coverage-type - - - /environment/sea/surface/wind-from-east-fps - - - /environment/sea/surface/wind-from-north-fps - - - /environment/wave/freq - - - /environment/wave/amp - - - /environment/wave/sharp - - - /environment/wave/angle - - - /environment/wave/factor - - - /environment/wave/dangle - - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/surface/scattering - - - /environment/terminator-relative-position-m - - - /environment/mean-terrain-elevation-m - - - /rendering/scene/overcast - - - /sim/rendering/eye-altitude-m - - - /environment/cloud-self-shading - - - /environment/moonlight - - - /sim/rendering/shaders/skydome - - - /environment/fog-structure - - - /environment/air-pollution-norm - - - /environment/sea/surface/ice-cover - - - /sim/rendering/shaders/landmass - - - - /environment/aircraft-effects/wash-x - - - /environment/aircraft-effects/wash-y - - - /environment/aircraft-effects/wash-strength - - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /environment/surface/delta-T-water - - - - /local-weather/cloud-shadows/cloudpos-x[0] - - - /local-weather/cloud-shadows/cloudpos-y[0] - - - /local-weather/cloud-shadows/cloudpos-x[1] - - - /local-weather/cloud-shadows/cloudpos-y[1] - - - /local-weather/cloud-shadows/cloudpos-x[2] - - - /local-weather/cloud-shadows/cloudpos-y[2] - - - /local-weather/cloud-shadows/cloudpos-x[3] - - - /local-weather/cloud-shadows/cloudpos-y[3] - - - /local-weather/cloud-shadows/cloudpos-x[4] - - - /local-weather/cloud-shadows/cloudpos-y[4] - - - /local-weather/cloud-shadows/cloudpos-x[5] - - - /local-weather/cloud-shadows/cloudpos-y[5] - - - /local-weather/cloud-shadows/cloudpos-x[6] - - - /local-weather/cloud-shadows/cloudpos-y[6] - - - /local-weather/cloud-shadows/cloudpos-x[7] - - - /local-weather/cloud-shadows/cloudpos-y[7] - - - /local-weather/cloud-shadows/cloudpos-x[8] - - - /local-weather/cloud-shadows/cloudpos-y[8] - - - /local-weather/cloud-shadows/cloudpos-x[9] - - - /local-weather/cloud-shadows/cloudpos-y[9] - - - /local-weather/cloud-shadows/cloudpos-x[10] - - - /local-weather/cloud-shadows/cloudpos-y[10] - - - /local-weather/cloud-shadows/cloudpos-x[11] - - - /local-weather/cloud-shadows/cloudpos-y[11] - - - /local-weather/cloud-shadows/cloudpos-x[12] - - - /local-weather/cloud-shadows/cloudpos-y[12] - - - /local-weather/cloud-shadows/cloudpos-x[13] - - - /local-weather/cloud-shadows/cloudpos-y[13] - - - /local-weather/cloud-shadows/cloudpos-x[14] - - - /local-weather/cloud-shadows/cloudpos-y[14] - - - /local-weather/cloud-shadows/cloudpos-x[15] - - - /local-weather/cloud-shadows/cloudpos-y[15] - - - /local-weather/cloud-shadows/cloudpos-x[16] - - - /local-weather/cloud-shadows/cloudpos-y[16] - - - /local-weather/cloud-shadows/cloudpos-x[17] - - - /local-weather/cloud-shadows/cloudpos-y[17] - - - /local-weather/cloud-shadows/cloudpos-x[18] - - - /local-weather/cloud-shadows/cloudpos-y[18] - - - /local-weather/cloud-shadows/cloudpos-x[19] - - - /local-weather/cloud-shadows/cloudpos-y[19] - - - /local-weather/cloud-shadows/cloud-shadow-flag - - - - /environment/sea/color_r - - - /environment/sea/color_g - - - /environment/sea/color_b - - - - - 6 - 7 - - - - - /sim/rendering/shaders/water - - 2.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - Shaders/Default/water.vert - Shaders/Default/include_fog.frag - Shaders/Default/water.frag - - - water_reflection - sampler-2d - 0 - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - water_reflection_grey - sampler-2d - 4 - - - sea_foam - sampler-2d - 5 - - - perlin_normalmap - sampler-2d - 6 - - - - normalmap_dds - float - - normalmap_dds - - - - saturation - float - - saturation - - - - CloudCover0 - float - - cloud-cover[0] - - - - CloudCover1 - float - - cloud-cover[1] - - - - CloudCover2 - float - - cloud-cover[2] - - - - CloudCover3 - float - - cloud-cover[3] - - - - CloudCover4 - float - - cloud-cover[4] - - - - Status - int - - status - - - - Overcast - float - - overcast - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - WaveFreq - float - - WaveFreq - - - - WaveAmp - float - - WaveAmp - - - - WaveSharp - float - - WaveSharp - - - - WaveAngle - float - - WaveAngle - - - - WaveFactor - float - - WaveFactor - - - - WaveDAngle - float - - WaveDAngle - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - - als-lighting - - - - 5.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - 4 - - texture[7]/image - - - texture[7]/type - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - texture[7]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - 7 - - texture[10]/image - - - texture[10]/type - - - texture[10]/filter - - - texture[10]/wrap-s - - - texture[10]/wrap-t - - - texture[10]/internal-format - - - - Shaders/ALS/water.vert - Shaders/ALS/water-high.frag - Shaders/ALS/noise.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - topo_map - sampler-2d - 4 - - - sea_foam - sampler-2d - 5 - - - perlin_normalmap - sampler-2d - 6 - - - ice_texture - sampler-2d - 7 - - - - normalmap_dds - float - - normalmap_dds - - - - saturation - float - - - saturation - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - wash_x - float - - wash-x - - - - wash_y - float - - wash-y - - - - wash_strength - float - - wash-strength - - - - WaveFreq - float - - WaveFreq - - - - WaveAmp - float - - WaveAmp - - - - WaveSharp - float - - WaveSharp - - - - WaveAngle - float - - WaveAngle - - - - WaveFactor - float - - WaveFactor - - - - WaveDAngle - float - - WaveDAngle - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - fogstructure - float - - fogstructure - - - - air_pollution - float - - air_pollution - - - - ice_cover - float - - ice_cover - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - - sea_r - float - - sea_r - - - - sea_g - float - - sea_g - - - - sea_b - float - - sea_b - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - ocean_flag - int - 0 - - - - - - als-lighting - - - - 4.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - Shaders/ALS/water.vert - Shaders/ALS/water-base.frag - Shaders/ALS/hazes.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - sea_foam - sampler-2d - 5 - - - perlin_normalmap - sampler-2d - 6 - - - - normalmap_dds - float - - normalmap_dds - - - - saturation - float - - - saturation - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - WaveFreq - float - - WaveFreq - - - - WaveAmp - float - - WaveAmp - - - - WaveSharp - float - - WaveSharp - - - - WaveAngle - float - - WaveAngle - - - - WaveFactor - float - - WaveFactor - - - - WaveDAngle - float - - WaveDAngle - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - sea_r - float - - sea_r - - - - sea_g - float - - sea_g - - - - sea_b - float - - sea_b - - - - ocean_flag - int - 0 - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - - diff --git a/Compositor/Effects/water.eff b/Compositor/Effects/water.eff deleted file mode 100644 index 01f111e95..000000000 --- a/Compositor/Effects/water.eff +++ /dev/null @@ -1,2504 +0,0 @@ - - - Effects/water - Effects/terrain-default - - - Textures/Water/water-reflection.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/waves-ver10-nm.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/water_sine_nmap.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/water-reflection-grey.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/sea_foam.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Water/perlin-noise-nm.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Globe/ocean_depth_1.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - - Textures/Terrain/packice-overlay.png - 2d - linear-mipmap-linear - repeat - repeat - normalized - - 0.0 - - /rendering/scene/saturation - - - /environment/config/enabled - - - /rendering/scene/overcast - - - /environment/clouds/layer[0]/coverage-type - - - /environment/clouds/layer[1]/coverage-type - - - /environment/clouds/layer[2]/coverage-type - - - /environment/clouds/layer[3]/coverage-type - - - /environment/clouds/layer[4]/coverage-type - - - /environment/sea/surface/wind-from-east-fps - - - /environment/sea/surface/wind-from-north-fps - - - /environment/wave/freq - - - /environment/wave/amp - - - /environment/wave/sharp - - - /environment/wave/angle - - - /environment/wave/factor - - - /environment/wave/dangle - - - - /environment/ground-visibility-m - - - /environment/visibility-m - - - /environment/ground-haze-thickness-m - - - /rendering/scene/scattering - - - /environment/surface/scattering - - - /environment/terminator-relative-position-m - - - /environment/mean-terrain-elevation-m - - - /rendering/scene/overcast - - - /sim/rendering/eye-altitude-m - - - /environment/cloud-self-shading - - - /environment/moonlight - - - /sim/rendering/shaders/skydome - - - /environment/fog-structure - - - /environment/air-pollution-norm - - - /environment/sea/surface/ice-cover - - - /sim/rendering/shaders/landmass - - - - /environment/sea/color_r - - - /environment/sea/color_g - - - /environment/sea/color_b - - - - /environment/aircraft-effects/wash-x - - - /environment/aircraft-effects/wash-y - - - /environment/aircraft-effects/wash-strength - - - - /sim/rendering/als-filters/use-filtering - - - /sim/rendering/als-filters/gamma - - - /sim/rendering/als-filters/brightness - - - /sim/rendering/als-filters/use-night-vision - - - /sim/rendering/als-filters/use-IR-vision - - - /environment/surface/delta-T-water - - - - /local-weather/cloud-shadows/cloudpos-x[0] - - - /local-weather/cloud-shadows/cloudpos-y[0] - - - /local-weather/cloud-shadows/cloudpos-x[1] - - - /local-weather/cloud-shadows/cloudpos-y[1] - - - /local-weather/cloud-shadows/cloudpos-x[2] - - - /local-weather/cloud-shadows/cloudpos-y[2] - - - /local-weather/cloud-shadows/cloudpos-x[3] - - - /local-weather/cloud-shadows/cloudpos-y[3] - - - /local-weather/cloud-shadows/cloudpos-x[4] - - - /local-weather/cloud-shadows/cloudpos-y[4] - - - /local-weather/cloud-shadows/cloudpos-x[5] - - - /local-weather/cloud-shadows/cloudpos-y[5] - - - /local-weather/cloud-shadows/cloudpos-x[6] - - - /local-weather/cloud-shadows/cloudpos-y[6] - - - /local-weather/cloud-shadows/cloudpos-x[7] - - - /local-weather/cloud-shadows/cloudpos-y[7] - - - /local-weather/cloud-shadows/cloudpos-x[8] - - - /local-weather/cloud-shadows/cloudpos-y[8] - - - /local-weather/cloud-shadows/cloudpos-x[9] - - - /local-weather/cloud-shadows/cloudpos-y[9] - - - /local-weather/cloud-shadows/cloudpos-x[10] - - - /local-weather/cloud-shadows/cloudpos-y[10] - - - /local-weather/cloud-shadows/cloudpos-x[11] - - - /local-weather/cloud-shadows/cloudpos-y[11] - - - /local-weather/cloud-shadows/cloudpos-x[12] - - - /local-weather/cloud-shadows/cloudpos-y[12] - - - /local-weather/cloud-shadows/cloudpos-x[13] - - - /local-weather/cloud-shadows/cloudpos-y[13] - - - /local-weather/cloud-shadows/cloudpos-x[14] - - - /local-weather/cloud-shadows/cloudpos-y[14] - - - /local-weather/cloud-shadows/cloudpos-x[15] - - - /local-weather/cloud-shadows/cloudpos-y[15] - - - /local-weather/cloud-shadows/cloudpos-x[16] - - - /local-weather/cloud-shadows/cloudpos-y[16] - - - /local-weather/cloud-shadows/cloudpos-x[17] - - - /local-weather/cloud-shadows/cloudpos-y[17] - - - /local-weather/cloud-shadows/cloudpos-x[18] - - - /local-weather/cloud-shadows/cloudpos-y[18] - - - /local-weather/cloud-shadows/cloudpos-x[19] - - - /local-weather/cloud-shadows/cloudpos-y[19] - - - /local-weather/cloud-shadows/cloud-shadow-flag - - - - - 6 - 7 - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/water - - 4.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - noise - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - 7 - - texture[7]/image - - - texture[7]/type - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - texture[7]/internal-format - - - - Shaders/Default/water.vert - Shaders/Default/include_fog.frag - Shaders/Default/water_sine.frag - - - water_reflection - sampler-2d - 0 - - - Noise - sampler-3d - 1 - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - water_reflection_grey - sampler-2d - 4 - - - sea_foam - sampler-2d - 5 - - - perlin_normalmap - sampler-2d - 6 - - - topo_map - sampler-2d - 7 - - - - normalmap_dds - float - - normalmap_dds - - - - saturation - float - - - saturation - - - - CloudCover0 - float - - cloud-cover[0] - - - - CloudCover1 - float - - cloud-cover[1] - - - - CloudCover2 - float - - cloud-cover[2] - - - - CloudCover3 - float - - cloud-cover[3] - - - - CloudCover4 - float - - cloud-cover[4] - - - - - Status - int - - status - - - - - Overcast - float - - overcast - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - WaveFreq - float - - WaveFreq - - - - WaveAmp - float - - WaveAmp - - - - WaveSharp - float - - WaveSharp - - - - WaveAngle - float - - WaveAngle - - - - WaveFactor - float - - WaveFactor - - - - WaveDAngle - float - - WaveDAngle - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - rembrandt_enabled - int - - rembrandt - - - - - - - - /sim/rendering/shaders/quality-level - /sim/rendering/shaders/water - - 2.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - Shaders/Default/water.vert - Shaders/Default/include_fog.frag - Shaders/Default/water.frag - - - water_reflection - sampler-2d - 0 - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - water_reflection_grey - sampler-2d - 4 - - - sea_foam - sampler-2d - 5 - - - perlin_normalmap - sampler-2d - 6 - - - - normalmap_dds - float - - normalmap_dds - - - - saturation - float - - - saturation - - - - CloudCover0 - float - - cloud-cover[0] - - - - CloudCover1 - float - - cloud-cover[1] - - - - CloudCover2 - float - - cloud-cover[2] - - - - CloudCover3 - float - - cloud-cover[3] - - - - CloudCover4 - float - - cloud-cover[4] - - - - Status - int - - status - - - - Overcast - float - - overcast - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - - WaveFreq - float - - WaveFreq - - - - WaveAmp - float - - WaveAmp - - - - WaveSharp - float - - WaveSharp - - - - WaveAngle - float - - WaveAngle - - - - WaveFactor - float - - WaveFactor - - - - WaveDAngle - float - - WaveDAngle - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - rembrandt_enabled - int - - rembrandt - - - - - - als-lighting - - - - 5.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - 4 - - texture[7]/image - - - texture[7]/type - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - texture[7]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - 7 - - texture[10]/image - - - texture[10]/type - - - texture[10]/filter - - - texture[10]/wrap-s - - - texture[10]/wrap-t - - - texture[10]/internal-format - - - - Shaders/ALS/water.vert - Shaders/ALS/water-high.frag - Shaders/ALS/noise.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - topo_map - sampler-2d - 4 - - - sea_foam - sampler-2d - 5 - - - perlin_normalmap - sampler-2d - 6 - - - ice_texture - sampler-2d - 7 - - - - normalmap_dds - float - - normalmap_dds - - - - saturation - float - - - saturation - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - wash_x - float - - wash-x - - - - wash_y - float - - wash-y - - - - wash_strength - float - - wash-strength - - - - WaveFreq - float - - WaveFreq - - - - WaveAmp - float - - WaveAmp - - - - WaveSharp - float - - WaveSharp - - - - WaveAngle - float - - WaveAngle - - - - WaveFactor - float - - WaveFactor - - - - WaveDAngle - float - - WaveDAngle - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - fogstructure - float - - fogstructure - - - - air_pollution - float - - air_pollution - - - - ice_cover - float - - ice_cover - - - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - - sea_r - float - - sea_r - - - - sea_g - float - - sea_g - - - - sea_b - float - - sea_b - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - ocean_flag - int - 1 - - - - - - als-lighting - - - - 4.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - Shaders/ALS/water.vert - Shaders/ALS/water-base.frag - Shaders/ALS/hazes.frag - Shaders/ALS/noise.frag - Shaders/ALS/filters.frag - - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - sea_foam - sampler-2d - 5 - - - perlin_normalmap - sampler-2d - 6 - - - - normalmap_dds - float - - normalmap_dds - - - - saturation - float - - - saturation - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - WaveFreq - float - - WaveFreq - - - - WaveAmp - float - - WaveAmp - - - - WaveSharp - float - - WaveSharp - - - - WaveAngle - float - - WaveAngle - - - - WaveFactor - float - - WaveFactor - - - - WaveDAngle - float - - WaveDAngle - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - - cloud_self_shading - - - - air_pollution - float - - air_pollution - - - - - gamma - float - - gamma - - - - brightness - float - - brightness - - - - use_filtering - bool - - use_filtering - - - - use_night_vision - bool - - use_night_vision - - - - use_IR_vision - bool - - use_IR_vision - - - - delta_T - float - - delta_T - - - - fact_grey - float - - fact_grey - - - - fact_black - float - - fact_black - - - - - sea_r - float - - sea_r - - - - sea_g - float - - sea_g - - - - sea_b - float - - sea_b - - - - ocean_flag - int - 1 - - - display_xsize - int - - display_xsize - - - - display_ysize - int - - display_ysize - - - - - - diff --git a/Compositor/Shaders/ALS/3dcloud-detailed.frag b/Compositor/Shaders/ALS/3dcloud-detailed.frag deleted file mode 100644 index cd5acc42a..000000000 --- a/Compositor/Shaders/ALS/3dcloud-detailed.frag +++ /dev/null @@ -1,90 +0,0 @@ -#version 120 - -uniform float fg_Fcoef; - -uniform sampler2D baseTexture; -uniform float scattering; - -varying float fogFactor; -varying float mie_frag; -varying float mie_frag_mod; -varying float z_pos; -varying float bottom_shade; - -varying vec3 internal_pos; -varying vec3 hazeColor; - -varying float flogz; - -vec3 filter_combined (in vec3 color) ; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - if (base.a < 0.02) - discard; - - float mie_factor = 0.0; - float geo_factor = 1.0; - - float mie_sign = 1.0; - if (mie_frag < 0.0) {mie_sign = -1.0;} - - if (mie_sign > 0.0) - {mie_factor = smoothstep(0.8, 1.0, mie_frag);} - else - {mie_factor = -1.0 * (1.0 - smoothstep(-1.0, -0.8, mie_frag));} - - mie_factor *= mie_frag_mod; - - // suppress effect in cloud center - - float z_bias = 0.2 * (1.0 - smoothstep(2.0, 3.0, z_pos)); - - geo_factor *= smoothstep(-0.9 - z_bias, -0.4 - z_bias, internal_pos.x) * (1.0 -smoothstep(0.4 + z_bias, 0.9 + z_bias, internal_pos.x)); - geo_factor *= smoothstep(-0.9 - z_bias, -0.4 - z_bias, internal_pos.y) * (1.0 -smoothstep(0.4 + z_bias, 0.9 + z_bias, internal_pos.y)); - geo_factor *= smoothstep(0, 0.3, internal_pos.z) * (1.0 - smoothstep(0.5, 1.2, internal_pos.z)); - - if (mie_sign > 0.0) - { - mie_factor *=(1.0 -geo_factor); - } - - float transparency = smoothstep(0.0, 0.7, base.a); - float opacity = smoothstep(0.7, 1.0, base.a); - - float inverse_mie = 0.0; - - if ((opacity == 0.0) && (mie_sign > 0.0)) // Mie forward scattering enhancing light - {mie_factor *= (1.0 - pow(transparency, 2.0));} - else if ((opacity == 0.0) && (mie_sign < 0.0)) // Mie forward scattering reducing reflected light - { - inverse_mie = (1.0 - pow(transparency, 2.0)) * smoothstep(0.65, 0.8, scattering); - inverse_mie *= (1.0 - smoothstep(-1.0, -0.5, mie_frag)); - } - else if (mie_sign > 0.0) // bulk light absorption - {mie_factor *= - 4.0 * pow(opacity, 2.0);} - - - // darken the bulk of the away-facing cloud - - float bulk_shade_factor = (1.0 - 0.6 * geo_factor * smoothstep(0.5, 1.0, mie_frag)); - bulk_shade_factor -= 0.3 * smoothstep(0.5, 1.0, mie_frag) * (1.0 - mie_frag_mod) * (1.0 - smoothstep(0.4, 0.5, bottom_shade)); - - - float mie_enhancement = 1.0 + clamp(mie_factor, 0.0, 1.0); - mie_enhancement = mie_enhancement * bulk_shade_factor; - - vec4 finalColor = base * gl_Color; - finalColor.rgb *= mie_enhancement * (1.0 - 0.4 * inverse_mie); - finalColor.rgb = max(finalColor.rgb, gl_Color.rgb * 1.2 * bottom_shade); - - finalColor.rgb = mix(hazeColor, finalColor.rgb, fogFactor ); - finalColor.rgb = filter_combined(finalColor.rgb); - - - gl_FragColor.rgb = finalColor.rgb; - gl_FragColor.a = mix(0.0, finalColor.a, 1.0 - 0.5 * (1.0 - fogFactor)); - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} diff --git a/Compositor/Shaders/ALS/3dcloud-detailed.vert b/Compositor/Shaders/ALS/3dcloud-detailed.vert deleted file mode 100644 index 4bb01c4ad..000000000 --- a/Compositor/Shaders/ALS/3dcloud-detailed.vert +++ /dev/null @@ -1,296 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; -varying vec3 hazeColor; -varying float mie_frag; -varying float mie_frag_mod; -varying vec3 internal_pos; -varying float bottom_shade; -varying float z_pos; - -varying float flogz; - -uniform float range; // From /sim/rendering/clouds3d-vis-range -uniform float detail_range; // From /sim/rendering/clouds3d_detail-range -uniform float scattering; -uniform float terminator; -uniform float altitude; -uniform float cloud_self_shading; -uniform float visibility; -uniform float moonlight; -uniform float air_pollution; -uniform float flash; -uniform float lightning_pos_x; -uniform float lightning_pos_y; -uniform float lightning_range; - -attribute vec3 usrAttr1; -attribute vec3 usrAttr2; - -float alpha_factor = usrAttr1.r; -float shade_factor = usrAttr1.g; -float cloud_height = usrAttr1.b; -float bottom_factor = usrAttr2.r; -float middle_factor = usrAttr2.g; -float top_factor = usrAttr2.b; - -const float EarthRadius = 5800000.0; - -// light_func is a generalized logistic function fit to the light intensity as a function -// of scaled terminator position obtained from Flightgear core - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x-0.5; - - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.03;} - - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -float mie_func (in float x, in float Mie) -{ -return x + 2.0 * x * Mie * (1.0 -0.8*x) * (1.0 -0.8*x); -} - -void main(void) -{ - - - //shade_factor = shade_factor * cloud_self_shading; - //top_factor = top_factor * cloud_self_shading; - //shade_factor = min(shade_factor, top_factor); - //middle_factor = min(middle_factor, top_factor); - //bottom_factor = min(bottom_factor, top_factor); - - float intensity; - float mix_factor; - - bottom_shade = bottom_factor; - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight * scattering; - gl_TexCoord[0] = gl_MultiTexCoord0; - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - // Find a rotation matrix that rotates 1,0,0 into u. u, r and w are - // the columns of that matrix. - vec3 absu = abs(u); - vec3 r = normalize(vec3(-u.y, u.x, 0.0)); - vec3 w = cross(u, r); - - // Do the matrix multiplication by [ u r w pos]. Assume no - // scaling in the homogeneous component of pos. - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.xyz = gl_Vertex.x * u; - gl_Position.xyz += gl_Vertex.y * r; - gl_Position.xyz += gl_Vertex.z * w; - // Apply Z scaling to allow sprites to be squashed in the z-axis - gl_Position.z = gl_Position.z * gl_Color.w; - - // Now shift the sprite to the correct position in the cloud. - gl_Position.xyz += gl_Color.xyz; - - internal_pos = gl_Position.xyz/ cloud_height; - - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(vec3(gl_ModelViewMatrix * vec4(- gl_Position.x, - gl_Position.y, - gl_Position.z, 0.0)))); - - // prepare suppression of shadeward Mie terms - float n1 = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(vec3(gl_ModelViewMatrix * vec4(- gl_Color.x, - gl_Color.y, - gl_Color.z, 0.0)))); - - //z_pos = dot(normalize(-gl_LightSource[0].position.xyz), - // vec3(gl_ModelViewMatrix * vec4(- gl_Position.x, - gl_Position.y, - gl_Position.z, 0.0)))/cloud_height; - - - float mie_suppress = smoothstep(0.0, 0.3, n1); - - // Determine the position - used for fog and shading calculations - float fogCoord = length(vec3(gl_ModelViewMatrix * vec4(gl_Color.x, gl_Color.y, gl_Color.z, 1.0))); - float center_dist = length(vec3(gl_ModelViewMatrix * vec4(0.0,0.0,0.0,1.0))); - - z_pos = (fogCoord - center_dist)/cloud_height; - - if ((fogCoord > detail_range) && (fogCoord > center_dist) && (shade_factor < 0.7)) { - // More than detail_range away, so discard all sprites on opposite side of - // cloud center by shifting them beyond the view fustrum - gl_Position = vec4(0.0,0.0,10.0,1.0); - gl_FrontColor.a = 0.0; - } else { - - // Determine the shading of the vertex. We shade it based on it's position - // in the cloud relative to the sun, and it's vertical position in the cloud. - float shade = mix(shade_factor, top_factor, smoothstep(-0.3, 0.3, n)); - //if (n < 0) { - // shade = mix(top_factor, shade_factor, abs(n)); - //} - - if (gl_Position.z < 0.5 * cloud_height) { - shade = min(shade, mix(bottom_factor, middle_factor, gl_Position.z * 2.0 / cloud_height)); - } else { - shade = min(shade, mix(middle_factor, top_factor, gl_Position.z * 2.0 / cloud_height - 1.0)); - } - - //float h = gl_Position.z / cloud_height; - //if (h < 0.5) { - // shade = min(shade, mix(bottom_factor, middle_factor, smoothstep(0.0, 0.5, h))); - //} else { - // shade = min(shade, mix(middle_factor, top_factor, smoothstep(2.0 * (h - 0.5))); - // } - - // Final position of the sprite - vec3 relVector = gl_Position.xyz - ep.xyz; - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - - // Light at the final position - - // first obtain normal to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction, corrected for altitude - // the altitude correction is clamped to reasonable values, sometimes altitude isn't parsed correctly, leading - // to overbright or overdark clouds - // float vertex_alt = clamp(altitude * 0.30480 + relVector.z,1000.0,10000.0); - float vertex_alt = clamp(altitude + relVector.z, 300.0, 10000.0); - float yprime = -dot(relVector, lightHorizon); - float yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - float terminator_width = 200000.0; - float earthShade = 1.0- 0.9* smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - float earthShadeFactor = 1.0 - smoothstep(0.4, 0.5, earthShade); - - // compute the light at the position - vec4 light_diffuse; - - float lightArg = (terminator-yprime_alt)/100000.0; - - light_diffuse.b = light_func(lightArg -1.2 * air_pollution, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg -0.6 * air_pollution, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - - //light_diffuse *= cloud_self_shading; - intensity = (1.0 - (0.8 * (1.0 - earthShade))) * length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, (1.0 - smoothstep(0.5,0.9, min(scattering, cloud_self_shading) )))); - - // correct ambient light intensity and hue before sunrise - if (earthShade < 0.6) - { - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.6,earthShade ) )); - - } - - - - gl_FrontColor.rgb = intensity * shade * normalize(mix(light_diffuse.rgb, shadedFogColor, smoothstep(0.1,0.4, (1.0 - shade) ))) ; - - // lightning - vec2 lightningRelVector = relVector.xy - vec2(lightning_pos_x, lightning_pos_y); - float rCoord = length(lightningRelVector); - - vec3 flash_color = vec3 (0.43, 0.57, 1.0); - float flash_factor = flash; - - if (flash == 2) - { - flash_color = vec3 (0.8, 0.7, 0.4); - flash_factor = 1; - } - - float rn = 0.5 + 0.5 * fract(gl_Color.x); - gl_FrontColor.rgb += flash_factor * flash_color * (1.0 - smoothstep(lightning_range, 5.0 * lightning_range, rCoord)) * rn; - - - // fading of cloudlets - - if ((fogCoord > (0.9 * detail_range)) && (fogCoord > center_dist) && (shade_factor < 0.7)) { - // cloudlet is almost at the detail range, so fade it out. - gl_FrontColor.a = 1.0 - smoothstep(0.9 * detail_range, detail_range, fogCoord); - } else { - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(0.9 * range, range, fogCoord)); - } - gl_FrontColor.a = gl_FrontColor.a * (1.0 - smoothstep(visibility, 3.0* visibility, fogCoord)); - - fogFactor = exp(-fogCoord/visibility); - - // haze of ground haze shader is slightly bluish - hazeColor = light_diffuse.rgb; - hazeColor.r = hazeColor.r * 0.83; - hazeColor.g = hazeColor.g * 0.9; - hazeColor = hazeColor * scattering; - - - // Mie correction - float Mie = 0.0; - float MieFactor = dot(normalize(lightFull), normalize(relVector)); - - - mie_frag = MieFactor; - mie_frag_mod = mie_suppress * (1.0 - smoothstep(0.4, 0.6, bottom_factor)) * (1.0 - smoothstep(detail_range, 1.5 * detail_range, fogCoord)) * smoothstep(0.65, 0.8, scattering) - * smoothstep(0.7, 1.0, top_factor); - - - if (bottom_factor < 0.4) {mie_frag_mod = 0.0;} - - if (bottom_factor > 0.4) - { - MieFactor = dot(normalize(lightFull), normalize(relVector)); - Mie = 1.5 * smoothstep(0.9,1.0, MieFactor) * smoothstep(0.6, 0.8, bottom_factor) * (1.0-earthShadeFactor) ; - //if (MieFactor < 0.0) {Mie = - Mie;} - } - //else {Mie = 0.0;} - - if (Mie > 0.0) - { - hazeColor.r = mie_func(hazeColor.r, Mie); - hazeColor.g = mie_func(hazeColor.g, 0.8* Mie); - hazeColor.b = mie_func(hazeColor.b, 0.5* Mie); - - gl_FrontColor.r = mie_func(gl_FrontColor.r, Mie); - gl_FrontColor.g = mie_func(gl_FrontColor.g, 0.8* Mie); - gl_FrontColor.b = mie_func(gl_FrontColor.b, 0.5*Mie); - } - else if (MieFactor < 0.0) - { - float thickness_reduction = smoothstep(0.4, 0.8, bottom_factor) ; - float light_reduction = dot (lightFull, lightHorizon); - light_reduction *= light_reduction; - - float factor_b = 0.8 + 0.2 * (1.0 - smoothstep(0.0, 0.7, -MieFactor) * thickness_reduction * light_reduction) ; - float factor_r = 0.6 + 0.4 * (1.0 - smoothstep(0.0, 0.7, -MieFactor) * thickness_reduction * light_reduction) ; - float factor_g = 0.65 + 0.35 * (1.0 - smoothstep(0.0, 0.7, -MieFactor) * thickness_reduction * light_reduction) ; - hazeColor.r *= factor_r; - hazeColor.g *= factor_g; - hazeColor.b *= factor_b; - - gl_FrontColor.r *= factor_r; - gl_FrontColor.g *= factor_g; - gl_FrontColor.b *= factor_b; - } - - gl_FrontColor.rgb = gl_FrontColor.rgb + moonLightColor * earthShadeFactor; - hazeColor.rgb = hazeColor.rgb + moonLightColor * earthShadeFactor; - gl_FrontColor.a = gl_FrontColor.a * alpha_factor; - gl_BackColor = gl_FrontColor; - } -} diff --git a/Compositor/Shaders/ALS/3dcloud.frag b/Compositor/Shaders/ALS/3dcloud.frag deleted file mode 100644 index ca3ff1e01..000000000 --- a/Compositor/Shaders/ALS/3dcloud.frag +++ /dev/null @@ -1,30 +0,0 @@ -#version 120 - -uniform float fg_Fcoef; - -uniform sampler2D baseTexture; -varying float fogFactor; - -varying vec3 hazeColor; - -varying float flogz; - -vec3 filter_combined (in vec3 color) ; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - if (base.a < 0.02) - discard; - - vec4 finalColor = base * gl_Color; - - finalColor.rgb = mix(hazeColor, finalColor.rgb, fogFactor ); - finalColor.rgb = filter_combined(finalColor.rgb); - - gl_FragColor.rgb = finalColor.rgb; - gl_FragColor.a = mix(0.0, finalColor.a, 1.0 - 0.5 * (1.0 - fogFactor)); - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} - diff --git a/Compositor/Shaders/ALS/3dcloud.vert b/Compositor/Shaders/ALS/3dcloud.vert deleted file mode 100644 index 1a7829f19..000000000 --- a/Compositor/Shaders/ALS/3dcloud.vert +++ /dev/null @@ -1,271 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; -varying vec3 hazeColor; - -varying float flogz; - -uniform float range; // From /sim/rendering/clouds3d-vis-range -uniform float detail_range; // From /sim/rendering/clouds3d_detail-range -uniform float scattering; -uniform float terminator; -uniform float altitude; -uniform float cloud_self_shading; -uniform float visibility; -uniform float moonlight; -uniform float air_pollution; -uniform float flash; -uniform float lightning_pos_x; -uniform float lightning_pos_y; -uniform float lightning_range; - -attribute vec3 usrAttr1; -attribute vec3 usrAttr2; - -float alpha_factor = usrAttr1.r; -float shade_factor = usrAttr1.g; -float cloud_height = usrAttr1.b; -float bottom_factor = usrAttr2.r; -float middle_factor = usrAttr2.g; -float top_factor = usrAttr2.b; - -const float EarthRadius = 5800000.0; - -vec3 moonlight_perception (in vec3 light); - -// light_func is a generalized logistic function fit to the light intensity as a function -// of scaled terminator position obtained from Flightgear core - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x-0.5; - - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.03;} - - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -float mie_func (in float x, in float Mie) -{ -return x + 2.0 * x * Mie * (1.0 -0.8*x) * (1.0 -0.8*x); -} - -void main(void) -{ - - - //shade_factor = shade_factor * cloud_self_shading; - //top_factor = top_factor * cloud_self_shading; - //shade_factor = min(shade_factor, top_factor); - //middle_factor = min(middle_factor, top_factor); - //bottom_factor = min(bottom_factor, top_factor); - - float intensity; - float mix_factor; - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight * scattering; - moonLightColor = moonlight_perception (moonLightColor); - - gl_TexCoord[0] = gl_MultiTexCoord0; - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - // Find a rotation matrix that rotates 1,0,0 into u. u, r and w are - // the columns of that matrix. - vec3 absu = abs(u); - vec3 r = normalize(vec3(-u.y, u.x, 0.0)); - vec3 w = cross(u, r); - - // Do the matrix multiplication by [ u r w pos]. Assume no - // scaling in the homogeneous component of pos. - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.xyz = gl_Vertex.x * u; - gl_Position.xyz += gl_Vertex.y * r; - gl_Position.xyz += gl_Vertex.z * w; - // Apply Z scaling to allow sprites to be squashed in the z-axis - gl_Position.z = gl_Position.z * gl_Color.w; - - // Now shift the sprite to the correct position in the cloud. - gl_Position.xyz += gl_Color.xyz; - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(vec3(gl_ModelViewMatrix * vec4(- gl_Position.x, - gl_Position.y, - gl_Position.z, 0.0)))); - - // Determine the position - used for fog and shading calculations - float fogCoord = length(vec3(gl_ModelViewMatrix * vec4(gl_Color.x, gl_Color.y, gl_Color.z, 1.0))); - float center_dist = length(vec3(gl_ModelViewMatrix * vec4(0.0,0.0,0.0,1.0))); - - if ((fogCoord > detail_range) && (fogCoord > center_dist) && (shade_factor < 0.7)) { - // More than detail_range away, so discard all sprites on opposite side of - // cloud center by shifting them beyond the view fustrum - gl_Position = vec4(0.0,0.0,10.0,1.0); - gl_FrontColor.a = 0.0; - } else { - - // Determine the shading of the vertex. We shade it based on it's position - // in the cloud relative to the sun, and it's vertical position in the cloud. - float shade = mix(shade_factor, top_factor, smoothstep(-0.3, 0.3, n)); - //if (n < 0) { - // shade = mix(top_factor, shade_factor, abs(n)); - //} - - if (gl_Position.z < 0.5 * cloud_height) { - shade = min(shade, mix(bottom_factor, middle_factor, gl_Position.z * 2.0 / cloud_height)); - } else { - shade = min(shade, mix(middle_factor, top_factor, gl_Position.z * 2.0 / cloud_height - 1.0)); - } - - //float h = gl_Position.z / cloud_height; - //if (h < 0.5) { - // shade = min(shade, mix(bottom_factor, middle_factor, smoothstep(0.0, 0.5, h))); - //} else { - // shade = min(shade, mix(middle_factor, top_factor, smoothstep(2.0 * (h - 0.5))); - // } - - // Final position of the sprite - vec3 relVector = gl_Position.xyz - ep.xyz; - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - - // Light at the final position - - // first obtain normal to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction, corrected for altitude - // the altitude correction is clamped to reasonable values, sometimes altitude isn't parsed correctly, leading - // to overbright or overdark clouds - // float vertex_alt = clamp(altitude * 0.30480 + relVector.z,1000.0,10000.0); - float vertex_alt = clamp(altitude + relVector.z, 300.0, 10000.0); - float yprime = -dot(relVector, lightHorizon); - float yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - float terminator_width = 200000.0; - float earthShade = 1.0- 0.9* smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - float earthShadeFactor = 1.0 - smoothstep(0.4, 0.5, earthShade); - - // compute the light at the position - vec4 light_diffuse; - - float lightArg = (terminator-yprime_alt)/100000.0; - - light_diffuse.b = light_func(lightArg -1.2 * air_pollution, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg -0.6 * air_pollution, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - - //light_diffuse *= cloud_self_shading; - intensity = (1.0 - (0.8 * (1.0 - earthShade))) * length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, (1.0 - smoothstep(0.5,0.9, min(scattering, cloud_self_shading) )))); - - // correct ambient light intensity and hue before sunrise - if (earthShade < 0.6) - { - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.6,earthShade ) )); - - } - - - - gl_FrontColor.rgb = intensity * shade * normalize(mix(light_diffuse.rgb, shadedFogColor, smoothstep(0.1,0.4, (1.0 - shade) ))) ; - - // lightning - vec2 lightningRelVector = relVector.xy - vec2(lightning_pos_x, lightning_pos_y); - float rCoord = length(lightningRelVector); - - vec3 flash_color = vec3 (0.43, 0.57, 1.0); - float flash_factor = flash; - - if (flash == 2) - { - flash_color = vec3 (0.8, 0.7, 0.4); - flash_factor = 1; - } - - float rn = 0.5 + 0.5 * fract(gl_Color.x); - gl_FrontColor.rgb += flash_factor * flash_color * (1.0 - smoothstep(lightning_range, 5.0 * lightning_range, rCoord)) * rn; - - - // fading of cloudlets - - if ((fogCoord > (0.9 * detail_range)) && (fogCoord > center_dist) && (shade_factor < 0.7)) { - // cloudlet is almost at the detail range, so fade it out. - gl_FrontColor.a = 1.0 - smoothstep(0.9 * detail_range, detail_range, fogCoord); - } else { - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(0.9 * range, range, fogCoord)); - } - gl_FrontColor.a = gl_FrontColor.a * (1.0 - smoothstep(visibility, 3.0* visibility, fogCoord)); - - fogFactor = exp(-fogCoord/visibility); - - // haze of ground haze shader is slightly bluish - hazeColor = light_diffuse.rgb; - hazeColor.r = hazeColor.r * 0.83; - hazeColor.g = hazeColor.g * 0.9; - hazeColor = hazeColor * scattering; - - - // Mie correction - float Mie = 0.0; - float MieFactor = 0.0; - - if (bottom_factor > 0.4) - { - MieFactor = dot(normalize(lightFull), normalize(relVector)); - Mie = 1.5 * smoothstep(0.9,1.0, MieFactor) * smoothstep(0.6, 0.8, bottom_factor) * (1.0-earthShadeFactor) ; - //if (MieFactor < 0.0) {Mie = - Mie;} - } - //else {Mie = 0.0;} - - if (Mie > 0.0) - { - hazeColor.r = mie_func(hazeColor.r, Mie); - hazeColor.g = mie_func(hazeColor.g, 0.8* Mie); - hazeColor.b = mie_func(hazeColor.b, 0.5* Mie); - - gl_FrontColor.r = mie_func(gl_FrontColor.r, Mie); - gl_FrontColor.g = mie_func(gl_FrontColor.g, 0.8* Mie); - gl_FrontColor.b = mie_func(gl_FrontColor.b, 0.5*Mie); - } - else if (MieFactor < 0.0) - { - float thickness_reduction = smoothstep(0.4, 0.8, bottom_factor) ; - float light_reduction = dot (lightFull, lightHorizon); - light_reduction *= light_reduction; - - float factor_b = 0.8 + 0.2 * (1.0 - smoothstep(0.0, 0.7, -MieFactor) * thickness_reduction * light_reduction) ; - float factor_r = 0.6 + 0.4 * (1.0 - smoothstep(0.0, 0.7, -MieFactor) * thickness_reduction * light_reduction) ; - float factor_g = 0.65 + 0.35 * (1.0 - smoothstep(0.0, 0.7, -MieFactor) * thickness_reduction * light_reduction) ; - hazeColor.r *= factor_r; - hazeColor.g *= factor_g; - hazeColor.b *= factor_b; - - gl_FrontColor.r *= factor_r; - gl_FrontColor.g *= factor_g; - gl_FrontColor.b *= factor_b; - } - - gl_FrontColor.rgb = gl_FrontColor.rgb + moonLightColor * earthShadeFactor; - hazeColor.rgb = hazeColor.rgb + moonLightColor * earthShadeFactor; - gl_FrontColor.a = gl_FrontColor.a * alpha_factor; - gl_BackColor = gl_FrontColor; - } -} diff --git a/Compositor/Shaders/ALS/agriculture.frag b/Compositor/Shaders/ALS/agriculture.frag deleted file mode 100644 index f73a235e8..000000000 --- a/Compositor/Shaders/ALS/agriculture.frag +++ /dev/null @@ -1,667 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, May 2014 -// based on ALS terrain shader -// Ambient term comes in gl_Color.rgb. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec2 rawPos; -varying vec3 worldPos; -varying vec3 ecViewdir; - - -uniform float fg_Fcoef; - -uniform sampler2D texture; -uniform sampler2D mix_texture; -uniform sampler2D grain_texture; -uniform sampler2D gradient_texture; - - -varying float steepness; -varying vec2 grad_dir; - -varying float flogz; - - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float snowlevel; -uniform float dust_cover_factor; -uniform float lichen_cover_factor; -uniform float wetness; -uniform float fogstructure; -uniform float snow_thickness_factor; -uniform float cloud_self_shading; -uniform float season; -uniform float air_pollution; -uniform float grain_strength; -uniform float intrinsic_wetness; -uniform float overlay_fraction; -uniform float overlay_scale; -uniform float rotation_scale; -uniform float distortion_factor; -uniform float uv_xoffset; -uniform float uv_yoffset; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; - -uniform float dust_resistance; -uniform float WindE; -uniform float WindN; -uniform float osg_SimulationTime; - -uniform int quality_level; -uniform int tquality_level; -uniform int wind_effects; -uniform int cloud_shadow_flag; -uniform int rotation_flag; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; - - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; -float yprime_alt; -float mie_angle; - -float shadow_func (in float x, in float y, in float noise, in float dist); -float Noise2D(in vec2 coord, in float wavelength); -float Noise3D(in vec3 coord, in float wavelength); -float VoronoiNoise2D(in vec2 coord, in float wavelength, in float xrand, in float yrand); -float SlopeLines2D(in vec2 coord, in vec2 gradDir, in float wavelength, in float steepness); -float fog_func (in float targ, in float alt); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float light_arg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 filter_combined (in vec3 color) ; - -float getShadowing(); - - -// a fade function for procedural scales which are smaller than a pixel - -float detail_fade (in float scale, in float angle, in float dist) -{ -float fade_dist = 2000.0 * scale * angle/max(pow(steepness,4.0), 0.1); - -return 1.0 - smoothstep(0.5 * fade_dist, fade_dist, dist); -} - - - - - -void main() -{ - - -yprime_alt = diffuse_term.a; -//diffuse_term.a = 1.0; -mie_angle = gl_Color.a; -float effective_scattering = min(scattering, cloud_self_shading); - -// distance to fragment -float dist = length(relPos); -// angle of view vector with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; -// float altitude of fragment above sea level -float msl_altitude = (relPos.z + eye_alt); - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - color.a = 1.0; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = normalize(normalize(lightDir) + normalize(ecViewdir)); - vec4 texel; - vec4 snow_texel; - vec4 detail_texel; - vec4 mix_texel; - vec4 grain_texel; - vec4 dot_texel; - vec4 gradient_texel; - vec4 foam_texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - - -// Wind motion of the overlay noise simulating movement of vegetation and loose debris - -vec2 windPos; - -if (wind_effects > 1) - { - float windSpeed = length(vec2 (WindE,WindN)) /3.0480; - // interfering sine wave wind pattern - float sineTerm = sin(0.35 * windSpeed * osg_SimulationTime + 0.05 * (rawPos.x + rawPos.y)); - sineTerm = sineTerm + sin(0.3 * windSpeed * osg_SimulationTime + 0.04 * (rawPos.x + rawPos.y)); - sineTerm = sineTerm + sin(0.22 * windSpeed * osg_SimulationTime + 0.05 * (rawPos.x + rawPos.y)); - sineTerm = sineTerm/3.0; - // non-linear amplification to simulate gusts - sineTerm = sineTerm * sineTerm;//smoothstep(0.2, 1.0, sineTerm); - - // wind starts moving dust and leaves at around 8 m/s - float timeArg = 0.01 * osg_SimulationTime * windSpeed * smoothstep(8.0, 15.0, windSpeed); - timeArg = timeArg + 0.02 * sineTerm; - - windPos = vec2 (rawPos.x + WindN * timeArg, rawPos.y + WindE * timeArg); - } -else - { - windPos = rawPos.xy; - } - - - -// get noise at different wavelengths - -// used: 5m, 5m gradient, 10m, 10m gradient: heightmap of the closeup terrain, 10m also snow -// 50m: detail texel -// 250m: detail texel -// 500m: distortion and overlay -// 1500m: overlay, detail, dust, fog -// 2000m: overlay, detail, snow, fog - -// Perlin noise - -float noise_10m = Noise2D(rawPos.xy, 10.0); -float noise_5m = Noise2D(rawPos.xy ,5.0); -float noise_2m = Noise2D(rawPos.xy ,2.0); -float noise_1m = Noise2D(rawPos.xy ,1.0); -float noise_01m = Noise2D(windPos.xy, 0.1); - -float noisegrad_10m; -float noisegrad_5m; -float noisegrad_2m; -float noisegrad_1m; - - - -float noise_25m = Noise2D(rawPos.xy, 25.0); -float noise_50m = Noise2D(rawPos.xy, 50.0); - - -float noise_250m = Noise3D(worldPos.xyz,250.0); -float noise_500m = Noise3D(worldPos.xyz, 500.0); -float noise_1500m = Noise3D(worldPos.xyz, 1500.0); -float noise_2000m = Noise3D(worldPos.xyz, 2000.0); - -// tiling noise - -float vnoise_overlay = VoronoiNoise2D(rawPos.xy, overlay_scale, distortion_factor, distortion_factor); -float vnoise_rotation = VoronoiNoise2D(rawPos.xy, rotation_scale, distortion_factor, distortion_factor); - - - -// slope noise - -float slopenoise_50m = SlopeLines2D(rawPos, grad_dir, 50.0, steepness); -float slopenoise_100m = SlopeLines2D(rawPos, grad_dir, 100.0, steepness); - -float snownoise_25m = mix(noise_25m, slopenoise_50m, clamp(3.0*(1.0-steepness),0.0,1.0)); -float snownoise_50m = mix(noise_50m, slopenoise_100m, clamp(3.0*(1.0-steepness),0.0,1.0)); - - - -// get the texels - - float distortion_factor = 1.0; - vec2 stprime; - int flag = 1; - int mix_flag = 1; - float noise_term; - float snow_alpha; - - float angle = vnoise_rotation * 2.0 * 3.1415; - - if (rotation_flag ==2) - { - if (vnoise_rotation < 0.25) {angle = 0.5 * 3.1415926;} - else if (vnoise_rotation < 0.5) {angle = 3.1415926;} - else if (vnoise_rotation < 0.75) {angle = 1.5 * 3.1415926;} - else {angle = 0.0;} - } - - if (rotation_flag > 0) - { - stprime = vec2 (cos(angle)*gl_TexCoord[0].s + sin(angle)*gl_TexCoord[0].t, -sin(angle)*gl_TexCoord[0].s + cos(angle)*gl_TexCoord[0].t); - } - else - {stprime = gl_TexCoord[0].st;} - stprime+= vec2 (uv_xoffset, uv_yoffset); - texel = texture2D(texture, stprime); - float local_autumn_factor = texel.a; - grain_texel = texture2D(grain_texture, gl_TexCoord[0].st * 25.0); - gradient_texel = texture2D(gradient_texture, gl_TexCoord[0].st * 4.0); - - - // we need to fade procedural structures when they get smaller than a single pixel, for this we need - // to know under what angle we see the surface - - float view_angle = abs(dot(normalize(normal), normalize(ecViewdir))); - float sfactor = sqrt(2.0 * (1.0-steepness)/0.03) + abs(ct)/0.15; - - // the snow texel is generated procedurally - if (msl_altitude +500.0 > snowlevel) - { - snow_texel = vec4 (0.95, 0.95, 0.95, 1.0) * (0.9 + 0.1* noise_500m + 0.1* (1.0 - noise_10m) ); - snow_texel.r = snow_texel.r * (0.9 + 0.05 * (noise_10m + noise_5m)); - snow_texel.g = snow_texel.g * (0.9 + 0.05 * (noise_10m + noise_5m)); - snow_texel.a = 1.0; - noise_term = 0.1 * (noise_500m-0.5) ; - noise_term = noise_term + 0.2 * (snownoise_50m -0.5) * detail_fade(50.0, view_angle, 0.5*dist) ; - noise_term = noise_term + 0.2 * (snownoise_25m -0.5) * detail_fade(25.0, view_angle, 0.5*dist) ; - noise_term = noise_term + 0.3 * (noise_10m -0.5) * detail_fade(10.0, view_angle, 0.8*dist) ; - noise_term = noise_term + 0.3 * (noise_5m - 0.5) * detail_fade(5.0, view_angle, dist); - noise_term = noise_term + 0.15 * (noise_2m -0.5) * detail_fade(2.0, view_angle, dist); - noise_term = noise_term + 0.08 * (noise_1m -0.5) * detail_fade(1.0, view_angle, dist); - snow_texel.a = snow_texel.a * 0.2+0.8* smoothstep(0.2,0.8, 0.3 +noise_term + snow_thickness_factor +0.0001*(msl_altitude -snowlevel) ); - } - - // the mixture/gradient texture - mix_texel = texture2D(mix_texture, stprime * 1.3); - if (mix_texel.a <0.1) {mix_flag = 0;} - - - -// texture preparation according to detail level - -// mix in hires texture patches - -float dist_fact; -float nSum; -float mix_factor; - - // first the second texture overlay - // transition model 0: random patch overlay without any gradient information - // transition model 1: only gradient-driven transitions, no randomness - - - if (mix_flag == 1) - { - //nSum = 0.18 * (2.0 * noise_2000m + 2.0 * noise_1500m + noise_500m); - //nSum = mix(nSum, 0.5, max(0.0, 2.0 * (transition_model - 0.5))); - //nSum = nSum + 0.4 * (1.0 -smoothstep(0.9,0.95, abs(steepness)+ 0.05 * (noise_50m - 0.5))) * min(1.0, 2.0 * transition_model); - //mix_factor = smoothstep(0.5, 0.54, nSum); - if (vnoise_overlay > overlay_fraction) {mix_factor = 0.0;} else {mix_factor = 1.0;} - texel = mix(texel, mix_texel, mix_factor); - local_autumn_factor = texel.a; - } - - - - // rock for very steep gradients - - if (gradient_texel.a > 0.0) - { - texel = mix(texel, gradient_texel, 1.0 - smoothstep(0.75,0.8,abs(steepness)+ 0.00002* msl_altitude + 0.05 * (noise_50m - 0.5))); - local_autumn_factor = texel.a; - } - - - - - - - // then the grain texture overlay - - texel.rgb = mix(texel.rgb, grain_texel.rgb, grain_strength * grain_texel.a * (1.0 - mix_factor) * (1.0-smoothstep(2000.0,5000.0, dist))); - - // for really hires, add procedural noise overlay - texel.rgb = texel.rgb * (1.0 + 0.4 * (noise_01m-0.5) * detail_fade(0.1, view_angle, dist)) ; - -// autumn colors - -float autumn_factor = season * 2.0 * (1.0 - local_autumn_factor) ; - - -texel.r = min(1.0, (1.0 + 2.5 * autumn_factor) * texel.r); -texel.g = texel.g; -texel.b = max(0.0, (1.0 - 4.0 * autumn_factor) * texel.b); - - -if (local_autumn_factor < 1.0) - { - intensity = length(texel.rgb) * (1.0 - 0.5 * smoothstep(1.1,2.0,season)); - texel.rgb = intensity * normalize(mix(texel.rgb, vec3(0.23,0.17,0.08), smoothstep(1.1,2.0, season))); - } - - // slope line overlay - texel.rgb = texel.rgb * (1.0 - 0.12 * slopenoise_50m - 0.08 * slopenoise_100m); - -//const vec4 dust_color = vec4 (0.76, 0.71, 0.56, 1.0); -const vec4 dust_color = vec4 (0.76, 0.65, 0.45, 1.0); -const vec4 lichen_color = vec4 (0.17, 0.20, 0.06, 1.0); - -// mix vegetation -float gradient_factor = smoothstep(0.5, 1.0, steepness); -texel = mix(texel, lichen_color, gradient_factor * (0.4 * lichen_cover_factor + 0.8 * lichen_cover_factor * 0.5 * (noise_10m + (1.0 - noise_5m))) ); -// mix dust -texel = mix(texel, dust_color, clamp(0.5 * dust_cover_factor *dust_resistance + 3.0 * dust_cover_factor * dust_resistance *(((noise_1500m - 0.5) * 0.125)+0.125 ) - 0.03*slopenoise_100m,0.0, 1.0) ); -// mix snow -float snow_mix_factor = 0.0; -if (msl_altitude +500.0 > snowlevel) - { - snow_alpha = smoothstep(0.75, 0.85, abs(steepness)); - snow_mix_factor = snow_texel.a* smoothstep(snowlevel, snowlevel+200.0, snow_alpha * msl_altitude+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0); - texel = mix(texel, snow_texel, snow_mix_factor); - } - - - - -// get distribution of water when terrain is wet - -float combined_wetness = min(1.0, wetness + intrinsic_wetness); -float water_threshold1; -float water_threshold2; -float water_factor =0.0; - - -if ((dist < 5000.0)&& (quality_level > 3) && (combined_wetness>0.0)) - { - water_threshold1 = 1.0-0.5* combined_wetness; - water_threshold2 = 1.0 - 0.3 * combined_wetness; - water_factor = smoothstep(water_threshold1, water_threshold2 , (0.3 * (2.0 * (1.0-noise_10m) + (1.0 -noise_5m)) * (1.0 - smoothstep(2000.0, 5000.0, dist))) - 5.0 * (1.0 -steepness)); - } - -// darken wet terrain - - texel.rgb = texel.rgb * (1.0 - 0.6 * combined_wetness); - - - -// light computations - - - vec4 light_specular = gl_LightSource[0].specular; - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - //n = (2.0 * gl_Color.a - 1.0) * normal; - n = normal;//vec3 (nvec.x, nvec.y, sqrt(1.0 -pow(nvec.x,2.0) - pow(nvec.y,2.0) )); - n = normalize(n); - - NdotL = dot(n, lightDir); - - noisegrad_10m = (noise_10m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),10.0))/0.05; - noisegrad_5m = (noise_5m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),5.0))/0.05; - noisegrad_2m = (noise_2m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),2.0))/0.05; - noisegrad_1m = (noise_1m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),1.0))/0.05; - - - - NdotL = NdotL + (noisegrad_10m * detail_fade(10.0, view_angle,dist) + 0.5* noisegrad_5m * detail_fade(5.0, view_angle,dist)) * mix_factor/0.8; - NdotL = NdotL + 0.15 * noisegrad_2m * mix_factor/0.8 * detail_fade(2.0,view_angle,dist); - NdotL = NdotL + 0.1 * noisegrad_2m * detail_fade(2.0,view_angle,dist); - NdotL = NdotL + 0.05 * noisegrad_1m * detail_fade(1.0, view_angle,dist); - - if (NdotL > 0.0) { - float shadowmap = getShadowing(); - if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 0.3 * noise_250m + 0.5 * noise_500m+0.2 * noise_1500m, dist);} - color += diffuse_term * NdotL * shadowmap; - NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = ((gl_FrontMaterial.specular.rgb * 0.1 + (water_factor * vec3 (1.0, 1.0, 1.0))) - * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor)) - * shadowmap); - } - color.a = 1.0;//diffuse_term.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - color.rgb +=secondary_light * light_distance_fading(dist); - - - fragColor = color * texel + specular; - - float lightArg = (terminator-yprime_alt)/100000.0; - vec3 hazeColor = get_hazeColor(lightArg); - - - -// Rayleigh color shift due to out-scattering - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); - -// Rayleigh color shift due to in-scattering - - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - //float lightIntensity = length(diffuse_term.rgb)/1.73 * rShade; - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; - -float mvisibility = min(visibility,avisibility); - -if (dist > 0.04 * mvisibility) -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - -// blur of the haze layer edge - -float blur_thickness = 50.0; -float cphi = dot(vec3(0.0, 1.0, 0.0), relPos)/dist; -float ctlayer = delta_z/dist-0.01 + 0.02 * Noise2D(vec2(cphi,1.0),0.1) -0.01; -float ctblur = 0.035 ; - -float blur_dist; - -if (abs(delta_z) < 400.0) - { - blur_dist = dist * (1.0-smoothstep(0.0,300.0,-delta_z)) * smoothstep(-400.0,-200.0, -delta_z); - blur_dist = blur_dist * smoothstep(ctlayer-4.0*ctblur, ctlayer-ctblur, ct) * (1.0-smoothstep(ctlayer+0.5*ctblur, ctlayer+ctblur, ct)); - distance_in_layer = max(distance_in_layer, blur_dist); - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - - - -if (visibility < avisibility) - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility + 1.0 * visibility * fogstructure * 0.06 * (noise_1500m + noise_2000m -1.0) )); - - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 - effective_scattering); - - } -else - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility + 1.0 * avisibility * fogstructure * 0.06 * (noise_1500m + noise_2000m - 1.0) )); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 - effective_scattering); - } - - - -transmission = fog_func(transmission_arg, alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - -//float lightArg = (terminator-yprime_alt)/100000.0; - - - -// now dim the light for haze -eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - -// Mie-like factor - - if (lightArg < 10.0) - { - intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -intensity = length(hazeColor); - -if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColor doesn't come out correctly -{ - - - // high altitude desaturation of the haze color - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - - // blue hue of haze - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - - - // additional blue in indirect light - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - // change haze color to blue hue for strong fogging - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - - - // reduce haze intensity when looking at shaded surfaces, only in terminator region - float shadow = mix( min(1.0 + dot(n,lightDir),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); - hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - } - -// don't let the light fade out too rapidly -lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - -hazeColor.rgb *= eqColorFactor * eShade; -hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - -fragColor.rgb = mix(hazeColor + secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission); - -} - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} - diff --git a/Compositor/Shaders/ALS/airfield.frag b/Compositor/Shaders/ALS/airfield.frag deleted file mode 100644 index 168524b01..000000000 --- a/Compositor/Shaders/ALS/airfield.frag +++ /dev/null @@ -1,530 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2011, based on default.frag -// Ambient term comes in gl_Color.rgb. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec3 worldPos; -varying vec2 rawPos; -varying vec3 ecViewdir; - - -uniform float fg_Fcoef; - -uniform sampler2D texture; -uniform sampler2D overlay_texture; -uniform sampler2D grain_texture; - -varying float steepness; - -varying float flogz; - - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float snowlevel; -uniform float dust_cover_factor; -uniform float fogstructure; -uniform float cloud_self_shading; -uniform float snow_thickness_factor; -uniform float grit_alpha; -uniform float overlay_bias; -uniform float overlay_alpha; -uniform float base_layer_magnification; -uniform float overlay_layer_magnification; -uniform float grain_layer_magnification; -uniform float wetness; -uniform float air_pollution; -uniform float season; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; - -uniform int quality_level; -uniform int tquality_level; -uniform int cloud_shadow_flag; -uniform int use_overlay; -uniform int use_grain; -uniform int use_color_overlay; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - - -float alt; -float eShade; -float yprime_alt; -float mie_angle; - -float shadow_func (in float x, in float y, in float noise, in float dist); -float Noise2D(in vec2 coord, in float wavelength); -float Noise3D(in vec3 coord, in float wavelength); -float fog_func (in float targ, in float alt); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float light_arg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 filter_combined (in vec3 color) ; - -float getShadowing(); - - -float detail_fade (in float scale, in float angle, in float dist) -{ -float fade_dist = 4000.0 * scale * angle; - -return 1.0 - smoothstep(0.5 * fade_dist, fade_dist, dist); -} - - -// this determines how light is attenuated in the distance -// physically this should be exp(-arg) but for technical reasons we use a sharper cutoff -// for distance > visibility - - -void main() -{ - -//if ((gl_FragCoord.y < ylimit) && (gl_FragCoord.x > zlimit1) && (gl_FragCoord.x < zlimit2)) -// {discard;} - - -float effective_scattering = min(scattering, cloud_self_shading); -yprime_alt = diffuse_term.a; -//diffuse_term.a = 1.0; -mie_angle = gl_Color.a; - -vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - -float dist = length(relPos); -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - color.a = 1.0; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector; - if (quality_level<6) - {halfVector = gl_LightSource[0].halfVector.xyz;} - else - {halfVector = normalize(normalize(lightDir) + normalize(ecViewdir));} - vec4 texel; - vec4 overlay_texel; - vec4 grain_texel; - vec4 snow_texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - -// get noise at different wavelengths - -// used: 5m, 5m gradient, 10m, 10m gradient: heightmap of the closeup terrain, 10m also snow -// 500m: distortion and overlay -// 1500m: overlay, detail, dust, fog -// 2000m: overlay, detail, snow, fog - -float noise_01m; -float noise_1m = Noise2D(rawPos.xy, 1.0); -float noise_2m; - -float noise_10m = Noise2D(rawPos.xy, 10.0); -float noise_5m = Noise2D(rawPos.xy,5.0); - - - -float noise_50m = Noise2D(rawPos.xy, 50.0); - -float noise_1500m = Noise3D(worldPos.xyz, 1500.0); -float noise_2000m = Noise3D(worldPos.xyz, 2000.0); - - - - -// - - -// get the texels - - texel = texture2D(texture, gl_TexCoord[0].st * base_layer_magnification); - float local_autumn_factor = texel.a; - - float distortion_factor = 1.0; - float noise_term; - float snow_alpha; - - if (quality_level > 3) - { - //snow_texel = texture2D(snow_texture, gl_TexCoord[0].st); - - snow_texel = vec4 (0.95, 0.95, 0.95, 1.0) * (0.9 + 0.1* noise_50m + 0.1* (1.0 - noise_10m) ); - snow_texel.a = 1.0; - noise_term = 0.1 * (noise_50m-0.5); - - noise_term = noise_term + 0.2 * (noise_10m -0.5) * (1.0 - smoothstep(10000.0, 16000.0, dist) ) ; - noise_term = noise_term + 0.3 * (noise_5m -0.5) * (1.0 - smoothstep(1200.0 , 2000.0 , dist) ) ; - if (dist < 1000.0){ noise_term = noise_term + 0.3 * (noise_1m -0.5) * (1.0 - smoothstep(500.0 , 1000.0 , dist) );} - snow_texel.a = snow_texel.a * 0.2+0.8* smoothstep(0.2,0.8, 0.3 +noise_term + snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) ); - } - -if (use_overlay == 1) - { - overlay_texel = texture2D(overlay_texture, gl_TexCoord[0].st * overlay_layer_magnification); - - texel.rgb = mix(texel.rgb, overlay_texel.rgb, overlay_texel.a * overlay_alpha * smoothstep(0.45, 0.65, overlay_bias + (0.5 * noise_1m + 0.1 * noise_2m + 0.4 * noise_10m))); - - - } - -if (use_grain == 1) - { - grain_texel = texture2D(grain_texture, gl_TexCoord[0].st * grain_layer_magnification); - texel.rgb = mix(texel.rgb, grain_texel.rgb, grain_texel.a); - } - - - - -float dist_fact; -float nSum; -float mix_factor; -float water_factor = 0.0; -float water_threshold1; -float water_threshold2; - - -// get distribution of water when terrain is wet - -if ((dist < 3000.0)&& (quality_level > 3) && (wetness>0.0)) - { - water_threshold1 = 1.0-0.5* wetness; - water_threshold2 = 1.0 - 0.3 * wetness; - water_factor = smoothstep(water_threshold1, water_threshold2 , 0.5 * (noise_5m + (1.0 -noise_1m))) * (1.0 - smoothstep(1000.0, 3000.0, dist)); - } - - -// color and shade variation of the grass - -if (use_color_overlay == 1) - { - float nfact_1m = 3.0 * (noise_1m - 0.5) * detail_fade(1.0, abs(ct),dist);//* (1.0 - smoothstep(3000.0, 6000.0, dist/ abs(ct))); - float nfact_5m = 2.0 * (noise_5m - 0.5) * detail_fade(2.0, abs(ct),dist);; - float nfact_10m = 1.0 * (noise_10m - 0.5); - texel.rgb = texel.rgb * (0.85 + 0.1 * (nfact_1m * detail_fade(1.0, abs(ct),dist) + nfact_5m + nfact_10m) * grit_alpha); - texel.r = texel.r * (1.0 + 0.14 * smoothstep(0.5,0.7, 0.33*(2.0 * noise_10m + (1.0-noise_5m)))); - } - - -// autumn colors - -float autumn_factor = season * 2.0 * (1.0 - local_autumn_factor) ; - - -texel.r = min(1.0, (1.0 + 2.5 * autumn_factor) * texel.r); -texel.g = texel.g; -texel.b = max(0.0, (1.0 - 4.0 * autumn_factor) * texel.b); - - -if (local_autumn_factor < 1.0) - { - intensity = length(texel.rgb) * (1.0 - 0.5 * smoothstep(1.1,2.0,season)); - texel.rgb = intensity * normalize(mix(texel.rgb, vec3(0.23,0.17,0.08), smoothstep(1.1,2.0, season))); - } - -vec4 dust_color; - -if (quality_level > 3) - { - // mix dust - dust_color = vec4 (0.76, 0.71, 0.56, 1.0); - texel = mix(texel, dust_color, clamp(0.5 * dust_cover_factor + 3.0 * dust_cover_factor * (((noise_1500m - 0.5) * 0.125)+0.125 ),0.0, 1.0) ); - - // mix snow - snow_alpha = smoothstep(0.75, 0.85, abs(steepness)); - texel = mix(texel, snow_texel, snow_texel.a * smoothstep(snowlevel, snowlevel+200.0, snow_alpha * (relPos.z + eye_alt)+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0)); - } - - -// darken grass when wet - texel.rgb = texel.rgb * (1.0 - 0.6 * wetness); - - - -// light computations - - - vec4 light_specular = gl_LightSource[0].specular ; - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - //n = (2.0 * gl_Color.a - 1.0) * normal; - //n = normalize(n); - n = normal;//vec3 (nvec.x, nvec.y, sqrt(1.0 -pow(nvec.x,2.0) - pow(nvec.y,2.0) )); - n = normalize(n); - - NdotL = dot(n, lightDir); - if ((dist < 200.0) && (quality_level > 4)) - { - noise_01m = Noise2D(rawPos.xy,0.1); - NdotL = NdotL + 0.8 * (noise_01m-0.5) * grit_alpha * detail_fade(0.1, abs(ct),dist) * (1.0 - water_factor); - } - - if (NdotL > 0.0) { - float shadowmap = getShadowing(); - if (cloud_shadow_flag == 1) - {NdotL = NdotL * shadow_func(relPos.x, relPos.y, noise_1500m, dist);} - color += diffuse_term * NdotL * shadowmap; - - - - - NdotHV = max(dot(n, halfVector), 0.0); - - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = ((gl_FrontMaterial.specular.rgb + (water_factor * vec3 (1.0, 1.0, 1.0))) - * light_specular.rgb - * pow(NdotHV, (gl_FrontMaterial.shininess + 20.0 * water_factor)) - * shadowmap); - } - color.a = 1.0; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - color.rgb +=secondary_light * light_distance_fading(dist); - - fragColor = color * texel + specular; - - - float lightArg = (terminator-yprime_alt)/100000.0; - - vec3 hazeColor = get_hazeColor(lightArg); - - -// Rayleigh color shift due to out-scattering - - if ((quality_level > 5) && (tquality_level > 5)) - { - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); -// Rayleigh color shift due to in-scattering - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - } - - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; -float mvisibility = min(visibility,avisibility); - -if (dist > 0.04 * mvisibility) -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - - - -if (visibility < avisibility) - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility + 1.0 * visibility * fogstructure * 0.06 * (noise_1500m + noise_2000m -1.0) )); - - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 - effective_scattering); - - } -else - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility + 1.0 * avisibility * fogstructure * 0.06 * (noise_1500m + noise_2000m - 1.0) )); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 - effective_scattering); - } - - - -transmission = fog_func(transmission_arg, alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - - - - -// now dim the light for haze -eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - -// Mie-like factor - -if (lightArg < 10.0) - {intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -// high altitude desaturation of the haze color - -intensity = length(hazeColor); - -if (intensity>0.0) -{ - -hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - -// blue hue of haze - -hazeColor.x = hazeColor.x * 0.83; -hazeColor.y = hazeColor.y * 0.9; - - -// additional blue in indirect light -float fade_out = max(0.65 - 0.3 *overcast, 0.45); -intensity = length(hazeColor); -hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - -// change haze color to blue hue for strong fogging -hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - -// reduce haze intensity when looking at shaded surfaces, only in terminator region - -float shadow = mix( min(1.0 + dot(n,lightDir),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); -hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); -} - - -//hazeColor = clamp(hazeColor,0.0,1.0); - -// don't let the light fade out too rapidly -lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - -hazeColor.rgb *= eqColorFactor * eShade; -hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - - -fragColor.rgb = mix(hazeColor+secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission); - - - -} - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} diff --git a/Compositor/Shaders/ALS/birds.frag b/Compositor/Shaders/ALS/birds.frag deleted file mode 100644 index 4e1154e28..000000000 --- a/Compositor/Shaders/ALS/birds.frag +++ /dev/null @@ -1,212 +0,0 @@ -// -*-C++-*- -#version 120 - -uniform float fg_Fcoef; - -uniform sampler2D texture; - -uniform float color_base_r; -uniform float color_base_g; -uniform float color_base_b; - -uniform float color_alt_r; -uniform float color_alt_g; -uniform float color_alt_b; - -uniform float visibility; -uniform float avisibility; -uniform float hazeLayerAltitude; -uniform float eye_alt; -uniform float terminator; -uniform float scattering; - -uniform float osg_SimulationTime; - - -varying vec3 vertex; -varying vec3 relPos; -varying vec3 normal; - -varying float flogz; - -const float terminator_width = 200000.0; - -float Noise2D(in vec2 coord, in float wavelength); -float VoronoiNoise2D(in vec2 coord, in float wavelength, in float xrand, in float yrand); -float fog_func (in float targ, in float alt); - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - -float noise = 0.0; - - -vec3 color_base = vec3 (color_base_r, color_base_g, color_base_b); -vec3 color_alt = vec3 (color_alt_r, color_alt_g, color_alt_b); -vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - - -vec3 viewDir = normalize(relPos); - - -vec2 lookup_coords = vertex.yz; -lookup_coords.x += 0.03* osg_SimulationTime; - -float domain_size = 0.05; -float r = length(vertex); - -float domain_noise = VoronoiNoise2D(lookup_coords, domain_size, 0.0, 0.0); -domain_noise = domain_noise * (1.0- smoothstep(0.5, 1.0, r)); - -if (domain_noise < 0.9) {discard;} - - - -// fogging - -float dist = length(relPos); -float delta_z = hazeLayerAltitude - eye_alt; -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - // angle with horizon - float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - - if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,min(visibility, avisibility)) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - - - transmission_arg = (dist-distance_in_layer)/avisibility; - if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - } - - - - transmission = fog_func(transmission_arg, 0.0); - float lightArg = terminator/100000.0; - float earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, 0.0)) + 0.4; - - vec4 light_diffuse; - - - light_diffuse.b = light_func(lightArg , 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg , 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - - light_diffuse *=scattering; - - - float intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - - -vec4 domainTexel; - - -if (domain_noise > 0.9) {domainTexel = vec4 (1.0, 1.0, 1.0, 1.0);} -else {domainTexel = vec4 (0.0, 0.0, 0.0, 0.0);} - - - -vec2 coords_raw = lookup_coords/domain_size; -coords_raw += vec2(0.5,0.5); -float coord_int_x = coords_raw.x - fract(coords_raw.x) ; -float coord_int_y = coords_raw.y - fract(coords_raw.y) ; - -vec2 domain_coords = vec2 (coords_raw.x - coord_int_x, coords_raw.y - coord_int_y); - -float domain_x = coords_raw.x - coord_int_x; - -domain_coords.y = clamp(domain_coords.y, 0.05, 0.95); - -domain_coords.x *=0.25; - -float shape_select = 0.0; - -if (domain_noise > 0.975) {shape_select = 0.25;} -else if (domain_noise > 0.95) {shape_select = 0.5;} -else if (domain_noise > 0.925) {shape_select = 0.75;} - -float t_fact = fract(osg_SimulationTime); - -if (t_fact > 0.75) {shape_select +=0.75;} -else if (t_fact > 0.5) {shape_select +=0.5;} -else if (t_fact > 0.25) {shape_select +=0.25;} - - -domain_coords.x += shape_select; - -vec4 shapeTexel = texture2D(texture, domain_coords); - -color_base.rgb = mix(color_alt.rgb, color_base.rgb, length(shapeTexel.rgb)/1.73); - -if ((domain_coords.y < 0.1) || (domain_coords.y > 0.9)) {shapeTexel.a = 0.0;} -if ((domain_x < 0.1) || (domain_x > 0.9)) {shapeTexel.a = 0.0;} - -domainTexel.rgb *= color_base.rgb; - -vec4 birdTexel; -birdTexel.rgb = domainTexel.rgb * light_diffuse.rgb; -birdTexel.a = domainTexel.a * shapeTexel.a * transmission; - - -gl_FragColor = birdTexel; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} diff --git a/Compositor/Shaders/ALS/birds.vert b/Compositor/Shaders/ALS/birds.vert deleted file mode 100644 index e63c31ea5..000000000 --- a/Compositor/Shaders/ALS/birds.vert +++ /dev/null @@ -1,52 +0,0 @@ -// -*-C++-*- - -#version 120 - - - - -varying vec3 vertex; -varying vec3 relPos; -varying vec3 normal; - -varying float flogz; - -uniform float osg_SimulationTime; - -void main() -{ - -vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - vec3 absu = abs(u); - vec3 r = normalize(vec3(-u.y, u.x, 0.0)); - vec3 w = cross(u, r); - -vertex = gl_Vertex.xyz; -relPos = vertex - ep.xyz; -normal = gl_NormalMatrix * gl_Normal; - - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.xyz = gl_Vertex.x * u; - gl_Position.xyz += gl_Vertex.y * r; - gl_Position.xyz += gl_Vertex.z * w; - - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - -//vec4 offset = gl_ModelViewProjectionMatrix * vec4 (0.05* osg_SimulationTime, 0.0, 0.0, 1.0); - -//gl_Position +=offset; - -//gl_Position = ftransform(); -gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - -gl_FrontColor = vec4 (1.0,1.0,1.0,1.0); -gl_BackColor = gl_FrontColor; -} - - diff --git a/Compositor/Shaders/ALS/bowwave.frag b/Compositor/Shaders/ALS/bowwave.frag deleted file mode 100644 index 97f2e8b4f..000000000 --- a/Compositor/Shaders/ALS/bowwave.frag +++ /dev/null @@ -1,449 +0,0 @@ -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// © Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// © Emilian Huminiuc and Vivian Meazza -// Optimisation - 2012-5-05 -// © Emilian Huminiuc and Vivian Meazza -// Ported to the Atmospheric Light Scattering Framework -// by Thorsten Renk, Aug. 2013 - -#version 120 -#define fps2kts 0.5925 - -uniform float fg_Fcoef; - -uniform sampler2D water_normalmap; -uniform sampler2D water_reflection; -uniform sampler2D water_dudvmap; -uniform sampler2D water_reflection_grey; -uniform sampler2D sea_foam; -uniform sampler2D alpha_tex; -uniform sampler2D bowwave_nmap; - -uniform float saturation, Overcast, WindE, WindN, spd, hdg; -uniform float CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4; -uniform int Status; - -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float scattering; -uniform float ground_scattering; -uniform float cloud_self_shading; -uniform float eye_alt; -uniform float fogstructure; -uniform float ice_cover; -uniform float sea_r; -uniform float sea_g; -uniform float sea_b; - -uniform int quality_level; - - -varying vec4 waterTex1; //moving texcoords -varying vec4 waterTex2; //moving texcoords -varying vec3 viewerdir; -varying vec3 lightdir; -varying vec3 normal; -varying vec3 relPos; -varying float earthShade; -varying float yprime_alt; -varying float mie_angle; -varying float steepness; - -varying float flogz; - -vec3 specular_light; - -float fog_func (in float targ, in float alt); - -vec3 get_hazeColor(in float light_arg); -vec3 filter_combined (in vec3 color) ; - -const float terminator_width = 200000.0; -const float EarthRadius = 5800000.0; - - -/////// functions ///////// - -float normalize_range(float _val) - { - if (_val > 180.0) - return _val - 360.0; - else - return _val; - } - - -void relWind(out float rel_wind_speed_kts, out float rel_wind_from_rad) - { - //calculate the carrier speed north and east in kts - float speed_north_kts = cos(radians(hdg)) * spd ; - float speed_east_kts = sin(radians(hdg)) * spd ; - - //calculate the relative wind speed north and east in kts - float rel_wind_speed_from_east_kts = WindE*fps2kts + speed_east_kts; - float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts; - - //combine relative speeds north and east to get relative windspeed in kts - rel_wind_speed_kts = sqrt(rel_wind_speed_from_east_kts*rel_wind_speed_from_east_kts - + rel_wind_speed_from_north_kts*rel_wind_speed_from_north_kts); - - //calculate the relative wind direction - float rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts)); - // rel_wind_from_rad = atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts); - float rel_wind = rel_wind_from_deg - hdg; - rel_wind = normalize_range(rel_wind); - rel_wind_from_rad = radians(rel_wind); - } - -void rotationmatrix(in float angle, out mat4 rotmat) - { - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); - } - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -// this determines how light is attenuated in the distance -// physically this should be exp(-arg) but for technical reasons we use a sharper cutoff -// for distance > visibility - - - -////////////////////// - -void main(void) - { - const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005); - const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02); - const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25); - - mat4 RotationMatrix; - - float relWindspd=0; - float relWinddir=0; - - float dist = length(relPos); - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - float effective_scattering = min(scattering, cloud_self_shading); - - // compute relative wind speed and direction - relWind (relWindspd, relWinddir); - - rotationmatrix(relWinddir, RotationMatrix); - - // compute direction to viewer - vec3 E = normalize(viewerdir); - - // compute direction to light source - vec3 L = normalize(lightdir); - - // half vector - vec3 H = normalize(L + E); - - const float water_shininess = 240.0; - // approximate cloud cover - float cover = 0.0; - //bool Status = true; - - float windEffect = relWindspd; //wind speed in kt - // float windEffect = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.6; //wind speed in kt - float windScale = 15.0/(5.0 + windEffect); //wave scale - float waveRoughness = 0.05 + smoothstep(0.0, 50.0, windEffect); //wave roughness filter - - - if (Status == 1){ - cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4); - } else { - // hack to allow for Overcast not to be set by Local Weather - - if (Overcast == 0){ - cover = 5; - } else { - cover = Overcast * 5; - } - - } - - //vec4 viewt = normalize(waterTex4); - vec4 viewt = vec4(-E, 0.0) * 0.6; - - vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale * 2.0) * 2.0 - 1.0; - vec4 dist1 = texture2D(water_dudvmap, vec2(waterTex1 + disdis*sca2)* windScale * 2.0) * 2.0 - 1.0; - vec4 fdist = normalize(dist1); - fdist = -fdist; - fdist *= sca; - - //normalmap - rotationmatrix(-relWinddir, RotationMatrix); - - vec4 nmap0 = texture2D(water_normalmap, vec2((waterTex1 + disdis*sca2) * RotationMatrix ) * windScale * 2.0) * 2.0 - 1.0; - vec4 nmap2 = texture2D(water_normalmap, vec2(waterTex2 * tscale * RotationMatrix ) * windScale * 2.0) * 2.0 - 1.0; - vec4 nmap3 = texture2D(bowwave_nmap, gl_TexCoord[0].st) * 2.0 - 1.0; - vec4 vNorm = normalize(mix(nmap3, nmap0 + nmap2, 0.3 )* waveRoughness); - vNorm = -vNorm; - - //load reflection - vec4 tmp = vec4(lightdir, 0.0); - vec4 refTex = texture2D(water_reflection, vec2(tmp + waterTex1) * 32.0) ; - vec4 refTexGrey = texture2D(water_reflection_grey, vec2(tmp + waterTex1) * 32.0) ; - vec4 refl ; - // cover = 0; - - /*if(cover >= 1.5){ - refl= normalize(refTex); - } - else - { - refl = normalize(refTexGrey); - refl.r *= (0.75 + 0.15 * cover); - refl.g *= (0.80 + 0.15 * cover); - refl.b *= (0.875 + 0.125 * cover); - refl.a *= 1.0; - } - */ - - refl.r = sea_r; - refl.g = sea_g; - refl.b = sea_b; - refl.a = 1.0; - - - float intensity; - // de-saturate for reduced light - refl.rgb = mix(refl.rgb, vec3 (0.248, 0.248, 0.248), 1.0 - smoothstep(0.1, 0.8, ground_scattering)); - - // de-saturate light for overcast haze - intensity = length(refl.rgb); - refl.rgb = mix(refl.rgb, intensity * vec3 (1.0, 1.0, 1.0), 0.5 * smoothstep(0.1, 0.9, overcast)); - - vec3 N0 = vec3(texture2D(water_normalmap, vec2((waterTex1 + disdis*sca2)* RotationMatrix) * windScale * 2.0) * 2.0 - 1.0); - vec3 N1 = vec3(texture2D(water_normalmap, vec2(waterTex2 * tscale * RotationMatrix ) * windScale * 2.0) * 2.0 - 1.0); - vec3 N2 = vec3(texture2D(bowwave_nmap, gl_TexCoord[0].st)*2.0-1.0); - //vec3 Nf = normalize((normal+N0+N1)*waveRoughness); - vec3 N = normalize(mix(normal+N2, normal+N0+N1, 0.3)* waveRoughness); - N = -N; - - // specular - - specular_light = gl_Color.rgb; - - vec3 specular_color = vec3(specular_light) - * pow(max(0.0, dot(N, H)), water_shininess) * 6.0; - vec4 specular = vec4(specular_color, 0.5); - - specular = specular * saturation * 0.3; - - //calculate fresnel - vec4 invfres = vec4( dot(vNorm, viewt) ); - vec4 fres = vec4(1.0) + invfres; - refl *= fres; - - vec4 alpha0 = texture2D(alpha_tex, gl_TexCoord[0].st); - - //calculate final colour - vec4 ambient_light; - ambient_light.rgb = max(specular_light.rgb, vec3(0.1, 0.1, 0.1)); - ambient_light.a = 1.0; - vec4 finalColor; - - finalColor = refl + specular * smoothstep(0.3, 0.6, ground_scattering); - - //add foam - - float foamSlope = 0.05 + 0.01 * windScale; - //float waveSlope = mix(N0.g, N1.g, 0.25); - - vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 50.0); - float waveSlope = N.g; - - if (windEffect >= 12.0) - if (waveSlope >= foamSlope){ - finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(foamSlope, 0.5, N.g)); - } - - //generate final colour - finalColor *= ambient_light;//+ alpha0 * 0.35; - - - -float delta_z = hazeLayerAltitude - eye_alt; - - -if (dist > 40.0) -{ - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - -// angle with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,min(visibility,avisibility)) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - - -if (visibility < avisibility) - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility )); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 -effective_scattering); - } -else - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility )); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 -effective_scattering); - } - - -transmission = fog_func(transmission_arg, eye_alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - -float lightArg = (terminator-yprime_alt)/100000.0; - -vec3 hazeColor = get_hazeColor(lightArg); - - -// now dim the light for haze -float eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - - -// Mie-like factor - -if (lightArg < 10.0) - {intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -// high altitude desaturation of the haze color - -intensity = length(hazeColor); - - -if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColor doesn't come out correctly - { - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, eye_alt))); - - // blue hue of haze - - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - - - // additional blue in indirect light - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - // change haze color to blue hue for strong fogging - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - } - - - - // don't let the light fade out too rapidly - lightArg = (terminator + 200000.0)/100000.0; - float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); - vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - - hazeColor.rgb *= eqColorFactor * eShade; - hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - - finalColor.rgb = mix(hazeColor, finalColor.rgb,transmission); - - - } - - - finalColor.rgb = filter_combined(finalColor.rgb); - gl_FragColor = vec4(finalColor.rgb, alpha0.a * 1.35); - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - - } diff --git a/Compositor/Shaders/ALS/building-default.vert b/Compositor/Shaders/ALS/building-default.vert deleted file mode 100644 index 0640592a7..000000000 --- a/Compositor/Shaders/ALS/building-default.vert +++ /dev/null @@ -1,314 +0,0 @@ -// -*-C++-*- -#version 120 -#extension GL_EXT_draw_instanced : enable - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -// Haze part added by Thorsten Renk, Oct. 2011 - - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -attribute vec3 instancePosition; // (x,y,z) -attribute vec3 instanceScale; // (width, depth, height) -attribute vec3 attrib1; // Generic packed attributes -attribute vec3 attrib2; - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; - -//varying float earthShade; -//varying float yprime; -//varying float vertex_alt; -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - -uniform int colorMode; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -//uniform float scattering; -uniform float ground_scattering; - -uniform bool use_IR_vision; - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - - -float earthShade; -//float mie_angle; - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -const float c_precision = 128.0; -const float c_precisionp1 = c_precision + 1.0; - -vec3 float2vec(float value) { - vec3 val; - val.x = mod(value, c_precisionp1) / c_precision; - val.y = mod(floor(value / c_precisionp1), c_precisionp1) / c_precision; - val.z = floor(value / (c_precisionp1 * c_precisionp1)) / c_precision; - return val; -} - -void main() -{ - - vec4 light_diffuse; - vec4 light_ambient; - - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - - // Unpack generic attributes - vec3 attr1 = float2vec(attrib1.x); - vec3 attr2 = float2vec(attrib1.z); - vec3 attr3 = float2vec(attrib2.x); - - // Determine the rotation for the building. - float sr = sin(6.28 * attr1.x); - float cr = cos(6.28 * attr1.x); - - vec3 position = gl_Vertex.xyz; - // Adjust the very top of the roof to match the rooftop scaling. This shapes - // the rooftop - gambled, gabled etc. These vertices are identified by gl_Color.z - position.x = (1.0 - gl_Color.z) * position.x + gl_Color.z * ((position.x + 0.5) * attr3.z - 0.5); - position.y = (1.0 - gl_Color.z) * position.y + gl_Color.z * (position.y * attrib2.y ); - - // Adjust pitch of roof to the correct height. These vertices are identified by gl_Color.z - // Scale down by the building height (instanceScale.z) because - // immediately afterwards we will scale UP the vertex to the correct scale. - position.z = position.z + gl_Color.z * attrib1.y / instanceScale.z; - position = position * instanceScale.xyz; - - // Rotation of the building and movement into position - position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr))); - position = position + instancePosition.xyz; - - gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0); - flogz = 1.0 + gl_Position.w; - - // Texture coordinates are stored as: - // - a separate offset (x0, y0) for the wall (wtex0x, wtex0y), and roof (rtex0x, rtex0y) - // - a semi-shared (x1, y1) so that the front and side of the building can have - // different texture mappings - // - // The vertex color value selects between them: - // gl_Color.x=1 indicates front/back walls - // gl_Color.y=1 indicates roof - // gl_Color.z=1 indicates top roof vertexs (used above) - // gl_Color.a=1 indicates sides - // Finally, the roof texture is on the right of the texture sheet - float wtex0x = attr1.y; // Front/Side texture X0 - float wtex0y = attr1.z; // Front/Side texture Y0 - float rtex0x = attr2.z; // Roof texture X0 - float rtex0y = attr3.x; // Roof texture Y0 - float wtex1x = attr2.x; // Front/Roof texture X1 - float stex1x = attr3.y; // Side texture X1 - float wtex1y = attr2.y; // Front/Roof/Side texture Y1 - vec2 tex0 = vec2(sign(gl_MultiTexCoord0.x) * (gl_Color.x*wtex0x + gl_Color.y*rtex0x + gl_Color.a*wtex0x), - gl_Color.x*wtex0y + gl_Color.y*rtex0y + gl_Color.a*wtex0y); - - vec2 tex1 = vec2(gl_Color.x*wtex1x + gl_Color.y*wtex1x + gl_Color.a*stex1x, - wtex1y); - - gl_TexCoord[0].x = tex0.x + gl_MultiTexCoord0.x * tex1.x; - gl_TexCoord[0].y = tex0.y + gl_MultiTexCoord0.y * tex1.y; - - // Rotate the normal. - normal = gl_Normal; - normal.xy = vec2(dot(normal.xy, vec2(cr, sr)), dot(normal.xy, vec2(-sr, cr))); - normal = gl_NormalMatrix * normal; - - - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = vec4(1.0,1.0,1.0,1.0); - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = vec4(1.0,1.0,1.0,1.0); - ambient_color = vec4(1.0,1.0,1.0,1.0); - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - // here start computations for the haze layer - // we need several geometrical quantities - - // first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = gl_Vertex.xyz + gl_Color.xyz - ep.xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(gl_Vertex.z + gl_Color.z,100.0); - scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * scattering; - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - //light_ambient = light_ambient * (0.4 + 0.6 * smoothstep(0.2, 0.5, earthShade)); - intensity = length(light_ambient.rgb); - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) )); - - intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_diffuse = vec4 (1.0, 1.0, 1.0, 1.0); - light_ambient = vec4 (0.33, 0.4, 0.5, 1.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - light_diffuse.b = 0.78 + lightArg * 0.21; - light_diffuse.g = 0.907 + lightArg * 0.091; - light_diffuse.r = 0.904 + lightArg * 0.092; - light_diffuse.a = 1.0; - - light_ambient.r = 0.316 + lightArg * 0.016; - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - } - - light_diffuse = light_diffuse * scattering; - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - -if (use_IR_vision) - { - light_ambient.rgb = max(light_ambient.rgb, vec3 (0.5, 0.5, 0.5)); - } - - -// default lighting based on texture and material using the light we have just computed - - diffuse_term = diffuse_color* light_diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + light_ambient); - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = 1.0; - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = constant_term.rgb; - gl_BackColor.rgb = constant_term.rgb; - //gl_FrontColor.a = mie_angle; gl_BackColor.a = mie_angle; -} diff --git a/Compositor/Shaders/ALS/building-model-ultra.vert b/Compositor/Shaders/ALS/building-model-ultra.vert deleted file mode 100644 index 84e6ebe2b..000000000 --- a/Compositor/Shaders/ALS/building-model-ultra.vert +++ /dev/null @@ -1,190 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// © Emilian Huminiuc and Vivian Meazza 2011 -#version 120 - -attribute vec3 instancePosition; // (x,y,z) -attribute vec3 instanceScale ; // (width, depth, height) -attribute vec3 attrib1; // Generic packed attributes -attribute vec3 attrib2; - -varying vec3 rawpos; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 vViewVec; -varying vec3 vertVec; -varying vec3 reflVec; - -varying float flogz; - -varying float alpha; - -attribute vec3 tangent; -attribute vec3 binormal; - -uniform float pitch; -uniform float roll; -uniform float hdg; -uniform int refl_dynamic; -uniform int nmap_enabled; -uniform int shader_qual; -uniform int rembrandt_enabled; -uniform int color_is_position; - -//////Fog Include/////////// -// uniform int fogType; -// void fog_Func(int type); -//////////////////////////// - -void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat) -{ - rotmat = mat4( cosRy , sinRx * sinRy , cosRx * sinRy, 0.0, - 0.0 , cosRx , -sinRx * cosRx, 0.0, - -sinRy, sinRx * cosRy, cosRx * cosRy , 0.0, - 0.0 , 0.0 , 0.0 , 1.0 ); -} - -void rotationMatrixH(in float sinRz, in float cosRz, out mat4 rotmat) -{ - rotmat = mat4( cosRz, -sinRz, 0.0, 0.0, - sinRz, cosRz, 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); -} - -const float c_precision = 128.0; -const float c_precisionp1 = c_precision + 1.0; - -vec3 float2vec(float value) { - vec3 val; - val.x = mod(value, c_precisionp1) / c_precision; - val.y = mod(floor(value / c_precisionp1), c_precisionp1) / c_precision; - val.z = floor(value / (c_precisionp1 * c_precisionp1)) / c_precision; - return val; -} - -void main(void) -{ - // Unpack generic attributes - vec3 attr1 = float2vec(attrib1.x); - vec3 attr2 = float2vec(attrib1.z); - vec3 attr3 = float2vec(attrib2.x); - - // Determine the rotation for the building. - float sr = sin(6.28 * attr1.x); - float cr = cos(6.28 * attr1.x); - - vec3 rawpos = gl_Vertex.xyz; - // Adjust the very top of the roof to match the rooftop scaling. This shapes - // the rooftop - gambled, gabled etc. These vertices are identified by gl_Color.z - rawpos.x = (1.0 - gl_Color.z) * rawpos.x + gl_Color.z * ((rawpos.x + 0.5) * attr3.z - 0.5); - rawpos.y = (1.0 - gl_Color.z) * rawpos.y + gl_Color.z * (rawpos.y * attrib2.y ); - - // Adjust pitch of roof to the correct height. These vertices are identified by gl_Color.z - // Scale down by the building height (instanceScale.z) because - // immediately afterwards we will scale UP the vertex to the correct scale. - rawpos.z = rawpos.z + gl_Color.z * attrib1.y / instanceScale.z; - rawpos = rawpos * instanceScale.xyz; - - // Rotation of the building and movement into rawpos - rawpos.xy = vec2(dot(rawpos.xy, vec2(cr, sr)), dot(rawpos.xy, vec2(-sr, cr))); - rawpos = rawpos + instancePosition.xyz; - vec4 ecPosition = gl_ModelViewMatrix * vec4(rawpos, 1.0); - - // Texture coordinates are stored as: - // - a separate offset (x0, y0) for the wall (wtex0x, wtex0y), and roof (rtex0x, rtex0y) - // - a semi-shared (x1, y1) so that the front and side of the building can have - // different texture mappings - // - // The vertex color value selects between them: - // gl_Color.x=1 indicates front/back walls - // gl_Color.y=1 indicates roof - // gl_Color.z=1 indicates top roof vertexs (used above) - // gl_Color.a=1 indicates sides - // Finally, the roof texture is on the right of the texture sheet - float wtex0x = attr1.y; // Front/Side texture X0 - float wtex0y = attr1.z; // Front/Side texture Y0 - float rtex0x = attr2.z; // Roof texture X0 - float rtex0y = attr3.x; // Roof texture Y0 - float wtex1x = attr2.x; // Front/Roof texture X1 - float stex1x = attr3.y; // Side texture X1 - float wtex1y = attr2.y; // Front/Roof/Side texture Y1 - vec2 tex0 = vec2(sign(gl_MultiTexCoord0.x) * (gl_Color.x*wtex0x + gl_Color.y*rtex0x + gl_Color.a*wtex0x), - gl_Color.x*wtex0y + gl_Color.y*rtex0y + gl_Color.a*wtex0y); - - vec2 tex1 = vec2(gl_Color.x*wtex1x + gl_Color.y*wtex1x + gl_Color.a*stex1x, - wtex1y); - - gl_TexCoord[0].x = tex0.x + gl_MultiTexCoord0.x * tex1.x; - gl_TexCoord[0].y = tex0.y + gl_MultiTexCoord0.y * tex1.y; - - // Rotate the normal. - vec3 normal = gl_Normal; - // Rotate the normal as per the building. - normal.xy = vec2(dot(normal.xy, vec2(cr, sr)), dot(normal.xy, vec2(-sr, cr))); - - VNormal = normalize(gl_NormalMatrix * normal); - vec3 n = normalize(normal); - vec3 tempTangent = cross(n, vec3(1.0,0.0,0.0)); - vec3 tempBinormal = cross(n, tempTangent); - - if (nmap_enabled > 0){ - tempTangent = tangent; - tempBinormal = binormal; - } - - VTangent = normalize(gl_NormalMatrix * tempTangent); - VBinormal = normalize(gl_NormalMatrix * tempBinormal); - vec3 t = tempTangent; - vec3 b = tempBinormal; - - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - alpha = gl_FrontMaterial.diffuse.a; - else - alpha = 1.0; - - // Vertex in eye coordinates - vertVec = ecPosition.xyz; - vViewVec.x = dot(t, vertVec); - vViewVec.y = dot(b, vertVec); - vViewVec.z = dot(n, vertVec); - - // calculate the reflection vector - vec4 reflect_eye = vec4(reflect(vertVec, VNormal), 0.0); - vec3 reflVec_stat = normalize(gl_ModelViewMatrixInverse * reflect_eye).xyz; - if (refl_dynamic > 0){ - //prepare rotation matrix - mat4 RotMatPR; - mat4 RotMatH; - float _roll = roll; - if (_roll>90.0 || _roll < -90.0) - { - _roll = -_roll; - } - float cosRx = cos(radians(_roll)); - float sinRx = sin(radians(_roll)); - float cosRy = cos(radians(-pitch)); - float sinRy = sin(radians(-pitch)); - float cosRz = cos(radians(hdg)); - float sinRz = sin(radians(hdg)); - rotationMatrixPR(sinRx, cosRx, sinRy, cosRy, RotMatPR); - rotationMatrixH(sinRz, cosRz, RotMatH); - vec3 reflVec_dyn = (RotMatH * (RotMatPR * normalize(gl_ModelViewMatrixInverse * reflect_eye))).xyz; - - reflVec = reflVec_dyn; - } else { - reflVec = reflVec_stat; - } - - if(rembrandt_enabled < 1){ - gl_FrontColor = gl_FrontMaterial.emission + vec4(1.0,1.0,1.0,1.0) - * (gl_LightModel.ambient + gl_LightSource[0].ambient); - } else { - gl_FrontColor = vec4(1.0,1.0,1.0,1.0); - } - gl_Position = gl_ModelViewProjectionMatrix * vec4(rawpos,1.0); - flogz = 1.0 + gl_Position.w; -} diff --git a/Compositor/Shaders/ALS/building.vert b/Compositor/Shaders/ALS/building.vert deleted file mode 100644 index cd55ba1e9..000000000 --- a/Compositor/Shaders/ALS/building.vert +++ /dev/null @@ -1,283 +0,0 @@ -// -*-C++-*- -#version 120 -#extension GL_EXT_draw_instanced : enable - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -// Haze part added by Thorsten Renk, Oct. 2011 - - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -attribute vec3 instancePosition; // (x,y,z) -attribute vec3 instanceScaleRotate; // (width, depth, height) -attribute vec3 rotPitchWtex0x; // (rotation, pitch height, texture x offset) -attribute vec3 wtex0yTex1xTex1y; // (wall texture y offset, wall/roof texture x gain, wall/roof texture y gain) -attribute vec3 rtex0xRtex0y; // (roof texture y offset, roof texture x gain, texture y gain) -attribute vec3 rooftopscale; // (rooftop x scale, rooftop y scale) - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; - -//varying float earthShade; -//varying float yprime; -//varying float vertex_alt; -varying float yprime_alt; -varying float mie_angle; - -uniform int colorMode; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -//uniform float scattering; -uniform float ground_scattering; - -uniform bool use_IR_vision; - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - - -float earthShade; -//float mie_angle; - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - - vec4 light_diffuse; - vec4 light_ambient; - - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - - // Determine the rotation for the building. - float sr = sin(6.28 * rotPitchWtex0x.x); - float cr = cos(6.28 * rotPitchWtex0x.x); - - vec3 position = gl_Vertex.xyz; - // Adjust the very top of the roof to match the rooftop scaling. This shapes - // the rooftop - gambled, gabled etc. These vertices are identified by gl_Color.z - position.x = (1.0 - gl_Color.z) * position.x + gl_Color.z * ((position.x + 0.5) * rooftopscale.x - 0.5); - position.y = (1.0 - gl_Color.z) * position.y + gl_Color.z * (position.y * rooftopscale.y); - - // Adjust pitch of roof to the correct height. These vertices are identified by gl_Color.z - // Scale down by the building height (instanceScaleRotate.z) because - // immediately afterwards we will scale UP the vertex to the correct scale. - position.z = position.z + gl_Color.z * rotPitchWtex0x.y / instanceScaleRotate.z; - position = position * instanceScaleRotate.xyz; - - // Rotation of the building and movement into position - position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr))); - position = position + instancePosition.xyz; - - gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0); - - // Texture coordinates are stored as: - // - a separate offset for the wall (wtex0x, wtex0y), and roof (rtex0x, rtex0y) - // - a shared gain value (tex1x, tex1y) - // - // The vertex color value selects between them, with glColor.x=1 indicating walls - // and glColor.y=1 indicating roofs. - // Finally, the roof texture is on the left of the texture sheet - vec2 tex0 = vec2(sign(gl_MultiTexCoord0.x) * (gl_Color.x*rotPitchWtex0x.z + gl_Color.y*rtex0xRtex0y.x), - gl_Color.x*wtex0yTex1xTex1y.x + gl_Color.y*rtex0xRtex0y.y); - gl_TexCoord[0].x = tex0.x + gl_MultiTexCoord0.x * wtex0yTex1xTex1y.y; - gl_TexCoord[0].y = tex0.y + gl_MultiTexCoord0.y * wtex0yTex1xTex1y.z; - - // Rotate the normal. - normal = gl_Normal; - normal.xy = vec2(dot(normal.xy, vec2(cr, sr)), dot(normal.xy, vec2(-sr, cr))); - normal = gl_NormalMatrix * normal; - - - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = vec4(1.0,1.0,1.0,1.0); - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = vec4(1.0,1.0,1.0,1.0); - ambient_color = vec4(1.0,1.0,1.0,1.0); - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - // here start computations for the haze layer - // we need several geometrical quantities - - // first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = gl_Vertex.xyz + gl_Color.xyz - ep.xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(gl_Vertex.z + gl_Color.z,100.0); - scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * scattering; - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - //light_ambient = light_ambient * (0.4 + 0.6 * smoothstep(0.2, 0.5, earthShade)); - intensity = length(light_ambient.rgb); - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) )); - - intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_diffuse = vec4 (1.0, 1.0, 1.0, 1.0); - light_ambient = vec4 (0.33, 0.4, 0.5, 1.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - light_diffuse.b = 0.78 + lightArg * 0.21; - light_diffuse.g = 0.907 + lightArg * 0.091; - light_diffuse.r = 0.904 + lightArg * 0.092; - light_diffuse.a = 1.0; - - light_ambient.r = 0.316 + lightArg * 0.016; - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - } - - light_diffuse = light_diffuse * scattering; - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - -if (use_IR_vision) - { - light_ambient.rgb = max(light_ambient.rgb, vec3 (0.5, 0.5, 0.5)); - } - - -// default lighting based on texture and material using the light we have just computed - - diffuse_term = diffuse_color* light_diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + light_ambient); - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = 1.0; - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = constant_term.rgb; - gl_BackColor.rgb = constant_term.rgb; - //gl_FrontColor.a = mie_angle; gl_BackColor.a = mie_angle; -} diff --git a/Compositor/Shaders/ALS/chute.vert b/Compositor/Shaders/ALS/chute.vert deleted file mode 100644 index 84857f6f1..000000000 --- a/Compositor/Shaders/ALS/chute.vert +++ /dev/null @@ -1,296 +0,0 @@ -// -*-C++-*- -#version 120 - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -// Haze part added by Thorsten Renk, Oct. 2011 - - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; - -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - -uniform int colorMode; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; -uniform float moonlight; -uniform float chute_force; -uniform float chute_fold; -uniform float chute_bend; -uniform float chute_projection_z; -uniform float osg_SimulationTime; - - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - - -float earthShade; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - - vec4 light_diffuse; - vec4 light_ambient; - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - - vec4 vertex = gl_Vertex; - - // wobble with wind - - float force_speedup = max(0.8, chute_force); - - float phi = asin(dot (vec2 (1.0, 0.0), normalize(vertex.xy))); - float wobble = 0.02 * sin(12.0*osg_SimulationTime) * sin(14.0 * phi); - wobble += 0.01 * sin(6.0*osg_SimulationTime) * sin(8.0 * phi); - - vertex.xy*= (1.0 + wobble * (1.0 - 0.5 * chute_fold)); - - float displace_x = vertex.z * sin(6.0*osg_SimulationTime * force_speedup) * 0.05; - float displace_y = vertex.z * cos(4.0*osg_SimulationTime * force_speedup) * 0.04; - - vertex.xy += vec2 (displace_x, displace_y) * (1.0 - chute_fold); - - // distort shape with force - - float force_gain; - float force_factor = abs(chute_force - 1.0); - - if (chute_force < 1.0) - {force_gain = 1.0 + 0.2 * force_factor;} - else - {force_gain = 1.0 - 0.2 * force_factor;} - - vertex.xy*= force_gain; - - vertex.z += 0.4 * (1./force_gain - 1.0) * max(vertex.z - chute_projection_z, 0.0); - - // fold - - vertex.z = chute_projection_z + (1.0 - 0.8* chute_fold) * (vertex.z - chute_projection_z); - - vertex.z += 0.5 * chute_fold * (0.5 * sin(2.0 * vertex.x + 1.0 * osg_SimulationTime) * cos(3.0 * vertex.y + 1.5 * osg_SimulationTime)); - - // and bend - - vertex.z -= vertex.x * vertex.x * 0.2 * chute_bend; - - - //float yprime_alt; - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - -// this code is copied from default.vert - - //vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - //gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = gl_NormalMatrix * gl_Normal; - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - - - // here start computations for the haze layer - // we need several geometrical quantities - - // first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = vertex.xyz - ep.xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(vertex.z,100.0); - scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * scattering; - - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - - - - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - //light_ambient = light_ambient * (0.7 + 0.3 * smoothstep(0.2, 0.5, earthShade)); - intensity = length(light_ambient.xyz); - - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.xyz); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_diffuse = vec4 (1.0, 1.0, 1.0, 0.0); - light_ambient = vec4 (0.33, 0.4, 0.5, 0.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - light_diffuse.b = 0.78 + lightArg * 0.21; - light_diffuse.g = 0.907 + lightArg * 0.091; - light_diffuse.r = 0.904 + lightArg * 0.092; - light_diffuse.a = 1.0; - - light_ambient.r = 0.316 + lightArg * 0.016; - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - } - - light_diffuse = light_diffuse * scattering; - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - - -// default lighting based on texture and material using the light we have just computed - - diffuse_term = diffuse_color* light_diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + light_ambient); - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = gl_Color.a; - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0; - gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; - gl_Position = gl_ModelViewProjectionMatrix * vertex; - // logarithmic depth - flogz = 1.0 + gl_Position.w; -} - - - - diff --git a/Compositor/Shaders/ALS/cliffs.frag b/Compositor/Shaders/ALS/cliffs.frag deleted file mode 100644 index 977a68619..000000000 --- a/Compositor/Shaders/ALS/cliffs.frag +++ /dev/null @@ -1,625 +0,0 @@ -// -*-C++-*- -#version 120 - -// adapted by James Hester 2018, based on rock-ALS.frag -// by Thorsten Renk. -// Ambient term comes in gl_Color.rgb. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec2 rawPos; -varying vec3 worldPos; -varying vec3 ecViewdir; - - - -varying float steepness; -varying vec2 grad_dir; - -varying float flogz; - - -uniform float fg_Fcoef; - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float dust_cover_factor; -uniform float lichen_cover_factor; -uniform float wetness; -uniform float fogstructure; -uniform float cloud_self_shading; -uniform float contrast; -uniform float air_pollution; -uniform float intrinsic_wetness; -uniform float transition_model; -uniform float overlay_bias; -uniform float crack_depth; -uniform float crack_pattern_stretch; -uniform float grain_fade_power; -uniform float rock_brightness; -uniform float overlay_alpha; -uniform float dust_resistance; -uniform float slopeline_strength; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; -uniform float osg_SimulationTime; - -uniform vec3 base_color; -uniform vec3 overlay_color; - -uniform int wind_effects; -uniform int cloud_shadow_flag; -uniform int rock_strata; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; -float yprime_alt; -float mie_angle; - -float shadow_func (in float x, in float y, in float noise, in float dist); -float Noise2D(in vec2 coord, in float wavelength); -float Noise3D(in vec3 coord, in float wavelength); -float VoronoiNoise2D(in vec2 coord, in float wavelength, in float xrand, in float yrand); -float SlopeLines2D(in vec2 coord, in vec2 gradDir, in float wavelength, in float steepness); -float Strata3D(in vec3 coord, in float wavelength, in float variation); -float fog_func (in float targ, in float alt); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float light_arg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 filter_combined (in vec3 color) ; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -// a fade function for procedural scales which are smaller than a pixel - -float detail_fade (in float scale, in float angle, in float dist) -{ -float fade_dist = 2000.0 * scale * angle/max(pow(steepness,4.0), 0.1); - -return 1.0 - smoothstep(0.5 * fade_dist, fade_dist, dist); -} - - - -void main() -{ - - -yprime_alt = diffuse_term.a; -//diffuse_term.a = 1.0; -mie_angle = gl_Color.a; -float effective_scattering = min(scattering, cloud_self_shading); - -// distance to fragment -float dist = length(relPos); -// horizontal distance using texture coordinate -float horiz_coord = gl_TexCoord[0].s * 1000.0; -// angle of view vector with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; -// float altitude of fragment above base of cliff -float cliff_altitude = gl_TexCoord[0].t * 1000.0; - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - color.a = 1.0; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = normalize(normalize(lightDir) + normalize(ecViewdir)); - vec4 texel; - vec4 detail_texel; - vec4 mix_texel; - vec4 grain_texel; - vec4 dot_texel; - vec4 gradient_texel; - vec4 foam_texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - - -// Perlin noise, distance along cliff in texture coordinate instead of x,y - -float noise_100m = Noise2D(vec2(horiz_coord,cliff_altitude),100.0); -float noise_50m = Noise2D(vec2(horiz_coord,cliff_altitude), 50.0); -float noise_25m = Noise2D(vec2(horiz_coord,cliff_altitude), 25.0); -float noise_10m = Noise2D(vec2(horiz_coord,cliff_altitude), 10.0); -float noise_5m = Noise2D(vec2(horiz_coord,cliff_altitude) ,5.0); -float noise_2m = Noise2D(vec2(horiz_coord,cliff_altitude) ,2.0); -float noise_1m = Noise2D(vec2(horiz_coord,cliff_altitude) ,1.0); -float noise_05m = Noise2D(vec2(horiz_coord,cliff_altitude),0.5); -float noise_02m = Noise2D(vec2(horiz_coord,cliff_altitude),0.2); -float noise_01m = Noise2D(vec2(horiz_coord,cliff_altitude), 0.1); - -float noisegrad_10m; -float noisegrad_5m; -float noisegrad_2m; -float noisegrad_1m; -float noisegrad_05m; -float noisegrad_02m; -float noisegrad_01m; - - - - - -float noise_250m = Noise3D(worldPos.xyz,250.0); -float noise_500m = Noise3D(worldPos.xyz, 500.0); -float noise_1500m = Noise3D(worldPos.xyz, 1500.0); -float noise_2000m = Noise3D(worldPos.xyz, 2000.0); - -// dot noise - -float dotnoise_2m = 0.0; -float dotnoise_10m = 0.0; -float dotnoise_15m = 0.0; - -float dotnoisegrad_10m; - -// slope noise - -float slopenoise_50m = SlopeLines2D(rawPos, grad_dir, 50.0, steepness); -float slopenoise_100m = SlopeLines2D(rawPos, grad_dir, 100.0, steepness); - - - - - - -// get the texels - - float noise_term; - float local_autumn_factor; - - // we need to fade procedural structures when they get smaller than a single pixel, for this we need - // to know under what angle we see the surface - - float view_angle = abs(dot(normalize(normal), normalize(ecViewdir))); - - // strata noise - - float stratnoise_50m; - float stratnoise_10m; - - if (rock_strata==1) - { - stratnoise_50m = Strata3D(vec3 (rawPos.x, rawPos.y, cliff_altitude), 50.0, 0.2); - stratnoise_10m = Strata3D(vec3 (rawPos.x, rawPos.y, cliff_altitude), 10.0, 0.2); - stratnoise_50m = mix(stratnoise_50m, 1.0, smoothstep(0.8,0.9, steepness)); - stratnoise_10m = mix(stratnoise_10m, 1.0, smoothstep(0.8,0.9, steepness)); - texel *= (0.4 + 0.4 * stratnoise_50m + 0.2 * stratnoise_10m); - } - - - - - - - - // procedural rock texture generation - - texel.rgb = base_color; - - // use powers of Perlin noise to generate the base pattern - - float grainy_noise; - float fade_norm; - - float gfp = grain_fade_power; - float gfptmp; - - //grainy_noise = (0.5 * (1.0-slopenoise_100m) + 0.5 *noise_50m) + gfp * (0.5 * slopenoise_50m + 0.5 * noise_25m); - grainy_noise = (0.5 *noise_50m) + gfp * ( 0.5 * noise_25m); - fade_norm = 1.0+gfp; - - gfptmp = gfp * gfp; - grainy_noise += noise_10m * gfptmp * detail_fade(10.0, view_angle, dist) ; - fade_norm += gfptmp * detail_fade(10.0, view_angle, dist) ; - - gfptmp = gfptmp * gfp; - grainy_noise += noise_5m * gfptmp * detail_fade(5.0, view_angle, dist) ; - fade_norm += gfptmp * detail_fade(5.0, view_angle, dist) ; - - gfptmp = gfptmp * gfp; - grainy_noise += noise_2m * gfptmp * detail_fade(2.0, view_angle, dist) ; - fade_norm += gfptmp * detail_fade(2.0, view_angle, dist) ; - - gfptmp = gfptmp * gfp; - grainy_noise += noise_1m * gfptmp * detail_fade(1.0, view_angle, dist) ; - fade_norm += gfptmp * detail_fade(1.0, view_angle, dist) ; - - gfptmp = gfptmp * gfp; - grainy_noise += noise_05m * gfptmp * detail_fade(0.5, view_angle, dist) ; - fade_norm += gfptmp * detail_fade(0.5, view_angle, dist) ; - - grainy_noise = grainy_noise/fade_norm; - grainy_noise = smoothstep(-0.2, 1.2, grainy_noise); - - // generate the crack pattern from isovalue lines of stretched Perlin noise - - float cnoise_500m = Noise2D(vec2(horiz_coord+10.0, crack_pattern_stretch * cliff_altitude), 500.0); - float cnoise_250m = Noise2D(vec2(horiz_coord+10.0, crack_pattern_stretch * cliff_altitude), 250.0); - float cnoise_100m = Noise2D(vec2(horiz_coord+10.0, crack_pattern_stretch * cliff_altitude), 100.0); - float cnoise_50m = Noise2D(vec2(horiz_coord+10.0, crack_pattern_stretch * cliff_altitude), 50.0); - float cnoise_25m = Noise2D(vec2(horiz_coord+10.0, crack_pattern_stretch * cliff_altitude), 25.0); - float cnoise_10m = Noise2D(vec2(horiz_coord+10.0, crack_pattern_stretch * cliff_altitude), 10.0); - float cnoise_5m = Noise2D(vec2(horiz_coord+10.0, crack_pattern_stretch * cliff_altitude), 5.0); - float cnoise_2m = Noise2D(vec2(horiz_coord+10.0, crack_pattern_stretch * cliff_altitude), 2.0); - float cnoise_1m = Noise2D(vec2(horiz_coord+10.0, crack_pattern_stretch * cliff_altitude), 1.0); - - float crack_noise; - float crack_factor; - float crack_size; - float scrack_noise; - float scrack_size; - - crack_noise = cnoise_500m + 0.65 * cnoise_250m + 0.42 * cnoise_100m * detail_fade(50.0, view_angle, dist) ; - crack_noise = crack_noise + 0.27 * cnoise_50m * detail_fade(25.0, view_angle, dist) ; - crack_noise = crack_noise + 0.17 * cnoise_25m * detail_fade(10.0, view_angle, dist) ; - crack_noise = crack_noise + 0.11 * cnoise_10m * detail_fade(5.0, view_angle, dist) ; - crack_noise = 0.381 * crack_noise; - - - - scrack_noise = cnoise_10m + 0.65 * cnoise_5m * detail_fade(5.0, view_angle, dist); - scrack_noise = scrack_noise + 0.3 * cnoise_2m + 0.1 * cnoise_1m * detail_fade(1.0, view_angle, dist); - scrack_noise = 0.48 * scrack_noise; - - crack_size = 0.02 +0.00001 * dist; - crack_factor = smoothstep(0.5-crack_size,0.50,crack_noise) * (1.0-smoothstep(0.51,0.51+crack_size,crack_noise)); - //crack_factor = step(0.5-0.2*crack_size,crack_noise) * (1.0-step(0.5+0.2*crack_size,crack_noise)); - - crack_size *= 0.5; - crack_factor += smoothstep(0.42,0.42+crack_size,crack_noise) * (1.0-smoothstep(0.43,0.43+crack_size,crack_noise)); - - scrack_size = crack_size * 4.0; - crack_factor += 0.75 * smoothstep(0.5-scrack_size,0.50,scrack_noise) * (1.0-smoothstep(0.51,0.51+scrack_size,scrack_noise))* (1.0- smoothstep(250.0,1000.0,dist)); - - - crack_factor = crack_factor * min(1.0,0.03/crack_size); - - - -// distribution of overlay color - - - float overlay_noise; - float overlay_factor; - - overlay_noise = 0.381 * (noise_50m + 0.65 * noise_25m + 0.42 * noise_10m + 0.27 * noise_5m + 0.17 * noise_2m + 0.11 * noise_1m); - overlay_noise = overlay_noise + 0.1 * (smoothstep(0.8,0.9, steepness)); - - overlay_factor = smoothstep(0.7, 0.72, overlay_noise + overlay_bias) + (1.0 - smoothstep(0.2, 0.22, overlay_noise - overlay_bias)); - - - -// merge the noise components - - //grainy_noise = grainy_noise * (1.0-crack_depth * crack_factor) + 0.5 * crack_depth * crack_factor; - texel.rgb = ((1.0 - contrast) + contrast * grainy_noise ) * texel.rgb; - texel.rgb = mix(texel.rgb, overlay_color.rgb,overlay_alpha * overlay_factor); - texel.rgb = texel.rgb * ((1.0-crack_depth) +crack_depth*(1.0-crack_factor * (0.5 + 0.5 * noise_50m) )); - - texel.rgb = texel.rgb * rock_brightness; - - texel.rgb = texel.rgb * (1.0 + 0.4 * (noise_01m-0.5) * detail_fade(0.1, view_angle, dist)) ; - - -const vec4 dust_color = vec4 (0.76, 0.65, 0.45, 1.0); -const vec4 lichen_color = vec4 (0.17, 0.20, 0.06, 1.0); - -// mix vegetation -float gradient_factor = smoothstep(0.5, 1.0, steepness); -texel = mix(texel, lichen_color, gradient_factor * (0.4 * lichen_cover_factor + 0.8 * lichen_cover_factor * 0.5 * (noise_10m + (1.0 - noise_5m))) ); -// mix dust -texel = mix(texel, dust_color, clamp(0.5 * dust_cover_factor *dust_resistance + 3.0 * dust_cover_factor * dust_resistance *(((noise_1500m - 0.5) * 0.125)+0.125 ), 0.0, 1.0) ); - -// get distribution of water when terrain is wet - -float combined_wetness = min(1.0, wetness + intrinsic_wetness); -float water_threshold1; -float water_threshold2; -float water_factor =0.0; - - -if ((dist < 5000.0) && (combined_wetness>0.0)) - { - water_threshold1 = 1.0-0.5* combined_wetness; - water_threshold2 = 1.0 - 0.3 * combined_wetness; - water_factor = smoothstep(water_threshold1, water_threshold2 , (0.3 * (2.0 * (1.0-noise_10m) + (1.0 -noise_5m)) * (1.0 - smoothstep(2000.0, 5000.0, dist))) - 5.0 * (1.0 -steepness)); - } - -// darken wet terrain - - texel.rgb = texel.rgb * (1.0 - 0.6 * combined_wetness); - - - -// light computations - - - vec4 light_specular = gl_LightSource[0].specular; - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - //n = (2.0 * gl_Color.a - 1.0) * normal; - n = normal; - n = normalize(n); - - NdotL = dot(n, lightDir); - - noisegrad_10m = (noise_10m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),10.0))/0.05; - noisegrad_5m = (noise_5m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),5.0))/0.05; - noisegrad_2m = (noise_2m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),2.0))/0.05; - noisegrad_1m = (noise_1m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),1.0))/0.05; - noisegrad_05m = (noise_05m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),0.5))/0.05; - - - dotnoisegrad_10m = 0.0; - - float fresnel; - - if (NdotL > 0.0) { - if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 0.3 * noise_250m + 0.5 * noise_500m+0.2 * noise_1500m, dist);} - color += diffuse_term * NdotL; - NdotHV = max(dot(n, halfVector), 0.0); - - fresnel = 1.0 + 5.0 * (1.0-smoothstep(0.0,0.2, dot(normalize(ecViewdir),n))); - - //if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = ((gl_FrontMaterial.specular.rgb * 0.1 + (water_factor * vec3 (1.0, 1.0, 1.0))) - * light_specular.rgb - * pow(NdotHV, max(gl_FrontMaterial.shininess,4.0) + (20.0 * water_factor))); - } - color.a = 1.0;//diffuse_term.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - color.rgb +=secondary_light * light_distance_fading(dist); - - - fragColor = color * texel + specular; - -float lightArg = (terminator-yprime_alt)/100000.0; -vec3 hazeColor = get_hazeColor(lightArg); - - - -// Rayleigh color shift due to out-scattering - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); - -// Rayleigh color shift due to in-scattering - - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; - -float mvisibility = min(visibility,avisibility); - -if (dist > 0.04 * mvisibility) - -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - -// blur of the haze layer edge - -float blur_thickness = 50.0; -float cphi = dot(vec3(0.0, 1.0, 0.0), relPos)/dist; -float ctlayer = delta_z/dist-0.01 + 0.02 * Noise2D(vec2(cphi,1.0),0.1) -0.01; -float ctblur = 0.035 ; - -float blur_dist; - -if (abs(delta_z) < 400.0) - { - blur_dist = dist * (1.0-smoothstep(0.0,300.0,-delta_z)) * smoothstep(-400.0,-200.0, -delta_z); - blur_dist = blur_dist * smoothstep(ctlayer-4.0*ctblur, ctlayer-ctblur, ct) * (1.0-smoothstep(ctlayer+0.5*ctblur, ctlayer+ctblur, ct)); - distance_in_layer = max(distance_in_layer, blur_dist); - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - - - -if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility + 1.0 * visibility * fogstructure * 0.06 * (noise_1500m + noise_2000m -1.0) )); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 - effective_scattering); - } -else - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility + 1.0 * avisibility * fogstructure * 0.06 * (noise_1500m + noise_2000m - 1.0) )); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 - effective_scattering); - } - - - -transmission = fog_func(transmission_arg, alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - - - - - - -// now dim the light for haze -eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - -// Mie-like factor - - if (lightArg < 10.0) - { - intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -intensity = length(hazeColor); - -if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColor doesn't come out correctly -{ - - - // high altitude desaturation of the haze color - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - - // blue hue of haze - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - - - // additional blue in indirect light - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - // change haze color to blue hue for strong fogging - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - - - // reduce haze intensity when looking at shaded surfaces, only in terminator region - float shadow = mix( min(1.0 + dot(n,lightDir),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); - hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - } - -// don't let the light fade out too rapidly -lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - -hazeColor.rgb *= eqColorFactor * eShade; -hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - - -fragColor.rgb = mix(hazeColor + secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission); - -} - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} - diff --git a/Compositor/Shaders/ALS/cloud-impostor.vert b/Compositor/Shaders/ALS/cloud-impostor.vert deleted file mode 100644 index 72ac337dc..000000000 --- a/Compositor/Shaders/ALS/cloud-impostor.vert +++ /dev/null @@ -1,139 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; -varying vec3 hazeColor; - -varying float flogz; - -uniform float terminator; -uniform float altitude; -uniform float cloud_self_shading; -uniform float moonlight; -uniform float air_pollution; -uniform float range; -uniform float visibility; - -const float shade = 1.0; -const float cloud_height = 1000.0; -const float EarthRadius = 5800000.0; - -vec3 moonlight_perception (in vec3 light); - -// light_func is a generalized logistic function fit to the light intensity as a function -// of scaled terminator position obtained from Flightgear core - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x-0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.03;} - - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -void main(void) -{ - - vec3 shadedFogColor = vec3 (0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - moonLightColor = moonlight_perception (moonLightColor); - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - //gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0); - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.x = gl_Vertex.x; - gl_Position.y += gl_Vertex.y; - gl_Position.z += gl_Vertex.z; - gl_Position.xyz += gl_Color.xyz; - - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - vec3 relVector = gl_Position.xyz - ep.xyz; - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - - // Light at the final position - - // first obtain normal to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - // yprime is the distance of the vertex into sun direction, corrected for altitude - //float vertex_alt = max(altitude * 0.30480 + relVector.z,100.0); - float vertex_alt = altitude + relVector.z; - float yprime = -dot(relVector, lightHorizon); - float yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - - // compute the light at the position - vec4 light_diffuse; - - float lightArg = (terminator-yprime_alt)/100000.0; - - light_diffuse.b = light_func(lightArg -1.2 * air_pollution, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg -0.6 * air_pollution, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - - - // two times terminator width governs how quickly light fades into shadow - float terminator_width = 200000.0; - float earthShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt) + 0.1; - - float intensity = (1.0 - (0.8 * (1.0 - earthShade))) * length(light_diffuse.rgb); - - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, (1.0 - smoothstep(0.5,0.9, cloud_self_shading )))); - if (earthShade < 0.6) - { - intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.6,earthShade ) )); - } - - - - gl_FrontColor = light_diffuse; - - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(100.0, 250.0, fogCoord), 1.0 - smoothstep(0.9 * range, range, fogCoord)); - - - - gl_FrontColor.a = gl_FrontColor.a * (1.0 - smoothstep(visibility, 3.0* visibility, fogCoord)); - - // Fog doesn't affect rain as much as other objects. - -float fadeScale = 0.05 + 0.2 * log(fogCoord/1000.0); - if (fadeScale < 0.05) fadeScale = 0.05; - fogFactor = exp( -gl_Fog.density * 0.5* fogCoord * fadeScale); - - hazeColor = light_diffuse.rgb; - hazeColor.r = hazeColor.r * 0.83; - hazeColor.g = hazeColor.g * 0.9; - - - - - gl_FrontColor.rgb = gl_FrontColor.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - hazeColor.rgb = hazeColor.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - gl_BackColor = gl_FrontColor; - -} diff --git a/Compositor/Shaders/ALS/cloud-noctilucent.vert b/Compositor/Shaders/ALS/cloud-noctilucent.vert deleted file mode 100644 index 4441e69ba..000000000 --- a/Compositor/Shaders/ALS/cloud-noctilucent.vert +++ /dev/null @@ -1,148 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; -varying vec3 hazeColor; - -varying float flogz; - -uniform float terminator; -uniform float altitude; -uniform float cloud_self_shading; -uniform float moonlight; - -const float shade = 1.0; -const float cloud_height = 1000.0; -const float EarthRadius = 5800000.0; - -vec3 moonlight_perception (in vec3 light); - -// light_func is a generalized logistic function fit to the light intensity as a function -// of scaled terminator position obtained from Flightgear core - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x-0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.03;} - - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -void main(void) -{ - - vec3 shadedFogColor = vec3 (0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - moonLightColor = moonlight_perception (moonLightColor); - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - //gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0); - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.x = gl_Vertex.x; - gl_Position.y += gl_Vertex.y; - gl_Position.z += gl_Vertex.z; - gl_Position.xyz += gl_Color.xyz; - - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - vec3 relVector = gl_Position.xyz - ep.xyz; - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - - // Light at the final position - - // first obtain normal to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - // yprime is the distance of the vertex into sun direction, corrected for altitude - //float vertex_alt = max(altitude * 0.30480 + relVector.z,100.0); - float vertex_alt = altitude + relVector.z; - float yprime = -dot(relVector, lightHorizon); - float yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - - // compute the light at the position - //vec4 light_diffuse; - - float lightArg = (terminator-yprime_alt)/100000.0; - - //light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0); - //light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - //light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - //light_diffuse.a = 1.0; - - float light_intensity = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - vec4 light_diffuse = vec4 (0.57, 0.57, 0.9, 1.0); - light_diffuse.rgb = light_intensity * light_diffuse.rgb; - - float intensity = length(light_diffuse.rgb); - //light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, (1.0 - smoothstep(0.5,0.9, cloud_self_shading )))); - -// Determine the shading of the sprite based on its vertical position and position relative to the sun. - n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front - vec4 backlight = light_diffuse * shade; - - gl_FrontColor = mix(backlight, light_diffuse, n); - gl_FrontColor += gl_FrontLightModelProduct.sceneColor; - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = 0.2 * min(smoothstep(100.0, 250.0, fogCoord), 1.0 - smoothstep(250000.0, 300000.0, fogCoord)); - // During the day, noctilucent clouds are invisible - gl_FrontColor.a = gl_FrontColor.a * (1.0 - smoothstep(4.0,8.0,lightArg)); - - - // Fog doesn't affect rain as much as other objects. - //fogFactor = exp( -gl_Fog.density * fogCoord * 0.4); - //fogFactor = clamp(fogFactor, 0.0, 1.0); - -float fadeScale = 0.05 + 0.2 * log(fogCoord/1000.0); - if (fadeScale < 0.05) fadeScale = 0.05; - fogFactor = exp( -gl_Fog.density * fogCoord * fadeScale); - - hazeColor = light_diffuse.rgb; - hazeColor.r = hazeColor.r * 0.83; - hazeColor.g = hazeColor.g * 0.9; - - // in sunset or sunrise conditions, do extra shading of clouds - - - - // two times terminator width governs how quickly light fades into shadow - float terminator_width = 200000.0; - - // now dim the light - float earthShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt) + 0.1; - - if (earthShade < 0.8) - { - intensity = length(light_diffuse.rgb); - gl_FrontColor.rgb = intensity * normalize(mix(gl_FrontColor.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade ) )); - } - - hazeColor = hazeColor * earthShade; - gl_FrontColor.rgb = gl_FrontColor.rgb * earthShade; - gl_FrontColor.rgb = gl_FrontColor.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - hazeColor.rgb = hazeColor.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - gl_BackColor = gl_FrontColor; - -} diff --git a/Compositor/Shaders/ALS/cloud-shadowfunc.frag b/Compositor/Shaders/ALS/cloud-shadowfunc.frag deleted file mode 100644 index 303472fa3..000000000 --- a/Compositor/Shaders/ALS/cloud-shadowfunc.frag +++ /dev/null @@ -1,156 +0,0 @@ -#version 120 -uniform float cloudpos1_x; -uniform float cloudpos1_y; -uniform float cloudpos2_x; -uniform float cloudpos2_y; -uniform float cloudpos3_x; -uniform float cloudpos3_y; -uniform float cloudpos4_x; -uniform float cloudpos4_y; -uniform float cloudpos5_x; -uniform float cloudpos5_y; -uniform float cloudpos6_x; -uniform float cloudpos6_y; -uniform float cloudpos7_x; -uniform float cloudpos7_y; -uniform float cloudpos8_x; -uniform float cloudpos8_y; -uniform float cloudpos9_x; -uniform float cloudpos9_y; -uniform float cloudpos10_x; -uniform float cloudpos10_y; -uniform float cloudpos11_x; -uniform float cloudpos11_y; -uniform float cloudpos12_x; -uniform float cloudpos12_y; -uniform float cloudpos13_x; -uniform float cloudpos13_y; -uniform float cloudpos14_x; -uniform float cloudpos14_y; -uniform float cloudpos15_x; -uniform float cloudpos15_y; -uniform float cloudpos16_x; -uniform float cloudpos16_y; -uniform float cloudpos17_x; -uniform float cloudpos17_y; -uniform float cloudpos18_x; -uniform float cloudpos18_y; -uniform float cloudpos19_x; -uniform float cloudpos19_y; -uniform float cloudpos20_x; -uniform float cloudpos20_y; - -uniform float cloudpos_n_x; -uniform float cloudpos_n_y; - -float shadow_func (in float x, in float y, in float noise, in float dist) -{ - -if (dist > 30000.0) {return 1.0;} - -float width = fract((cloudpos1_x)) * 5000.0; -float strength = fract((cloudpos1_y)); - - -float dlength = length( vec2 (x - cloudpos1_x, y - cloudpos1_y)); -float shadeValue = strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos2_x, y - cloudpos2_y)); -width = fract((cloudpos2_x)) * 5000.0; strength = fract((cloudpos2_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos3_x, y - cloudpos3_y)); -width = fract((cloudpos3_x)) * 5000.0; strength = fract((cloudpos3_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos4_x, y - cloudpos4_y)); -width = fract((cloudpos4_x)) * 5000.0; strength = fract((cloudpos4_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos5_x, y - cloudpos5_y)); -width = fract((cloudpos5_x)) * 5000.0; strength = fract((cloudpos5_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos6_x, y - cloudpos6_y)); -width = fract((cloudpos6_x)) * 5000.0; strength = fract((cloudpos6_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos7_x, y - cloudpos7_y)); -width = fract((cloudpos7_x)) * 5000.0; strength = fract((cloudpos7_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos8_x, y - cloudpos8_y)); -width = fract((cloudpos8_x)) * 5000.0; strength = fract((cloudpos8_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos9_x, y - cloudpos9_y)); -width = fract((cloudpos9_x)) * 5000.0; strength = fract((cloudpos9_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos10_x, y - cloudpos10_y)); -width = fract((cloudpos10_x)) * 5000.0; strength = fract((cloudpos10_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos11_x, y - cloudpos11_y)); -width = fract((cloudpos11_x)) * 5000.0; strength = fract((cloudpos11_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos12_x, y - cloudpos12_y)); -width = fract((cloudpos12_x)) * 5000.0; strength = fract((cloudpos12_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos13_x, y - cloudpos13_y)); -width = fract((cloudpos13_x)) * 5000.0; strength = fract((cloudpos13_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos14_x, y - cloudpos14_y)); -width = fract((cloudpos14_x)) * 5000.0; strength = fract((cloudpos14_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos15_x, y - cloudpos15_y)); -width = fract((cloudpos15_x)) * 5000.0; strength = fract((cloudpos15_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos16_x, y - cloudpos16_y)); -width = fract((cloudpos16_x)) * 5000.0; strength = fract((cloudpos16_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos17_x, y - cloudpos17_y)); -width = fract((cloudpos17_x)) * 5000.0; strength = fract((cloudpos17_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos18_x, y - cloudpos18_y)); -width = fract((cloudpos18_x)) * 5000.0; strength = fract((cloudpos18_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos19_x, y - cloudpos19_y)); -width = fract((cloudpos19_x)) * 5000.0; strength = fract((cloudpos19_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -dlength = length ( vec2 (x - cloudpos20_x, y - cloudpos20_y)); -width = fract((cloudpos20_x)) * 5000.0; strength = fract((cloudpos20_y)); -shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -shadeValue = shadeValue * (0.8 + 2.0 * shadeValue * smoothstep(0.4,0.6,noise)); -shadeValue = clamp(shadeValue,0.0,1.0); -shadeValue = shadeValue * (1.0 - smoothstep(15000.0, 30000.0,dist)); - -return 1.0 - shadeValue; - -} - - -float shadow_func_nearest (in float x, in float y, in float noise, in float dist) -{ - -if (dist > 6000.0) {return 1.0;} - -float width = fract((cloudpos_n_x)) * 5000.0; -float strength = fract((cloudpos_n_y)); - - -float dlength = length( vec2 (x - cloudpos_n_x, y - cloudpos_n_y)); -float shadeValue = strength * (1.0-smoothstep(width * 0.5, width, dlength)); - -return 1.0 - shadeValue; -} diff --git a/Compositor/Shaders/ALS/cloud-static-detailed.frag b/Compositor/Shaders/ALS/cloud-static-detailed.frag deleted file mode 100644 index f8c023822..000000000 --- a/Compositor/Shaders/ALS/cloud-static-detailed.frag +++ /dev/null @@ -1,65 +0,0 @@ -// -*-C++-*- -#version 120 - -uniform float fg_Fcoef; - -uniform sampler2D baseTexture; - -uniform float ring_factor; -uniform float rainbow_factor; - -varying float fogFactor; -varying float mie_frag; -varying float eShade; - -varying vec3 hazeColor; - -varying float flogz; - -vec3 filter_combined (in vec3 color) ; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - - float fwd_enhancement = smoothstep(0.8, 1.0, mie_frag) * eShade; - float light_intensity = length(gl_Color.rgb)/1.76; - - - //22 deg ring - - float halo_ring_enhancement = smoothstep (0.88, 0.927, mie_frag) * (1.0 - smoothstep(0.927, 0.94, mie_frag)) * eShade * 1.5 * ring_factor; - - - float halo_ring_enhancement_b = smoothstep (0.88, 0.90, mie_frag) * (1.0 - smoothstep(0.90, 0.92, mie_frag)) * eShade * ring_factor; - float halo_ring_enhancement_r = smoothstep (0.91, 0.93, mie_frag) * (1.0 - smoothstep(0.93, 0.955, mie_frag)) * eShade * ring_factor; - - - vec4 finalColor = base * gl_Color; - - float reduction = 0.16 * light_intensity * rainbow_factor; - - finalColor.g *= (1.0 - reduction * halo_ring_enhancement_r); - finalColor.b *= (1.0 - reduction * halo_ring_enhancement_r); - - finalColor.r *= (1.0 - reduction * halo_ring_enhancement_b); - finalColor.g *= (1.0 - reduction * halo_ring_enhancement_b); - - fwd_enhancement *=(1.0-smoothstep(0.8, 1.0, light_intensity)); - finalColor.rgb *= (1.0 + fwd_enhancement) * (1.0 + 0.5 * halo_ring_enhancement * (1.0-smoothstep(0.8, 1.0, light_intensity))) ; - finalColor.a *= (1.0 + 0.5 * halo_ring_enhancement); - - - - finalColor.rgb = clamp(finalColor.rgb, 0.0, 1.0); - finalColor.a = clamp(finalColor.a, 0.0, 1.0); - - vec4 fragColor = vec4 (mix(hazeColor, finalColor.rgb, fogFactor ), mix(0.0, finalColor.a, 1.0 - 0.5 * (1.0 - fogFactor))); - - - fragColor.rgb = filter_combined(fragColor.rgb); - //fragColor.rgb = vec3 (1.0, 0.0, 0.0); - gl_FragColor = fragColor; - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} diff --git a/Compositor/Shaders/ALS/cloud-static-detailed.vert b/Compositor/Shaders/ALS/cloud-static-detailed.vert deleted file mode 100644 index 78693204d..000000000 --- a/Compositor/Shaders/ALS/cloud-static-detailed.vert +++ /dev/null @@ -1,146 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; -varying float mie_frag; -varying float eShade; -varying vec3 hazeColor; - -varying float flogz; - -uniform float terminator; -uniform float altitude; -uniform float cloud_self_shading; -uniform float moonlight; - -const float shade = 1.0; -const float cloud_height = 1000.0; -const float EarthRadius = 5800000.0; - -// light_func is a generalized logistic function fit to the light intensity as a function -// of scaled terminator position obtained from Flightgear core - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x-0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.03;} - - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -void main(void) -{ - - vec3 shadedFogColor = vec3 (0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - //gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0); - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.x = gl_Vertex.x; - gl_Position.y += gl_Vertex.y; - gl_Position.z += gl_Vertex.z; - gl_Position.xyz += gl_Color.xyz; - - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - vec3 relVector = gl_Position.xyz - ep.xyz; - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - - // Light at the final position - - // first obtain normal to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - mie_frag = dot(normalize(lightFull), normalize(relVector)); - - - // yprime is the distance of the vertex into sun direction, corrected for altitude - //float vertex_alt = max(altitude * 0.30480 + relVector.z,100.0); - float vertex_alt = altitude + relVector.z; - float yprime = -dot(relVector, lightHorizon); - float yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - - // compute the light at the position - vec4 light_diffuse; - - float lightArg = (terminator-yprime_alt)/100000.0; - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - - float intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, (1.0 - smoothstep(0.5,0.9, cloud_self_shading )))); - -// Determine the shading of the sprite based on its vertical position and position relative to the sun. - n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front - vec4 backlight = light_diffuse * shade; - - gl_FrontColor = mix(backlight, light_diffuse, n); - gl_FrontColor += gl_FrontLightModelProduct.sceneColor; - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(100.0, 250.0, fogCoord), 1.0 - smoothstep(70000.0, 75000.0, fogCoord)); - - // Fog doesn't affect rain as much as other objects. - //fogFactor = exp( -gl_Fog.density * fogCoord * 0.4); - //fogFactor = clamp(fogFactor, 0.0, 1.0); - -float fadeScale = 0.05 + 0.2 * log(fogCoord/1000.0); - if (fadeScale < 0.05) fadeScale = 0.05; - fogFactor = exp( -gl_Fog.density * fogCoord * fadeScale); - - hazeColor = light_diffuse.rgb; - hazeColor.r = hazeColor.r * 0.83; - hazeColor.g = hazeColor.g * 0.9; - - // in sunset or sunrise conditions, do extra shading of clouds - - - - // two times terminator width governs how quickly light fades into shadow - float terminator_width = 200000.0; - - // now dim the light - float earthShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt) + 0.1; - - eShade = earthShade; - - if (earthShade < 0.8) - { - intensity = length(light_diffuse.rgb); - gl_FrontColor.rgb = intensity * normalize(mix(gl_FrontColor.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade ) )); - } - - hazeColor = hazeColor * earthShade; - gl_FrontColor.rgb = gl_FrontColor.rgb * earthShade; - gl_FrontColor.rgb = gl_FrontColor.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - hazeColor.rgb = hazeColor.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - gl_BackColor = gl_FrontColor; - -} diff --git a/Compositor/Shaders/ALS/cloud-static.frag b/Compositor/Shaders/ALS/cloud-static.frag deleted file mode 100644 index 23994cf72..000000000 --- a/Compositor/Shaders/ALS/cloud-static.frag +++ /dev/null @@ -1,26 +0,0 @@ -#version 120 - -uniform float fg_Fcoef; - -uniform sampler2D baseTexture; -varying float fogFactor; - -varying vec3 hazeColor; - -varying float flogz; - -vec3 filter_combined (in vec3 color) ; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - vec4 finalColor = base * gl_Color; - - vec4 fragColor = vec4 (mix(hazeColor, finalColor.rgb, fogFactor ), mix(0.0, finalColor.a, 1.0 - 0.5 * (1.0 - fogFactor))); - - - fragColor.rgb = filter_combined(fragColor.rgb); - gl_FragColor = fragColor; - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} diff --git a/Compositor/Shaders/ALS/cloud-static.vert b/Compositor/Shaders/ALS/cloud-static.vert deleted file mode 100644 index 453b7bbfd..000000000 --- a/Compositor/Shaders/ALS/cloud-static.vert +++ /dev/null @@ -1,141 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; -varying vec3 hazeColor; - -varying float flogz; - -uniform float terminator; -uniform float altitude; -uniform float cloud_self_shading; -uniform float moonlight; - -const float shade = 1.0; -const float cloud_height = 1000.0; -const float EarthRadius = 5800000.0; - -vec3 moonlight_perception (in vec3 light); - -// light_func is a generalized logistic function fit to the light intensity as a function -// of scaled terminator position obtained from Flightgear core - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x-0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.03;} - - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -void main(void) -{ - - vec3 shadedFogColor = vec3 (0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - moonLightColor = moonlight_perception (moonLightColor); - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - //gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0); - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.x = gl_Vertex.x; - gl_Position.y += gl_Vertex.y; - gl_Position.z += gl_Vertex.z; - gl_Position.xyz += gl_Color.xyz; - - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - vec3 relVector = gl_Position.xyz - ep.xyz; - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - - // Light at the final position - - // first obtain normal to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - // yprime is the distance of the vertex into sun direction, corrected for altitude - //float vertex_alt = max(altitude * 0.30480 + relVector.z,100.0); - float vertex_alt = altitude + relVector.z; - float yprime = -dot(relVector, lightHorizon); - float yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - - // compute the light at the position - vec4 light_diffuse; - - float lightArg = (terminator-yprime_alt)/100000.0; - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - - float intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, (1.0 - smoothstep(0.5,0.9, cloud_self_shading )))); - -// Determine the shading of the sprite based on its vertical position and position relative to the sun. - n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front - vec4 backlight = light_diffuse * shade; - - gl_FrontColor = mix(backlight, light_diffuse, n); - gl_FrontColor += gl_FrontLightModelProduct.sceneColor; - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(100.0, 250.0, fogCoord), 1.0 - smoothstep(70000.0, 75000.0, fogCoord)); - - // Fog doesn't affect rain as much as other objects. - //fogFactor = exp( -gl_Fog.density * fogCoord * 0.4); - //fogFactor = clamp(fogFactor, 0.0, 1.0); - -float fadeScale = 0.05 + 0.2 * log(fogCoord/1000.0); - if (fadeScale < 0.05) fadeScale = 0.05; - fogFactor = exp( -gl_Fog.density * fogCoord * fadeScale); - - hazeColor = light_diffuse.rgb; - hazeColor.r = hazeColor.r * 0.83; - hazeColor.g = hazeColor.g * 0.9; - - // in sunset or sunrise conditions, do extra shading of clouds - - - - // two times terminator width governs how quickly light fades into shadow - float terminator_width = 200000.0; - - // now dim the light - float earthShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt) + 0.1; - - if (earthShade < 0.8) - { - intensity = length(light_diffuse.rgb); - gl_FrontColor.rgb = intensity * normalize(mix(gl_FrontColor.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade ) )); - } - - hazeColor = hazeColor * earthShade; - gl_FrontColor.rgb = gl_FrontColor.rgb * earthShade; - gl_FrontColor.rgb = gl_FrontColor.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - hazeColor.rgb = hazeColor.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - gl_BackColor = gl_FrontColor; - -} diff --git a/Compositor/Shaders/ALS/clustered-include.frag b/Compositor/Shaders/ALS/clustered-include.frag deleted file mode 100644 index c94084bda..000000000 --- a/Compositor/Shaders/ALS/clustered-include.frag +++ /dev/null @@ -1,133 +0,0 @@ -#version 140 - -uniform usampler3D fg_ClusteredLightGrid; -uniform usamplerBuffer fg_ClusteredLightIndices; -uniform int fg_ClusteredTileSize; -uniform float fg_ClusteredSliceScale; -uniform float fg_ClusteredSliceBias; - -const bool debug = true; -const float shininess = 16.0; - -struct PointLight { - vec4 position; - vec4 ambient; - vec4 diffuse; - vec4 specular; - vec4 attenuation; -}; - -struct SpotLight { - vec4 position; - vec4 direction; - vec4 ambient; - vec4 diffuse; - vec4 specular; - vec4 attenuation; - float cos_cutoff; - float exponent; -}; - -layout (std140) uniform PointLightBlock { - PointLight pointLights[256]; -}; -layout (std140) uniform SpotLightBlock { - SpotLight spotLights[256]; -}; - - -vec3 addColors(vec3 a, vec3 b) -{ - return 0.14 * log(exp(a/0.14) + exp(b/0.14) - vec3(1.0)); -} - -// @param p Fragment position in view space. -// @param n Fragment normal in view space. -vec3 addClusteredLightsContribution(vec3 inputColor, vec3 p, vec3 n) -{ - int slice = int(max(log2(-p.z) * fg_ClusteredSliceScale - + fg_ClusteredSliceBias, 0.0)); - ivec3 clusterCoord = ivec3(gl_FragCoord.xy / fg_ClusteredTileSize, slice); - uvec3 cluster = texelFetch(fg_ClusteredLightGrid, - clusterCoord, - 0).rgb; - uint startIndex = cluster.r; - uint pointCount = cluster.g; - uint spotCount = cluster.b; - - vec3 color = vec3(0.0); - - for (uint i = uint(0); i < pointCount; ++i) { - uint lightListIndex = texelFetch(fg_ClusteredLightIndices, - int(startIndex + i)).r; - PointLight light = pointLights[lightListIndex]; - - float range = light.attenuation.w; - vec3 toLight = light.position.xyz - p; - // Ignore fragments outside the light volume - if (dot(toLight, toLight) > (range * range)) - continue; - - //////////////////////////////////////////////////////////////////////// - // Actual lighting - - float d = length(toLight); - float att = 1.0 / (light.attenuation.x // constant - + light.attenuation.y * d // linear - + light.attenuation.z * d * d); // quadratic - vec3 lightDir = normalize(toLight); - float NdotL = max(dot(n, lightDir), 0.0); - - vec3 Iamb = light.ambient.rgb; - vec3 Idiff = light.diffuse.rgb * NdotL; - vec3 Ispec = vec3(0.0); - - if (NdotL > 0.0) { - vec3 halfVector = normalize(lightDir + normalize(-p)); - float NdotHV = max(dot(n, halfVector), 0.0); - Ispec = light.specular.rgb * att * pow(NdotHV, shininess); - } - - color += addColors(color, (Iamb + Idiff + Ispec) * att); - } - - for (uint i = uint(0); i < spotCount; ++i) { - uint lightListIndex = texelFetch(fg_ClusteredLightIndices, - int(startIndex + i)).r; - SpotLight light = spotLights[lightListIndex]; - - vec3 toLight = light.position.xyz - p; - - //////////////////////////////////////////////////////////////////////// - // Actual lighting - - float d = length(toLight); - float att = 1.0 / (light.attenuation.x // constant - + light.attenuation.y * d // linear - + light.attenuation.z * d * d); // quadratic - - vec3 lightDir = normalize(toLight); - - float spotDot = dot(-lightDir, light.direction.xyz); - if (spotDot < light.cos_cutoff) - continue; - - att *= pow(spotDot, light.exponent); - - float NdotL = max(dot(n, lightDir), 0.0); - - vec3 Iamb = light.ambient.rgb; - vec3 Idiff = light.diffuse.rgb * NdotL; - vec3 Ispec = vec3(0.0); - - if (NdotL > 0.0) { - vec3 halfVector = normalize(lightDir + normalize(-p)); - float NdotHV = max(dot(n, halfVector), 0.0); - Ispec = light.specular.rgb * att * pow(NdotHV, shininess); - } - - color += (Iamb + Idiff + Ispec) * att; - } - - return clamp(color + inputColor, 0.0, 1.0); -} diff --git a/Compositor/Shaders/ALS/color_temperature.frag b/Compositor/Shaders/ALS/color_temperature.frag deleted file mode 100755 index d9a81c05a..000000000 --- a/Compositor/Shaders/ALS/color_temperature.frag +++ /dev/null @@ -1,51 +0,0 @@ -// -*-C++-*- -#version 120 - - -vec4 color_temperature (in float T) -{ -T *=0.01; - -float red; -float green; -float blue; -float alpha; - -red = 1.0; - -if (T<66.0) - { - red = 255.0; - green = T; - green = 99.4708025 * log(green) - 161.11956; - - if (T <=19) - {blue = 0.0;} - else - { - blue = T-10; - blue = 138.517731 * log(blue) - 305.044792; - } - - - } -else - { - red = T - 60.0; - red = 329.6987 * pow(red, -0.1332047); - - green = T - 60.0; - green = 288.122169 * pow(green, -0.075514); - - blue = 255.0; - } - -alpha = 0.8 * smoothstep(5.0, 15.0, T); - -vec3 color = vec3 (red, green, blue); -color /= 255.0; - -color = clamp(color, 0.0, 1.0); - -return vec4 (color, alpha); -} diff --git a/Compositor/Shaders/ALS/drunway.frag b/Compositor/Shaders/ALS/drunway.frag deleted file mode 100644 index f855cbe35..000000000 --- a/Compositor/Shaders/ALS/drunway.frag +++ /dev/null @@ -1,509 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2011, based on default.frag -// Ambient term comes in gl_Color.rgb. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec2 rawPos; -varying vec3 ecViewdir; - - -uniform float fg_Fcoef; - -uniform sampler2D texture; -uniform sampler2D NormalTex; -uniform sampler2D mix_texture; -uniform sampler2D grain_texture; - -varying float steepness; - -varying float flogz; - - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float snowlevel; -uniform float dust_cover_factor; -uniform float lichen_cover_factor; -uniform float filter_threshold; -uniform float filter_transition; -uniform float size_base; -uniform float size_overlay; -uniform float size_grain; -uniform float strength_05m; -uniform float strength_1m; -uniform float strength_2m; -uniform float strength_5m; -uniform float strength_10m; -uniform float relief_strength; -uniform float grain_strength; -uniform float bias_center_strength; -uniform float wetness; -uniform float fogstructure; -uniform float snow_thickness_factor; -uniform float cloud_self_shading; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; -uniform float air_pollution; - - -uniform int quality_level; -uniform int tquality_level; -uniform int cloud_shadow_flag; -uniform int bias_center; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; -float yprime_alt; -float mie_angle; - - -float shadow_func (in float x, in float y, in float noise, in float dist); -float Noise2D(in vec2 coord, in float wavelength); -float fog_func (in float targ, in float alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); - -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float light_arg); -vec3 filter_combined (in vec3 color) ; - - - -void main() -{ - - - -yprime_alt = diffuse_term.a; -//diffuse_term.a = 1.0; -mie_angle = gl_Color.a; -float effective_scattering = min(scattering, cloud_self_shading); - -// distance to fragment -float dist = length(relPos); -// angle of view vector with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - color.a = 1.0; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector; - if (quality_level<6) - {halfVector = gl_LightSource[0].halfVector.xyz;} - else - {halfVector = normalize(normalize(lightDir) + normalize(ecViewdir));} - - vec4 texel; - vec4 snow_texel; - vec4 mix_texel; - vec4 grain_texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - -// get noise at different wavelengths - -// used: 5m, 5m gradient, 10m, 10m gradient: heightmap of the closeup terrain, 10m also snow -// 50m: detail texel -// 250m: detail texel -// 500m: distortion and overlay -// 1500m: overlay, detail, dust, fog -// 2000m: overlay, detail, snow, fog - -float noise_01m; -float noise_05m = Noise2D(rawPos.xy, 0.5); -float noise_1m = Noise2D(rawPos.xy, 1.0); -float noise_2m = Noise2D(rawPos.xy, 2.0); -float noise_10m = Noise2D(rawPos.xy, 10.0); -float noise_5m = Noise2D(rawPos.xy ,5.0); - - -float noisegrad_10m; -float noisegrad_5m; - -float noise_50m = Noise2D(rawPos.xy, 50.0);; -float noise_250m; -float noise_500m = Noise2D(rawPos.xy, 500.0); -float noise_1500m = Noise2D(rawPos.xy, 1500.0); -float noise_2000m = Noise2D(rawPos.xy, 2000.0); - - - - - -// - - -// get the texels - - //texel = texture2D(texture, gl_TexCoord[0].st); - //mix_texel = texture2D(mix_texture, gl_TexCoord[0].st * 5.0); - texel = texture2D(texture, rawPos * 1.0/size_base); - mix_texel = texture2D(mix_texture, rawPos * 1.0/size_overlay); - grain_texel = texture2D(grain_texture, rawPos * 1.0/size_grain); - vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * 8.0); - //vec4 nmap = texture2D(NormalTex, rawPos * 0.01); - vec3 N = nmap.rgb * 2.0 - 1.0; - - float distortion_factor = 1.0; - vec2 stprime; - int flag = 1; - int mix_flag = 1; - float noise_term; - float snow_alpha; - - - //noise_term = smoothstep(overlay_limit ,1.0,noise_1m); - //noise_term = smoothstep(overlay_limit, 1.0, 0.5 * noise_1m + 0.5 * noise_10m); - noise_term = strength_05m * noise_05m; - noise_term += strength_1m * noise_1m; - noise_term += strength_2m * noise_2m; - noise_term += strength_5m * noise_5m; - noise_term += strength_10m * noise_10m; - - - - if (bias_center == 1) - { - float centerness = smoothstep(0.02, 0.1, (0.14 - abs(gl_TexCoord[0].s - 0.14))); - centerness *= smoothstep(0.05, 0.15, gl_TexCoord[0].t); - centerness = 1.0 - centerness; - - noise_term *= (1.0 - bias_center_strength) + bias_center_strength * centerness; - noise_term = clamp(noise_term, 0.0, 1.0); - } - - float filtered_noise_term = smoothstep(filter_threshold, filter_threshold + filter_transition, noise_term); - - texel = mix(texel, mix_texel, filtered_noise_term); - - texel.rgb = mix(texel.rgb, grain_texel.rgb, grain_strength * grain_texel.a * (1.0 - noise_term));// * (1.0-smoothstep(2000.0,5000.0, dist))); - - - - //float view_angle = abs(dot(normal, normalize(ecViewdir))); - - //if ((quality_level > 3)&&(relPos.z + eye_alt +500.0 > snowlevel)) - if (quality_level > 3) - { - float sfactor; - noise_01m = Noise2D(rawPos.xy,0.1); - snow_texel = vec4 (0.95, 0.95, 0.95, 1.0) * (0.9 + 0.1* noise_50m + 0.1* (1.0 - noise_10m) ); - snow_texel.a = 1.0; - noise_term = 0.1 * (noise_50m-0.5); - sfactor = 1.0;//sqrt(2.0 * (1.0-steepness)/0.03) + abs(ct)/0.15; - noise_term = noise_term + 0.2 * (noise_10m -0.5) * (1.0 - smoothstep(10000.0*sfactor, 16000.0*sfactor, dist) ) ; - noise_term = noise_term + 0.3 * (noise_5m -0.5) * (1.0 - smoothstep(1200.0 * sfactor, 2000.0 * sfactor, dist) ) ; - noise_term = noise_term + 0.3 * (noise_1m -0.5) * (1.0 - smoothstep(500.0 * sfactor, 1000.0 *sfactor, dist) ); - noise_term = noise_term + 0.3 * (noise_01m -0.5) * (1.0 - smoothstep(20.0 * sfactor, 100.0 *sfactor, dist) ); - snow_texel.a = snow_texel.a * 0.2+0.8* smoothstep(0.2,0.8, 0.3 +noise_term + 0.2*snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) ); - - } - - -const vec4 dust_color = vec4 (0.76, 0.71, 0.56, 1.0); -const vec4 lichen_color = vec4 (0.17, 0.20, 0.06, 1.0);; -//float snow_alpha; - -if (quality_level > 3) - { - - // mix vegetation - texel = mix(texel, lichen_color, 0.4 * lichen_cover_factor + 0.8 * lichen_cover_factor * 0.5 * (noise_10m + (1.0 - noise_5m)) ); - // mix dust - texel = mix(texel, dust_color, clamp(0.5 * dust_cover_factor + 3.0 * dust_cover_factor * (((noise_1500m - 0.5) * 0.125)+0.125 ),0.0, 1.0) ); - - // mix snow - if (relPos.z + eye_alt +500.0 > snowlevel) - { - snow_alpha = smoothstep(0.75, 0.85, abs(steepness)); - texel = mix(texel, snow_texel, snow_texel.a* smoothstep(snowlevel, snowlevel+200.0, snow_alpha * (relPos.z + eye_alt)+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0)); - } - } - - - -// get distribution of water when terrain is wet - -float water_threshold1; -float water_threshold2; -float water_factor =0.0; - - -if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0)) - { - water_threshold1 = 1.0-0.5* wetness; - water_threshold2 = 1.0 - 0.3 * wetness; - //water_factor = smoothstep(water_threshold1, water_threshold2 , (0.3 * (2.0 * (1.0-noise_10m) + (1.0 -noise_5m)) * (1.0 - smoothstep(2000.0, 5000.0, dist))) - 5.0 * (1.0 -steepness)); - water_factor = smoothstep(water_threshold1, water_threshold2 , 0.5 * (noise_5m + (1.0 -noise_1m))) * (1.0 - smoothstep(1000.0, 3000.0, dist)); - } - -// darken wet terrain - - texel.rgb = texel.rgb * (1.0 - 0.6 * wetness - 0.1 * water_factor); - - -// light computations - - - vec4 light_specular = gl_LightSource[0].specular; - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - //n = (2.0 * gl_Color.a - 1.0) * normal; - n = normal;//vec3 (nvec.x, nvec.y, sqrt(1.0 -pow(nvec.x,2.0) - pow(nvec.y,2.0) )); - n = normalize(n); - - NdotL = dot(n, lightDir); - - if (quality_level > 4) - { - NdotL = NdotL + (3.0 * N.r + 0.1 * (noise_01m-0.5))* (1.0 - water_factor) * relief_strength; - //NdotL = NdotL + 3.0 * N.r + 0.1 * (noise_01m-0.5) ; - } - if (NdotL > 0.0) { - if (cloud_shadow_flag == 1) - {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 1.0, dist);} - color += diffuse_term * NdotL; - NdotHV = max(dot(n, halfVector), 0.0); - //if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = ((gl_FrontMaterial.specular.rgb + (water_factor * vec3 (1.0, 1.0, 1.0))) - * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor))); - } - color.a = 1.0;//diffuse_term.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light.rgb += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - color.rgb +=secondary_light * light_distance_fading(dist); - - fragColor = color * texel + specular; - - -float lightArg = (terminator-yprime_alt)/100000.0; - -vec3 hazeColor = get_hazeColor(lightArg); - - -// Rayleigh color shifts - - if ((quality_level > 5) && (tquality_level > 5)) - { - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); -// Rayleigh color shift due to in-scattering - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - } - - -// here comes the terrain haze model - -float delta_z = hazeLayerAltitude - eye_alt; -float mvisibility = min(visibility, avisibility); - -if (dist > 0.04 * mvisibility) -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - - - -if (visibility < avisibility) - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility + 1.0 * visibility * fogstructure * 0.06 * (noise_1500m + noise_2000m -1.0) )); - - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 - effective_scattering); - - } -else - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility + 1.0 * avisibility * fogstructure * 0.06 * (noise_1500m + noise_2000m - 1.0) )); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 - effective_scattering); - } - -transmission = fog_func(transmission_arg, alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - -// now dim the light for haze -eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - -// Mie-like factor - - if (lightArg < 10.0) - { - intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -intensity = length(hazeColor); - -if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColor doesn't come out correctly -{ - - - // high altitude desaturation of the haze color - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - - // blue hue of haze - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - - - // additional blue in indirect light - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - // change haze color to blue hue for strong fogging - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - - - // reduce haze intensity when looking at shaded surfaces, only in terminator region - float shadow = mix( min(1.0 + dot(n,lightDir),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); - hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - } - - -// don't let the light fade out too rapidly -lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - -hazeColor.rgb *= eqColorFactor * eShade; -hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - -fragColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility) , fragColor.rgb,transmission); - -} - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} - diff --git a/Compositor/Shaders/ALS/filters.frag b/Compositor/Shaders/ALS/filters.frag deleted file mode 100644 index cb69c2a31..000000000 --- a/Compositor/Shaders/ALS/filters.frag +++ /dev/null @@ -1,146 +0,0 @@ -// -*-C++-*- - -// This is a library of filter functions - -// Thorsten Renk 2016 - -#version 120 - -uniform float gamma; -uniform float brightness; -uniform float delta_T; -uniform float osg_SimulationTime; -uniform float fact_grey; -uniform float fact_black; - -uniform bool use_filtering; -uniform bool use_night_vision; -uniform bool use_IR_vision; - -uniform int display_xsize; -uniform int display_ysize; - -float rand2D(in vec2 co); -float Noise2D(in vec2 coord, in float wavelength); - -vec3 gamma_correction (in vec3 color) { - - -float value = length(color)/1.732; -return pow(value, gamma) * color; - -} - -vec3 brightness_adjust (in vec3 color) { - -return clamp(brightness * color, 0.0, 1.0); - -} - -vec3 night_vision (in vec3 color) { - -float value = length(color)/1.732; - -vec2 center = vec2 (float(display_xsize) * 0.5, float(display_ysize) * 0.5); -float noise = Noise2D( vec2 (gl_FragCoord.x + 100.0 * osg_SimulationTime, gl_FragCoord.y + 300.0 * osg_SimulationTime), 4.0); - -float fade = 1.0 - smoothstep( 0.3 * display_ysize, 0.55 * display_ysize, length(gl_FragCoord.xy -center)); - -return vec3 (0.0, 1.0, 0.0) * value * (0.5 + 0.5 * noise) * fade; - -} - - -vec3 IR_vision (in vec3 color) { - -float value = length(color)/1.732; -value = 1.0 - value; - -float T_mapped = smoothstep(-10.0, 10.0, delta_T); - -float gain = mix(T_mapped, value, 0.5); -//float gain = 0.2 * T_mapped + 0.8 * value * T_mapped; -if (delta_T < -10.0) {gain = 0.0;} - - -return vec3 (0.7, 0.7, 0.7) * gain; - -} - - -vec3 moonlight_perception (in vec3 light) { - -return light; - -} - - -vec3 g_force (in vec3 color) { - -vec2 center = vec2 (float(display_xsize) * 0.5, float(display_ysize) * 0.5); - -float greyout_band_width = 0.2; -float blackout_band_width = 0.3; - -float f_grey = 1.0 - fact_grey; - -float greyout = smoothstep( f_grey * display_ysize, (f_grey + greyout_band_width) * display_ysize, length(gl_FragCoord.xy -center)); - -float tgt_brightness = (1.0 - 0.5 * greyout); - -float noise = Noise2D( vec2 (gl_FragCoord.x + 100.0 * osg_SimulationTime, -gl_FragCoord.y + 300.0 * osg_SimulationTime), 8.0); - -float f_black = 1.0 - fact_black; - -noise *= (1.0 - smoothstep(0.0, 0.5, f_black)); - -color = mix(color, vec3 (1.0, 1.0, 1.0) * mix(length(color), -tgt_brightness, greyout) , 0.9* greyout + 0.6 * noise); -color *= tgt_brightness; - -float blackout = 1.0 - smoothstep( f_black * display_ysize, (f_black + blackout_band_width) * display_ysize, length(gl_FragCoord.xy -center)); - -color *= blackout; - -return color; - -} - -vec3 filter_combined (in vec3 color) { - - // Apply some dithering to eliminate banding caused by rendering to a - // 32 bpp framebuffer - float dither_noise = rand2D(gl_FragCoord.xy); - color += mix(-0.5/255.0, 0.5/255.0, dither_noise); - -if (use_filtering == false) - { - return color; - } - -color = g_force(color); - - -if (use_night_vision) - { - color = brightness_adjust(color); - color = night_vision(color); - } - -else if (use_IR_vision) - { - float IR_brightness = min(1.0/(brightness+0.01), 5.0); - color = clamp(IR_brightness * color, 0.0, 1.0); - color = IR_vision(color); - } -else - { - color = brightness_adjust(color); - } - -return gamma_correction (color); - -} - - diff --git a/Compositor/Shaders/ALS/filters.vert b/Compositor/Shaders/ALS/filters.vert deleted file mode 100644 index 5027e7d6c..000000000 --- a/Compositor/Shaders/ALS/filters.vert +++ /dev/null @@ -1,11 +0,0 @@ -// -*-C++-*- - -// This is a library of filter functions for the vertex shader - -// Thorsten Renk 2017 - -vec3 moonlight_perception (in vec3 light) { - -return light; - -} diff --git a/Compositor/Shaders/ALS/flutter.vert b/Compositor/Shaders/ALS/flutter.vert deleted file mode 100644 index 1708a9357..000000000 --- a/Compositor/Shaders/ALS/flutter.vert +++ /dev/null @@ -1,315 +0,0 @@ -// -*-C++-*- -// © Vivian Meazza - 2011 -// adapted to Atmospheric Light Scattering by Thorsten Renk 2013 - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. - -#version 120 -#define fps2kts 0.5925 - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -// The ambient term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; - -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - -uniform int colorMode; -uniform float osg_SimulationTime; -uniform float Offset, AmpFactor, WindE, WindN, spd, hdg; -uniform sampler3D Noise; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; -uniform float moonlight; - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float earthShade; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -float normalize_range(float _val) - { - if (_val > 180.0) - return _val - 360.0; - else - return _val; - } - -void relWind(out float rel_wind_speed_kts, out float rel_wind_from_rad) - { - //calculate speed north and east in kts - float speed_north_kts = cos(radians(hdg)) * spd ; - float speed_east_kts = sin(radians(hdg)) * spd ; - - //calculate the relative wind speed north and east in kts - float rel_wind_speed_from_east_kts = WindE*fps2kts + speed_east_kts; - float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts; - - //combine relative speeds north and east to get relative windspeed in kts - rel_wind_speed_kts = sqrt(pow(abs(rel_wind_speed_from_east_kts), 2.0) - + pow(abs(rel_wind_speed_from_north_kts), 2.0)); - - //calculate the relative wind direction - float rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts)); - //rel_wind_from_rad = atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts); - float rel_wind = rel_wind_from_deg - hdg; - rel_wind = normalize_range(rel_wind); - rel_wind_from_rad = radians(rel_wind); - } - -void rotationmatrix(in float angle, out mat4 rotmat) - { - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); - } - -void main() - { - vec4 light_diffuse; - vec4 light_ambient; - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - - - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - - - - mat4 RotationMatrix; - - float relWindspd=0.0; - float relWinddir=0.0; - - // compute relative wind speed and direction - relWind (relWindspd, relWinddir); - - // map noise vector - vec4 noisevec = texture3D(Noise, gl_Vertex.xyz); - - //waving effect - float tsec = osg_SimulationTime; - vec4 pos = gl_Vertex; - vec4 oldpos = gl_Vertex; - - float freq = (10.0 * relWindspd) + 10.0; - pos.y = sin((pos.x * 5.0 + tsec * freq )/5.0) * 0.5 ; - pos.y += sin((pos.z * 5.0 + tsec * freq/2.0)/5.0) * 0.125 ; - - pos.y *= pow(pos.x - Offset, 2.0) * AmpFactor; - - //rotate the flag to align with relative wind - rotationmatrix(-relWinddir, RotationMatrix); - pos *= RotationMatrix; - gl_Position = gl_ModelViewProjectionMatrix * pos; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - - //do the colour and fog - vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = gl_NormalMatrix * gl_Normal; - vec4 ambient_color, diffuse_color; - - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - - // first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = gl_Vertex.xyz - ep.xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(gl_Vertex.z,100.0); - scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * scattering; - - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - - - - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - //light_ambient = light_ambient * (0.7 + 0.3 * smoothstep(0.2, 0.5, earthShade)); - intensity = length(light_ambient.xyz); - - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.xyz); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.7,earthShade) )); - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_diffuse = vec4 (1.0, 1.0, 1.0, 0.0); - light_ambient = vec4 (0.33, 0.4, 0.5, 0.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - light_diffuse.b = 0.78 + lightArg * 0.21; - light_diffuse.g = 0.907 + lightArg * 0.091; - light_diffuse.r = 0.904 + lightArg * 0.092; - light_diffuse.a = 1.0; - - light_ambient.r = 0.316 + lightArg * 0.016; - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - } - - light_diffuse = light_diffuse * scattering; - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - - - - - - diffuse_term = diffuse_color * light_diffuse; - vec4 ambient_term = ambient_color * light_ambient; - - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = gl_Color.a; - - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = ambient_term.rgb; gl_FrontColor.a = 0.0; - gl_BackColor.rgb = ambient_term.rgb; gl_FrontColor.a = 1.0; -// fogCoord = abs(ecPosition.z / ecPosition.w); - - //fog_Func(fogType); - - } diff --git a/Compositor/Shaders/ALS/generic-base.vert b/Compositor/Shaders/ALS/generic-base.vert deleted file mode 100644 index e52450c0f..000000000 --- a/Compositor/Shaders/ALS/generic-base.vert +++ /dev/null @@ -1,254 +0,0 @@ -// -*-C++-*- -#version 120 - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -// Haze part added by Thorsten Renk, Oct. 2011 - - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec4 ecPosition; - -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - -uniform int colorMode; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; -uniform float moonlight; - - -void setupShadows(vec4 eyeSpacePos); - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - - -float earthShade; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - - vec4 light_diffuse; - vec4 light_ambient; - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - - - //float yprime_alt; - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - -// this code is copied from default.vert - - ecPosition = gl_ModelViewMatrix * gl_Vertex; - gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = gl_NormalMatrix * gl_Normal; - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - - - // here start computations for the haze layer - // we need several geometrical quantities - - // first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = gl_Vertex.xyz - ep.xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(gl_Vertex.z,100.0); - scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * scattering; - - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - - - - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - //light_ambient = light_ambient * (0.7 + 0.3 * smoothstep(0.2, 0.5, earthShade)); - intensity = length(light_ambient.xyz); - - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.xyz); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_diffuse = vec4 (1.0, 1.0, 1.0, 0.0); - light_ambient = vec4 (0.33, 0.4, 0.5, 0.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - light_diffuse.b = 0.78 + lightArg * 0.21; - light_diffuse.g = 0.907 + lightArg * 0.091; - light_diffuse.r = 0.904 + lightArg * 0.092; - light_diffuse.a = 1.0; - - light_ambient.r = 0.316 + lightArg * 0.016; - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - } - - light_diffuse = light_diffuse * scattering; - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - - -// default lighting based on texture and material using the light we have just computed - - diffuse_term = diffuse_color* light_diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + light_ambient); - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = gl_Color.a; - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0; - gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; - - setupShadows(gl_ModelViewMatrix * gl_Vertex); -} - - - - diff --git a/Compositor/Shaders/ALS/glass.frag b/Compositor/Shaders/ALS/glass.frag deleted file mode 100644 index 1d8110896..000000000 --- a/Compositor/Shaders/ALS/glass.frag +++ /dev/null @@ -1,260 +0,0 @@ -// -*-C++-*- -#version 120 - -varying vec2 rawPos; -varying vec2 nPos; -varying vec3 vertPos; -varying vec3 normal; -varying vec3 refl_vec; -varying vec3 light_diffuse; -varying float splash_angle; -varying float Mie; -varying float ambient_fraction; - -varying float flogz; - -uniform float fg_Fcoef; - -uniform sampler2D texture; -uniform sampler2D frost_texture; -uniform sampler2D func_texture; -uniform samplerCube cube_texture; -uniform samplerCube cube_light_texture; - -uniform vec4 tint; -uniform vec3 overlay_color; - - -uniform float rain_norm; -uniform float ground_splash_norm; -uniform float frost_level; -uniform float fog_level; -uniform float reflection_strength; -uniform float overlay_alpha; -uniform float overlay_glare; -uniform float splash_x; -uniform float splash_y; -uniform float splash_z; -uniform float lightmap_r_factor; -uniform float lightmap_g_factor; -uniform float lightmap_b_factor; -uniform float lightmap_a_factor; -uniform float osg_SimulationTime; - -uniform int use_reflection; -uniform int use_reflection_lightmap; -uniform int use_mask; -uniform int use_wipers; -uniform int use_overlay; -uniform int adaptive_mapping; -uniform int lightmap_multi; - -uniform vec3 lightmap_r_color; -uniform vec3 lightmap_g_color; -uniform vec3 lightmap_b_color; -uniform vec3 lightmap_a_color; - -float DotNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density); -float DropletNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density); -float Noise2D(in vec2 coord, in float wavelength); -vec3 filter_combined (in vec3 color) ; - -void main() -{ - -vec4 texel; -vec4 frost_texel; -vec4 func_texel; - -texel = texture2D(texture, gl_TexCoord[0].st); -texel *=gl_Color; - -vec2 frost_coords; - -if (adaptive_mapping == 1) {frost_coords = gl_TexCoord[0].st * 7.0;} -else if (adaptive_mapping ==2) {frost_coords = nPos * 7.0;} -else {frost_coords = vertPos.xy * 7.0;} - -frost_texel = texture2D(frost_texture, frost_coords); -func_texel = texture2D(func_texture, gl_TexCoord[0].st); - - - -float noise_003m = Noise2D(vertPos.xy, 0.03); -float noise_0003m = Noise2D(vertPos.xy, 0.003); - - -// environment reflection, including a lightmap for the reflections - -vec4 reflection = textureCube(cube_texture, refl_vec); -vec4 reflection_lighting = textureCube(cube_light_texture, refl_vec); - -vec3 lightmapcolor = vec3(0.0, 0.0, 0.0); - - -if (use_reflection_lightmap == 1) - { - vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor, lightmap_b_factor, lightmap_a_factor); - lightmapFactor = lightmapFactor * reflection_lighting; - if (lightmap_multi > 0 ) - { - lightmapcolor = lightmap_r_color * lightmapFactor.r + - lightmap_g_color * lightmapFactor.g + - lightmap_b_color * lightmapFactor.b + - lightmap_a_color * lightmapFactor.a ; - } - else - { - lightmapcolor = reflection_lighting.rgb * lightmap_r_color * lightmapFactor.r; - } - - } - -float lightmap_intensity = length(lightmapcolor); -float light_fraction = clamp(lightmap_intensity / (length(light_diffuse.rgb) + 0.01), 0.0, 5.0); - -if (light_fraction < 1.0) {light_fraction = smoothstep(0.7, 1.0, light_fraction);} - - -if (use_reflection ==1) - { - // to determine whether what we see reflected is currently in light, we make the somewhat drastic - // assumption that its normal will be opposite to the glass normal - // (which is mostly truish in a normal cockpit) - float reflection_shade = ambient_fraction + (1.0-ambient_fraction) * max(0.0, dot (normalize(normal), normalize(gl_LightSource[0].position.xyz))); - - texel.rgb = mix(texel.rgb, reflection.rgb, (reflection_strength * reflection_shade * (1.0-Mie))); - - } - -//texel.rgb = mix(texel.rgb, lightmapcolor.rgb, lightmap_intensity); - -// overlay pattern - -if ((use_mask == 1) && (use_overlay==1)) - { - vec4 overlay_texel = vec4(overlay_color, overlay_alpha); - overlay_texel.rgb *= light_diffuse.rgb* (1.0 + (1.0 + overlay_glare)*Mie); - overlay_texel.a *=(1.0 + overlay_glare* Mie); - texel = mix(texel, overlay_texel, func_texel.b * overlay_texel.a); - } - - -// frost - -float fth = (1.0-frost_level) * 0.4 + 0.3; -float fbl = 0.2 * frost_level; - - -float frost_factor = (fbl + (1.0-fbl)* smoothstep(fth,fth+0.2,noise_003m)) * (4.0 + 4.0* Mie); - - -float background_frost = 0.5 * smoothstep(0.7,1.0,frost_level); -frost_texel.rgb = mix(frost_texel.rgb, vec3 (0.5,0.5,0.5), (1.0- smoothstep(0.0,0.02,frost_texel.a))); -frost_texel.a =max(frost_texel.a, background_frost * (1.0- smoothstep(0.0,0.02,frost_texel.a))); - -frost_texel *= vec4(light_diffuse.rgb,0.5) * (1.0 + 3.0 * Mie); - -frost_factor = max(frost_factor, 0.8*background_frost); - - -texel.rgb = mix(texel.rgb, frost_texel.rgb, frost_texel.a * frost_factor * smoothstep(0.0,0.1,frost_level)); -texel.a = max(texel.a, frost_texel.a * frost_level); - -// rain splashes - -vec3 splash_vec = vec3 (splash_x, splash_y, splash_z); -float splash_speed = length(splash_vec); - - -float rain_factor = 0.0; - -float rnorm = max(rain_norm, ground_splash_norm); - -if (rnorm > 0.0) - { - float droplet_size = (0.5 + 0.8 * rnorm) * (1.0 - 0.1 * splash_speed); - vec2 rainPos = vec2 (rawPos.x * splash_speed, rawPos.y / splash_speed ); - rainPos.y = rainPos.y - 0.1 * smoothstep(1.0,2.0, splash_speed) * osg_SimulationTime; - if (splash_angle> 0.0) - { - // the dynamically impacting raindrops - - float time_shape = 1.0; - float base_rate = 6.0 + 3.0 * rnorm + 4.0 * (splash_speed - 1.0); - float base_density = 0.6 * rnorm + 0.4 * (splash_speed -1.0); - if ((use_mask ==1)&&(use_wipers==1)) {base_density *= (1.0 - 0.5 * func_texel.g);} - - float time_fact1 = (sin(base_rate*osg_SimulationTime)); - float time_fact2 = (sin(base_rate*osg_SimulationTime + 1.570)); - float time_fact3 = (sin(base_rate*osg_SimulationTime + 3.1415)); - float time_fact4 = (sin(base_rate*osg_SimulationTime + 4.712)); - - time_fact1 = smoothstep(0.0,1.0, time_fact1); - time_fact2 = smoothstep(0.0,1.0, time_fact2); - time_fact3 = smoothstep(0.0,1.0, time_fact3); - time_fact4 = smoothstep(0.0,1.0, time_fact4); - - rain_factor += DotNoise2D(rawPos.xy, 0.02 * droplet_size ,0.5, base_density ) * time_fact1; - rain_factor += DotNoise2D(rainPos.xy, 0.03 * droplet_size,0.4, base_density) * time_fact2; - rain_factor += DotNoise2D(rawPos.xy, 0.04 * droplet_size ,0.3, base_density)* time_fact3; - rain_factor += DotNoise2D(rainPos.xy, 0.05 * droplet_size ,0.25, base_density)* time_fact4; - } - - - // the static pattern of small droplets created by the splashes - - float sweep = min(1./splash_speed,1.0); - if ((use_mask ==1)&&(use_wipers==1)) {sweep *= (1.0 - func_texel.g);} - if (adaptive_mapping ==2) {rainPos = nPos;} - rain_factor += DropletNoise2D(rainPos.xy, 0.02 * droplet_size ,0.5, 0.6* rnorm * sweep); - rain_factor += DotNoise2D(rainPos.xy, 0.012 * droplet_size ,0.7, 0.6* rnorm * sweep); - } - -rain_factor = smoothstep(0.1,0.2, rain_factor) * (1.0 - smoothstep(0.4,1.0, rain_factor) * (0.2+0.8*noise_0003m)); - - -vec4 rainColor = vec4 (0.2,0.2, 0.2, 0.6 - 0.3 * smoothstep(1.0,2.0, splash_speed)); -rainColor.rgb *= length(light_diffuse)/1.73; - - - -// glass tint - - -vec4 outerColor = mix(texel, rainColor, rain_factor); -// now mix illuminated reflections in - -vec3 reflLitColor = reflection.rgb * lightmapcolor.rgb; - -outerColor.rgb = mix(outerColor.rgb, reflLitColor, clamp(reflection_strength * light_fraction,0.0,1.0)); -outerColor.a = max(outerColor.a, 0.1 * light_fraction * reflection_strength); - -outerColor *= tint; - - - - -// fogging - this is inside the glass - -vec4 fog_texel = vec4 (0.6,0.6,0.6, fog_level); - -if (use_mask == 1) {fog_texel.a = fog_texel.a * func_texel.r;} - -fog_texel *= vec4(light_diffuse.rgb,1.0); -fog_texel.rgb *= (1.0 + 3.0 * Mie); -fog_texel.a *= min((1.0 + 0.5 * Mie), 0.85); - - -vec4 fragColor; - -fragColor.rgb = mix(outerColor.rgb, fog_texel.rgb, fog_texel.a); -fragColor.a = max(outerColor.a, fog_texel.a); - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = clamp(fragColor,0.0,1.0); -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} diff --git a/Compositor/Shaders/ALS/glass.vert b/Compositor/Shaders/ALS/glass.vert deleted file mode 100644 index 886677eab..000000000 --- a/Compositor/Shaders/ALS/glass.vert +++ /dev/null @@ -1,143 +0,0 @@ -// -*-C++-*- -#version 120 - -varying vec2 rawPos; -varying vec2 nPos; -varying vec3 vertPos; -varying vec3 normal; -varying vec3 light_diffuse; -varying vec3 refl_vec; -varying float splash_angle; -varying float Mie; -varying float ambient_fraction; - -varying float flogz; - -uniform float ground_scattering; -uniform float hazeLayerAltitude; -uniform float moonlight; -uniform float terminator; -uniform float splash_x; -uniform float splash_y; -uniform float splash_z; - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - -vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - -// geometry for lighting -vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); -vec3 relPos = gl_Vertex.xyz - ep.xyz; -vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; -vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); -float dist = length(relPos); -float vertex_alt = max(gl_Vertex.z,100.0); -float scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); -float yprime_alt = - sqrt(2.0 * EarthRadius * vertex_alt); -float earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; -float lightArg = (terminator-yprime_alt)/100000.0; - -// light computation - -vec3 light_ambient; - -light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); -light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); -light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); -light_diffuse = light_diffuse * scattering; - - -light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); -light_ambient.g = light_ambient.r * 0.4/0.33; -light_ambient.b = light_ambient.r * 0.5/0.33; - -float intensity; - -if (earthShade < 0.5) - { - intensity = length(light_ambient.xyz); - - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.xyz); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - } - - -float MieFactor = dot(normalize(lightFull), normalize(relPos)); -Mie = smoothstep(0.9,1.0, MieFactor) * earthShade * earthShade * scattering; - - -// get a reflection vector for cube map - -vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; -normal = normalize(gl_NormalMatrix * gl_Normal); -vec4 reflect_eye = vec4(reflect(ecPosition.xyz, normal), 0.0); -vec3 reflVec_stat = normalize(gl_ModelViewMatrixInverse * reflect_eye).xyz; -refl_vec = reflVec_stat; - -// get a projection plane orthogonal to the splash vector - -vec3 splash_vec = vec3 (splash_x, splash_y, splash_z); -vec3 corrected_splash = normalize(splash_vec); - -float angle = abs(dot(corrected_splash, gl_Normal)); - - -//corrected_splash = normalize(corrected_splash + 0.4* gl_Normal ); - - -vec3 base_1 = vec3 (-corrected_splash.y, corrected_splash.x, 0.0); -vec3 base_2 = cross (corrected_splash, base_1); - -base_1 = normalize(base_1); -base_2 = normalize(base_2); - -rawPos = vec2 (dot(gl_Vertex.xyz, base_1), dot(gl_Vertex.xyz, base_2)); - -base_1 = vec3 (-gl_Normal.y, gl_Normal.x, 0.0); -base_2 = cross(gl_Normal, base_1); - -base_1 = normalize(base_1); -base_2 = normalize(base_2); - -nPos = vec2 (dot(gl_Vertex.xyz, base_1), dot(gl_Vertex.xyz, base_2)); - -vertPos = gl_Vertex.xyz; - -splash_angle = dot(gl_Normal, corrected_splash); - -ambient_fraction = length(light_ambient.rgb)/(length(light_diffuse.rgb +light_ambient.rgb ) + 0.01); - - -gl_Position = ftransform(); -// logarithmic depth -flogz = 1.0 + gl_Position.w; - -vec4 diffuse_color = gl_FrontMaterial.diffuse; -vec4 ambient_color = gl_FrontMaterial.ambient; - -vec4 constant_term = gl_FrontMaterial.emission + ambient_color * vec4 (light_diffuse.rgb + light_ambient.rgb,1.0); -constant_term.a = min(diffuse_color.a, ambient_color.a); - -gl_FrontColor = constant_term; -gl_BackColor = gl_FrontColor; - -} diff --git a/Compositor/Shaders/ALS/grass.frag b/Compositor/Shaders/ALS/grass.frag deleted file mode 100755 index 2767e7afb..000000000 --- a/Compositor/Shaders/ALS/grass.frag +++ /dev/null @@ -1,180 +0,0 @@ -// -*-C++-*- -#version 120 - -#define BLADE_FRACTION 0.1 -#define MAX_DISTANCE 1000.0 - -uniform float fg_Fcoef; - -uniform float visibility; -uniform float scattering; -uniform float overlay_bias; -uniform float season; -uniform float max_height; -uniform float grass_density; -uniform float grass_modulate_height_min; - -uniform float wind_x; -uniform float wind_y; - -uniform float wash_x; -uniform float wash_y; -uniform float wash_strength; - -uniform int grass_modulate_by_overlay; -uniform int grass_groups; -uniform int wind_effects; - -uniform sampler2D colorTex; -uniform sampler2D densityTex; - -uniform float osg_SimulationTime; - -varying vec2 g_rawpos; // Horizontal position in model space -varying float g_distance_to_eye; // Distance to the camera. Layers were disregarded -varying float g_layer; // The layer where the fragment lives (0-1 range) - -varying float flogz; - -float rand2D(in vec2 co); -float Noise2D(in vec2 co, in float wavelength); -vec3 filter_combined (in vec3 color) ; - -float getShadowing(); - - -float map(float s, float a1, float a2, float b1, float b2) -{ - return b1+(s-a1)*(b2-b1)/(a2-a1); -} - -float decodeBinary(float n, float layer) -{ - return float(mod(floor(n*pow(0.5, layer)), 2.0)); -} - - -float bladeNoise2D(in float x, in float y, in float dDensity, in float layer, in float d_factor, in float h_factor) -{ - float integer_x = x - fract(x); - float fractional_x = x - integer_x; - - float integer_y = y - fract(y); - float fractional_y = y - integer_y; - - if (rand2D(vec2(integer_x+1.0, integer_y +1.0)) > dDensity) - {return 0.0;} - - float hfact = 0.7 + 0.3 * (rand2D(vec2(integer_x, integer_y + 2.0))); - hfact *= h_factor; - - if (layer > hfact) {return 0.0;} - - float xoffset = (rand2D(vec2(integer_x, integer_y)) -0.5); - float yoffset = (rand2D(vec2(integer_x+1.0, integer_y)) - 0.5); - - float xbend = (rand2D(vec2(integer_x+1.0, integer_y + 1.0)) - 0.5); - float ybend = (rand2D(vec2(integer_x, integer_y + 1.0)) - 0.5); - float fraction = BLADE_FRACTION * (0.5 + 0.5 * (1.0 - smoothstep(0.5, 1.0, layer))); - - float bend = 0.5 * layer * layer; - - vec2 truePos = vec2 (0.5 + xoffset * (1.0 - 2.0 * BLADE_FRACTION) + xbend * bend, 0.5 + yoffset * (1.0 -2.0 * BLADE_FRACTION) + ybend * bend); - - float distance = length(truePos - vec2(fractional_x, fractional_y)); - return 1.0 - step (fraction * d_factor, distance); -} - -float BladeNoise2D(in vec2 coord, in float wavelength, in float dDensity, in float layer, in float d_factor, in float h_factor) -{ -return bladeNoise2D(coord.x/wavelength, coord.y/wavelength, dDensity, layer, d_factor, h_factor); -} - -void main() -{ - - if (season > 1.6) {discard;} - if (g_distance_to_eye > MAX_DISTANCE) {discard;} - - vec2 texCoord = gl_TexCoord[0].st; - - if (wind_effects > 1) - { - - vec2 eyePos = (gl_ModelViewMatrixInverse * vec4 (0.0, 0.0, 0.0, 1.0)).xy; - - vec2 washDir = vec2 (wash_x, wash_y) - (g_rawpos - eyePos); - float washStrength = 20.0 * min(14.0 * wash_strength/(length(washDir) + 1.0), 1.0); - washStrength *= (1.0 - 0.8 * sin(20.0 * osg_SimulationTime + length(washDir) + dot(normalize(washDir), vec2(1.0, 0.0)))); - - vec2 windDir = normalize(vec2 (max(wind_x, 0.1), wind_y) + washStrength * vec2 (-washDir.y, washDir.x)); - - float windStrength = 0.5 * length(vec2 (wind_x, wind_y)) + washStrength; - float windAmplitude = 1.0 + 0.3 * windStrength; - float sineTerm = sin(0.7 * windStrength * osg_SimulationTime + 0.05 * (g_rawpos.x + g_rawpos.y)); - sineTerm = sineTerm + sin(0.6 * windStrength * osg_SimulationTime + 0.04 * (g_rawpos.x + g_rawpos.y)); - sineTerm = sineTerm + sin(0.44 * windStrength * osg_SimulationTime + 0.05 * (g_rawpos.x + g_rawpos.y)); - sineTerm = sineTerm/3.0; - sineTerm = 5.0 * sineTerm * sineTerm; - - float windDisplacement = pow(g_layer/32.0, 2.0) * clamp((windStrength + windAmplitude * sineTerm), -35.0, 35.0); - - texCoord += (windDisplacement * windDir); - } - - - - - float noise_1m = Noise2D(g_rawpos.xy, 1.0); - float noise_2m = Noise2D(g_rawpos.xy, 2.0); ; - float noise_10m = Noise2D(g_rawpos.xy, 10.0); - - float h_factor; - float overlay_mix = smoothstep(0.45, 0.65, overlay_bias + (0.5 * noise_1m + 0.1 * noise_2m + 0.4 * noise_10m)); - - if (grass_modulate_by_overlay == 1) - {h_factor = grass_modulate_height_min + (1.0 - grass_modulate_height_min) * (1.0 - overlay_mix) ;} - else - {h_factor = 1.0;} - - float value = 0.0; - - float d_fade =smoothstep(100.0, MAX_DISTANCE, g_distance_to_eye); - float d_factor = 1.0 + 1.0 * d_fade; - d_factor *= clamp(max_height/0.3,0.5, 1.0); - - float bladeFlag = BladeNoise2D(texCoord, 0.015, grass_density, g_layer, d_factor, h_factor); - if (grass_groups >1) {bladeFlag += BladeNoise2D(texCoord, 0.01, grass_density, g_layer, d_factor, h_factor);} - if (grass_groups >2) {bladeFlag += BladeNoise2D(texCoord, 0.007, grass_density, g_layer, d_factor, h_factor);} - - - if (bladeFlag > 0.0) {value = 1.0;} - else {discard;} - - vec3 texel = texture2D(colorTex, texCoord).rgb; - - // autumn coloring - - texel.r = min(1.0, (1.0 + 2.5 * 0.1 * season) * texel.r); - texel.g = texel.g; - texel.b = max(0.0, (1.0 - 4.0 * 0.1 * season) * texel.b); - float intensity = length(texel.rgb) * (1.0 - 0.5 * smoothstep(1.1,2.0,season)) * mix(0.3, 1.0, getShadowing()); - texel.rgb = intensity * normalize(mix(texel.rgb, vec3(0.23,0.17,0.08), smoothstep(1.1,2.0, season))); - - float base_alpha = clamp(0.4 * max_height/0.3, 0.4, 1.0); - value*= base_alpha * (1.0 - d_fade); - - value *= 1.0 - smoothstep(visibility* 0.5, visibility, g_distance_to_eye); - value= clamp(value, 0.0, 1.0); - - texel *= length(gl_LightSource[0].diffuse.rgb)/1.73 * scattering; - texel = clamp(texel, 0.0, 1.0); - - - vec4 fragColor = vec4 (texel, value); - fragColor.rgb = filter_combined(fragColor.rgb); - - gl_FragColor = fragColor; - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} diff --git a/Compositor/Shaders/ALS/grass.geom b/Compositor/Shaders/ALS/grass.geom deleted file mode 100755 index 2384a0901..000000000 --- a/Compositor/Shaders/ALS/grass.geom +++ /dev/null @@ -1,74 +0,0 @@ -// -*-C++-*- -#version 120 -#extension GL_EXT_geometry_shader4 : enable - -#define MAX_LAYERS 20 -#define MIN_LAYERS 8 -#define MAX_MINUS_MIN_LAYERS 12 - -uniform float max_height; - -varying in vec3 v_normal[3]; - -varying out vec2 g_rawpos; -varying out float g_distance_to_eye; -varying out float g_layer; - -varying out float flogz; - - -uniform mat4 fg_LightMatrix_csm0; -uniform mat4 fg_LightMatrix_csm1; -uniform mat4 fg_LightMatrix_csm2; -uniform mat4 fg_LightMatrix_csm3; -varying out vec4 lightSpacePos[4]; -void setupShadows(vec4 eyeSpacePos) -{ - lightSpacePos[0] = fg_LightMatrix_csm0 * eyeSpacePos; - lightSpacePos[1] = fg_LightMatrix_csm1 * eyeSpacePos; - lightSpacePos[2] = fg_LightMatrix_csm2 * eyeSpacePos; - lightSpacePos[3] = fg_LightMatrix_csm3 * eyeSpacePos; -} - -float min3(in float a, in float b, in float c) -{ - float m = a; - if (m > b) m = b; - if (m > c) m = c; - return m; -} - -void main() -{ - float distances[3]; - distances[0] = -(gl_ModelViewMatrix * gl_PositionIn[0]).z; - distances[1] = -(gl_ModelViewMatrix * gl_PositionIn[1]).z; - distances[2] = -(gl_ModelViewMatrix * gl_PositionIn[2]).z; - float minDistance = min3(distances[0], distances[1], distances[2]); - //float avgDistance = (distances[0]+distances[1]+distances[2])*0.33; - - int numLayers = MIN_LAYERS + int(smoothstep(500.0, 50.0, minDistance) * float(MAX_MINUS_MIN_LAYERS)); - - float deltaLayer = 1.0 / float(numLayers); - float currDeltaLayer = deltaLayer * 0.5; - - for (int layer = 0; layer < numLayers; ++layer) { - for (int i = 0; i < 3; ++i) { - vec4 pos = gl_PositionIn[i] + vec4(v_normal[i] * currDeltaLayer * max_height, 0.0); - g_rawpos = gl_PositionIn[i].xy; - g_distance_to_eye = distances[i]; - g_layer = currDeltaLayer; - - setupShadows(gl_ModelViewMatrix * pos); - - gl_Position = gl_ModelViewProjectionMatrix * pos; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - gl_TexCoord[0] = gl_TexCoordIn[i][0]; - EmitVertex(); - } - EndPrimitive(); - - currDeltaLayer += deltaLayer; - } -} diff --git a/Compositor/Shaders/ALS/grass.vert b/Compositor/Shaders/ALS/grass.vert deleted file mode 100755 index 9a315e7c7..000000000 --- a/Compositor/Shaders/ALS/grass.vert +++ /dev/null @@ -1,17 +0,0 @@ -// -*-C++-*- -#version 120 - -// The UV scale controls the grass thickness. Lower numbers thicken the blades -// while higher numbers make them thinner. -#define UV_SCALE 10.0 - -varying vec3 v_normal; - -void main() -{ - - gl_Position = gl_Vertex; - - gl_TexCoord[0] = gl_MultiTexCoord0 * UV_SCALE; - v_normal = gl_Normal; -} diff --git a/Compositor/Shaders/ALS/hazes.frag b/Compositor/Shaders/ALS/hazes.frag deleted file mode 100644 index e8b457071..000000000 --- a/Compositor/Shaders/ALS/hazes.frag +++ /dev/null @@ -1,103 +0,0 @@ -// -*-C++-*- -#version 120 - -uniform float air_pollution; - -// standard ALS fog function with exp(-d/D) fading and cutoff at low altitude and exp(-d^2/D^2) at high altitude - -const float AtmosphericScaleHeight = 8500.0; - -float fog_func (in float targ, in float alt) -{ - - -float fade_mix; - -// for large altitude > 30 km, we switch to some component of quadratic distance fading to -// create the illusion of improved visibility range - -targ = 1.25 * targ * smoothstep(0.04,0.06,targ); // need to sync with the distance to which terrain is drawn - - -if (alt < 30000.0) - {return exp(-targ - targ * targ * targ * targ);} -else if (alt < 50000.0) - { - fade_mix = (alt - 30000.0)/20000.0; - return fade_mix * exp(-targ*targ - pow(targ,4.0)) + (1.0 - fade_mix) * exp(-targ - pow(targ,4.0)); - } -else - { - return exp(- targ * targ - pow(targ,4.0)); - } - -} - -// altitude correction for exponential drop in atmosphere density - -float alt_factor(in float eye_alt, in float vertex_alt) -{ -float h0 = AtmosphericScaleHeight; -float h1 = min(eye_alt,vertex_alt); -float h2 = max(eye_alt,vertex_alt); - - -if ((h2-h1) < 200.0) // use a Taylor-expanded version - { - return 0.5 * (exp(-h2/h0) + exp(-h1/h0)); - } -else - { - return h0/(h2-h1) * (exp(-h1/h0) - exp(-h2/h0)); - } -} - - -// Rayleigh in-scatter function - -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt) -{ - -float fade_length = avisibility * (2.5 - 2.2 * sqrt(air_pollution)); - -fade_length = fade_length / alt_factor(eye_alt, vertex_alt); - -return 1.0-exp(-dist/max(15000.0,fade_length)); -} - - -// Rayleigh out-scattering color shift - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter) -{ -color.r = color.r * (1.0 - 0.4 * outscatter); -color.g = color.g * (1.0 - 0.8 * outscatter); -color.b = color.b * (1.0 - 1.6 * outscatter); - -return color; -} - -// the generalized logistic function used to compute lightcurves - -float light_curve (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -// the haze color function - -vec3 get_hazeColor(in float lightArg) -{ -vec3 hazeColor; -hazeColor.r = light_curve(lightArg, 8.305e-06, 0.161, 4.827-3.0 *air_pollution, 3.04e-05, 1.0); -hazeColor.g = light_curve(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); -hazeColor.b = light_curve(lightArg, 1.330e-05, 0.264, 1.527+ 2.0*air_pollution, 1.08e-05, 1.0); - -return hazeColor; -} diff --git a/Compositor/Shaders/ALS/hud.frag b/Compositor/Shaders/ALS/hud.frag deleted file mode 100644 index e3b856ddf..000000000 --- a/Compositor/Shaders/ALS/hud.frag +++ /dev/null @@ -1,294 +0,0 @@ -// -*-C++-*- -#version 120 - -varying vec2 rawPos; -varying vec2 nPos; -varying vec3 vertPos; -varying vec3 normal; -varying vec3 refl_vec; -varying vec3 light_diffuse; -varying float splash_angle; -varying float Mie; -varying float ambient_fraction; - -varying float flogz; - -uniform float fg_Fcoef; - -uniform sampler2D texture; -uniform sampler2D frost_texture; -uniform sampler2D func_texture; -uniform samplerCube cube_texture; -uniform samplerCube cube_light_texture; - -uniform vec4 tint; -uniform vec3 overlay_color; - - -uniform float rain_norm; -uniform float ground_splash_norm; -uniform float frost_level; -uniform float fog_level; -uniform float reflection_strength; -uniform float overlay_alpha; -uniform float overlay_glare; -uniform float splash_x; -uniform float splash_y; -uniform float splash_z; -uniform float lightmap_r_factor; -uniform float lightmap_g_factor; -uniform float lightmap_b_factor; -uniform float lightmap_a_factor; -uniform float osg_SimulationTime; - -uniform float sample_res; -uniform float sample_far; -uniform float hud_brightness; - -uniform int use_reflection; -uniform int use_reflection_lightmap; -uniform int use_mask; -uniform int use_wipers; -uniform int use_overlay; -uniform int adaptive_mapping; -uniform int lightmap_multi; - -uniform vec3 lightmap_r_color; -uniform vec3 lightmap_g_color; -uniform vec3 lightmap_b_color; -uniform vec3 lightmap_a_color; - -float DotNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density); -float DropletNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density); -float Noise2D(in vec2 coord, in float wavelength); -vec3 filter_combined (in vec3 color) ; - -void main() -{ - -vec4 texel; - - - -vec4 frost_texel; -vec4 func_texel; - - -texel = texture2D(texture, gl_TexCoord[0].st); - -texel+= texture2D(texture, vec2 (gl_TexCoord[0].s + sample_res, gl_TexCoord[0].t)); -texel+= texture2D(texture, vec2 (gl_TexCoord[0].s - sample_res, gl_TexCoord[0].t)); -texel+= texture2D(texture, vec2 (gl_TexCoord[0].s, gl_TexCoord[0].t + sample_res)); -texel+= texture2D(texture, vec2 (gl_TexCoord[0].s, gl_TexCoord[0].t - sample_res)); - -texel+= 0.75* texture2D(texture, vec2 (gl_TexCoord[0].s + sample_far * sample_res, gl_TexCoord[0].t+ sample_far * sample_res)); -texel+= 0.75* texture2D(texture, vec2 (gl_TexCoord[0].s - sample_far * sample_res, gl_TexCoord[0].t+ sample_far * sample_res)); -texel+= 0.75* texture2D(texture, vec2 (gl_TexCoord[0].s + sample_far * sample_res, gl_TexCoord[0].t- sample_far * sample_res)); -texel+= 0.75* texture2D(texture, vec2 (gl_TexCoord[0].s - sample_far * sample_res, gl_TexCoord[0].t- sample_far * sample_res)); - -texel+= 0.5 * texture2D(texture, vec2 (gl_TexCoord[0].s + 2.0 * sample_far * sample_res, gl_TexCoord[0].t - sample_res)); -texel+= 0.5 * texture2D(texture, vec2 (gl_TexCoord[0].s - 2.0 * sample_far * sample_res, gl_TexCoord[0].t + sample_res)); -texel+= 0.5 * texture2D(texture, vec2 (gl_TexCoord[0].s - sample_res, gl_TexCoord[0].t + 2.0 * sample_far * sample_res)); -texel+= 0.5 * texture2D(texture, vec2 (gl_TexCoord[0].s + sample_res, gl_TexCoord[0].t - 2.0 * sample_far * sample_res)); - -texel/=10.0; - -float threshold_high = max(hud_brightness, 0.05) * 0.7; -float threshold_low = max(hud_brightness, 0.05) * 0.4; -float threshold_mid = max(hud_brightness, 0.05) * 0.5; - -texel.rgb = mix(texel.rgb, vec3 (1.0, 1.0, 1.0), smoothstep(threshold_mid, threshold_high, texel.a)); -texel.rgb = mix(texel.rgb, vec3 (0.0, 0.0, 0.0), 1.0 - smoothstep(0.0, threshold_low, texel.a)); - -texel *=gl_Color; - -vec2 frost_coords; - -if (adaptive_mapping == 1) {frost_coords = gl_TexCoord[0].st * 7.0;} -else if (adaptive_mapping ==2) {frost_coords = nPos * 7.0;} -else {frost_coords = vertPos.xy * 7.0;} - -frost_texel = texture2D(frost_texture, frost_coords); -func_texel = texture2D(func_texture, gl_TexCoord[0].st * 2.0); - - - -float noise_003m = Noise2D(vertPos.xy, 0.03); -float noise_0003m = Noise2D(vertPos.xy, 0.003); - - -// environment reflection, including a lightmap for the reflections - -vec4 reflection = textureCube(cube_texture, refl_vec); -vec4 reflection_lighting = textureCube(cube_light_texture, refl_vec); - -vec3 lightmapcolor = vec3(0.0, 0.0, 0.0); - - -if (use_reflection_lightmap == 1) - { - vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor, lightmap_b_factor, lightmap_a_factor); - lightmapFactor = lightmapFactor * reflection_lighting; - if (lightmap_multi > 0 ) - { - lightmapcolor = lightmap_r_color * lightmapFactor.r + - lightmap_g_color * lightmapFactor.g + - lightmap_b_color * lightmapFactor.b + - lightmap_a_color * lightmapFactor.a ; - } - else - { - lightmapcolor = reflection_lighting.rgb * lightmap_r_color * lightmapFactor.r; - } - - } - -float lightmap_intensity = length(lightmapcolor); -float light_fraction = clamp(lightmap_intensity / (length(light_diffuse.rgb) + 0.01), 0.0, 5.0); - -if (light_fraction < 1.0) {light_fraction = smoothstep(0.7, 1.0, light_fraction);} - - -if (use_reflection ==1) - { - // to determine whether what we see reflected is currently in light, we make the somewhat drastic - // assumption that its normal will be opposite to the glass normal - // (which is mostly truish in a normal cockpit) - float reflection_shade = ambient_fraction + (1.0-ambient_fraction) * max(0.0, dot (normalize(normal), normalize(gl_LightSource[0].position.xyz))); - - texel.rgb = mix(texel.rgb, reflection.rgb, (reflection_strength * reflection_shade * (1.0-Mie))); - - } - -//texel.rgb = mix(texel.rgb, lightmapcolor.rgb, lightmap_intensity); - -// overlay pattern - -if ((use_mask == 1) && (use_overlay==1)) - { - vec4 overlay_texel = vec4(overlay_color, overlay_alpha); - overlay_texel.rgb *= light_diffuse.rgb* (1.0 + (1.0 + overlay_glare)*Mie); - overlay_texel.a *=(1.0 + overlay_glare* Mie); - texel = mix(texel, overlay_texel, func_texel.b * overlay_texel.a); - } - - -// frost - -float fth = (1.0-frost_level) * 0.4 + 0.3; -float fbl = 0.2 * frost_level; - - -float frost_factor = (fbl + (1.0-fbl)* smoothstep(fth,fth+0.2,noise_003m)) * (4.0 + 4.0* Mie); - - -float background_frost = 0.5 * smoothstep(0.7,1.0,frost_level); -frost_texel.rgb = mix(frost_texel.rgb, vec3 (0.5,0.5,0.5), (1.0- smoothstep(0.0,0.02,frost_texel.a))); -frost_texel.a =max(frost_texel.a, background_frost * (1.0- smoothstep(0.0,0.02,frost_texel.a))); - -frost_texel *= vec4(light_diffuse.rgb,0.5) * (1.0 + 3.0 * Mie); - -frost_factor = max(frost_factor, 0.8*background_frost); - - -texel.rgb = mix(texel.rgb, frost_texel.rgb, frost_texel.a * frost_factor * smoothstep(0.0,0.1,frost_level)); -texel.a = max(texel.a, frost_texel.a * frost_level); - -// rain splashes - -vec3 splash_vec = vec3 (splash_x, splash_y, splash_z); -float splash_speed = length(splash_vec); - - -float rain_factor = 0.0; - -float rnorm = max(rain_norm, ground_splash_norm); - -if (rnorm > 0.0) - { - float droplet_size = (0.5 + 0.8 * rnorm) * (1.0 - 0.1 * splash_speed); - vec2 rainPos = vec2 (rawPos.x * splash_speed, rawPos.y / splash_speed ); - rainPos.y = rainPos.y - 0.1 * smoothstep(1.0,2.0, splash_speed) * osg_SimulationTime; - if (splash_angle> 0.0) - { - // the dynamically impacting raindrops - - float time_shape = 1.0; - float base_rate = 6.0 + 3.0 * rnorm + 4.0 * (splash_speed - 1.0); - float base_density = 0.6 * rnorm + 0.4 * (splash_speed -1.0); - if ((use_mask ==1)&&(use_wipers==1)) {base_density *= (1.0 - 0.5 * func_texel.g);} - - float time_fact1 = (sin(base_rate*osg_SimulationTime)); - float time_fact2 = (sin(base_rate*osg_SimulationTime + 1.570)); - float time_fact3 = (sin(base_rate*osg_SimulationTime + 3.1415)); - float time_fact4 = (sin(base_rate*osg_SimulationTime + 4.712)); - - time_fact1 = smoothstep(0.0,1.0, time_fact1); - time_fact2 = smoothstep(0.0,1.0, time_fact2); - time_fact3 = smoothstep(0.0,1.0, time_fact3); - time_fact4 = smoothstep(0.0,1.0, time_fact4); - - rain_factor += DotNoise2D(rawPos.xy, 0.02 * droplet_size ,0.5, base_density ) * time_fact1; - rain_factor += DotNoise2D(rainPos.xy, 0.03 * droplet_size,0.4, base_density) * time_fact2; - rain_factor += DotNoise2D(rawPos.xy, 0.04 * droplet_size ,0.3, base_density)* time_fact3; - rain_factor += DotNoise2D(rainPos.xy, 0.05 * droplet_size ,0.25, base_density)* time_fact4; - } - - - // the static pattern of small droplets created by the splashes - - float sweep = min(1./splash_speed,1.0); - if ((use_mask ==1)&&(use_wipers==1)) {sweep *= (1.0 - func_texel.g);} - if (adaptive_mapping ==2) {rainPos = nPos;} - rain_factor += DropletNoise2D(rainPos.xy, 0.02 * droplet_size ,0.5, 0.6* rnorm * sweep); - rain_factor += DotNoise2D(rainPos.xy, 0.012 * droplet_size ,0.7, 0.6* rnorm * sweep); - } - -rain_factor = smoothstep(0.1,0.2, rain_factor) * (1.0 - smoothstep(0.4,1.0, rain_factor) * (0.2+0.8*noise_0003m)); - - -vec4 rainColor = vec4 (0.2,0.2, 0.2, 0.6 - 0.3 * smoothstep(1.0,2.0, splash_speed)); -rainColor.rgb *= length(light_diffuse)/1.73; - - - -// glass tint - - -vec4 outerColor = mix(texel, rainColor, rain_factor); -// now mix illuminated reflections in - -vec3 reflLitColor = reflection.rgb * lightmapcolor.rgb; - -outerColor.rgb = mix(outerColor.rgb, reflLitColor, clamp(reflection_strength * light_fraction,0.0,1.0)); -outerColor.a = max(outerColor.a, 0.1 * light_fraction * reflection_strength); - -outerColor *= tint; - - - - -// fogging - this is inside the glass - -vec4 fog_texel = vec4 (0.6,0.6,0.6, fog_level); - -if (use_mask == 1) {fog_texel.a = fog_texel.a * func_texel.r;} - -fog_texel *= vec4(light_diffuse.rgb,1.0); -fog_texel.rgb *= (1.0 + 3.0 * Mie); -fog_texel.a *= min((1.0 + 0.5 * Mie), 0.85); - - -vec4 fragColor; - -fragColor.rgb = mix(outerColor.rgb, fog_texel.rgb, fog_texel.a); -fragColor.a = max(outerColor.a, fog_texel.a); - -fragColor.rgb = filter_combined(fragColor.rgb); - - -gl_FragColor = clamp(fragColor,0.0,1.0); -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} diff --git a/Compositor/Shaders/ALS/hud.vert b/Compositor/Shaders/ALS/hud.vert deleted file mode 100644 index 6e41507a2..000000000 --- a/Compositor/Shaders/ALS/hud.vert +++ /dev/null @@ -1,144 +0,0 @@ -// -*-C++-*- -#version 120 - -varying vec2 rawPos; -varying vec2 nPos; -varying vec3 vertPos; -varying vec3 normal; -varying vec3 light_diffuse; -varying vec3 refl_vec; -varying float splash_angle; -varying float Mie; -varying float ambient_fraction; - -varying float flogz; - -uniform float ground_scattering; -uniform float hazeLayerAltitude; -uniform float moonlight; -uniform float terminator; -uniform float splash_x; -uniform float splash_y; -uniform float splash_z; - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - -vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - -// geometry for lighting -vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); -vec3 relPos = gl_Vertex.xyz - ep.xyz; -vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; -vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); -float dist = length(relPos); -float vertex_alt = max(gl_Vertex.z,100.0); -float scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); -float yprime_alt = - sqrt(2.0 * EarthRadius * vertex_alt); -float earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; -float lightArg = (terminator-yprime_alt)/100000.0; - -// light computation - -vec3 light_ambient; - -light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); -light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); -light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); -light_diffuse = light_diffuse * scattering; - - -light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); -light_ambient.g = light_ambient.r * 0.4/0.33; -light_ambient.b = light_ambient.r * 0.5/0.33; - -float intensity; - -if (earthShade < 0.5) - { - intensity = length(light_ambient.xyz); - - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.xyz); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - } - - -float MieFactor = dot(normalize(lightFull), normalize(relPos)); -Mie = smoothstep(0.9,1.0, MieFactor) * earthShade * earthShade * scattering; - - -// get a reflection vector for cube map - -vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; -normal = -normalize(gl_NormalMatrix * gl_Normal); -vec4 reflect_eye = vec4(reflect(ecPosition.xyz, normal), 0.0); -vec3 reflVec_stat = normalize(gl_ModelViewMatrixInverse * reflect_eye).xyz; -refl_vec = reflVec_stat; - -// get a projection plane orthogonal to the splash vector - -vec3 splash_vec = vec3 (splash_x, splash_y, splash_z); -vec3 corrected_splash = normalize(splash_vec); - -float angle = abs(dot(corrected_splash, gl_Normal)); - - -//corrected_splash = normalize(corrected_splash + 0.4* gl_Normal ); - - -vec3 base_1 = vec3 (-corrected_splash.y, corrected_splash.x, 0.0); -vec3 base_2 = cross (corrected_splash, base_1); - -base_1 = normalize(base_1); -base_2 = normalize(base_2); - -rawPos = vec2 (dot(gl_Vertex.xyz, base_1), dot(gl_Vertex.xyz, base_2)); - -base_1 = vec3 (-gl_Normal.y, gl_Normal.x, 0.0); -base_2 = cross(gl_Normal, base_1); - -base_1 = normalize(base_1); -base_2 = normalize(base_2); - -nPos = vec2 (dot(gl_Vertex.xyz, base_1), dot(gl_Vertex.xyz, base_2)); - -vertPos = gl_Vertex.xyz; - -splash_angle = dot(gl_Normal, corrected_splash); - -ambient_fraction = length(light_ambient.rgb)/(length(light_diffuse.rgb +light_ambient.rgb ) + 0.01); - - -gl_Position = ftransform(); -// logarithmic depth -flogz = 1.0 + gl_Position.w; -gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - -vec4 diffuse_color = gl_FrontMaterial.diffuse; -vec4 ambient_color = gl_FrontMaterial.ambient; - -vec4 constant_term = gl_FrontMaterial.emission + ambient_color * vec4 (light_diffuse.rgb + light_ambient.rgb,1.0); -constant_term.a = min(diffuse_color.a, ambient_color.a); - -gl_FrontColor = constant_term; -gl_BackColor = gl_FrontColor; - -} diff --git a/Compositor/Shaders/ALS/light.frag b/Compositor/Shaders/ALS/light.frag deleted file mode 100644 index d90b2f0bc..000000000 --- a/Compositor/Shaders/ALS/light.frag +++ /dev/null @@ -1,237 +0,0 @@ -// -*-C++-*- -#version 120 - -uniform float fg_Fcoef; - -uniform sampler2D texture; - -uniform float light_color_base_r; -uniform float light_color_base_g; -uniform float light_color_base_b; - -uniform float light_color_center_r; -uniform float light_color_center_g; -uniform float light_color_center_b; - -uniform float intensity_scale; - -uniform float pointing_x; -uniform float pointing_y; -uniform float pointing_z; - -uniform float outer_angle; -uniform float inner_angle; -uniform float zero_angle; -uniform float outer_gain; - -uniform float visibility; -uniform float avisibility; -uniform float hazeLayerAltitude; -uniform float eye_alt; -uniform float terminator; - -uniform float osg_SimulationTime; - -uniform bool is_directional; -uniform bool is_strobe; - -varying vec3 vertex; -varying vec3 relPos; -varying vec3 normal; - -varying float flogz; - -float Noise2D(in vec2 coord, in float wavelength); -float fog_func (in float targ, in float alt); - -float shape (in vec3 coord, in float noise, in float fade, in float transmission, in float glare, in float lightArg) -{ - float r = length (coord) / max(fade, 0.2); - - float angle = noise * 6.2832; - - float sinphi = dot(vec2 (sin(angle),cos(angle)), normalize(coord.yz)); - float sinterm = sin(mod((sinphi-3.0) * (sinphi-3.0),6.2832)); - float ray = 0.0; - if (sinterm == 0.0) - {ray = 0.0;} - else - //{ray = clamp(pow(sinterm,10.0),0.0,1.0); - {ray = sinterm * sinterm * sinterm * sinterm * sinterm * sinterm * sinterm * sinterm * sinterm * sinterm; - ray *= exp(-40.0 * r * r) * smoothstep(0.8, 1.0,fade) * smoothstep(0.7, 1.0, glare); - } - - - - float base = exp(-80.0*r*r ); - float halo = 0.2 * exp(-10.0 * r * r) * (1.0 - smoothstep(-5.0, 0.0, lightArg)); - float fogEffect = (1.0-smoothstep(0.4,0.8,transmission)); - //fogEffect = 1.0; - - //float offset = 0.0; - //offset *=0.3; - //vec2 offset_vec = vec2 (1.0, 0.0); - //offset_vec *= offset; - - // vec2 coord_reduced1 = vec2(coord.y- 1.2* offset_vec.x, coord.z - 1.2 * offset_vec.y); - //vec2 coord_reduced2 = vec2(coord.y- 2.0 * offset_vec.x, coord.z - 2.0 * offset_vec.y); - //vec3 coord_reduced = coord; - //r = min(length (coord_reduced1), 0.8* length(coord_reduced2)); - //r /= 1.0 - 0.3 * smoothstep(0.0, 0.3, offset); - - float intensity = clamp(base + halo + ray,0.0,1.0) + 0.2 * fogEffect * (1.0-smoothstep(0.3, 0.6,r)); - - intensity *=fade; - -return intensity; -} - - -float directional_fade (in float direction) -{ - -float arg = clamp(direction, 0.0, 1.0); -float ia = (1.0 - inner_angle); -float oa = (1.0 - outer_angle); -float za = (1.0 - zero_angle); - -if (direction > ia) {return 1.0;} -else if (direction > oa) - {return outer_gain + (1.0-outer_gain) * (direction - oa) / (ia - oa);} -else if (direction > za) - {return outer_gain * (direction - za) / (oa - za);} -else {return 0.0;} - -} - -float strobe_fade (in float fade) -{ - -float time_arg1 = sin(4.0 * osg_SimulationTime); -float time_arg2 = sin(4.0 * osg_SimulationTime - 0.4); - -return fade * 0.825 * (pow(time_arg1, 40.0) + pow(time_arg2, 8.0)); - -} - - -void main() -{ - -float noise = 0.0; - -vec3 light_color_base = vec3 (light_color_base_r, light_color_base_g, light_color_base_b); -vec3 light_color_center = vec3 (light_color_center_r, light_color_center_g, light_color_center_b); - -vec3 pointing_vec = vec3 (pointing_x, pointing_y, pointing_z); -vec3 viewDir = normalize(relPos); - -// fogging - -float dist = length(relPos); -float delta_z = hazeLayerAltitude - eye_alt; -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - // angle with horizon - float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - - if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,min(visibility, avisibility)) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - - - transmission_arg = (dist-distance_in_layer)/avisibility; - if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - } - - - - transmission = fog_func(transmission_arg, 0.0); - float lightArg = terminator/100000.0; - - -float r = length(vertex); -float mix_factor = 0.3 + 0.7 * smoothstep(0.0, 0.5, r); - -// directionality - -vec3 nViewDir = normalize(viewDir); -vec3 nPointingVec = normalize(pointing_vec); -float direction = dot (nViewDir, nPointingVec ); - -float fade; -vec2 offset = vec2 (0.0, 0.0); - -if (is_directional) - { - fade = directional_fade(direction); - } -else - {fade = 1.0;} - - - -// time evolution - -if (is_strobe) {fade = strobe_fade (fade);} - -fade *= intensity_scale; - -// disc size correction for daylight - -// shape of the light disc -float glare = length(light_color_center)/1.7321 * (1.0 - smoothstep(-5.0, 10.0, lightArg)); -float intensity = shape(vertex, noise, fade, transmission, glare, lightArg); - -// coloring of the light disc -vec3 light_color = mix(light_color_base, light_color_center, intensity*intensity); - - -gl_FragColor = vec4 (light_color.rgb, intensity * transmission ); -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} diff --git a/Compositor/Shaders/ALS/light.vert b/Compositor/Shaders/ALS/light.vert deleted file mode 100644 index f6c0710c0..000000000 --- a/Compositor/Shaders/ALS/light.vert +++ /dev/null @@ -1,90 +0,0 @@ -// -*-C++-*- - -#version 120 - -// doing directionality is surprisingly complicated - with just the vector and the eye we can't -// do a spherical billboard, but the animation itself operates before the shader, so -// the model-coordinate to eye relationship is always the same -// thus we need to use pitch, yaw and roll to get the current model space coordinates - -uniform float pitch; -uniform float roll; -uniform float hdg; - - -varying vec3 vertex; -varying vec3 relPos; -varying vec3 normal; - -varying float flogz; - - -void main() -{ - -vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - vec3 absu = abs(u); - vec3 r = normalize(vec3(-u.y, u.x, 0.0)); - vec3 w = cross(u, r); - -vertex = gl_Vertex.xyz; -relPos = vertex - ep.xyz; -normal = gl_NormalMatrix * gl_Normal; - - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.xyz = gl_Vertex.x * u; - gl_Position.xyz += gl_Vertex.y * r; - gl_Position.xyz += gl_Vertex.z * w; - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - -//gl_Position = ftransform(); -gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - -gl_FrontColor = vec4 (1.0,1.0,1.0,1.0); -gl_BackColor = gl_FrontColor; -} - -/* - -void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat) -{ - rotmat = mat4( cosRy , sinRx * sinRy , cosRx * sinRy, 0.0, - 0.0 , cosRx , -sinRx * cosRx, 0.0, - -sinRy, sinRx * cosRy, cosRx * cosRy , 0.0, - 0.0 , 0.0 , 0.0 , 1.0 ); -} - -void rotationMatrixH(in float sinRz, in float cosRz, out mat4 rotmat) -{ - rotmat = mat4( cosRz, -sinRz, 0.0, 0.0, - sinRz, cosRz, 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); -} - -//prepare rotation matrix -mat4 RotMatPR; -mat4 RotMatH; -float _roll = roll; -if (_roll>90.0 || _roll < -90.0) {_roll = -_roll;} -float cosRx = cos(radians(_roll)); -float sinRx = sin(radians(_roll)); -float cosRy = cos(radians(-pitch)); -float sinRy = sin(radians(-pitch)); -float cosRz = cos(radians(hdg)); -float sinRz = sin(radians(hdg)); -rotationMatrixPR(sinRx, cosRx, sinRy, cosRy, RotMatPR); -rotationMatrixH(sinRz, cosRz, RotMatH); - -vec3 model_x = (RotMatH * RotMatPR * vec4 (1.0, 0.0, 0.0, 0.0)).xyz; -vec3 model_y = (RotMatH * RotMatPR * vec4 (0.0, 1.0, 0.0, 0.0)).xyz; -vec3 model_z = (RotMatH * RotMatPR * vec4 (0.0, 0.0, 1.0, 0.0)).xyz; - -vec3 pointingVec = normalize(pointing_x * model_x + pointing_y * model_y + pointing_z * model_z); -pointing_angle = dot (viewDir, pointingVec);*/ diff --git a/Compositor/Shaders/ALS/lightspot.frag b/Compositor/Shaders/ALS/lightspot.frag deleted file mode 100644 index 5a033d4fd..000000000 --- a/Compositor/Shaders/ALS/lightspot.frag +++ /dev/null @@ -1,108 +0,0 @@ -// -*-C++-*- -#version 120 - -uniform float eyerel_x1; -uniform float eyerel_y1; -uniform float eyerel_z1; -uniform float lightspot_r1; -uniform float lightspot_g1; -uniform float lightspot_b1; -uniform float eyerel_x2; -uniform float eyerel_y2; -uniform float eyerel_z2; -uniform float lightspot_r2; -uniform float lightspot_g2; -uniform float lightspot_b2; -uniform float eyerel_x3; -uniform float eyerel_y3; -uniform float eyerel_z3; -uniform float lightspot_r3; -uniform float lightspot_g3; -uniform float lightspot_b3; -uniform float eyerel_x4; -uniform float eyerel_y4; -uniform float eyerel_z4; -uniform float lightspot_r4; -uniform float lightspot_g4; -uniform float lightspot_b4; -uniform float eyerel_x5; -uniform float eyerel_y5; -uniform float eyerel_z5; -uniform float lightspot_r5; -uniform float lightspot_g5; -uniform float lightspot_b5; -uniform float lightspot_project1; -uniform float lightspot_project2; -uniform float lightspot_dir1; -uniform float lightspot_dir2; -uniform float lightspot_size1; -uniform float lightspot_size2; -uniform float lightspot_size3; -uniform float lightspot_size4; -uniform float lightspot_size5; - -uniform int num_lightspots; - -vec3 lightspot(vec3 relPos) -{ - - -if (num_lightspots == 0) - { - return vec3 (0.0, 0.0, 0.0); - } - -// first projectable spot - -vec3 eye_rel = vec3 (eyerel_x1, eyerel_y1, eyerel_z1); -vec3 difference_vec = relPos - eye_rel; - -mat2 rotMat = mat2 (cos(lightspot_dir1), sin(lightspot_dir1), -sin(lightspot_dir1), cos(lightspot_dir1)); - -difference_vec.xy = rotMat * difference_vec.xy; -difference_vec.x/= (1.0 + lightspot_project1); - -float lightspot_arg = (1.0 - smoothstep(lightspot_size1/3.0, lightspot_size1, length(difference_vec))) * (1.0 - 0.5* smoothstep(lightspot_size1/3.0, lightspot_size1/(1.0+lightspot_project1), -difference_vec.x)); - -vec3 lightspot_color = vec3 (lightspot_r1,lightspot_g1, lightspot_b1 ) * lightspot_arg; - -// second projectable spot - -eye_rel = vec3 (eyerel_x2, eyerel_y2, eyerel_z2); -difference_vec = relPos - eye_rel; - -rotMat = mat2 (cos(lightspot_dir2), sin(lightspot_dir2), -sin(lightspot_dir2), cos(lightspot_dir2)); - -difference_vec.xy = rotMat * difference_vec.xy; -difference_vec.x/= (1.0 + lightspot_project2); - -lightspot_arg = (1.0 - smoothstep(lightspot_size2/3.0, lightspot_size2, length(difference_vec))) * (1.0 - 0.5* smoothstep(lightspot_size2/3.0, lightspot_size2/(1.0+lightspot_project2), -difference_vec.x)); - -lightspot_color += vec3 (lightspot_r2,lightspot_g2, lightspot_b2 ) * lightspot_arg; - -if (num_lightspots < 3) - { - return lightspot_color ; - } - -// spherical spot - -eye_rel = vec3 (eyerel_x3, eyerel_y3, eyerel_z3); -lightspot_arg = (1.0 - smoothstep(lightspot_size3/3.0, lightspot_size3, length(relPos - eye_rel))); -lightspot_color += vec3 (lightspot_r3,lightspot_g3, lightspot_b3 ) * lightspot_arg; - -// spherical spot - -eye_rel = vec3 (eyerel_x4, eyerel_y4, eyerel_z4); -lightspot_arg = (1.0 - smoothstep(lightspot_size4/3.0, lightspot_size4, length(relPos - eye_rel))); -lightspot_color += vec3 (lightspot_r4,lightspot_g4, lightspot_b4 ) * lightspot_arg; - -// spherical spot - -eye_rel = vec3 (eyerel_x5, eyerel_y5, eyerel_z5); -lightspot_arg = (1.0 - smoothstep(lightspot_size5/3.0, lightspot_size5, length(relPos - eye_rel))); -lightspot_color += vec3 (lightspot_r5,lightspot_g5, lightspot_b5 ) * lightspot_arg; - -return lightspot_color; - -} diff --git a/Compositor/Shaders/ALS/model-base.frag b/Compositor/Shaders/ALS/model-base.frag deleted file mode 100644 index 14a28e390..000000000 --- a/Compositor/Shaders/ALS/model-base.frag +++ /dev/null @@ -1,333 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2011, based on default.frag -// Ambient term comes in gl_Color.rgb. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec4 ecPosition; - -uniform float fg_Fcoef; - -uniform sampler2D texture; - - -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float cloud_self_shading; -uniform float air_pollution; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; - -uniform int quality_level; -uniform int tquality_level; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; - - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; - - -float fog_func (in float targ, in float alt); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float light_arg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 filter_combined (in vec3 color) ; - -float getShadowing(); -vec3 addClusteredLightsContribution(vec3 inputColor, vec3 v, vec3 N); - -float luminance(vec3 color) -{ - return dot(vec3(0.212671, 0.715160, 0.072169), color); -} - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -// this determines how light is attenuated in the distance -// physically this should be exp(-arg) but for technical reasons we use a sharper cutoff -// for distance > visibility - - - - -void main() -{ - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = gl_LightSource[0].halfVector.xyz; - vec4 texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - float effective_scattering = min(scattering, cloud_self_shading); - - eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - vec4 light_specular = gl_LightSource[0].specular * (eShade - 0.1); - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - n = (2.0 * gl_Color.a - 1.0) * normal; - n = normalize(n); - - NdotL = dot(n, lightDir); - if (NdotL > 0.0) { - float shadowmap = getShadowing(); - color += diffuse_term * NdotL * shadowmap; - NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = (gl_FrontMaterial.specular.rgb - * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess) - * shadowmap); - } - color.a = diffuse_term.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - float dist = length(relPos); - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if ((quality_level > 5) && (tquality_level > 5)) - { - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - if (dist > 2.0) // we don't want to light the cockpit... - {color.rgb +=secondary_light * light_distance_fading(dist);} - } - - texel = texture2D(texture, gl_TexCoord[0].st); - fragColor = color * texel + specular; - - -float lightArg = (terminator-yprime_alt)/100000.0; - -vec3 hazeColor = get_hazeColor(lightArg); - - -// Rayleigh color shift due to in-scattering - - if ((quality_level > 5) && (tquality_level > 5)) - { - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - } - - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; -float mvisibility = min(visibility, avisibility); - -if (dist > 0.04 * mvisibility) -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - -// angle with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - -//float scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, relPos.z + eye_alt); - -if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 -effective_scattering); - - } -else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 -effective_scattering); - } - - - -transmission = fog_func(transmission_arg, alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - - - - - - -// Mie-like factor - -if (lightArg < 10.0) - {intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -// high altitude desaturation of the haze color - -intensity = length(hazeColor); -hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - -// blue hue of haze - -hazeColor.x = hazeColor.x * 0.83; -hazeColor.y = hazeColor.y * 0.9; - - -// additional blue in indirect light -float fade_out = max(0.65 - 0.3 *overcast, 0.45); -intensity = length(hazeColor); -hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - -// change haze color to blue hue for strong fogging -//intensity = length(hazeColor); -hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - -// reduce haze intensity when looking at shaded surfaces, only in terminator region - -float shadow = mix( min(1.0 + dot(normal,lightDir),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); -hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - -// don't let the light fade out too rapidly - -lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); -hazeColor *= eqColorFactor * eShade; -hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - -// determine the right mix of transmission and haze - - -fragColor.rgb = mix(hazeColor + secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission); - - - -} - -fragColor.rgb = addClusteredLightsContribution(fragColor.rgb, ecPosition.xyz, normal); -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} - diff --git a/Compositor/Shaders/ALS/model-interior-base.frag b/Compositor/Shaders/ALS/model-interior-base.frag deleted file mode 100644 index 03052f1c0..000000000 --- a/Compositor/Shaders/ALS/model-interior-base.frag +++ /dev/null @@ -1,188 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2015 - -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; - -uniform float fg_Fcoef; - -uniform sampler2D texture; -uniform samplerCube cube_texture; - -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float cloud_self_shading; -uniform float angle; -uniform float threshold_low; -uniform float threshold_high; -uniform float emit_intensity; -uniform float light_radius; - -uniform vec3 offset_vec; -uniform vec3 scale_vec; -uniform vec3 tag_color; -uniform vec3 emit_color; -uniform vec3 light_filter_one; -uniform vec3 light_filter_two; - -uniform int quality_level; -uniform int tquality_level; -uniform int use_searchlight; -uniform int implicit_lightmap_enabled; -uniform int use_flashlight; - - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; - - -float fog_func (in float targ, in float alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - -vec3 get_hazeColor(in float light_arg); -vec3 flashlight(in vec3 color, in float radius); -vec3 filter_combined (in vec3 color) ; - -float luminance(vec3 color) -{ - return dot(vec3(0.212671, 0.715160, 0.072169), color); -} - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -// this determines how light is attenuated in the distance -// physically this should be exp(-arg) but for technical reasons we use a sharper cutoff -// for distance > visibility - - - - -void main() -{ - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = gl_LightSource[0].halfVector.xyz; - vec4 texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - float effective_scattering = min(scattering, cloud_self_shading); - - eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - vec4 light_specular = gl_LightSource[0].specular * (eShade - 0.1); - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - n = (2.0 * gl_Color.a - 1.0) * normal; - n = normalize(n); - - // lookup on the opacity map - vec3 light_vec = normalize((gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz); - //vec3 light_vec = vec3 (-1.0,0.0,0.0); - - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec3 scaled_pos = relPos + ep.xyz; - - //vec3 lookup_vec = normalize(- normalize(light_vec) + relPos); - scaled_pos -= offset_vec; - float rangle = radians(angle); - mat2 rotMat = mat2 (cos(rangle), -sin(rangle), sin(rangle), cos(rangle)); - scaled_pos.xy *=rotMat; - - scaled_pos /= scale_vec; - - //vec3 lookup_pos = dot(base1,scaled_pos) * base1 + dot(base2,scaled_pos) * base2; - vec3 lookup_pos = scaled_pos - light_vec * dot(light_vec, scaled_pos); - - vec3 lookup_vec = normalize(normalize(light_vec) + lookup_pos); - vec4 opacity = textureCube(cube_texture, lookup_vec); - - - vec4 diffuse = diffuse_term; - NdotL = dot(n, lightDir); - //NdotL = dot(n, (gl_ModelViewMatrix * vec4 (light_vec,0.0)).xyz); - if (NdotL > 0.0) { - - diffuse.rgb += 2.0 * diffuse.rgb * (1.0 - opacity.a); - color += diffuse * NdotL * opacity; - NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = (gl_FrontMaterial.specular.rgb - * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess)); - } - color.a = diffuse.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - //color = clamp(color, 0.0, 1.0); - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_flashlight == 1) - { - secondary_light.rgb += flashlight(light_filter_one, light_radius); - } - if (use_flashlight == 2) - { - secondary_light.rgb += flashlight(light_filter_two, light_radius); - } - float dist = length(relPos); - color.rgb += secondary_light * light_distance_fading(dist); - - texel = texture2D(texture, gl_TexCoord[0].st); - fragColor = color * texel + specular; - - // implicit lightmap - the user gets to select - - if (implicit_lightmap_enabled == 1) - { - float cdiff = (length(texel.rgb - tag_color)); - float enhance = 1.0 - smoothstep(threshold_low, threshold_high, cdiff); - fragColor.rgb = fragColor.rgb + enhance * emit_color * emit_intensity; - } - - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} - diff --git a/Compositor/Shaders/ALS/model-interior-detailed.frag b/Compositor/Shaders/ALS/model-interior-detailed.frag deleted file mode 100644 index fda1d5bbf..000000000 --- a/Compositor/Shaders/ALS/model-interior-detailed.frag +++ /dev/null @@ -1,248 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2015 - -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec3 rawpos; - - -uniform float fg_Fcoef; - -uniform sampler2D texture; -uniform sampler2D lightmap_texture; -uniform sampler2D grain_texture; -uniform samplerCube cube_texture; - - -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float cloud_self_shading; -uniform float angle; -uniform float threshold_low; -uniform float threshold_high; -uniform float emit_intensity; -uniform float light_radius; -uniform float lightmap_r_factor; -uniform float lightmap_g_factor; -uniform float lightmap_b_factor; -uniform float lightmap_a_factor; -uniform float grain_magnification; - -uniform vec3 offset_vec; -uniform vec3 scale_vec; -uniform vec3 tag_color; -uniform vec3 emit_color; -uniform vec3 light_filter_one; -uniform vec3 light_filter_two; -uniform vec3 lightmap_r_color; -uniform vec3 lightmap_g_color; -uniform vec3 lightmap_b_color; -uniform vec3 lightmap_a_color; - -uniform int quality_level; -uniform int tquality_level; -uniform int use_searchlight; -uniform int implicit_lightmap_enabled; -uniform int use_flashlight; -uniform int lightmap_enabled; -uniform int lightmap_multi; -uniform int grain_texture_enabled; - - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; - - -float fog_func (in float targ, in float alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - -vec3 addLights(in vec3 color1, in vec3 color2); -vec3 flashlight(in vec3 color, in float radius); -vec3 filter_combined (in vec3 color) ; - -float luminance(vec3 color) -{ - return dot(vec3(0.212671, 0.715160, 0.072169), color); -} - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -// this determines how light is attenuated in the distance -// physically this should be exp(-arg) but for technical reasons we use a sharper cutoff -// for distance > visibility - - - - -void main() -{ - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = gl_LightSource[0].halfVector.xyz; - vec4 texel; - vec4 fragColor; - vec3 specular = vec3(0.0); - float intensity; - - float effective_scattering = min(scattering, cloud_self_shading); - - eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - vec4 light_specular = gl_LightSource[0].specular * (eShade - 0.1); - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - n = (2.0 * gl_Color.a - 1.0) * normal; - n = normalize(n); - - // lookup on the opacity map - vec3 light_vec = normalize((gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz); - //vec3 light_vec = vec3 (-1.0,0.0,0.0); - - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec3 scaled_pos = relPos + ep.xyz; - - //vec3 lookup_vec = normalize(- normalize(light_vec) + relPos); - scaled_pos -= offset_vec; - float rangle = radians(angle); - mat2 rotMat = mat2 (cos(rangle), -sin(rangle), sin(rangle), cos(rangle)); - scaled_pos.xy *=rotMat; - - scaled_pos /= scale_vec; - - //vec3 lookup_pos = dot(base1,scaled_pos) * base1 + dot(base2,scaled_pos) * base2; - vec3 lookup_pos = scaled_pos - light_vec * dot(light_vec, scaled_pos); - - vec3 lookup_vec = normalize(normalize(light_vec) + lookup_pos); - vec4 opacity = textureCube(cube_texture, lookup_vec); - - - vec4 diffuse = diffuse_term; - NdotL = dot(n, lightDir); - //NdotL = dot(n, (gl_ModelViewMatrix * vec4 (light_vec,0.0)).xyz); - if (NdotL > 0.0) { - - diffuse.rgb += 2.0 * diffuse.rgb * (1.0 - opacity.a); - color += diffuse * NdotL * opacity; - - //NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) { - vec3 ecViewDir = (gl_ModelViewMatrix * (ep - vec4(rawpos, 1.0))).xyz; - vec3 HV = normalize(normalize(gl_LightSource[0].position.xyz) + normalize(ecViewDir)); - NdotHV = max(0.0, dot(n,HV)); - specular = (gl_FrontMaterial.specular.rgb - * (light_specular.rgb+2.0*light_specular.rgb*(1.0-opacity.a)) - * pow(NdotHV, gl_FrontMaterial.shininess)*opacity.rgb); - } - } - color.a = diffuse.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - //color = clamp(color, 0.0, 1.0); - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_flashlight == 1) - { - secondary_light.rgb += flashlight(light_filter_one, light_radius); - } - if (use_flashlight == 2) - { - secondary_light.rgb += flashlight(light_filter_two, light_radius); - } - float dist = length(relPos); - color.rgb += secondary_light * light_distance_fading(dist); - - texel = texture2D(texture, gl_TexCoord[0].st); - - if (grain_texture_enabled ==1) - { - vec4 grainTexel = texture2D(grain_texture, gl_TexCoord[0].st * grain_magnification); - texel.rgb = mix(texel.rgb, grainTexel.rgb, grainTexel.a ); - } - - - fragColor = color * texel; - fragColor.rgb += specular.rgb; - - // implicit lightmap - the user gets to select a color which is then made emissive - - if (implicit_lightmap_enabled == 1) - { - float cdiff = (length(texel.rgb - tag_color)); - float enhance = 1.0 - smoothstep(threshold_low, threshold_high, cdiff); - fragColor.rgb = fragColor.rgb + enhance * emit_color * emit_intensity; - } - - // explicit lightmap - - vec3 lightmapcolor = vec3(0.0, 0.0, 0.0); - - - if (lightmap_enabled == 1) - { - vec4 lightmapTexel = texture2D(lightmap_texture, gl_TexCoord[0].st); - vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor, lightmap_b_factor, lightmap_a_factor); - lightmapFactor = lightmapFactor * lightmapTexel; - if (lightmap_multi > 0 ) - { - //lightmapcolor = lightmap_r_color * lightmapFactor.r + - //lightmap_g_color * lightmapFactor.g + - // lightmap_b_color * lightmapFactor.b + - //lightmap_a_color * lightmapFactor.a ; - - lightmapcolor = lightmap_r_color * lightmapFactor.r; - lightmapcolor = addLights(lightmapcolor, lightmap_g_color * lightmapFactor.g); - lightmapcolor = addLights(lightmapcolor, lightmap_b_color * lightmapFactor.b); - lightmapcolor = addLights(lightmapcolor, lightmap_a_color * lightmapFactor.a); - } - else - { - lightmapcolor = lightmapTexel.rgb * lightmap_r_color * lightmapFactor.r; - } - fragColor.rgb = max(fragColor.rgb, lightmapcolor.rgb * gl_FrontMaterial.diffuse.rgb * smoothstep(0.0, 1.0, texel.rgb*.5 + lightmapcolor.rgb*.5)); - } - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} - diff --git a/Compositor/Shaders/ALS/model-interior-detailed.vert b/Compositor/Shaders/ALS/model-interior-detailed.vert deleted file mode 100644 index 8b40fe0e7..000000000 --- a/Compositor/Shaders/ALS/model-interior-detailed.vert +++ /dev/null @@ -1,308 +0,0 @@ -// -*-C++-*- -#version 120 - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -// Haze part added by Thorsten Renk, Oct. 2011 - - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec3 rawpos; - -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - -uniform int colorMode; -uniform int irradiance_map_type; -uniform int ra_irradiance_map_type; - -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; -uniform float moonlight; -uniform float irradiance_map_strength; -uniform float ra_irradiance_map_strength; -uniform float scattering; -uniform float residual_ambience_r; -uniform float residual_ambience_g; -uniform float residual_ambience_b; - - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - - -float earthShade; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - rawpos = gl_Vertex.xyz; - vec4 light_diffuse; - vec4 light_ambient; - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - - - //float yprime_alt; - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float eff_scattering; - -// this code is copied from default.vert - - //vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = gl_NormalMatrix * gl_Normal; - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - - - // here start computations for the haze layer - // we need several geometrical quantities - - // first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = gl_Vertex.xyz - ep.xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(gl_Vertex.z,100.0); - eff_scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * scattering; - - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - - - - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - //light_ambient = light_ambient * (0.7 + 0.3 * smoothstep(0.2, 0.5, earthShade)); - intensity = length(light_ambient.xyz); - - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.xyz); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_diffuse = vec4 (1.0, 1.0, 1.0, 0.0); - light_ambient = vec4 (0.33, 0.4, 0.5, 0.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - light_diffuse.b = 0.78 + lightArg * 0.21; - light_diffuse.g = 0.907 + lightArg * 0.091; - light_diffuse.r = 0.904 + lightArg * 0.092; - light_diffuse.a = 1.0; - - light_ambient.r = 0.316 + lightArg * 0.016; - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - } - - light_diffuse = light_diffuse * smoothstep(0.5, 1.0, scattering); - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - -// irradiance mapping for ambient light - - float ambient_irradiance_factor = 1.0; - float steepness = dot(normalize(gl_Normal), vec3 (0.0, 0.0, 1.0)); - - - if (irradiance_map_type == 1) // maximum irradiance from zenith - { - ambient_irradiance_factor = (1.0 - irradiance_map_strength) + 1.3 * irradiance_map_strength * (0.5 + 0.5 * steepness); - } - else if (irradiance_map_type == 2) //maximum irradiance from sides - { - ambient_irradiance_factor = (1.0 - irradiance_map_strength) + 1.3 * irradiance_map_strength * (1.0 - abs(steepness)); - } - else if (irradiance_map_type == 3) // maximum irradiance from +x direction - { - float forwardness = dot(normalize(gl_Normal), vec3 (-1.0, 0.0, 0.0)); - - ambient_irradiance_factor = (1.0 - irradiance_map_strength) + 1.5 * irradiance_map_strength * (1.0 - abs(steepness)) * (0.5 + 0.5 * forwardness); - } - - light_ambient = light_ambient * ambient_irradiance_factor; - -// residual ambience - comes with its own irradiance map - - vec3 residual_ambience = vec3 (residual_ambience_r, residual_ambience_g, residual_ambience_b); - - ambient_irradiance_factor = 1.0; - - if (ra_irradiance_map_type == 1) // maximum irradiance from zenith - { - ambient_irradiance_factor = (1.0 - ra_irradiance_map_strength) + 1.3 * ra_irradiance_map_strength * (0.5 + 0.5 * steepness); - } - else if (ra_irradiance_map_type == 2) //maximum irradiance from sides - { - ambient_irradiance_factor = (1.0 - ra_irradiance_map_strength) + 1.3 * ra_irradiance_map_strength * (1.0 - abs(steepness)); - } - else if (ra_irradiance_map_type == 3) // maximum irradiance from +x direction - { - float forwardness = dot(normalize(gl_Normal), vec3 (-1.0, 0.0, 0.0)); - - ambient_irradiance_factor = (1.0 - ra_irradiance_map_strength) + 1.5 * ra_irradiance_map_strength * (1.0 - abs(steepness)) * (0.5 + 0.5 * forwardness); - } - - // make sure the residual ambience is only visible when it's dark enough - float residual_fraction = length(residual_ambience.rgb) / (length(light_ambient.rgb + residual_ambience.rgb) + 0.01); - - light_ambient.rgb += residual_ambience.rgb * ambient_irradiance_factor * smoothstep(0.4, 0.6, residual_fraction); - -// default lighting based on texture and material using the light we have just computed - - diffuse_term = diffuse_color* light_diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + light_ambient); - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = gl_Color.a; - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0; - gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; - -} - - - - diff --git a/Compositor/Shaders/ALS/model-interior-display.frag b/Compositor/Shaders/ALS/model-interior-display.frag deleted file mode 100644 index 3582ad5ca..000000000 --- a/Compositor/Shaders/ALS/model-interior-display.frag +++ /dev/null @@ -1,368 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2017 - -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; - - -uniform float fg_Fcoef; - -uniform sampler2D texture; -uniform sampler2D dust_texture; -uniform sampler2D lightmap_texture; -uniform sampler2D grain_texture; -uniform samplerCube cube_texture; - - -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float cloud_self_shading; -uniform float angle; -uniform float threshold_low; -uniform float threshold_high; -uniform float emit_intensity; -uniform float light_radius; -uniform float dirt_factor; -uniform float lightmap_r_factor; -uniform float lightmap_g_factor; -uniform float lightmap_b_factor; -uniform float lightmap_a_factor; -uniform float grain_magnification; -uniform float sample_res; - - -uniform float contrast; - -uniform vec3 offset_vec; -uniform vec3 scale_vec; -uniform vec3 tag_color; -uniform vec3 emit_color; -uniform vec3 light_filter_one; -uniform vec3 light_filter_two; -uniform vec3 lightmap_r_color; -uniform vec3 lightmap_g_color; -uniform vec3 lightmap_b_color; -uniform vec3 lightmap_a_color; - - -uniform int quality_level; -uniform int tquality_level; -uniform int use_searchlight; -uniform int implicit_lightmap_enabled; -uniform int use_flashlight; -uniform int lightmap_enabled; -uniform int lightmap_multi; -uniform int grain_texture_enabled; - - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; - - -float fog_func (in float targ, in float alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - -vec3 addLights(in vec3 color1, in vec3 color2); -vec3 flashlight(in vec3 color, in float radius); -vec3 filter_combined (in vec3 color) ; - -float luminance(vec3 color) -{ - return dot(vec3(0.212671, 0.715160, 0.072169), color); -} - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -// bloom effect on the display texture - - -vec4 find_max (in vec4 texel1, in vec4 texel2, in vec4 texel3, in vec4 texel4) -{ - -float r = max(texel1.r, texel2.r); -r = max(r, texel3.r); -r = max(r, texel4.r); - -float g = max(texel1.g, texel2.g); -g = max(g, texel3.g); -g = max(g, texel4.g); - -float b = max(texel1.b, texel2.b); -b = max(b, texel3.b); -b = max(b, texel4.b); - -float a = max(texel1.a, texel2.a); -a = max(a, texel3.a); -a = max(a, texel4.a); - -//float a = (texel1.a + texel2.a + texel3.a + texel4.a)/4.0; - -return vec4 (r,g,b,a); -} - -vec4 get_blurred_texel (in vec4 direct_light) -{ - - - -float fade0 = smoothstep(0.5, 1.0,contrast); -float fade1 = 0.25 * contrast * contrast; -float fade2 = 0.25 * contrast * contrast; - -//fade0 = 1.0; -//fade1 = 1.0; -//fade2 = 1.0; - -float desaturation_brightness = 1.0; - -float sample_far = 2.0; -float curr_sample_res = sample_res * contrast; - -vec4 texel = texture2D(texture, gl_TexCoord[0].st); - -vec4 texel1 = texture2D(texture, vec2 (gl_TexCoord[0].s + curr_sample_res, gl_TexCoord[0].t)); -vec4 texel2 = texture2D(texture, vec2 (gl_TexCoord[0].s - curr_sample_res, gl_TexCoord[0].t)); -vec4 texel3 = texture2D(texture, vec2 (gl_TexCoord[0].s, gl_TexCoord[0].t + curr_sample_res)); -vec4 texel4 = texture2D(texture, vec2 (gl_TexCoord[0].s, gl_TexCoord[0].t - curr_sample_res)); - -vec4 sample_texel = find_max (texel1, texel2, texel3, texel4); - -texel.rgb += fade0 * sample_texel.rgb; - - -texel1 = texture2D(texture, vec2 (gl_TexCoord[0].s + sample_far * curr_sample_res, gl_TexCoord[0].t+ sample_far * curr_sample_res)); -texel2 = texture2D(texture, vec2 (gl_TexCoord[0].s - sample_far * curr_sample_res, gl_TexCoord[0].t+ sample_far * curr_sample_res)); -texel3 = texture2D(texture, vec2 (gl_TexCoord[0].s + sample_far * curr_sample_res, gl_TexCoord[0].t- sample_far * curr_sample_res)); -texel4 = texture2D(texture, vec2 (gl_TexCoord[0].s - sample_far * curr_sample_res, gl_TexCoord[0].t- sample_far * curr_sample_res)); - -sample_texel = find_max (texel1, texel2, texel3, texel4); - -texel.rgb += fade1 * sample_texel.rgb; - - - -texel1 = texture2D(texture, vec2 (gl_TexCoord[0].s + 2.0 * sample_far * curr_sample_res, gl_TexCoord[0].t - curr_sample_res)); -texel2 = texture2D(texture, vec2 (gl_TexCoord[0].s - 2.0 * sample_far * curr_sample_res, gl_TexCoord[0].t + curr_sample_res)); -texel3 = texture2D(texture, vec2 (gl_TexCoord[0].s - curr_sample_res, gl_TexCoord[0].t + 2.0 * sample_far * curr_sample_res)); -texel4 = texture2D(texture, vec2 (gl_TexCoord[0].s + curr_sample_res, gl_TexCoord[0].t - 2.0 * sample_far * curr_sample_res)); - -sample_texel = find_max (texel1, texel2, texel3, texel4); - -texel.rgb += fade2 * sample_texel.rgb; - - -texel1 = texture2D(texture, vec2 (gl_TexCoord[0].s + 2.5 * sample_far * curr_sample_res, gl_TexCoord[0].t + 2.5 * sample_far * curr_sample_res)); -texel2 = texture2D(texture, vec2 (gl_TexCoord[0].s - 2.5 * sample_far * curr_sample_res, gl_TexCoord[0].t + 2.5 * sample_far * curr_sample_res)); -texel3 = texture2D(texture, vec2 (gl_TexCoord[0].s + 2.5 * sample_far * curr_sample_res, gl_TexCoord[0].t - 2.5 * sample_far * curr_sample_res)); -texel4 = texture2D(texture, vec2 (gl_TexCoord[0].s - 2.5 * sample_far * curr_sample_res, gl_TexCoord[0].t - 2.5 * sample_far * curr_sample_res)); - -sample_texel = find_max (texel1, texel2, texel3, texel4); - -texel.rgb += fade2 * sample_texel.rgb; - - - -texel.rgb/= (1.0 + 1.0 * fade0 + 1.0 * fade1 + 2.0 * fade2); -texel.a = smoothstep(0.0, 0.1, length(texel.rgb)); - -texel.a *= (1.0 - 0.9 * smoothstep(0.0, 1.0, length(direct_light.rgb)/1.73 * 4.0 *( 0.5 - contrast)) ); - -float threshold_high = max(desaturation_brightness, 0.05) * 1.0; -float threshold_mid = max(desaturation_brightness, 0.05) * 0.6; - -float pixel_brightness = max(texel.r, texel.g); -pixel_brightness = max(pixel_brightness, texel.b); -pixel_brightness *= contrast; - - -texel.rgb = mix(texel.rgb, vec3 (1.0, 1.0, 1.0), 0.9 * smoothstep(threshold_mid, threshold_high, pixel_brightness)); - - -return texel; -} - - -void main() -{ - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = gl_LightSource[0].halfVector.xyz; - vec4 texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - float effective_scattering = min(scattering, cloud_self_shading); - - eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - vec4 light_specular = gl_LightSource[0].specular * (eShade - 0.1); - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - n = (2.0 * gl_Color.a - 1.0) * normal; - n = normalize(n); - - // lookup on the opacity map - vec3 light_vec = normalize((gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz); - //vec3 light_vec = vec3 (-1.0,0.0,0.0); - - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec3 scaled_pos = relPos + ep.xyz; - - //vec3 lookup_vec = normalize(- normalize(light_vec) + relPos); - scaled_pos -= offset_vec; - float rangle = radians(angle); - mat2 rotMat = mat2 (cos(rangle), -sin(rangle), sin(rangle), cos(rangle)); - scaled_pos.xy *=rotMat; - - scaled_pos /= scale_vec; - - //vec3 lookup_pos = dot(base1,scaled_pos) * base1 + dot(base2,scaled_pos) * base2; - vec3 lookup_pos = scaled_pos - light_vec * dot(light_vec, scaled_pos); - - vec3 lookup_vec = normalize(normalize(light_vec) + lookup_pos); - vec4 opacity = textureCube(cube_texture, lookup_vec); - - - vec4 diffuse = diffuse_term; - NdotL = dot(n, lightDir); - //NdotL = dot(n, (gl_ModelViewMatrix * vec4 (light_vec,0.0)).xyz); - if (NdotL > 0.0) { - - diffuse.rgb += 2.0 * diffuse.rgb * (1.0 - opacity.a); - color += diffuse * NdotL * opacity; - NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = (gl_FrontMaterial.specular.rgb - * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess)); - } - color.a = diffuse.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - //color = clamp(color, 0.0, 1.0); - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_flashlight == 1) - { - secondary_light.rgb += flashlight(light_filter_one, light_radius); - } - if (use_flashlight == 2) - { - secondary_light.rgb += flashlight(light_filter_two, light_radius); - } - float dist = length(relPos); - color.rgb += secondary_light * light_distance_fading(dist); - - //texel = texture2D(texture, gl_TexCoord[0].st); - - texel = get_blurred_texel(diffuse * max(0.0, NdotL) * opacity); - - if (grain_texture_enabled ==1) - { - vec4 grainTexel = texture2D(grain_texture, gl_TexCoord[0].st * grain_magnification); - texel.rgb = mix(texel.rgb, grainTexel.rgb, grainTexel.a ); - } - - - - fragColor = color * texel + specular; - - // explicit lightmap - - vec3 lightmapcolor = vec3(0.0, 0.0, 0.0); - - - if (lightmap_enabled == 1) - { - vec4 lightmapTexel = texture2D(lightmap_texture, gl_TexCoord[0].st); - vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor, lightmap_b_factor, lightmap_a_factor); - lightmapFactor = lightmapFactor * lightmapTexel; - - - - if (lightmap_multi > 0 ) - { - - - lightmapcolor = lightmap_r_color * lightmapFactor.r; - lightmapcolor = addLights(lightmapcolor, lightmap_g_color * lightmapFactor.g); - lightmapcolor = addLights(lightmapcolor, lightmap_b_color * lightmapFactor.b); - lightmapcolor = addLights(lightmapcolor, lightmap_a_color * lightmapFactor.a); - - } - else - { - lightmapcolor = lightmapTexel.rgb * lightmap_r_color * lightmapFactor.r; - } - - - // implicit lightmap - the user gets to select a color which is then made emissive - - if (implicit_lightmap_enabled == 1) - { - float cdiff = (length(texel.rgb - tag_color)); - float enhance = 1.0 - smoothstep(threshold_low, threshold_high, cdiff); - enhance *= (1.0 - length(lightmapcolor.rgb)/1.73); - fragColor.rgb = fragColor.rgb + enhance * emit_color * emit_intensity; - } - - - fragColor.rgb = max(fragColor.rgb, lightmapcolor.rgb * gl_FrontMaterial.diffuse.rgb * smoothstep(0.0, 1.0, texel.rgb*.5 + lightmapcolor.rgb*.5)); - } - - // add visible dust for glancing sun angle - - vec4 dustTexel = texture2D(dust_texture, gl_TexCoord[0].st); - dustTexel.rgb *= diffuse.rgb; - dustTexel.a = clamp(dustTexel.a * dirt_factor * (1.0 - 0.4 * max(0.0,NdotL)) * (length(opacity.rgb)/1.76),0.0,1.0); - fragColor.rgb = mix(fragColor.rgb, dustTexel.rgb, dustTexel.a ); - fragColor.a = max(fragColor.a, dustTexel.a); - - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - - -} - diff --git a/Compositor/Shaders/ALS/model-transparent.frag b/Compositor/Shaders/ALS/model-transparent.frag deleted file mode 100644 index 6aa49a409..000000000 --- a/Compositor/Shaders/ALS/model-transparent.frag +++ /dev/null @@ -1,51 +0,0 @@ -// -*-C++-*- - -// Ambient term comes in gl_Color.rgb. -#version 120 - -varying vec4 diffuse_term; -varying vec3 normal; - -varying float flogz; - -uniform float fg_Fcoef; - -uniform sampler2D texture; - -void main() -{ - vec3 n; - float NdotL, NdotHV; - vec4 color = gl_Color; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = gl_LightSource[0].halfVector.xyz; - vec4 texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - n = (2.0 * gl_Color.a - 1.0) * normal; - n = normalize(n); - - NdotL = dot(n, lightDir); - if (NdotL > 0.0) { - color += diffuse_term * NdotL; - NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = (gl_FrontMaterial.specular.rgb - * gl_LightSource[0].specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess)); - } - color.a = diffuse_term.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - texel = texture2D(texture, gl_TexCoord[0].st); - fragColor = color * texel + specular; - - gl_FragColor = fragColor; - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} diff --git a/Compositor/Shaders/ALS/model-transparent.vert b/Compositor/Shaders/ALS/model-transparent.vert deleted file mode 100644 index fc69445af..000000000 --- a/Compositor/Shaders/ALS/model-transparent.vert +++ /dev/null @@ -1,65 +0,0 @@ -// -*-C++-*- - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -#version 120 -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; - -varying float flogz; - -uniform int colorMode; - -////fog "include"//////// -//uniform int fogType; -// -//void fog_Func(int type); -///////////////////////// - -void main() -{ - gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = gl_NormalMatrix * gl_Normal; - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - diffuse_term = diffuse_color * gl_LightSource[0].diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + gl_LightSource[0].ambient); - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = gl_Color.a; - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0; - gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; - //fogCoord = abs(ecPosition.z / ecPosition.w); - //fog_Func(fogType); -} diff --git a/Compositor/Shaders/ALS/model-ultra.frag b/Compositor/Shaders/ALS/model-ultra.frag deleted file mode 100644 index fc9915f07..000000000 --- a/Compositor/Shaders/ALS/model-ultra.frag +++ /dev/null @@ -1,691 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Authors: Frederic Bouvier and Gijs de Rooy -// with major additions and revisions by -// Emilian Huminiuc and Vivian Meazza 2011 -// ported to Atmospheric Light Scattering -// by Thorsten Renk, 2013 -#version 120 - -varying vec3 VBinormal; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 rawpos; -varying vec3 reflVec; -varying vec3 vViewVec; -varying vec3 vertVec; - -varying float alpha; - -varying float flogz; - -uniform float fg_Fcoef; - -uniform sampler2D BaseTex; -uniform sampler2D LightMapTex; -uniform sampler2D NormalTex; -uniform sampler2D ReflMapTex; -uniform sampler2D ReflGradientsTex; -uniform sampler3D ReflNoiseTex; -uniform samplerCube Environment; -uniform sampler2D GrainTex; - -uniform int dirt_enabled; -uniform int dirt_multi; -uniform int dirt_modulates_reflection; -uniform int lightmap_enabled; -uniform int lightmap_multi; -uniform int nmap_dds; -uniform int nmap_enabled; -uniform int refl_enabled; -uniform int refl_type; -uniform int refl_map; -uniform int grain_texture_enabled; -uniform int rain_enabled; -uniform int cloud_shadow_flag; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; -uniform int snow_enabled; -uniform int building_flag; - -uniform float amb_correction; -uniform float dirt_b_factor; -uniform float dirt_g_factor; -uniform float dirt_r_factor; -uniform float dirt_reflection_factor; -uniform float lightmap_a_factor; -uniform float lightmap_b_factor; -uniform float lightmap_g_factor; -uniform float lightmap_r_factor; -uniform float nmap_tile; -uniform float refl_correction; -uniform float refl_fresnel; -uniform float refl_fresnel_factor; -uniform float refl_noise; -uniform float refl_rainbow; -uniform float grain_magnification; -uniform float wetness; -uniform float rain_norm; - -uniform float avisibility; -uniform float cloud_self_shading; -uniform float eye_alt; -uniform float ground_scattering; -uniform float hazeLayerAltitude; -uniform float moonlight; -uniform float overcast; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float visibility; -uniform float air_pollution; -uniform float snowlevel; -uniform float snow_thickness_factor; - -uniform float osg_SimulationTime; -uniform mat4 osg_ViewMatrix; - -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; - -uniform bool use_IR_vision; - -// constants needed by the light and fog computations ################################################### - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -uniform vec3 lightmap_r_color; -uniform vec3 lightmap_g_color; -uniform vec3 lightmap_b_color; -uniform vec3 lightmap_a_color; - -uniform vec3 dirt_r_color; -uniform vec3 dirt_g_color; -uniform vec3 dirt_b_color; - -float DotNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density); -float Noise2D(in vec2 coord, in float wavelength); -float shadow_func (in float x, in float y, in float noise, in float dist); -float fog_func (in float targ, in float altitude); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float lightArg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 filter_combined (in vec3 color) ; -vec3 moonlight_perception (in vec3 light) ; -vec3 addLights(in vec3 color1, in vec3 color2); - -float getShadowing(); - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) - { - if (x > 30.0) {return e;} - if (x < -15.0) {return 0.0;} - return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); - } - - - - - -void main (void) - { - vec4 texel = texture2D(BaseTex, gl_TexCoord[0].st); - vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * nmap_tile); - vec4 reflmap = texture2D(ReflMapTex, gl_TexCoord[0].st); - vec4 noisevec = texture3D(ReflNoiseTex, rawpos.xyz); - vec4 lightmapTexel = texture2D(LightMapTex, gl_TexCoord[0].st); - - vec4 grainTexel; - - vec3 mixedcolor; - vec3 N = vec3(0.0,0.0,1.0); - - - float pf = 0.0; - float pf1 = 0.0; - ///some generic light scattering parameters - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - moonLightColor = moonlight_perception(moonLightColor); - float alt = eye_alt; - float effective_scattering = min(scattering, cloud_self_shading); - - - /// BEGIN geometry for light - - vec3 up; - - if (building_flag == 1) // osg_ViewMatrix contains the transforms of animations, but doesn't work for random buildings - { - up = (gl_ModelViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz; - } - else - { - up = (osg_ViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz; - } - //vec4 worldPos3D = (osg_ViewMatrixInverse * vec4 (0.0,0.0,0.0, 1.0)); - //worldPos3D.a = 0.0; - //vec3 up = (osg_ViewMatrix * worldPos3D).xyz; - float dist = length(vertVec); - float vertex_alt = max(100.0,dot(up, vertVec) + alt); - float vertex_scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - - vec3 lightHorizon = gl_LightSource[0].position.xyz - up * dot(up,gl_LightSource[0].position.xyz); - float yprime = -dot(vertVec, lightHorizon); - float yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - float lightArg = (terminator-yprime_alt)/100000.0; - - float earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - float mie_angle; - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(vertVec), normalize(gl_LightSource[0].position.xyz)) ) + 0.5;} - else - {mie_angle = 1.0;} - - float fog_vertex_alt = max(vertex_alt,hazeLayerAltitude); - float fog_yprime_alt = yprime_alt; - if (fog_vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - fog_vertex_alt = mix(fog_vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - fog_yprime_alt = yprime -sqrt(2.0 * EarthRadius * fog_vertex_alt); - } - } - else - { - fog_vertex_alt = hazeLayerAltitude; - fog_yprime_alt = yprime -sqrt(2.0 * EarthRadius * fog_vertex_alt); - } - - float fog_lightArg = (terminator-fog_yprime_alt)/100000.0; - float fog_earthShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, fog_yprime_alt) + 0.1; - float delta_z = hazeLayerAltitude - eye_alt; - - - float ct = dot(normalize(up), normalize(vertVec)); - vec3 relPos = (gl_ModelViewMatrixInverse * vec4 (vertVec,0.0)).xyz; - - /// END geometry for light - - - /// BEGIN light - vec4 light_diffuse; - vec4 light_ambient; - float intensity; - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * vertex_scattering; - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - - if (earthShade < 0.5) - { - intensity = length(light_ambient.rgb); - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.7,earthShade) )); - } - - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec3 ecViewDir = (gl_ModelViewMatrix * (ep - vec4(rawpos, 1.0))).xyz; - vec3 HV = normalize(normalize(gl_LightSource[0].position.xyz) + normalize(ecViewDir)); - - /// END light - - /// BEGIN grain overlay - if (grain_texture_enabled ==1) - { - grainTexel = texture2D(GrainTex, gl_TexCoord[0].st * grain_magnification); - texel.rgb = mix(texel.rgb, grainTexel.rgb, grainTexel.a ); - } - else if (grain_texture_enabled == 2) - { - grainTexel = texture2D(GrainTex, rawpos.xy * grain_magnification); - texel.rgb = mix(texel.rgb, grainTexel.rgb, grainTexel.a ); - } - - /// END grain overlay - - /// BEGIN snowcover - - vec4 snow_texel = vec4 (0.95, 0.95, 0.95, 1.0); - - if (snow_enabled == 1) - { - float noise_1m = Noise2D(rawpos.xy, 1.0); - float noise_5m = Noise2D(rawpos.xy, 5.0); - - float noise_term = 0.5 * (noise_5m - 0.5); - noise_term += 0.5 * (noise_1m - 0.5); - snow_texel.a = snow_texel.a * 0.2+0.8* smoothstep(0.2,0.8, 0.3 +noise_term + 0.5*snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) ); - - snow_texel.a *= smoothstep(0.5, 0.7,dot(VNormal, up)); - - - float noise_2000m = 0.0; - float noise_10m = 0.0; - - - texel.rgb = mix(texel.rgb, snow_texel.rgb, snow_texel.a* smoothstep(snowlevel, snowlevel+200.0, 1.0 * (relPos.z + eye_alt)+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0)); - } - - /// END snowcover - - vec3 reflVecN; - - ///BEGIN bump - if (nmap_enabled > 0){ - N = nmap.rgb * 2.0 - 1.0; - // this is exact only for viewing under 90 degrees but much faster than the real solution - reflVecN = normalize (N.x * VTangent + N.y * VBinormal + N.z * reflVec); - N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); - if (nmap_dds > 0) - N = -N; - } else { - N = normalize(VNormal); - reflVecN = reflVec; - } - ///END bump - - - - vec4 reflection = textureCube(Environment, reflVecN ); - vec3 viewVec = normalize(vViewVec); - float v = abs(dot(viewVec, normalize(VNormal)));// Map a rainbowish color - vec4 fresnel = texture2D(ReflGradientsTex, vec2(v, 0.75)); - vec4 rainbow = texture2D(ReflGradientsTex, vec2(v, 0.25)); - - float nDotVP = max(0.0, dot(N, normalize(gl_LightSource[0].position.xyz))); - //float nDotHV = max(0.0, dot(N, normalize(gl_LightSource[0].halfVector.xyz))); - float nDotHV = max(0.0, dot(N,HV)); - //glare on the backside of tranparent objects - if ((gl_FrontMaterial.diffuse.a < 1.0 || texel.a < 1.0) - && dot(N, normalize(gl_LightSource[0].position.xyz)) < 0.0) { - nDotVP = max(0.0, dot(-N, normalize(gl_LightSource[0].position.xyz)) * (1.0 -texel.a) ); - nDotHV = max(0.0, dot(-N, HV) * (1.0 -texel.a) ); - } - - float nDotVP1 = 0.0; - float nDotHV1 = 0.0; - - - // try specular reflection of sky irradiance - nDotVP1 = max(0.0, dot(N, up)); - nDotHV1 = max(0.0, dot(N, normalize(normalize(up) + normalize(-vertVec)))); - - - if (nDotVP == 0.0) - {pf = 0.0;} - else - {pf = pow(nDotHV, gl_FrontMaterial.shininess);} - - if (nDotVP1 == 0.0) - {pf1 = 0.0;} - else - {pf1 = pow(nDotHV1, 0.5*gl_FrontMaterial.shininess);} - - - float shadowmap = getShadowing(); - light_diffuse *= shadowmap; - - if (cloud_shadow_flag == 1) - { - float cloud_shadow_factor = shadow_func(relPos.x, relPos.y, 1.0, dist); - cloud_shadow_factor = 1.0 - ((1.0 - cloud_shadow_factor) * (1.0 - smoothstep (-100.0, 100.0, vertex_alt - hazeLayerAltitude))); - light_diffuse = light_diffuse * cloud_shadow_factor; - } - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - - - vec4 Diffuse = light_diffuse * nDotVP; - Diffuse.rgb += secondary_light * light_distance_fading(dist); - if (use_IR_vision) - { - Diffuse.rgb = max(Diffuse.rgb, vec3 (0.5, 0.5, 0.5)); - } - - ///BEGIN reflection correction by dirt - - float refl_d = 1.0; - - if ((dirt_enabled == 1) && (dirt_modulates_reflection == 1)) - { - refl_d = 1.0 - (reflmap.r * dirt_r_factor * (1.0 - dirt_reflection_factor)); - } - - ///END reflection correction by dirt - - - vec4 Specular = gl_FrontMaterial.specular * light_diffuse * pf + gl_FrontMaterial.specular * light_ambient * pf1; - Specular+= gl_FrontMaterial.specular * pow(max(0.0,-dot(N,normalize(vertVec))),gl_FrontMaterial.shininess) * vec4(secondary_light,1.0); - - Specular *= refl_d; - Specular *= shadowmap; - - vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse; - color = clamp( color, 0.0, 1.0 ); - - //////////////////////////////////////////////////////////////////// - //BEGIN reflect - //////////////////////////////////////////////////////////////////// - if (refl_enabled > 0){ - float reflFactor = 0.0; - float transparency_offset = clamp(refl_correction, -1.0, 1.0);// set the user shininess offset - - if(refl_map > 0){ - // map the shininess of the object with user input - //float pam = (map.a * -2) + 1; //reverse map - reflFactor = reflmap.a + transparency_offset; - } else if (nmap_enabled > 0) { - // set the reflectivity proportional to shininess with user input - reflFactor = gl_FrontMaterial.shininess * 0.0078125 * nmap.a + transparency_offset; - } else { - reflFactor = gl_FrontMaterial.shininess* 0.0078125 + transparency_offset; - } - - // enhance low angle reflection by a fresnel term - float fresnel_enhance = (1.0-smoothstep(0.0,0.4, dot(N,-normalize(vertVec)))) * refl_fresnel_factor; - - reflFactor+=fresnel_enhance; - - reflFactor = clamp(reflFactor, 0.0, 1.0); - - // add fringing fresnel and rainbow effects and modulate by reflection - vec4 reflcolor = mix(reflection, rainbow, refl_rainbow * v); - //vec4 reflcolor = reflection; - vec4 reflfrescolor = mix(reflcolor, fresnel, refl_fresnel * v); - vec4 noisecolor = mix(reflfrescolor, noisevec, refl_noise); - //vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0); - vec4 raincolor = vec4(noisecolor.rgb, 1.0); - raincolor += Specular; - raincolor *= light_diffuse; - - if (refl_type == 1) - {mixedcolor = mix(texel, raincolor, reflFactor * refl_d).rgb;} - else if (refl_type == 2) - {mixedcolor = ((texel +(reflcolor * reflFactor * refl_d))-(0.5*reflFactor * refl_d)).rgb;} - - } else { - mixedcolor = texel.rgb; - } - ///////////////////////////////////////////////////////////////////// - //END reflect - ///////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////// - //begin DIRT - ////////////////////////////////////////////////////////////////////// - if (dirt_enabled >= 1){ - vec3 dirtFactorIn = vec3 (dirt_r_factor, dirt_g_factor, dirt_b_factor); - vec3 dirtFactor = reflmap.rgb * dirtFactorIn.rgb; - //dirtFactor.r = smoothstep(0.0, 1.0, dirtFactor.r); - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_r_color, smoothstep(0.0, 1.0, dirtFactor.r)); - if (dirt_multi > 0) { - //dirtFactor.g = smoothstep(0.0, 1.0, dirtFactor.g); - //dirtFactor.b = smoothstep(0.0, 1.0, dirtFactor.b); - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_g_color, smoothstep(0.0, 1.0, dirtFactor.g)); - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_b_color, smoothstep(0.0, 1.0, dirtFactor.b)); - } - } - ////////////////////////////////////////////////////////////////////// - //END Dirt - ////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////// - //begin WETNESS - ////////////////////////////////////////////////////////////////////// - - if (rain_enabled >0.0) - { - texel.rgb = texel.rgb * (1.0 - 0.6 * wetness); - float rain_factor = 0.0; - - float rain_orientation = max(dot(VNormal, up),0.0); - - if ((rain_norm > 0.0) && (rain_orientation > 0.0)) - { - rain_factor += DotNoise2D(rawpos.xy, 0.2 ,0.5, rain_norm) * abs(sin(6.0*osg_SimulationTime)); - rain_factor += DotNoise2D(rawpos.xy, 0.3 ,0.4, rain_norm) * abs(sin(6.0*osg_SimulationTime + 2.094)); - rain_factor += DotNoise2D(rawpos.xy, 0.4 ,0.3, rain_norm)* abs(sin(6.0*osg_SimulationTime + 4.188)); - } - - - - // secondary reflection of sky irradiance in water film - float fresnelW = ((0.8 * wetness) ) * (1.0-smoothstep(0.0,0.4, dot(N,-normalize(vertVec)) * 1.0 - 0.2 * rain_factor * wetness)); - float sky_factor = (1.0-ct*ct); - vec3 sky_light = vec3 (1.0,1.0,1.0) * length(light_diffuse.rgb) * (1.0-effective_scattering); - Specular.rgb += sky_factor * fresnelW * sky_light; - } - ///////////////////////////////////////////////////////////////////// - //end WETNESS - ////////////////////////////////////////////////////////////////////// - - - // set ambient adjustment to remove bluiness with user input - float ambient_offset = clamp(amb_correction, -1.0, 1.0); - //vec4 ambient = gl_LightModel.ambient + gl_LightSource[0].ambient; - vec4 ambient = gl_LightModel.ambient + light_ambient; - vec4 ambient_Correction = vec4(ambient.rg, ambient.b * 0.6, 1.0) - * ambient_offset ; - ambient_Correction = clamp(ambient_Correction, -1.0, 1.0); - - color.a = texel.a * alpha; - vec4 fragColor = vec4(color.rgb * mixedcolor + ambient_Correction.rgb, color.a); - - fragColor += Specular * nmap.a; - - ////////////////////////////////////////////////////////////////////// - // BEGIN lightmap - ////////////////////////////////////////////////////////////////////// - if ( lightmap_enabled >= 1 ) { - vec3 lightmapcolor = vec3(0.0); - vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor, - lightmap_b_factor, lightmap_a_factor); - lightmapFactor = lightmapFactor * lightmapTexel; - if (lightmap_multi > 0 ){ - //lightmapcolor = lightmap_r_color * lightmapFactor.r + - // lightmap_g_color * lightmapFactor.g + - // lightmap_b_color * lightmapFactor.b + - // lightmap_a_color * lightmapFactor.a ; - - lightmapcolor = lightmap_r_color * lightmapFactor.r; - lightmapcolor = addLights(lightmapcolor, lightmap_g_color * lightmapFactor.g); - lightmapcolor = addLights(lightmapcolor, lightmap_b_color * lightmapFactor.b); - lightmapcolor = addLights(lightmapcolor, lightmap_a_color * lightmapFactor.a); - - - } else { - lightmapcolor = lightmapTexel.rgb * lightmap_r_color * lightmapFactor.r; - } - fragColor.rgb = max(fragColor.rgb, lightmapcolor * gl_FrontMaterial.diffuse.rgb * smoothstep(0.0, 1.0, mixedcolor*.5 + lightmapcolor*.5)); - } - ////////////////////////////////////////////////////////////////////// - // END lightmap - ///////////////////////////////////////////////////////////////////// - - - /// BEGIN fog amount - - float transmission; - float vAltitude; - float delta_zv; - float H; - float distance_in_layer; - float transmission_arg; - float eqColorFactor; - - float mvisibility = min(visibility, avisibility); - - if (dist > 0.04 * mvisibility) - { - if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - transmission_arg = (dist-distance_in_layer)/avisibility; - - - if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 -effective_scattering); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 -effective_scattering); - } - transmission = fog_func(transmission_arg, alt); - if (eqColorFactor < 0.2) eqColorFactor = 0.2; - } - else - { - eqColorFactor = 1.0; - transmission = 1.0; - } - - /// END fog amount - - /// BEGIN fog color - - vec3 hazeColor = get_hazeColor(fog_lightArg); - - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - - if (transmission< 1.0) - { - - - - if (fog_lightArg < 10.0) - { - intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - - intensity = length(hazeColor); - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - - hazeColor.r = hazeColor.r * 0.83; - hazeColor.g = hazeColor.g * 0.9; - - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,fog_earthShade) )); - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - float shadow = mix( min(1.0 + dot(VNormal,gl_LightSource[0].position.xyz),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); - hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - } - else - { - hazeColor = vec3 (1.0, 1.0, 1.0); - } - - if (use_IR_vision) - { - //hazeColor.rgb = max(hazeColor.rgb, vec3 (0.5, 0.5, 0.5)); - } - - - /// END fog color - fragColor = clamp(fragColor, 0.0, 1.0); - //hazeColor = clamp(hazeColor, 0.0, 1.0); - - ///BEGIN Rayleigh fog /// - - // Rayleigh color shift due to out-scattering - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); - - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - - /// END Rayleigh fog - - // don't let the light fade out too rapidly - lightArg = (terminator + 200000.0)/100000.0; - float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); - vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - hazeColor *= eqColorFactor * fog_earthShade; - hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - - - fragColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission); - - - fragColor.rgb = filter_combined(fragColor.rgb); - gl_FragColor = fragColor; - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - } diff --git a/Compositor/Shaders/ALS/model-ultra.vert b/Compositor/Shaders/ALS/model-ultra.vert deleted file mode 100644 index 096522889..000000000 --- a/Compositor/Shaders/ALS/model-ultra.vert +++ /dev/null @@ -1,123 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// © Emilian Huminiuc and Vivian Meazza 2011 -#version 120 - -varying vec3 rawpos; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 vViewVec; -varying vec3 reflVec; -varying vec3 vertVec; - -varying float alpha; - -varying float flogz; - -attribute vec3 tangent; -attribute vec3 binormal; - -uniform float pitch; -uniform float roll; -uniform float hdg; -uniform int refl_dynamic; -uniform int nmap_enabled; -uniform int shader_qual; - -//////Fog Include/////////// -// uniform int fogType; -// void fog_Func(int type); -//////////////////////////// - -void setupShadows(vec4 eyeSpacePos); - -void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat) -{ - rotmat = mat4( cosRy , sinRx * sinRy , cosRx * sinRy, 0.0, - 0.0 , cosRx , -sinRx * cosRx, 0.0, - -sinRy, sinRx * cosRy, cosRx * cosRy , 0.0, - 0.0 , 0.0 , 0.0 , 1.0 ); -} - -void rotationMatrixH(in float sinRz, in float cosRz, out mat4 rotmat) -{ - rotmat = mat4( cosRz, -sinRz, 0.0, 0.0, - sinRz, cosRz, 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); -} - -void main(void) -{ - rawpos = gl_Vertex.xyz; - vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - //fog_Func(fogType); - - VNormal = normalize(gl_NormalMatrix * gl_Normal); - - vec3 n = normalize(gl_Normal); - vec3 tempTangent = cross(n, vec3(1.0,0.0,0.0)); - vec3 tempBinormal = cross(n, tempTangent); - - if (nmap_enabled > 0){ - tempTangent = tangent; - tempBinormal = binormal; - } - - VTangent = normalize(gl_NormalMatrix * tempTangent); - VBinormal = normalize(gl_NormalMatrix * tempBinormal); - vec3 t = tempTangent; - vec3 b = tempBinormal; - - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - alpha = gl_FrontMaterial.diffuse.a; - else - alpha = gl_Color.a; - - // Vertex in eye coordinates - vertVec = ecPosition.xyz; - vViewVec.x = dot(t, vertVec); - vViewVec.y = dot(b, vertVec); - vViewVec.z = dot(n, vertVec); - - // calculate the reflection vector - vec4 reflect_eye = vec4(reflect(vertVec, VNormal), 0.0); - vec3 reflVec_stat = normalize(gl_ModelViewMatrixInverse * reflect_eye).xyz; - if (refl_dynamic > 0){ - //prepare rotation matrix - mat4 RotMatPR; - mat4 RotMatH; - float _roll = roll; - if (_roll>90.0 || _roll < -90.0) - { - _roll = -_roll; - } - float cosRx = cos(radians(_roll)); - float sinRx = sin(radians(_roll)); - float cosRy = cos(radians(-pitch)); - float sinRy = sin(radians(-pitch)); - float cosRz = cos(radians(hdg)); - float sinRz = sin(radians(hdg)); - rotationMatrixPR(sinRx, cosRx, sinRy, cosRy, RotMatPR); - rotationMatrixH(sinRz, cosRz, RotMatH); - vec3 reflVec_dyn = (RotMatH * (RotMatPR * normalize(gl_ModelViewMatrixInverse * reflect_eye))).xyz; - - reflVec = reflVec_dyn; - } else { - reflVec = reflVec_stat; - } - - - gl_FrontColor = gl_FrontMaterial.emission + gl_Color - * (gl_LightModel.ambient + gl_LightSource[0].ambient); - - gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - - setupShadows(ecPosition); -} diff --git a/Compositor/Shaders/ALS/model-wingflex-organic.vert b/Compositor/Shaders/ALS/model-wingflex-organic.vert deleted file mode 100644 index b15d3d9a3..000000000 --- a/Compositor/Shaders/ALS/model-wingflex-organic.vert +++ /dev/null @@ -1,172 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// based on -// © Emilian Huminiuc and Vivian Meazza 2011 -// addition for wingflex mesh distortion by Thorsten Renk 2015 - -#version 120 - -varying vec3 rawpos; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 vViewVec; -varying vec3 reflVec; -varying vec3 vertVec; - -varying float alpha; - -varying float flogz; - -attribute vec3 tangent; -attribute vec3 binormal; - -uniform float pitch; -uniform float roll; -uniform float hdg; -uniform float wingflex_alpha; -uniform float wingflex_trailing_alpha; -uniform float wingsweep_factor; -uniform int refl_dynamic; -uniform int nmap_enabled; -uniform int shader_qual; -uniform int rembrandt_enabled; - -//////Fog Include/////////// -// uniform int fogType; -// void fog_Func(int type); -//////////////////////////// - -void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat) -{ - rotmat = mat4( cosRy , sinRx * sinRy , cosRx * sinRy, 0.0, - 0.0 , cosRx , -sinRx * cosRx, 0.0, - -sinRy, sinRx * cosRy, cosRx * cosRy , 0.0, - 0.0 , 0.0 , 0.0 , 1.0 ); -} - -void rotationMatrixH(in float sinRz, in float cosRz, out mat4 rotmat) -{ - rotmat = mat4( cosRz, -sinRz, 0.0, 0.0, - sinRz, cosRz, 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); -} - -void main(void) -{ - vec4 vertex = gl_Vertex; - - - float body_width = 0.7; - float arm_reach = 4.8; - - float x_factor = max((abs(vertex.x) - body_width),0); - float y_factor = max(vertex.y,0.0); - float flex_factor1 = wingflex_alpha * (1.0 - wingsweep_factor); - float flex_factor2 = wingflex_trailing_alpha * (1.0 -wingsweep_factor); - - - if (flex_factor1<0.0) {flex_factor1 *=0.7;} - if (flex_factor2<0.0) {flex_factor1 *=0.7;} - - // basic flapping motion is linear to arm_reach, then parabolic - - float intercept_point = 0.1 * arm_reach * arm_reach * flex_factor1; - - if (x_factor < arm_reach) - { - vertex.z += x_factor/arm_reach * intercept_point; - } - - else - { - vertex.z += 0.1 * x_factor * x_factor * flex_factor1; - } - - // upward stroke is slightly forward-swept, downward stroke a bit backward - vertex.y += -0.25 * abs(x_factor) * flex_factor1; - - //trailing edge lags the motion - vertex.z += 0.2 * y_factor * x_factor * flex_factor2; - - - // if the wings are folded, we sweep them back - vertex.y += 0.5 * x_factor * wingsweep_factor; - float sweep_x = 0.5; - if (vertex.x > 0.0) {sweep_x = - 0.5;} - - vertex.x+= sweep_x * (1.0 + 0.5 *x_factor) * wingsweep_factor; - - - rawpos = vertex.xyz; - vec4 ecPosition = gl_ModelViewMatrix * vertex; - - VNormal = normalize(gl_NormalMatrix * gl_Normal); - - vec3 n = normalize(gl_Normal); - vec3 tempTangent = cross(n, vec3(1.0,0.0,0.0)); - vec3 tempBinormal = cross(n, tempTangent); - - if (nmap_enabled > 0){ - tempTangent = tangent; - tempBinormal = binormal; - } - - VTangent = normalize(gl_NormalMatrix * tempTangent); - VBinormal = normalize(gl_NormalMatrix * tempBinormal); - vec3 t = tempTangent; - vec3 b = tempBinormal; - - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - alpha = gl_FrontMaterial.diffuse.a; - else - alpha = gl_Color.a; - - // Vertex in eye coordinates - vertVec = ecPosition.xyz; - vViewVec.x = dot(t, vertVec); - vViewVec.y = dot(b, vertVec); - vViewVec.z = dot(n, vertVec); - - // calculate the reflection vector - vec4 reflect_eye = vec4(reflect(vertVec, VNormal), 0.0); - vec3 reflVec_stat = normalize(gl_ModelViewMatrixInverse * reflect_eye).xyz; - if (refl_dynamic > 0){ - //prepare rotation matrix - mat4 RotMatPR; - mat4 RotMatH; - float _roll = roll; - if (_roll>90.0 || _roll < -90.0) - { - _roll = -_roll; - } - float cosRx = cos(radians(_roll)); - float sinRx = sin(radians(_roll)); - float cosRy = cos(radians(-pitch)); - float sinRy = sin(radians(-pitch)); - float cosRz = cos(radians(hdg)); - float sinRz = sin(radians(hdg)); - rotationMatrixPR(sinRx, cosRx, sinRy, cosRy, RotMatPR); - rotationMatrixH(sinRz, cosRz, RotMatH); - vec3 reflVec_dyn = (RotMatH * (RotMatPR * normalize(gl_ModelViewMatrixInverse * reflect_eye))).xyz; - - reflVec = reflVec_dyn; - } else { - reflVec = reflVec_stat; - } - - if(rembrandt_enabled < 1){ - gl_FrontColor = gl_FrontMaterial.emission + gl_Color - * (gl_LightModel.ambient + gl_LightSource[0].ambient); - } else { - gl_FrontColor = gl_Color; - } - gl_Position = gl_ModelViewProjectionMatrix * vertex; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - //gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; -} diff --git a/Compositor/Shaders/ALS/noise.frag b/Compositor/Shaders/ALS/noise.frag deleted file mode 100644 index 60448a0e7..000000000 --- a/Compositor/Shaders/ALS/noise.frag +++ /dev/null @@ -1,293 +0,0 @@ -// -*-C++-*- - -// This is a library of noise functions, taking a coordinate vector and a wavelength -// as input and returning a number [0:1] as output. - -// * Noise2D(in vec2 coord, in float wavelength) is 2d Perlin noise -// * Noise3D(in vec3 coord, in float wavelength) is 3d Perlin noise -// * DotNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dDensity) -// is sparse dot noise and takes a dot density parameter -// * DropletNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dDensity) -// is sparse dot noise modified to look like liquid and takes a dot density parameter -// * VoronoiNoise2D(in vec2 coord, in float wavelength, in float xrand, in float yrand) -// is a function mapping the terrain into random domains, based on Voronoi tiling of a regular grid -// distorted with xrand and yrand -// * SlopeLines2D(in vec2 coord, in vec2 gradDir, in float wavelength, in float steepness) -// computes a semi-random set of lines along the direction of steepest descent, allowing to -// simulate e.g. water erosion patterns -// * Strata3D(in vec3 coord, in float wavelength, in float variation) -// computers a vertically stratified random pattern, appropriate e.g. for rock textures - -// Thorsten Renk 2014 - -#version 120 - - -float rand2D(in vec2 co){ - return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); -} - -float rand3D(in vec3 co){ - return fract(sin(dot(co.xyz ,vec3(12.9898,78.233,144.7272))) * 43758.5453); -} - -float cosine_interpolate(in float a, in float b, in float x) -{ - float ft = x * 3.1415927; - float f = (1.0 - cos(ft)) * .5; - - return a*(1.0-f) + b*f; -} - -float simple_interpolate(in float a, in float b, in float x) -{ -return a + smoothstep(0.0,1.0,x) * (b-a); -} - -float interpolatedNoise2D(in float x, in float y) -{ - float integer_x = x - fract(x); - float fractional_x = x - integer_x; - - float integer_y = y - fract(y); - float fractional_y = y - integer_y; - - float v1 = rand2D(vec2(integer_x, integer_y)); - float v2 = rand2D(vec2(integer_x+1.0, integer_y)); - float v3 = rand2D(vec2(integer_x, integer_y+1.0)); - float v4 = rand2D(vec2(integer_x+1.0, integer_y +1.0)); - - float i1 = simple_interpolate(v1 , v2 , fractional_x); - float i2 = simple_interpolate(v3 , v4 , fractional_x); - - return simple_interpolate(i1 , i2 , fractional_y); -} - -float interpolatedNoise3D(in float x, in float y, in float z) -{ - float integer_x = x - fract(x); - float fractional_x = x - integer_x; - - float integer_y = y - fract(y); - float fractional_y = y - integer_y; - - float integer_z = z - fract(z); - float fractional_z = z - integer_z; - - float v1 = rand3D(vec3(integer_x, integer_y, integer_z)); - float v2 = rand3D(vec3(integer_x+1.0, integer_y, integer_z)); - float v3 = rand3D(vec3(integer_x, integer_y+1.0, integer_z)); - float v4 = rand3D(vec3(integer_x+1.0, integer_y +1.0, integer_z)); - - float v5 = rand3D(vec3(integer_x, integer_y, integer_z+1.0)); - float v6 = rand3D(vec3(integer_x+1.0, integer_y, integer_z+1.0)); - float v7 = rand3D(vec3(integer_x, integer_y+1.0, integer_z+1.0)); - float v8 = rand3D(vec3(integer_x+1.0, integer_y +1.0, integer_z+1.0)); - - - float i1 = simple_interpolate(v1,v5, fractional_z); - float i2 = simple_interpolate(v2,v6, fractional_z); - float i3 = simple_interpolate(v3,v7, fractional_z); - float i4 = simple_interpolate(v4,v8, fractional_z); - - float ii1 = simple_interpolate(i1,i2,fractional_x); - float ii2 = simple_interpolate(i3,i4,fractional_x); - - - return simple_interpolate(ii1 , ii2 , fractional_y); -} - - -float Noise2D(in vec2 coord, in float wavelength) -{ -return interpolatedNoise2D(coord.x/wavelength, coord.y/wavelength); - -} - -float Noise3D(in vec3 coord, in float wavelength) -{ -return interpolatedNoise3D(coord.x/wavelength, coord.y/wavelength, coord.z/wavelength); -} - -float dotNoise2D(in float x, in float y, in float fractionalMaxDotSize, in float dDensity) -{ - float integer_x = x - fract(x); - float fractional_x = x - integer_x; - - float integer_y = y - fract(y); - float fractional_y = y - integer_y; - - if (rand2D(vec2(integer_x+1.0, integer_y +1.0)) > dDensity) - {return 0.0;} - - float xoffset = (rand2D(vec2(integer_x, integer_y)) -0.5); - float yoffset = (rand2D(vec2(integer_x+1.0, integer_y)) - 0.5); - float dotSize = 0.5 * fractionalMaxDotSize * max(0.25,rand2D(vec2(integer_x, integer_y+1.0))); - - - vec2 truePos = vec2 (0.5 + xoffset * (1.0 - 2.0 * dotSize) , 0.5 + yoffset * (1.0 -2.0 * dotSize)); - - float distance = length(truePos - vec2(fractional_x, fractional_y)); - - return 1.0 - smoothstep (0.3 * dotSize, 1.0* dotSize, distance); -} - -float DotNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dDensity) -{ -return dotNoise2D(coord.x/wavelength, coord.y/wavelength, fractionalMaxDotSize, dDensity); -} - -float dropletNoise2D(in float x, in float y, in float fractionalMaxDotSize, in float dDensity) -{ - float integer_x = x - fract(x); - float fractional_x = x - integer_x; - - float integer_y = y - fract(y); - float fractional_y = y - integer_y; - - if (rand2D(vec2(integer_x+1.0, integer_y +1.0)) > dDensity) - {return 0.0;} - - float xoffset = (rand2D(vec2(integer_x, integer_y)) -0.5); - float yoffset = (rand2D(vec2(integer_x+1.0, integer_y)) - 0.5); - float dotSize = 0.5 * fractionalMaxDotSize * max(0.25,rand2D(vec2(integer_x, integer_y+1.0))); - - float x1offset = 2.0 * (rand2D(vec2(integer_x+5.0, integer_y)) -0.5); - float y1offset = 2.0 * (rand2D(vec2(integer_x, integer_y + 5.0)) - 0.5); - float x2offset = 2.0 * (rand2D(vec2(integer_x-5.0, integer_y)) -0.5); - float y2offset = 2.0 * (rand2D(vec2(integer_x-5.0, integer_y -5.0)) - 0.5); - float smear = (rand2D(vec2(integer_x + 3.0, integer_y)) -0.5); - - - vec2 truePos = vec2 (0.5 + xoffset * (1.0 - 4.0 * dotSize) , 0.5 + yoffset * (1.0 -4.0 * dotSize)); - vec2 secondPos = truePos + vec2 (dotSize * x1offset, dotSize * y1offset); - vec2 thirdPos = truePos + vec2 (dotSize * x2offset, dotSize * y2offset); - - float distance = length(truePos - vec2(fractional_x, fractional_y)); - float dist1 = length(secondPos - vec2(fractional_x, fractional_y)); - float dist2 = length(thirdPos - vec2(fractional_x, fractional_y)); - - return clamp(3.0 - smoothstep (0.3 * dotSize, 1.0* dotSize, distance) - smoothstep (0.3 * dotSize, 1.0* dotSize, dist1) - smoothstep ((0.1 + 0.5 * smear) * dotSize, 1.0* dotSize, dist2), 0.0,1.0); -} - -float DropletNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dDensity) -{ -return dropletNoise2D(coord.x/wavelength, coord.y/wavelength, fractionalMaxDotSize, dDensity); -} - -float voronoiNoise2D(in float x, in float y, in float xrand, in float yrand) -{ - float integer_x = x - fract(x); - float fractional_x = x - integer_x; - - float integer_y = y - fract(y); - float fractional_y = y - integer_y; - - float val[4]; - - val[0] = rand2D(vec2(integer_x, integer_y)); - val[1] = rand2D(vec2(integer_x+1.0, integer_y)); - val[2] = rand2D(vec2(integer_x, integer_y+1.0)); - val[3] = rand2D(vec2(integer_x+1.0, integer_y+1.0)); - - float xshift[4]; - - xshift[0] = xrand * (rand2D(vec2(integer_x+0.5, integer_y)) - 0.5); - xshift[1] = xrand * (rand2D(vec2(integer_x+1.5, integer_y)) -0.5); - xshift[2] = xrand * (rand2D(vec2(integer_x+0.5, integer_y+1.0))-0.5); - xshift[3] = xrand * (rand2D(vec2(integer_x+1.5, integer_y+1.0))-0.5); - - float yshift[4]; - - yshift[0] = yrand * (rand2D(vec2(integer_x, integer_y +0.5)) - 0.5); - yshift[1] = yrand * (rand2D(vec2(integer_x+1.0, integer_y+0.5)) -0.5); - yshift[2] = yrand * (rand2D(vec2(integer_x, integer_y+1.5))-0.5); - yshift[3] = yrand * (rand2D(vec2(integer_x+1.5, integer_y+1.5))-0.5); - - - float dist[4]; - - dist[0] = sqrt((fractional_x + xshift[0]) * (fractional_x + xshift[0]) + (fractional_y + yshift[0]) * (fractional_y + yshift[0])); - dist[1] = sqrt((1.0 -fractional_x + xshift[1]) * (1.0-fractional_x+xshift[1]) + (fractional_y +yshift[1]) * (fractional_y+yshift[1])); - dist[2] = sqrt((fractional_x + xshift[2]) * (fractional_x + xshift[2]) + (1.0-fractional_y +yshift[2]) * (1.0-fractional_y + yshift[2])); - dist[3] = sqrt((1.0-fractional_x + xshift[3]) * (1.0-fractional_x + xshift[3]) + (1.0-fractional_y +yshift[3]) * (1.0-fractional_y + yshift[3])); - - - - int i, i_min; - float dist_min = 100.0; - for (i=0; i<4;i++) - { - if (dist[i] < dist_min) - { - dist_min = dist[i]; - i_min = i; - } - } - - return val[i_min]; - //return val[0]; - -} - -float VoronoiNoise2D(in vec2 coord, in float wavelength, in float xrand, in float yrand) -{ -return voronoiNoise2D(coord.x/wavelength, coord.y/wavelength, xrand, yrand); -} - -float slopeLines2D(in float x, in float y, in float sx, in float sy, in float steepness) -{ - float integer_x = x - fract(x); - float fractional_x = x - integer_x; - - float integer_y = y - fract(y); - float fractional_y = y - integer_y; - - vec2 O = vec2 (0.2 + 0.6* rand2D(vec2 (integer_x, integer_y+1)), 0.3 + 0.4* rand2D(vec2 (integer_x+1, integer_y))); - vec2 S = vec2 (sx, sy); - vec2 P = vec2 (-sy, sx); - vec2 X = vec2 (fractional_x, fractional_y); - - float radius = 0.0 + 0.3 * rand2D(vec2 (integer_x, integer_y)); - - float b = (X.y - O.y + O.x * S.y/S.x - X.x * S.y/S.x) / (P.y - P.x * S.y/S.x); - float a = (X.x - O.x - b*P.x)/S.x; - - return (1.0 - smoothstep(0.7 * (1.0-steepness), 1.2* (1.0 - steepness), 0.6* abs(a))) * (1.0 - smoothstep(0.0, 1.0 * radius,abs(b))); - - -} - - -float SlopeLines2D(in vec2 coord, in vec2 gradDir, in float wavelength, in float steepness) -{ -return slopeLines2D(coord.x/wavelength, coord.y/wavelength, gradDir.x, gradDir.y, steepness); -} - - -float strata3D(in float x, in float y, in float z, in float variation) -{ - float integer_x = x - fract(x); - float fractional_x = x - integer_x; - - float integer_y = y - fract(y); - float fractional_y = y - integer_y; - - float integer_z = z - fract(z); - float fractional_z = z - integer_z; - - float rand_value_low = rand3D(vec3(0.0, 0.0, integer_z)); - float rand_value_high = rand3D(vec3(0.0, 0.0, integer_z+1)); - - float rand_var = 0.5 - variation + 2.0 * variation * rand3D(vec3(integer_x, integer_y, integer_z)); - - - return (1.0 - smoothstep(rand_var -0.15, rand_var + 0.15, fract(z))) * rand_value_low + smoothstep(rand_var-0.15, rand_var + 0.15, fract(z)) * rand_value_high; - -} - - -float Strata3D(in vec3 coord, in float wavelength, in float variation) -{ -return strata3D(coord.x/wavelength, coord.y/wavelength, coord.z/wavelength, variation); -} diff --git a/Compositor/Shaders/ALS/planet-aurora.frag b/Compositor/Shaders/ALS/planet-aurora.frag deleted file mode 100644 index b05804701..000000000 --- a/Compositor/Shaders/ALS/planet-aurora.frag +++ /dev/null @@ -1,77 +0,0 @@ -// -*-C++-*- - -// Ambient term comes in gl_Color.rgb. -#version 120 - -varying vec3 vertex; -varying vec3 relVec; -varying vec3 normal; - - -uniform float strength; -uniform float ray_factor; -uniform float upper_alt_factor; -uniform float penetration_factor; -uniform float patchiness; -uniform float afterglow; -uniform float arc_id; -uniform float osg_SimulationTime; - -float Noise2D(in vec2 coord, in float wavelength); -vec3 filter_combined (in vec3 color) ; - -void main() -{ - - - -float vCoord = abs(vertex.z) - 0.02 * arc_id; - - - -float aurora_time = 0.001 * osg_SimulationTime + arc_id; - -float noise_01 = Noise2D( vec2(vertex.x +aurora_time, vertex.y), 0.05); -float blend_factor = smoothstep(0.935, 0.955, vCoord - 0.001 * noise_01 - 0.02 * (1.0-upper_alt_factor)); - -float blend_low = smoothstep(0.915, 0.925, vCoord - 0.001 * noise_01-0.00250 * penetration_factor); - -noise_01 = smoothstep(0.0 + 0.25 * patchiness, 1.0 - 0.25 *patchiness, noise_01 - 0.5 * (1.0-strength) * patchiness); - -float noise_02 = 0.7 + 0.3 * Noise2D( vec2 (vertex.x +vertex.y, aurora_time), 0.002); -noise_02 = mix(0.85, noise_02 , min((1.0-blend_factor) * ray_factor, 1.0)); - -float smoothness = 0.01 + 0.02 * (1.0 - ray_factor); - -float noise_03 = 0.05 * (0.5 - Noise2D ( vec2 (vertex.x + vertex.y, 2.0 * aurora_time), smoothness)); -noise_03 = mix(0.0, noise_03, upper_alt_factor); - - -vCoord += 0.00250 * penetration_factor; - -float vStrength = smoothstep(0.92, 0.94, vCoord) * (1.0 - smoothstep(0.94, 0.95 + 0.1 * upper_alt_factor, vCoord+noise_03)); - -vec3 auroraColor1 = vec3 (0.0, 0.2, 0.1); -vec3 auroraColor2 = vec3 (0.2, 0.0, 0.05); -vec3 auroraColor3 = vec3 (0.8, 0.3, 0.4); - - - -vec3 auroraColor = mix(auroraColor1, auroraColor2, blend_factor); -auroraColor = mix(auroraColor3, auroraColor, blend_low); - -float fade_factor = smoothstep(0.94, 0.97, vCoord - 0.001 * noise_01 - 0.02 * (1.0-upper_alt_factor)); -fade_factor = mix(1.0, fade_factor, afterglow); - -float view_angle = abs(dot(normalize(relVec), normalize(normal))); - -float angStrength = smoothstep(0.2, 0.6, view_angle); - - -float auroraStrength = vStrength * angStrength * noise_01 * noise_02 * strength * fade_factor; - -vec3 finalColor = vec3 (auroraColor.x, auroraColor.y, auroraColor.z); -finalColor.rgb = filter_combined(finalColor.rgb); - -gl_FragColor = vec4(finalColor.r, finalColor.g, finalColor.b, auroraStrength); -} diff --git a/Compositor/Shaders/ALS/planet-aurora.vert b/Compositor/Shaders/ALS/planet-aurora.vert deleted file mode 100644 index d9ef71973..000000000 --- a/Compositor/Shaders/ALS/planet-aurora.vert +++ /dev/null @@ -1,32 +0,0 @@ -#version 120 - -varying vec3 vertex; -varying vec3 normal; -varying vec3 relVec; - -uniform float fg_Fcoef; - -uniform float osg_SimulationTime; -uniform float arc_id; - - -void main() -{ - - normal = gl_Normal; - vertex = gl_Vertex.xyz; - vec3 ep = (gl_ModelViewMatrixInverse * vec4 (0.0, 0.0, 0.0, 1.0)).xyz; - relVec = vertex - ep; - - vec4 vert_out = gl_Vertex; - - float ang = dot(vert_out.xy, vec2 (0.0, 1.0)); - - vert_out.x *= (1.0 + 0.05 * sin(ang + 0.1 * osg_SimulationTime + arc_id)); - vert_out.y *= (1.0 + 0.05 * sin(ang + 0.12 * osg_SimulationTime + arc_id)); - - - gl_Position = gl_ModelViewProjectionMatrix * vert_out; - // logarithmic depth - gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w; -} diff --git a/Compositor/Shaders/ALS/planet-cloudlayer.frag b/Compositor/Shaders/ALS/planet-cloudlayer.frag deleted file mode 100644 index a50a73919..000000000 --- a/Compositor/Shaders/ALS/planet-cloudlayer.frag +++ /dev/null @@ -1,186 +0,0 @@ -// -*-C++-*- - -// Ambient term comes in gl_Color.rgb. -#version 120 - -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 ecViewDir; -varying vec3 VTangent; - -uniform float shade_effect; -uniform float sun_angle; -uniform float air_pollution; -uniform float moonlight; - -uniform float roi_x1; -uniform float roi_y1; -uniform float lightning; -uniform float cloudcover_bias; - -uniform bool use_overlay; -uniform bool use_cloud_normals; - -uniform sampler2D texture; -uniform sampler2D structure_texture; - -float Noise2D(in vec2 coord, in float wavelength); -vec3 filter_combined (in vec3 color) ; -vec3 moonlight_perception (in vec3 light); - -float add_cosines (in float cos1, in float cos2, in float sign) -{ - -float sin1 = sqrt(1.0 - pow(cos1, 2.0)); -float sin2 = sqrt(1.0 - pow(cos2, 2.0)); - -return cos1 * cos2 + sign * sin1 * sin2; - -} - -vec3 lightning_color (in vec2 coord) -{ - -vec2 roi1 = vec2 (roi_x1, roi_y1); - -float strength = 1.0 - smoothstep(0.0, 0.005, length(roi1 - coord)); - -return strength * vec3 (0.43, 0.57, 1.0); - -} - - -void main() -{ - vec3 n; - float NdotL, NdotHV, NdotLraw; - vec4 color = gl_Color; - vec3 lightDir = gl_LightSource[0].position.xyz; - - vec3 halfVector = normalize(normalize(lightDir) + normalize(ecViewDir)); - vec4 texel; - vec4 ref_texel; - vec4 structureTexel; - - vec4 fragColor; - vec4 specular = vec4(0.0, 0.0, 0.0, 0.0); - - n = normalize(normal); - - - vec3 light_specular = vec3 (1.0, 1.0, 1.0); - NdotL = dot(n, normalize(lightDir)); - NdotLraw = NdotL; - NdotL = smoothstep(-0.2,0.2,NdotL); - - float intensity = length(diffuse_term.rgb); - - vec3 dawn_color = mix (vec3 (1.0,0.7,0.4), vec3 (1.0,0.4,0.2), air_pollution); - - vec3 dawn = intensity * 1.2 * normalize (dawn_color); - - vec4 diff_term = mix(vec4(dawn, 1.0), diffuse_term, smoothstep(0.0, 0.45, NdotL)); - - - vec2 grad_dir = vec2 (1.0, 0.0); - - vec3 tangent = normalize(VTangent); - vec3 binormal = cross(n, tangent); - float NdotL2 = 1.0; - - texel = texture2D(texture, gl_TexCoord[0].st); - ref_texel = texel; - - float sign = -1.0; - float ml_fact = 1.0; - - - if (use_cloud_normals) - { - vec2 sun2d = vec2 (0.0, 1.0); - - float xOffset = -1.0 * dot(normalize(lightDir), tangent); - float yOffset = -1.0 * dot(normalize(lightDir), binormal); - - grad_dir = normalize (vec2 (xOffset, yOffset)); - - vec4 comp_texel = texture2D(texture, gl_TexCoord[0].st - 0.0005 * grad_dir); - - // parallax mapping - - xOffset = -1.0 * dot(ecViewDir, tangent); - yOffset = -1.0 * dot(ecViewDir, binormal); - - grad_dir = normalize (vec2 (xOffset, yOffset)); - - texel = texture2D(texture, gl_TexCoord[0].st - 0.0005 * grad_dir * ref_texel.a * 0.7); - - // relief shading based on gradient and parallax lookup - - float slope = shade_effect * (comp_texel.a - ref_texel.a) * texel.a; - if (slope < 0.0) {sign = 1.0;} - - vec2 snormal = normalize(vec2 (slope, 1.0)); - - NdotL2 = dot (snormal, sun2d); - NdotL = add_cosines(NdotL, NdotL2, sign ); - - ml_fact = 0.5 + 1.0 * add_cosines(0.0, NdotL2, sign); - - - } - - ref_texel = texel; - texel.a = pow(texel.a,1.0/cloudcover_bias); - texel.a = clamp(texel.a, 0.0, 1.0); - - - color += diff_term * max(NdotL, 0.15) ; - - - - - - color.rgb *= smoothstep(-0.2, -0.1, NdotLraw); - // - - float darkness_fact = 1.0 - smoothstep(0.0,0.2, length(color.rgb)); - color.rgb += lightning_color(gl_TexCoord[0].st) * (1.0 - texel.a) * lightning * darkness_fact; - - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - moonLightColor = moonlight_perception (moonLightColor); - color.rgb += moonLightColor * ml_fact; - - color.a = 1.0;//diffuse_term.a; - color = clamp(color, 0.0, 1.0); - - structureTexel = texture2D(structure_texture, 20.0 * gl_TexCoord[0].st); - - float noise = Noise2D( gl_TexCoord[0].st, 0.01); - noise += Noise2D( gl_TexCoord[0].st, 0.005); - noise += Noise2D( gl_TexCoord[0].st, 0.002); - - - vec4 noiseTexel = vec4 (1.0,1.0,1.0, 0.5* noise * texel.a); - structureTexel = mix(structureTexel, noiseTexel,noiseTexel.a); - - structureTexel = mix(structureTexel, texel, clamp(1.5 * ref_texel.a * (cloudcover_bias - 1.0), 0.0, 1.0)); - - - if (use_overlay) - { - texel = vec4(structureTexel.rgb, smoothstep(0.0, 0.5,texel.a) * structureTexel.a); - //texel.a = pow(texel.a,1.0/cloudcover_bias); - - } - - texel.a = clamp((1.0 + darkness_fact) * texel.a, 0.0, 1.0); - - - fragColor = color * texel; - fragColor.rgb = filter_combined(fragColor.rgb); - - gl_FragColor = clamp(fragColor, 0.0, 1.0); - - -} diff --git a/Compositor/Shaders/ALS/planet-high.frag b/Compositor/Shaders/ALS/planet-high.frag deleted file mode 100644 index 9852493d9..000000000 --- a/Compositor/Shaders/ALS/planet-high.frag +++ /dev/null @@ -1,193 +0,0 @@ -// -*-C++-*- - -// Ambient term comes in gl_Color.rgb. -#version 120 - -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 ecViewDir; -varying vec3 VTangent; - -uniform float visibility; -uniform float air_pollution; -uniform float moonlight; -uniform float sun_angle; -uniform bool use_clouds; -uniform bool use_cloud_shadows; -uniform bool use_overlay; -uniform sampler2D texture; -uniform sampler2D shadowtex; -uniform sampler2D grain_texture; -uniform sampler2D normal_texture; - -float Noise2D(in vec2 coord, in float wavelength); -vec3 filter_combined (in vec3 color) ; -vec3 moonlight_perception (in vec3 light); - -void main() -{ - vec3 n; - float NdotL, NdotHV; - vec4 color = gl_Color; - vec3 lightDir = normalize(gl_LightSource[0].position.xyz); - - vec3 halfVector = normalize(lightDir + normalize(ecViewDir)); - vec4 texel; - vec4 shadowTexel; - vec4 grainTexel; - vec4 fragColor; - vec4 specular = vec4(0.0); - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - n = (2.0 * gl_Color.a - 1.0) * normal; - n = normalize(n); - - float parallaxFactor = max(1.0 - dot(normalize(ecViewDir), n),0.0); - - vec3 VBinormal; - VBinormal = normalize(cross(normal, VTangent)); - - float xOffset1 = -1.0 * dot(ecViewDir, normalize(VTangent)); - float yOffset1 = -1.0 * dot(ecViewDir, VBinormal); - - vec2 grad_dir = normalize (vec2 (xOffset1, yOffset1)); - - vec4 nmap = texture2D(normal_texture, gl_TexCoord[0].st); - - - - - float hmap = 1.0 - nmap.a; - nmap = texture2D(normal_texture, gl_TexCoord[0].st - 0.0005 * grad_dir * hmap * 2.0 * parallaxFactor); - - // sanity processing for normal map when alpha is close to zero - nmap.rgb = normalize(nmap.rgb); - //if (nmap.b < 0.0) {nmap.b = -nmap.b;} - - vec3 N = nmap.rgb * 2.0 - 1.0; - N = normalize(N.x * normalize(VTangent) * 0.6 + N.y * VBinormal * 0.6 + N.z * n); - - - float xOffset = -0.005 * dot(lightDir, normalize(VTangent)); - float yOffset = -0.005 * dot(lightDir, VBinormal); - - - - - if ((use_cloud_shadows)&&(use_clouds)) - {shadowTexel = texture2D(shadowtex, vec2(gl_TexCoord[0].s-xOffset, gl_TexCoord[0].t-yOffset));} - else - {shadowTexel = vec4 (0.0,0.0,0.0,0.0);} - - texel = texture2D(texture, gl_TexCoord[0].st - 0.0005 * grad_dir * hmap * 2.0 * parallaxFactor); - float night_light = (1.0 -texel.a); - texel.a = 1.0; - grainTexel = texture2D(grain_texture, gl_TexCoord[0].st * 40.0); - - float noise = Noise2D( gl_TexCoord[0].st, 0.00005); - noise += Noise2D( gl_TexCoord[0].st, 0.0002); - noise += Noise2D( gl_TexCoord[0].st, 0.0001); - - noise= noise/3.0; - - - vec3 light_specular = vec3 (1.0, 1.0, 1.0); - NdotL = dot(N, lightDir); - float NdotLraw = NdotL; - // due to atmosphere scattering, we should make this harder - NdotL = smoothstep(-0.2 ,0.2,NdotL); - // fog does not feel normal map - float NdotLfog = smoothstep(-0.2 , 0.2, dot(n, lightDir)); - - float intensity = length(diffuse_term); - vec4 dawn = intensity * normalize (vec4 (1.0,0.5,0.3,1.0)); - vec4 diff_term = mix(dawn, diffuse_term, smoothstep(0.0, 0.3, NdotL)); - - - intensity = length(light_specular); - light_specular = mix(dawn.rgb, light_specular, smoothstep(0.0, 0.4, NdotL)); - - float oceanness = smoothstep(0.0, 0.1,length(texel.rgb - vec3 (0.007,0.019, 0.078))); - float specular_enhancement = 4.0 * (1.0 - oceanness); - - if (use_overlay) { - //texel.rgb = mix(texel.rgb, grainTexel.rgb, 0.4* grainTexel.a * oceanness); - texel.rgb = texel.rgb * (0.85 + 0.3 * noise); - texel.r = smoothstep(0.0, 0.95, texel.r); - texel.g = smoothstep(0.0, 0.95, texel.g); - texel.b = smoothstep(0.0, 0.95, texel.b); - float intensity = length(texel.rgb); - texel.rgb = mix(texel.rgb, intensity * vec3 (1.0,1.0,1.0), 0.3); - } - - //texel.rgb = vec3 (0.5,0.5,0.5); - - - - - if (NdotL > 0.0) { - color += diff_term * NdotL * (1.0-shadowTexel.a); - NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = (gl_FrontMaterial.specular.rgb * specular_enhancement - * light_specular * (1.0-shadowTexel.a) - * pow(NdotHV, gl_FrontMaterial.shininess)); - } - - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - moonLightColor = moonlight_perception (moonLightColor); - color.rgb += moonLightColor; - - color.a = diffuse_term.a; - - - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - fragColor = color * texel + specular; - - - float night_light_factor = night_light * (1.0 - smoothstep(-0.3, 0.0, NdotLraw)); - - float noise_factor = (0.4 + 0.6* smoothstep(0.7 - 0.4* night_light,0.9 - 0.4 * night_light,noise)); - night_light_factor *= noise_factor; - - - vec3 light_color = vec3(1.0, 0.7, 0.3); - vec3 central_light_color = vec3 (1.0, 1.0, 1.0); - light_color = mix(light_color, central_light_color, smoothstep(0.3, 0.6,noise*noise * night_light)); - - fragColor.rgb += light_color * night_light_factor * 1.4; - - float angle = dot(normalize(ecViewDir), normalize(normal)); - float distance_through_atmosphere = min(10.0 / (abs(angle)+0.001),500.0); - - - float fogLighting = clamp(NdotLfog,0.0,1.0) * length(diff_term.rgb/1.73); - - vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * fogLighting; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * fogLighting; - - float heightFactor = exp(-hmap * 0.8); - distance_through_atmosphere *= heightFactor; - - float fogFactor = exp(-distance_through_atmosphere/(visibility/1000.0)); - float rayleighFactor = exp(-distance_through_atmosphere/(300.0 / (1.0 + 4.0 * air_pollution)) ); - - - - fragColor.rgb = mix(rayleighColor, fragColor.rgb, rayleighFactor); - fragColor = mix(fogColor, fragColor, fogFactor); - - fragColor.rgb = filter_combined(fragColor.rgb); - - - - - gl_FragColor = clamp(fragColor, 0.0, 1.0); - - -} diff --git a/Compositor/Shaders/ALS/planet.frag b/Compositor/Shaders/ALS/planet.frag deleted file mode 100644 index 6c42d5421..000000000 --- a/Compositor/Shaders/ALS/planet.frag +++ /dev/null @@ -1,151 +0,0 @@ -// -*-C++-*- - -// Ambient term comes in gl_Color.rgb. -#version 120 - -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 ecViewDir; -varying vec3 VTangent; - -uniform float visibility; -uniform float air_pollution; -uniform float sun_angle; -uniform bool use_clouds; -uniform bool use_cloud_shadows; -uniform bool use_overlay; -uniform sampler2D texture; -uniform sampler2D shadowtex; -uniform sampler2D grain_texture; - -float Noise2D(in vec2 coord, in float wavelength); -vec3 filter_combined (in vec3 color) ; - - -void main() -{ - vec3 n; - float NdotL, NdotHV; - vec4 color = gl_Color; - vec3 lightDir = normalize(gl_LightSource[0].position.xyz); - - vec3 halfVector = normalize(lightDir + normalize(ecViewDir)); - vec4 texel; - vec4 shadowTexel; - vec4 grainTexel; - vec4 fragColor; - vec4 specular = vec4(0.0); - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - n = (2.0 * gl_Color.a - 1.0) * normal; - n = normalize(n); - - vec3 VBinormal; - VBinormal = cross(normal, VTangent); - - float xOffset = -0.005 * dot(lightDir, normalize(VTangent)); - float yOffset = -0.005 * dot(lightDir, normalize(VBinormal)); - - if ((use_cloud_shadows)&&(use_clouds)) - {shadowTexel = texture2D(shadowtex, vec2(gl_TexCoord[0].s-xOffset, gl_TexCoord[0].t-yOffset));} - else - {shadowTexel = vec4 (0.0,0.0,0.0,0.0);} - - texel = texture2D(texture, gl_TexCoord[0].st); - float night_light = (1.0 -texel.a); - texel.a = 1.0; - grainTexel = texture2D(grain_texture, gl_TexCoord[0].st * 40.0); - - float noise = Noise2D( gl_TexCoord[0].st, 0.00005); - noise += Noise2D( gl_TexCoord[0].st, 0.0002); - noise += Noise2D( gl_TexCoord[0].st, 0.0001); - - noise= noise/3.0; - - - vec3 light_specular = vec3 (1.0, 1.0, 1.0); - NdotL = dot(n, lightDir); - float NdotLraw = NdotL; - // due to atmosphere scattering, we should make this harder - NdotL = smoothstep(-0.2,0.2,NdotL); - - float intensity = length(diffuse_term); - vec4 dawn = intensity * normalize (vec4 (1.0,0.5,0.3,1.0)); - vec4 diff_term = mix(dawn, diffuse_term, smoothstep(0.0, 0.3, NdotL)); - - - intensity = length(light_specular); - light_specular = mix(dawn.rgb, light_specular, smoothstep(0.0, 0.4, NdotL)); - - float oceanness = smoothstep(0.0, 0.1,length(texel.rgb - vec3 (0.007,0.019, 0.078))); - float specular_enhancement = 4.0 * (1.0 - oceanness); - - if (use_overlay) { - //texel.rgb = mix(texel.rgb, grainTexel.rgb, 0.4* grainTexel.a * oceanness); - texel.rgb = texel.rgb * (0.85 + 0.3 * noise); - texel.r = smoothstep(0.0, 0.95, texel.r); - texel.g = smoothstep(0.0, 0.95, texel.g); - texel.b = smoothstep(0.0, 0.95, texel.b); - float intensity = length(texel.rgb); - texel.rgb = mix(texel.rgb, intensity * vec3 (1.0,1.0,1.0), 0.3); - } - - //texel.rgb = vec3 (0.5,0.5,0.5); - - - - - if (NdotL > 0.0) { - color += diff_term * NdotL * (1.0-shadowTexel.a); - NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = (gl_FrontMaterial.specular.rgb * specular_enhancement - * light_specular * (1.0-shadowTexel.a) - * pow(NdotHV, gl_FrontMaterial.shininess)); - } - color.a = diffuse_term.a; - - - - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - fragColor = color * texel + specular; - - - float night_light_factor = night_light * (1.0 - smoothstep(-0.3, 0.0, NdotLraw)); - - float noise_factor = (0.4 + 0.6* smoothstep(0.7 - 0.4* night_light,0.9 - 0.4 * night_light,noise)); - night_light_factor *= noise_factor; - - - vec3 light_color = vec3(1.0, 0.7, 0.3); - vec3 central_light_color = vec3 (1.0, 1.0, 1.0); - light_color = mix(light_color, central_light_color, smoothstep(0.3, 0.6,noise*noise * night_light)); - - fragColor.rgb += light_color * night_light_factor * 1.4; - - float angle = dot(normalize(ecViewDir), normalize(normal)); - float distance_through_atmosphere = min(10.0 / (abs(angle)+0.001),500.0); - - float fogLighting = clamp(NdotL,0.0,1.0) * length(diff_term.rgb/1.73); - - - vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * fogLighting; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * fogLighting; - - - float fogFactor = exp(-distance_through_atmosphere/(visibility/1000.0)); - float rayleighFactor = exp(-distance_through_atmosphere/(300.0 / (1.0 + 4.0 * air_pollution)) ); - - fragColor.rgb = mix(rayleighColor, fragColor.rgb, rayleighFactor); - fragColor = mix(fogColor, fragColor, fogFactor); - - fragColor.rgb = filter_combined(fragColor.rgb); - - gl_FragColor = clamp(fragColor, 0.0, 1.0); - -} diff --git a/Compositor/Shaders/ALS/planet.vert b/Compositor/Shaders/ALS/planet.vert deleted file mode 100644 index 4d07fdb34..000000000 --- a/Compositor/Shaders/ALS/planet.vert +++ /dev/null @@ -1,73 +0,0 @@ -// -*-C++-*- - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -#version 120 -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 ecViewDir; -varying vec3 VTangent; - -uniform float fg_Fcoef; - -uniform int colorMode; - -attribute vec3 tangent;//, binormal; - - - -void main() -{ - - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - ecViewDir = (gl_ModelViewMatrix * (ep - gl_Vertex)).xyz; - - gl_Position = ftransform(); - // logarithmic depth - gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = gl_NormalMatrix * gl_Normal; - VTangent = gl_NormalMatrix * tangent; - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - vec4 light_diffuse = vec4 (1.0,1.0,1.0,1.0); - vec4 light_ambient = vec4 (0.03, 0.03, 0.03, 1.0); - - diffuse_term = diffuse_color * light_diffuse;//gl_LightSource[0].diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + light_ambient); - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = gl_Color.a; - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0; - gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; - //fogCoord = abs(ecPosition.z / ecPosition.w); - //fog_Func(fogType); -} diff --git a/Compositor/Shaders/ALS/rain-layer.frag b/Compositor/Shaders/ALS/rain-layer.frag deleted file mode 100644 index 2f33354b8..000000000 --- a/Compositor/Shaders/ALS/rain-layer.frag +++ /dev/null @@ -1,71 +0,0 @@ -#version 120 - -uniform float fg_Fcoef; - -uniform sampler2D baseTexture; -varying float fogFactor; -varying vec3 hazeColor; -varying vec3 relVector; - -varying float flogz; - -vec3 filter_combined (in vec3 color) ; - -uniform bool is_lightning; - -vec3 rainbow (in float index) -{ - -float red = max(1.0 - 2.0 * index,0.0); -float green; - -if (index < 0.5) - {green = 2.0 * index;} -else - {green = 1.0 - 2.0 *(index - 0.5);} - - - -float blue = max(2.0 * (index - 0.5), 0.0); - -red *= 1.3; -green *=0.6; - -return vec3 (red, green, blue) * hazeColor; -} - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - vec4 finalColor = base * gl_Color; - - vec4 fragColor; - - - if (is_lightning==false) - { - vec3 nView = normalize(relVector); - vec3 lightFull = normalize((gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz); - - float calpha = dot(-lightFull, nView); - - float rainbow_shape = smoothstep(0.743 -0.03, 0.743, calpha) * (1.0 - smoothstep(0.743, 0.743+0.03, calpha)); - - float color_index = clamp((calpha - 0.713)/ 0.06,0.0,1.0); - - vec3 rainbow_color = rainbow(color_index); - finalColor.rgb = mix(finalColor.rgb, rainbow_color, 0.5* rainbow_shape); - - - fragColor.rgb = mix(hazeColor, finalColor.rgb, fogFactor ); - } - else - {fragColor.rgb = finalColor.rgb;} - fragColor.a = mix(0.0, finalColor.a, fogFactor); - - fragColor.rgb = filter_combined(fragColor.rgb); - - gl_FragColor = fragColor; - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} diff --git a/Compositor/Shaders/ALS/rain-layer.vert b/Compositor/Shaders/ALS/rain-layer.vert deleted file mode 100644 index 6d1ab5dc8..000000000 --- a/Compositor/Shaders/ALS/rain-layer.vert +++ /dev/null @@ -1,139 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; -varying vec3 hazeColor; -varying vec3 relVector; - -varying float flogz; - -uniform float range; // From /sim/rendering/clouds3d-vis-range -uniform float scattering; -uniform float terminator; -uniform float altitude; -uniform float flash; -uniform float lightning_pos_x; -uniform float lightning_pos_y; -uniform float lightning_range; - - -float shade = 0.8; -float cloud_height = 1000.0; -const float EarthRadius = 5800000.0; - -// light_func is a generalized logistic function fit to the light intensity as a function -// of scaled terminator position obtained from Flightgear core - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x-0.5; -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -void main(void) -{ - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - //gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0); - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.x = gl_Vertex.x; - gl_Position.y += gl_Vertex.y; - gl_Position.z += gl_Vertex.z; - gl_Position.xyz += gl_Color.xyz; - - - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - relVector = gl_Position.xyz - ep.xyz; - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - -// Light at the final position - - // first obtain normal to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - // yprime is the distance of the vertex into sun direction, corrected for altitude - float vertex_alt = max(altitude * 0.30480 + relVector.z,100.0); - float yprime = -dot(relVector, lightHorizon); - float yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - - // compute the light at the position - vec4 light_diffuse; - - float lightArg = (terminator-yprime_alt)/100000.0; - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 2.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 0.0; - - //light_diffuse = light_diffuse * scattering; - float intensity = length(light_diffuse); - light_diffuse = intensity * normalize(mix(light_diffuse, 2.0*vec4 (0.55, 0.6, 0.8, 1.0), (1.0 - smoothstep(0.3,0.8, scattering)))); - -// Determine the shading of the sprite based on its vertical position and position relative to the sun. - n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front - vec4 backlight = gl_LightSource[0].diffuse * shade; - - gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n); - gl_FrontColor += gl_FrontLightModelProduct.sceneColor; - - // two times terminator width governs how quickly light fades into shadow - float terminator_width = 200000.0; - float earthShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt) + 0.1; - gl_FrontColor.rgb = gl_FrontColor.rgb * earthShade; - - // lightning - vec2 lightningRelVector = relVector.xy - vec2(lightning_pos_x, lightning_pos_y); - float rCoord = length(lightningRelVector); - - vec3 flashColor = 2.0 * flash * vec3 (0.43, 0.57, 1.0) * (1.0 - smoothstep(lightning_range, 5.0 * lightning_range, rCoord)); - - gl_FrontColor.rgb += flashColor; - gl_FrontColor.rgb = clamp(gl_FrontColor.rgb,0.0,1.0); - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(100.0, 250.0, fogCoord), 1.0 - smoothstep(range*0.9, range, fogCoord)); - gl_BackColor = gl_FrontColor; - - // Fog doesn't affect rain as much as other objects. - //fogFactor = exp( -gl_Fog.density * fogCoord * 0.4); - //fogFactor = clamp(fogFactor, 0.0, 1.0); - -float fadeScale = 0.05 + 0.2 * log(fogCoord/1000.0); - if (fadeScale < 0.05) fadeScale = 0.05; - fogFactor = exp( -gl_Fog.density * 1.0 * fogCoord * fadeScale); - - hazeColor = light_diffuse.rgb; - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - hazeColor = hazeColor * scattering; - -// change haze color to blue hue for strong fogging - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 2.0 * vec3 (0.55, 0.6, 0.8), (1.0-smoothstep(0.3,0.8,scattering)))); - - - - hazeColor = clamp(hazeColor * earthShade, 0.0,1.0); - - -} diff --git a/Compositor/Shaders/ALS/road-ultra.frag b/Compositor/Shaders/ALS/road-ultra.frag deleted file mode 100644 index c67d8490f..000000000 --- a/Compositor/Shaders/ALS/road-ultra.frag +++ /dev/null @@ -1,873 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Authors: Frederic Bouvier and Gijs de Rooy -// with major additions and revisions by -// Emilian Huminiuc and Vivian Meazza 2011 -// ported to Atmospheric Light Scattering -// by Thorsten Renk, 2013 -// changes for road and traffic rendering -// by Thorsten Renk 2017 -2019 -#version 120 - -varying vec3 VBinormal; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 rawpos; -varying vec3 reflVec; -varying vec3 vViewVec; -varying vec3 vertVec; - -varying float alpha; - -varying float flogz; - -uniform float fg_Fcoef; - -uniform sampler2D BaseTex; -uniform sampler2D NormalTex; -uniform sampler2D ReflMapTex; -uniform sampler2D CarTex; -uniform sampler2D CarMetaTex; -uniform sampler2D ReflGradientsTex; -uniform samplerCube Environment; -uniform sampler2D GrainTex; - -uniform int dirt_enabled; -uniform int dirt_multi; -uniform int nmap_dds; -uniform int nmap_enabled; -uniform int refl_enabled; -uniform int refl_type; -uniform int refl_map; -uniform int grain_texture_enabled; -uniform int road_traffic_direction; -uniform int rain_enabled; -uniform int road_traffic_enabled; -uniform int cloud_shadow_flag; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; - -uniform float amb_correction; -uniform float dirt_b_factor; -uniform float dirt_g_factor; -uniform float dirt_r_factor; -uniform float nmap_tile; -uniform float refl_correction; -uniform float refl_fresnel; -uniform float refl_fresnel_factor; -uniform float refl_noise; -uniform float refl_rainbow; -uniform float grain_magnification; -uniform float wetness; -uniform float rain_norm; -uniform float road_traffic_density; -uniform float streetlight_factor; -uniform float road_traffic_variation; - -uniform float avisibility; -uniform float cloud_self_shading; -uniform float eye_alt; -uniform float ground_scattering; -uniform float hazeLayerAltitude; -uniform float moonlight; -uniform float overcast; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float visibility; -uniform float air_pollution; -uniform float snowlevel; -uniform float snow_thickness_factor; - -uniform float osg_SimulationTime; - -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; - -uniform bool use_IR_vision; - -// constants needed by the light and fog computations ################################################### - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - - -uniform vec3 dirt_r_color; -uniform vec3 dirt_g_color; -uniform vec3 dirt_b_color; - -uniform vec3 streetlight_color; - -float DotNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density); -float shadow_func (in float x, in float y, in float noise, in float dist); -float fog_func (in float targ, in float altitude); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); -float rand2D(in vec2 co); -float Noise2D(in vec2 coord, in float wavelength); - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float lightArg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 filter_combined (in vec3 color) ; -vec3 addLights(in vec3 color1, in vec3 color2); - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) - { - if (x > 30.0) {return e;} - if (x < -15.0) {return 0.0;} - return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); - } - - -void road_type_mapper (in vec2 coord, out float rtype_traffic_density, out float rtype_base_illumination, out float rtype_traffic_speed, out int rtype_dual_lane) - { - if (coord.s < 0.125) // railway - { - rtype_dual_lane = 0; - rtype_traffic_density = 0; - rtype_base_illumination = 0; - rtype_traffic_speed = 0.0; - } - else if (coord.s < 0.250) // residential - { - rtype_dual_lane = 0; - rtype_traffic_density = 0.3; - rtype_base_illumination = 0.65; - rtype_traffic_speed = 0.5; - } - else if (coord.s < 0.375) // single-lane major - { - rtype_dual_lane = 0; - rtype_traffic_density = 1.0; - rtype_base_illumination = 0.65; - rtype_traffic_speed = 1.0; - } - else if (coord.s < 0.5) - { - rtype_dual_lane = 0; - rtype_traffic_density = 0.0; - rtype_base_illumination = 0.0; - rtype_traffic_speed = 0.0; - } - else if (coord.s < 0.625) // grass - { - rtype_dual_lane = 0; - rtype_traffic_density = 0.0; - rtype_base_illumination = 0.0; - rtype_traffic_speed = 0.0; - } - else if (coord.s < 0.750) // dual-lane highway - { - rtype_dual_lane = 1; - rtype_traffic_density = 1.0; - rtype_base_illumination = 0.0; - rtype_traffic_speed = 1.0; - } - else if (coord.s < 0.875) // dirt - { - rtype_dual_lane = 0; - rtype_traffic_density = 0.1; - rtype_base_illumination = 0.0; - rtype_traffic_speed = 0.3; - } - else // tramway - { - rtype_dual_lane = 0; - rtype_traffic_density = 0.0; - rtype_base_illumination = 0.0; - rtype_traffic_speed = 0.0; - } - - - } - - - -void main (void) - { - vec4 texel = texture2D(BaseTex, gl_TexCoord[0].st); - vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * nmap_tile); - vec4 reflmap = texture2D(ReflMapTex, gl_TexCoord[0].st); - vec4 noisevec = vec4 (1.0, 1.0, 1.0, 1.0); - - vec4 grainTexel; - - vec3 mixedcolor; - vec3 N = vec3(0.0,0.0,1.0); - - // noise - - float noise_1m = Noise2D(rawpos.xy, 1.0); - float noise_5m = Noise2D(rawpos.xy, 5.0); - - // road type characteristics - - float rtype_traffic_density = 0.0; - float rtype_base_illumination = 0.0; - float rtype_traffic_speed = 0.0; - int rtype_dual_lane = 0; - road_type_mapper (gl_TexCoord[0].st, rtype_traffic_density, rtype_base_illumination, rtype_traffic_speed, rtype_dual_lane); - - float pf = 0.0; - float pf1 = 0.0; - ///some generic light scattering parameters - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - float alt = eye_alt; - float effective_scattering = min(scattering, cloud_self_shading); - - - /// BEGIN geometry for light - - vec3 up = (gl_ModelViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz; - - vec3 nVertVec = normalize(vertVec); - - float dist = length(vertVec); - float vertex_alt = max(100.0,dot(up, vertVec) + alt); - float vertex_scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - - vec3 lightHorizon = gl_LightSource[0].position.xyz - up * dot(up,gl_LightSource[0].position.xyz); - float yprime = -dot(vertVec, lightHorizon); - float yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - float lightArg = (terminator-yprime_alt)/100000.0; - - float earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - float mie_angle; - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(nVertVec, normalize(gl_LightSource[0].position.xyz)) ) + 0.5;} - else - {mie_angle = 1.0;} - - float fog_vertex_alt = max(vertex_alt,hazeLayerAltitude); - float fog_yprime_alt = yprime_alt; - if (fog_vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - fog_vertex_alt = mix(fog_vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - fog_yprime_alt = yprime -sqrt(2.0 * EarthRadius * fog_vertex_alt); - } - } - else - { - fog_vertex_alt = hazeLayerAltitude; - fog_yprime_alt = yprime -sqrt(2.0 * EarthRadius * fog_vertex_alt); - } - - float fog_lightArg = (terminator-fog_yprime_alt)/100000.0; - float fog_earthShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, fog_yprime_alt) + 0.1; - - float ct = dot(normalize(up), nVertVec); - - vec3 relPos = (gl_ModelViewMatrixInverse * vec4 (vertVec,0.0)).xyz; - - /// END geometry for light - - - /// BEGIN light - vec4 light_diffuse; - vec4 light_ambient; - float intensity; - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * vertex_scattering; - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - - if (earthShade < 0.5) - { - intensity = length(light_ambient.rgb); - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.7,earthShade) )); - } - - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec3 ecViewDir = (gl_ModelViewMatrix * (ep - vec4(rawpos, 1.0))).xyz; - vec3 HV = normalize(normalize(gl_LightSource[0].position.xyz) + normalize(ecViewDir)); - - /// END light - - /// BEGIN grain overlay - if (grain_texture_enabled ==1) - { - grainTexel = texture2D(GrainTex, gl_TexCoord[0].st * grain_magnification); - texel.rgb = mix(texel.rgb, grainTexel.rgb, grainTexel.a ); - } - else if (grain_texture_enabled == 2) - { - grainTexel = texture2D(GrainTex, rawpos.xy * grain_magnification); - texel.rgb = mix(texel.rgb, grainTexel.rgb, grainTexel.a ); - } - - /// END grain overlay - - - /// BEGIN procedural textures - cars and snow - - vec2 roadCoords = gl_TexCoord[0].st; - roadCoords.s *=8.0; - roadCoords.s = fract(roadCoords.s); - - - - vec4 snow_texel = vec4 (0.95, 0.95, 0.95, 1.0); - float noise_term = 0.5 * (noise_5m - 0.5); - noise_term += 0.5 * (noise_1m - 0.5); - snow_texel.a = snow_texel.a * 0.2+0.8* smoothstep(0.2,0.8, 0.3 +noise_term + 0.5*snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) ); - - float noise_2000m = 0.0; - float noise_10m = 0.0; - - float snowLaneShape = smoothstep(0.20, 0.28, roadCoords.s) * (1.0-smoothstep(0.42, 0.5, roadCoords.s)); - snowLaneShape += smoothstep(0.6, 0.68, roadCoords.s) * (1.0-smoothstep(0.82, 0.9, roadCoords.s)); - snow_texel.a *= (1.0 - 0.3* snowLaneShape * rtype_traffic_density); - - texel.rgb = mix(texel.rgb, snow_texel.rgb, snow_texel.a* smoothstep(snowlevel, snowlevel+200.0, 1.0 * (relPos.z + eye_alt)+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0)); - - float cTag = 0.0; - float cPresent = 0.0; - - float cSign = 1.0; - float total_traffic_density = 0.0; - - vec4 carMetaTexel; - - if (road_traffic_enabled == 1) - { - float cOffset = 0.0; - if (roadCoords.s > 0.5) - { - if (rtype_dual_lane == 0) {cSign = -1.0;} - else {cOffset = 5.0;} - } - - if (rtype_dual_lane == 1) {cSign = -1.0;} - - cSign *= road_traffic_direction; - - total_traffic_density = road_traffic_density * rtype_traffic_density * road_traffic_variation; - - float cCoord = roadCoords.t + cOffset; - cCoord += 0.3 * osg_SimulationTime * cSign * rtype_traffic_speed * (1.0 - (0.9 * smoothstep(1.0, 2.5, total_traffic_density))); - cCoord *= 5.0; - - cTag = fract(cCoord); - float cDomain = cCoord - cTag; - float cRnd = rand2D(vec2 (cDomain, cSign)); - - cPresent = 0.0; - float cDisc = 0.2 * total_traffic_density; - if (cRnd > 1.0 - cDisc) {cPresent = 1.0;} - - float cColorRnd = (cRnd - 1.0 + cDisc)/ max(cDisc, 0.05); - float cColorRnd2 = rand2D(vec2 (cDomain, 0.5)); - - float cColumn = (cColorRnd2 * 16.0) - fract(cColorRnd2 * 16.0); - float cRow = (rand2D(vec2 (cDomain, 1.5)) * 2.0); - cRow = cRow- fract(cRow); - //cRow = 0.0; - - - vec3 cColor = vec3 (0.8 * (1.0 - cColorRnd), 0.8 * 2.0 * (0.5 - abs(cColorRnd - 0.5)) , 0.8 * cColorRnd); - cColor *= cColorRnd2; - - float cPos = cTag; - if (cSign > 0.0) {cPos = 1.0 - cPos;} - float cShape = smoothstep(0.0, 0.05, cPos) * (1.0-smoothstep(0.35, 0.4, cPos)); - - float ctPos; - if (roadCoords.s < 0.5) - {ctPos = clamp(5.0 * (roadCoords.s - 0.25), 0.0,1.0); } - else - {ctPos = clamp(5.0 * (roadCoords.s - 0.65), 0.0,1.0); } - - float clPos = cPos;// + 0.45; - - vec4 carTexel = texture2D(CarTex, vec2((ctPos + cColumn) / 16.0 , ((clPos + cRow) / 2.0) )); - carMetaTexel = texture2D(CarMetaTex, vec2((ctPos + cColumn) / 16.0 , ((clPos + cRow) / 2.0) )); - - - float laneShape = smoothstep(0.25, 0.28, roadCoords.s) * (1.0-smoothstep(0.42, 0.45, roadCoords.s)); - laneShape += smoothstep(0.65, 0.68, roadCoords.s) * (1.0-smoothstep(0.82, 0.85, roadCoords.s)); - cShape *= laneShape; - - //texel.rgb = mix(texel.rgb, cColor, cPresent * cShape); - texel.rgb = mix(texel.rgb, carTexel.rgb, cPresent * carTexel.a * laneShape); - //texel.rgb = mix(texel.rgb, vec3 (1.0, 0.0, 0.0) * cColorRnd2, 0.3); - } - - - - /// END procedural cars - - vec3 reflVecN; - - ///BEGIN bump - if (nmap_enabled > 0){ - N = nmap.rgb * 2.0 - 1.0; - // this is exact only for viewing under 90 degrees but much faster than the real solution - reflVecN = normalize (N.x * VTangent + N.y * VBinormal + N.z * reflVec); - N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); - if (nmap_dds > 0) - N = -N; - } else { - N = normalize(VNormal); - reflVecN = reflVec; - } - ///END bump - - - - vec4 reflection = textureCube(Environment, reflVecN ); - vec3 viewVec = normalize(vViewVec); - float v = abs(dot(viewVec, normalize(VNormal)));// Map a rainbowish color - vec4 fresnel = texture2D(ReflGradientsTex, vec2(v, 0.75)); - vec4 rainbow = texture2D(ReflGradientsTex, vec2(v, 0.25)); - - //float nDotVP = max(0.0, dot(N, normalize(gl_LightSource[0].position.xyz))); - - - float nDotVP = max(0.0, dot(N, normalize(gl_LightSource[0].position.xyz))); - - //float nDotHV = max(0.0, dot(N, normalize(gl_LightSource[0].halfVector.xyz))); - float nDotHV = max(0.0, dot(N,HV)); - //glare on the backside of tranparent objects - //if ((gl_FrontMaterial.diffuse.a < 1.0 || texel.a < 1.0) - // && dot(N, normalize(gl_LightSource[0].position.xyz)) < 0.0) { - // nDotVP = max(0.0, dot(-N, normalize(gl_LightSource[0].position.xyz)) * (1.0 -texel.a) ); - // nDotHV = max(0.0, dot(-N, HV) * (1.0 -texel.a) ); - // } - - float nDotVP1 = 0.0; - float nDotHV1 = 0.0; - - - // try specular reflection of sky irradiance - nDotVP1 = max(0.0, dot(N, up)); - nDotHV1 = max(0.0, dot(N, normalize(normalize(up) + normalize(-vertVec)))); - - - if (nDotVP == 0.0) - {pf = 0.0;} - else - {pf = pow(nDotHV, gl_FrontMaterial.shininess);} - - if (nDotVP1 == 0.0) - {pf1 = 0.0;} - else - {pf1 = pow(nDotHV1, 0.5*gl_FrontMaterial.shininess);} - - - - if (cloud_shadow_flag == 1) - { - light_diffuse = light_diffuse * shadow_func(relPos.x, relPos.y, 1.0, dist); - } - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - - - vec4 Diffuse = light_diffuse * nDotVP; - Diffuse.rgb += secondary_light * light_distance_fading(dist); - if (use_IR_vision) - { - Diffuse.rgb = max(Diffuse.rgb, vec3 (0.5, 0.5, 0.5)); - } - vec4 Specular = gl_FrontMaterial.specular * light_diffuse * pf + gl_FrontMaterial.specular * light_ambient * pf1; - Specular+= gl_FrontMaterial.specular * pow(max(0.0,-dot(N,nVertVec)),gl_FrontMaterial.shininess) * vec4(secondary_light,1.0); - - - //vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse; - vec4 color = Diffuse;// * gl_FrontMaterial.diffuse; - - - color = clamp( color, 0.0, 1.0 ); - - - - //////////////////////////////////////////////////////////////////// - //BEGIN reflect - //////////////////////////////////////////////////////////////////// - if (refl_enabled > 0){ - float reflFactor = 0.0; - float transparency_offset = clamp(refl_correction, -1.0, 1.0);// set the user shininess offset - - if(refl_map > 0){ - // map the shininess of the object with user input - //float pam = (map.a * -2) + 1; //reverse map - reflFactor = reflmap.a + transparency_offset; - } else if (nmap_enabled > 0) { - // set the reflectivity proportional to shininess with user input - reflFactor = gl_FrontMaterial.shininess * 0.0078125 * nmap.a + transparency_offset; - } else { - reflFactor = gl_FrontMaterial.shininess* 0.0078125 + transparency_offset; - } - - // enhance low angle reflection by a fresnel term - float fresnel_enhance = (1.0-smoothstep(0.0,0.4, dot(N,-nVertVec))) * refl_fresnel_factor; - - reflFactor+=fresnel_enhance; - - reflFactor = clamp(reflFactor, 0.0, 1.0); - - // add fringing fresnel and rainbow effects and modulate by reflection - vec4 reflcolor = mix(reflection, rainbow, refl_rainbow * v); - //vec4 reflcolor = reflection; - vec4 reflfrescolor = mix(reflcolor, fresnel, refl_fresnel * v); - vec4 noisecolor = mix(reflfrescolor, noisevec, refl_noise); - //vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0); - vec4 raincolor = vec4(noisecolor.rgb, 1.0); - raincolor += Specular; - raincolor *= light_diffuse; - - if (refl_type == 1) - {mixedcolor = mix(texel, raincolor, reflFactor).rgb;} - else if (refl_type == 2) - {mixedcolor = ((texel +(reflcolor * reflFactor))-(0.5*reflFactor)).rgb;} - - } else { - mixedcolor = texel.rgb; - } - ///////////////////////////////////////////////////////////////////// - //END reflect - ///////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////// - //begin DIRT - ////////////////////////////////////////////////////////////////////// - if (dirt_enabled >= 1){ - vec3 dirtFactorIn = vec3 (dirt_r_factor, dirt_g_factor, dirt_b_factor); - vec3 dirtFactor = reflmap.rgb * dirtFactorIn.rgb; - //dirtFactor.r = smoothstep(0.0, 1.0, dirtFactor.r); - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_r_color, smoothstep(0.0, 1.0, dirtFactor.r)); - if (dirt_multi > 0) { - //dirtFactor.g = smoothstep(0.0, 1.0, dirtFactor.g); - //dirtFactor.b = smoothstep(0.0, 1.0, dirtFactor.b); - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_g_color, smoothstep(0.0, 1.0, dirtFactor.g)); - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_b_color, smoothstep(0.0, 1.0, dirtFactor.b)); - } - } - ////////////////////////////////////////////////////////////////////// - //END Dirt - ////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////// - //begin WETNESS - ////////////////////////////////////////////////////////////////////// - - if (rain_enabled >0.0) - { - texel.rgb = texel.rgb * (1.0 - 0.6 * wetness); - float rain_factor = 0.0; - - float rain_orientation = max(dot(VNormal, up),0.0); - - if ((rain_norm > 0.0) && (rain_orientation > 0.0)) - { - rain_factor += DotNoise2D(rawpos.xy, 0.2 ,0.5, rain_norm) * abs(sin(6.0*osg_SimulationTime)); - rain_factor += DotNoise2D(rawpos.xy, 0.3 ,0.4, rain_norm) * abs(sin(6.0*osg_SimulationTime + 2.094)); - rain_factor += DotNoise2D(rawpos.xy, 0.4 ,0.3, rain_norm)* abs(sin(6.0*osg_SimulationTime + 4.188)); - } - - - - // secondary reflection of sky irradiance in water film - float fresnelW = ((0.8 * wetness) ) * (1.0-smoothstep(0.0,0.4, dot(N,-nVertVec) * 1.0 - 0.2 * rain_factor * wetness)); - float sky_factor = (1.0-ct*ct); - vec3 sky_light = vec3 (1.0,1.0,1.0) * length(light_diffuse.rgb) * (1.0-effective_scattering); - Specular.rgb += sky_factor * fresnelW * sky_light; - } - ///////////////////////////////////////////////////////////////////// - //end WETNESS - ////////////////////////////////////////////////////////////////////// - - - // set ambient adjustment to remove bluiness with user input - float ambient_offset = clamp(amb_correction, -1.0, 1.0); - vec4 ambient = gl_LightModel.ambient + light_ambient; - vec4 ambient_Correction = vec4(ambient.rg, ambient.b * 0.6, 1.0) - * ambient_offset ; - ambient_Correction = clamp(ambient_Correction, -1.0, 1.0); - - color += ambient; - color.a = texel.a * alpha; - vec4 fragColor = vec4(color.rgb * mixedcolor + ambient_Correction.rgb, color.a); - - fragColor += Specular * nmap.a; - - - - ////////////////////////////////////////////////////////////////////// - // BEGIN procedural lightmap - ////////////////////////////////////////////////////////////////////// - - - - - - - - - vec3 pLMColor = streetlight_color; - - float pLMIntensity = smoothstep(0.0, 0.4, roadCoords.s) * (1.0 - smoothstep(0.6, 1.0, roadCoords.s)); - pLMIntensity = 0.25 * rtype_base_illumination * (1.0+ streetlight_factor) + 0.1 * max(0.0,sin(4.0 * roadCoords.t)) * streetlight_factor; - pLMIntensity = clamp(pLMIntensity, 0.0, 1.0); - - if (gl_FrontMaterial.diffuse.r == 0.0) {pLMIntensity =0.0;} - - pLMColor *= pLMIntensity; - - if (road_traffic_enabled == 1) - { - - float viewAngleFactor = smoothstep(-0.05, 0.0, cSign * dot(normalize(VBinormal), nVertVec)); - - vec3 pCLColor = vec3 (0.95, 1.0, 1.0); - vec3 pTLColor = vec3 (0.95, 0.0, 0.0); - - - // mean illumination by car headlights - pLMColor = pLMColor + 0.2 * min(1.0,total_traffic_density) * pCLColor; - - //float pCLIntensity = smoothstep(0.4, 0.6, cTag) * (1.0-smoothstep(0.6, 0.8, cTag)); - //float laneFact = smoothstep(0.25, 0.3, roadCoords.s) * (1.0-smoothstep(0.3, 0.35, roadCoords.s)); - //laneFact += smoothstep(0.35, 0.4, roadCoords.s) * (1.0-smoothstep(0.4, 0.45, roadCoords.s)); - //laneFact += smoothstep(0.65, 0.7, roadCoords.s) * (1.0-smoothstep(0.7, 0.75, roadCoords.s)); - //laneFact += smoothstep(0.75, 0.8, roadCoords.s) * (1.0-smoothstep(0.8, 0.85, roadCoords.s)); - //pCLIntensity = pCLIntensity * laneFact * cPresent; - - - float pCLIntensity, pTLIntensity; - if (cSign == -1.0) - { - pCLIntensity = carMetaTexel.r * cPresent * smoothstep(0.45, 0.55, cTag) * viewAngleFactor ; - pCLIntensity += 0.85 * carMetaTexel.b * cPresent * smoothstep(0.45, 0.55, cTag); - pTLIntensity = carMetaTexel.r * cPresent * (1.0 - smoothstep(0.45, 0.55, cTag)) * (1.0 - viewAngleFactor); - pTLIntensity += 0.85 * carMetaTexel.b * cPresent * (1.0 - smoothstep(0.45, 0.55, cTag)); - - } - else - { - pCLIntensity = carMetaTexel.r * cPresent * (1.0 - smoothstep(0.45, 0.55, cTag)) *viewAngleFactor ; - pCLIntensity += 0.85 * carMetaTexel.b * cPresent * (1.0 - smoothstep(0.45, 0.55, cTag)); - pTLIntensity = carMetaTexel.r * cPresent * smoothstep(0.45, 0.55, cTag) * (1.0 - viewAngleFactor); - pTLIntensity += 0.85 * carMetaTexel.b * cPresent * smoothstep(0.45, 0.55, cTag); - } - - //pCLColor *= pCLIntensity; - - - - //if (cSign == 1.0) - // { - // pTLIntensity = smoothstep(0.9, 0.94, cTag) * (1.0-smoothstep(0.96, 1.0, cTag)); - // } - //else - // { - // pTLIntensity = smoothstep(0.0, 0.04, cTag) * (1.0-smoothstep(0.06, 0.1, cTag)); - // } - - - - //pTLIntensity = pTLIntensity * laneFact * cPresent * (1.0 - viewAngleFactor); - - - pCLColor = pCLColor * pCLIntensity + pTLColor * pTLIntensity; - - - pLMColor = clamp(pLMColor, 0.0, 1.0); - - pLMColor = max(pLMColor,pCLColor); - } - - //fragColor.rgb = max(fragColor.rgb, pLMColor * gl_FrontMaterial.diffuse.rgb * smoothstep(0.0, 1.0, mixedcolor*.5 + pLMColor*.5)); - - fragColor.rgb = max(fragColor.rgb, pLMColor * smoothstep(0.0, 1.0, mixedcolor*.5 + pLMColor*.5)); - - - - ////////////////////////////////////////////////////////////////////// - // END procedural lightmap - ////////////////////////////////////////////////////////////////////// - - - /// BEGIN fog amount - - float transmission; - float vAltitude; - float delta_zv; - float H; - float distance_in_layer; - float transmission_arg; - float eqColorFactor; - - float delta_z = hazeLayerAltitude - eye_alt; - float mvisibility = min(visibility, avisibility); - - if (dist > 0.04 * mvisibility) - { - if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - transmission_arg = (dist-distance_in_layer)/avisibility; - - - if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 -effective_scattering); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 -effective_scattering); - } - transmission = fog_func(transmission_arg, alt); - if (eqColorFactor < 0.2) eqColorFactor = 0.2; - } - else - { - eqColorFactor = 1.0; - transmission = 1.0; - } - - /// END fog amount - - /// BEGIN fog color - - vec3 hazeColor = get_hazeColor(fog_lightArg); - - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - - if (transmission< 1.0) - { - - - - if (fog_lightArg < 10.0) - { - intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - - intensity = length(hazeColor); - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - - hazeColor.r = hazeColor.r * 0.83; - hazeColor.g = hazeColor.g * 0.9; - - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,fog_earthShade) )); - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - float shadow = mix( min(1.0 + dot(VNormal,gl_LightSource[0].position.xyz),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); - hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - } - else - { - hazeColor = vec3 (1.0, 1.0, 1.0); - } - - - - - /// END fog color - fragColor = clamp(fragColor, 0.0, 1.0); - hazeColor = clamp(hazeColor, 0.0, 1.0); - - ///BEGIN Rayleigh fog /// - - // Rayleigh color shift due to out-scattering - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); - - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - - /// END Rayleigh fog - - // don't let the light fade out too rapidly - lightArg = (terminator + 200000.0)/100000.0; - float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); - vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - hazeColor *= eqColorFactor * fog_earthShade; - hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - - - fragColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission); - - fragColor.rgb = filter_combined(fragColor.rgb); - - gl_FragColor = fragColor; - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - } diff --git a/Compositor/Shaders/ALS/rock.frag b/Compositor/Shaders/ALS/rock.frag deleted file mode 100644 index d8613cb84..000000000 --- a/Compositor/Shaders/ALS/rock.frag +++ /dev/null @@ -1,684 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2011, based on default.frag -// Ambient term comes in gl_Color.rgb. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec2 rawPos; -varying vec3 worldPos; -varying vec3 ecViewdir; - - - -varying float steepness; -varying vec2 grad_dir; - -varying float flogz; - - -uniform float fg_Fcoef; - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float snowlevel; -uniform float dust_cover_factor; -uniform float lichen_cover_factor; -uniform float wetness; -uniform float fogstructure; -uniform float snow_thickness_factor; -uniform float cloud_self_shading; -uniform float contrast; -uniform float air_pollution; -uniform float intrinsic_wetness; -uniform float transition_model; -uniform float overlay_bias; -uniform float crack_depth; -uniform float crack_pattern_stretch; -uniform float grain_fade_power; -uniform float rock_brightness; -uniform float overlay_alpha; -uniform float dust_resistance; -uniform float slopeline_strength; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; -uniform float osg_SimulationTime; - -uniform vec3 base_color; -uniform vec3 overlay_color; - -uniform int wind_effects; -uniform int cloud_shadow_flag; -uniform int rock_strata; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; -float yprime_alt; -float mie_angle; - -float shadow_func (in float x, in float y, in float noise, in float dist); -float Noise2D(in vec2 coord, in float wavelength); -float Noise3D(in vec3 coord, in float wavelength); -float VoronoiNoise2D(in vec2 coord, in float wavelength, in float xrand, in float yrand); -float SlopeLines2D(in vec2 coord, in vec2 gradDir, in float wavelength, in float steepness); -float Strata3D(in vec3 coord, in float wavelength, in float variation); -float fog_func (in float targ, in float alt); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float light_arg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 filter_combined (in vec3 color) ; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -// a fade function for procedural scales which are smaller than a pixel - -float detail_fade (in float scale, in float angle, in float dist) -{ -float fade_dist = 2000.0 * scale * angle/max(pow(steepness,4.0), 0.1); - -return 1.0 - smoothstep(0.5 * fade_dist, fade_dist, dist); -} - - - -void main() -{ - - -yprime_alt = diffuse_term.a; -//diffuse_term.a = 1.0; -mie_angle = gl_Color.a; -float effective_scattering = min(scattering, cloud_self_shading); - -// distance to fragment -float dist = length(relPos); -// angle of view vector with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; -// float altitude of fragment above sea level -float msl_altitude = (relPos.z + eye_alt); - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - color.a = 1.0; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = normalize(normalize(lightDir) + normalize(ecViewdir)); - vec4 texel; - vec4 snow_texel; - vec4 detail_texel; - vec4 mix_texel; - vec4 grain_texel; - vec4 dot_texel; - vec4 gradient_texel; - vec4 foam_texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - - -// Perlin noise - -float noise_100m = Noise2D(rawPos.xy,100.0); -float noise_50m = Noise2D(rawPos.xy, 50.0); -float noise_25m = Noise2D(rawPos.xy, 25.0); -float noise_10m = Noise2D(rawPos.xy, 10.0); -float noise_5m = Noise2D(rawPos.xy ,5.0); -float noise_2m = Noise2D(rawPos.xy ,2.0); -float noise_1m = Noise2D(rawPos.xy ,1.0); -float noise_05m = Noise2D(rawPos.xy,0.5); -float noise_02m = Noise2D(rawPos.xy,0.2); -float noise_01m = Noise2D(rawPos.xy, 0.1); - -float noisegrad_10m; -float noisegrad_5m; -float noisegrad_2m; -float noisegrad_1m; -float noisegrad_05m; -float noisegrad_02m; -float noisegrad_01m; - - - - - -float noise_250m = Noise3D(worldPos.xyz,250.0); -float noise_500m = Noise3D(worldPos.xyz, 500.0); -float noise_1500m = Noise3D(worldPos.xyz, 1500.0); -float noise_2000m = Noise3D(worldPos.xyz, 2000.0); - -// dot noise - -float dotnoise_2m = 0.0; -float dotnoise_10m = 0.0; -float dotnoise_15m = 0.0; - -float dotnoisegrad_10m; - -// slope noise - -float slopenoise_50m = SlopeLines2D(rawPos, grad_dir, 50.0, steepness); -float slopenoise_100m = SlopeLines2D(rawPos, grad_dir, 100.0, steepness); - -float snownoise_25m = mix(noise_25m, slopenoise_50m, clamp(3.0*(1.0-steepness),0.0,1.0)); -float snownoise_50m = mix(noise_50m, slopenoise_100m, clamp(3.0*(1.0-steepness),0.0,1.0)); - - - - - -// get the texels - - float noise_term; - float snow_alpha; - float local_autumn_factor; - - // we need to fade procedural structures when they get smaller than a single pixel, for this we need - // to know under what angle we see the surface - - float view_angle = abs(dot(normalize(normal), normalize(ecViewdir))); - - - // the snow texel is generated procedurally - if (msl_altitude +500.0 > snowlevel) - { - snow_texel = vec4 (0.95, 0.95, 0.95, 1.0) * (0.9 + 0.1* noise_500m + 0.1* (1.0 - noise_10m) ); - snow_texel.r = snow_texel.r * (0.9 + 0.05 * (noise_10m + noise_5m)); - snow_texel.g = snow_texel.g * (0.9 + 0.05 * (noise_10m + noise_5m)); - snow_texel.a = 1.0; - noise_term = 0.1 * (noise_500m-0.5) ; - noise_term = noise_term + 0.2 * (snownoise_50m -0.5) * detail_fade(50.0, view_angle, 0.5*dist) ; - noise_term = noise_term + 0.2 * (snownoise_25m -0.5) * detail_fade(25.0, view_angle, 0.5*dist) ; - noise_term = noise_term + 0.3 * (noise_10m -0.5) * detail_fade(10.0, view_angle, 0.8*dist) ; - noise_term = noise_term + 0.3 * (noise_5m - 0.5) * detail_fade(5.0, view_angle, dist); - noise_term = noise_term + 0.15 * (noise_2m -0.5) * detail_fade(2.0, view_angle, dist); - noise_term = noise_term + 0.08 * (noise_1m -0.5) * detail_fade(1.0, view_angle, dist); - snow_texel.a = snow_texel.a * 0.2+0.8* smoothstep(0.2,0.8, 0.3 +noise_term + snow_thickness_factor +0.0001*(msl_altitude -snowlevel) ); - } - - - - - - - - - - - - - - - // strata noise - - float stratnoise_50m; - float stratnoise_10m; - - if (rock_strata==1) - { - stratnoise_50m = Strata3D(vec3 (rawPos.x, rawPos.y, msl_altitude), 50.0, 0.2); - stratnoise_10m = Strata3D(vec3 (rawPos.x, rawPos.y, msl_altitude), 10.0, 0.2); - stratnoise_50m = mix(stratnoise_50m, 1.0, smoothstep(0.8,0.9, steepness)); - stratnoise_10m = mix(stratnoise_10m, 1.0, smoothstep(0.8,0.9, steepness)); - texel *= (0.4 + 0.4 * stratnoise_50m + 0.2 * stratnoise_10m); - } - - - - - - - - // procedural rock texture generation - - texel.rgb = base_color; - - // use powers of Perlin noise to generate the base pattern - - float grainy_noise; - float fade_norm; - - float gfp = grain_fade_power; - float gfptmp; - - grainy_noise = (0.5 * (1.0-slopenoise_100m) + 0.5 *noise_50m) + gfp * (0.5 * slopenoise_50m + 0.5 * noise_25m); - fade_norm = 1.0+gfp; - - gfptmp = gfp * gfp; - grainy_noise += noise_10m * gfptmp * detail_fade(10.0, view_angle, dist) ; - fade_norm += gfptmp * detail_fade(10.0, view_angle, dist) ; - - gfptmp = gfptmp * gfp; - grainy_noise += noise_5m * gfptmp * detail_fade(5.0, view_angle, dist) ; - fade_norm += gfptmp * detail_fade(5.0, view_angle, dist) ; - - gfptmp = gfptmp * gfp; - grainy_noise += noise_2m * gfptmp * detail_fade(2.0, view_angle, dist) ; - fade_norm += gfptmp * detail_fade(2.0, view_angle, dist) ; - - gfptmp = gfptmp * gfp; - grainy_noise += noise_1m * gfptmp * detail_fade(1.0, view_angle, dist) ; - fade_norm += gfptmp * detail_fade(1.0, view_angle, dist) ; - - gfptmp = gfptmp * gfp; - grainy_noise += noise_05m * gfptmp * detail_fade(0.5, view_angle, dist) ; - fade_norm += gfptmp * detail_fade(0.5, view_angle, dist) ; - - grainy_noise = grainy_noise/fade_norm; - grainy_noise = smoothstep(-0.2, 1.2, grainy_noise); - - // generate the crack pattern from isovalue lines of stretched Perlin noise - - float cnoise_500m = Noise2D(vec2(rawPos.x+10.0, crack_pattern_stretch * rawPos.y), 500.0); - float cnoise_250m = Noise2D(vec2(rawPos.x+10.0, crack_pattern_stretch * rawPos.y), 250.0); - float cnoise_100m = Noise2D(vec2(rawPos.x+10.0, crack_pattern_stretch * rawPos.y), 100.0); - float cnoise_50m = Noise2D(vec2(rawPos.x+10.0, crack_pattern_stretch * rawPos.y), 50.0); - float cnoise_25m = Noise2D(vec2(rawPos.x+10.0, crack_pattern_stretch * rawPos.y), 25.0); - float cnoise_10m = Noise2D(vec2(rawPos.x+10.0, crack_pattern_stretch * rawPos.y), 10.0); - float cnoise_5m = Noise2D(vec2(rawPos.x+10.0, crack_pattern_stretch * rawPos.y), 5.0); - float cnoise_2m = Noise2D(vec2(rawPos.x+10.0, crack_pattern_stretch * rawPos.y), 2.0); - float cnoise_1m = Noise2D(vec2(rawPos.x+10.0, crack_pattern_stretch * rawPos.y), 1.0); - - float crack_noise; - float crack_factor; - float crack_size; - float scrack_noise; - float scrack_size; - - crack_noise = cnoise_500m + 0.65 * cnoise_250m + 0.42 * cnoise_100m * detail_fade(50.0, view_angle, dist) ; - crack_noise = crack_noise + 0.27 * cnoise_50m * detail_fade(25.0, view_angle, dist) ; - crack_noise = crack_noise + 0.17 * cnoise_25m * detail_fade(10.0, view_angle, dist) ; - crack_noise = crack_noise + 0.11 * cnoise_10m * detail_fade(5.0, view_angle, dist) ; - crack_noise = 0.381 * crack_noise; - - - - scrack_noise = cnoise_10m + 0.65 * cnoise_5m * detail_fade(5.0, view_angle, dist); - scrack_noise = scrack_noise + 0.3 * cnoise_2m + 0.1 * cnoise_1m * detail_fade(1.0, view_angle, dist); - scrack_noise = 0.48 * scrack_noise; - - crack_size = 0.02 +0.00001 * dist; - crack_factor = smoothstep(0.5-crack_size,0.50,crack_noise) * (1.0-smoothstep(0.51,0.51+crack_size,crack_noise)); - //crack_factor = step(0.5-0.2*crack_size,crack_noise) * (1.0-step(0.5+0.2*crack_size,crack_noise)); - - crack_size *= 0.5; - crack_factor += smoothstep(0.42,0.42+crack_size,crack_noise) * (1.0-smoothstep(0.43,0.43+crack_size,crack_noise)); - - scrack_size = crack_size * 4.0; - crack_factor += 0.75 * smoothstep(0.5-scrack_size,0.50,scrack_noise) * (1.0-smoothstep(0.51,0.51+scrack_size,scrack_noise))* (1.0- smoothstep(250.0,1000.0,dist)); - - - crack_factor = crack_factor * min(1.0,0.03/crack_size); - - - -// distribution of overlay color - - - float overlay_noise; - float overlay_factor; - - overlay_noise = 0.381 * (noise_50m + 0.65 * noise_25m + 0.42 * noise_10m + 0.27 * noise_5m + 0.17 * noise_2m + 0.11 * noise_1m); - overlay_noise = overlay_noise + 0.1 * (smoothstep(0.8,0.9, steepness)); - - overlay_factor = smoothstep(0.7, 0.72, overlay_noise + overlay_bias) + (1.0 - smoothstep(0.2, 0.22, overlay_noise - overlay_bias)); - - - -// merge the noise components - - //grainy_noise = grainy_noise * (1.0-crack_depth * crack_factor) + 0.5 * crack_depth * crack_factor; - texel.rgb = ((1.0 - contrast) + contrast * grainy_noise ) * texel.rgb; - texel.rgb = mix(texel.rgb, overlay_color.rgb,overlay_alpha * overlay_factor); - texel.rgb = texel.rgb * ((1.0-crack_depth) +crack_depth*(1.0-crack_factor * (0.5 + 0.5 * noise_50m) )); - - texel.rgb = texel.rgb * rock_brightness; - - texel.rgb = texel.rgb * (1.0 + 0.4 * (noise_01m-0.5) * detail_fade(0.1, view_angle, dist)) ; - - -const vec4 dust_color = vec4 (0.76, 0.65, 0.45, 1.0); -const vec4 lichen_color = vec4 (0.17, 0.20, 0.06, 1.0); - -// mix vegetation -float gradient_factor = smoothstep(0.5, 1.0, steepness); -texel = mix(texel, lichen_color, gradient_factor * (0.4 * lichen_cover_factor + 0.8 * lichen_cover_factor * 0.5 * (noise_10m + (1.0 - noise_5m))) ); -// mix dust -texel = mix(texel, dust_color, clamp(0.5 * dust_cover_factor *dust_resistance + 3.0 * dust_cover_factor * dust_resistance *(((noise_1500m - 0.5) * 0.125)+0.125 ) - 0.03*slopenoise_100m,0.0, 1.0) ); -// mix snow -float snow_mix_factor = 0.0; -if (msl_altitude +500.0 > snowlevel) - { - - snow_alpha = smoothstep(0.65, 0.85, abs(steepness)); - snow_alpha += (1.0 - snow_alpha) * crack_factor; - - snow_mix_factor = snow_texel.a* smoothstep(snowlevel, snowlevel+200.0, snow_alpha * msl_altitude + (noise_2000m + 0.1 * noise_10m -0.55) *400.0); - texel = mix(texel, snow_texel, snow_mix_factor); - } - - - - -// get distribution of water when terrain is wet - -float combined_wetness = min(1.0, wetness + intrinsic_wetness); -float water_threshold1; -float water_threshold2; -float water_factor =0.0; - - -if ((dist < 5000.0) && (combined_wetness>0.0)) - { - water_threshold1 = 1.0-0.5* combined_wetness; - water_threshold2 = 1.0 - 0.3 * combined_wetness; - water_factor = smoothstep(water_threshold1, water_threshold2 , (0.3 * (2.0 * (1.0-noise_10m) + (1.0 -noise_5m)) * (1.0 - smoothstep(2000.0, 5000.0, dist))) - 5.0 * (1.0 -steepness)); - } - -// darken wet terrain - - texel.rgb = texel.rgb * (1.0 - 0.6 * combined_wetness); - - - -// light computations - - - vec4 light_specular = gl_LightSource[0].specular; - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - //n = (2.0 * gl_Color.a - 1.0) * normal; - n = normal; - n = normalize(n); - - NdotL = dot(n, lightDir); - - noisegrad_10m = (noise_10m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),10.0))/0.05; - noisegrad_5m = (noise_5m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),5.0))/0.05; - noisegrad_2m = (noise_2m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),2.0))/0.05; - noisegrad_1m = (noise_1m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),1.0))/0.05; - noisegrad_05m = (noise_05m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),0.5))/0.05; - - - dotnoisegrad_10m = 0.0;//(dotnoise_10m - DotNoise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),10.0 * dot_size,0.5, 0.0))/0.05; - - - //NdotL = NdotL + (noisegrad_10m * detail_fade(10.0, view_angle,dist) + 0.8* noisegrad_5m * detail_fade(5.0, view_angle,dist)); - //NdotL = NdotL + 0.4 * noisegrad_2m * detail_fade(2.0,view_angle,dist); - //NdotL = NdotL + 0.2 * noisegrad_2m * detail_fade(2.0,view_angle,dist); - //NdotL = NdotL + 0.05 * noisegrad_1m * detail_fade(1.0, view_angle,dist); - //NdotL = NdotL + 0.02 * noisegrad_05m * detail_fade(0.5, view_angle,dist); - - //NdotL = NdotL + (1.0-snow_mix_factor) * 0.3* dot_texel.a * (0.5* dotnoisegrad_10m * detail_fade(1.0 * dot_size, view_angle, dist) +0.5 * dotnoisegrad_10m * noise_01m * detail_fade(0.1, view_angle, dist)) ; - //NdotL = NdotL + 0.2 * grainy_noise; - - float snow_factor; - float fresnel; - - if (NdotL > 0.0) { - if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 0.3 * noise_250m + 0.5 * noise_500m+0.2 * noise_1500m, dist);} - color += diffuse_term * NdotL; - NdotHV = max(dot(n, halfVector), 0.0); - - fresnel = 1.0 + 5.0 * (1.0-smoothstep(0.0,0.2, dot(normalize(ecViewdir),n))); - snow_factor = 0.2 * smoothstep(0.7,0.9,snow_mix_factor) * fresnel; - - //if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = ((gl_FrontMaterial.specular.rgb * 0.1 + snow_factor * vec3(1.0,1.0,1.0) + (water_factor * vec3 (1.0, 1.0, 1.0))) - * light_specular.rgb - * pow(NdotHV, max(gl_FrontMaterial.shininess,4.0) + (20.0 * water_factor))); - } - color.a = 1.0;//diffuse_term.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - color.rgb +=secondary_light * light_distance_fading(dist); - - - fragColor = color * texel + specular; - -float lightArg = (terminator-yprime_alt)/100000.0; -vec3 hazeColor = get_hazeColor(lightArg); - - - -// Rayleigh color shift due to out-scattering - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); - -// Rayleigh color shift due to in-scattering - - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; - -float mvisibility = min(visibility,avisibility); - -if (dist > 0.04 * mvisibility) - -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - -// blur of the haze layer edge - -float blur_thickness = 50.0; -float cphi = dot(vec3(0.0, 1.0, 0.0), relPos)/dist; -float ctlayer = delta_z/dist-0.01 + 0.02 * Noise2D(vec2(cphi,1.0),0.1) -0.01; -float ctblur = 0.035 ; - -float blur_dist; - -if (abs(delta_z) < 400.0) - { - blur_dist = dist * (1.0-smoothstep(0.0,300.0,-delta_z)) * smoothstep(-400.0,-200.0, -delta_z); - blur_dist = blur_dist * smoothstep(ctlayer-4.0*ctblur, ctlayer-ctblur, ct) * (1.0-smoothstep(ctlayer+0.5*ctblur, ctlayer+ctblur, ct)); - distance_in_layer = max(distance_in_layer, blur_dist); - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - - - -if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility + 1.0 * visibility * fogstructure * 0.06 * (noise_1500m + noise_2000m -1.0) )); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 - effective_scattering); - } -else - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility + 1.0 * avisibility * fogstructure * 0.06 * (noise_1500m + noise_2000m - 1.0) )); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 - effective_scattering); - } - - - -transmission = fog_func(transmission_arg, alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - - - - - - -// now dim the light for haze -eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - -// Mie-like factor - - if (lightArg < 10.0) - { - intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -intensity = length(hazeColor); - -if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColor doesn't come out correctly -{ - - - // high altitude desaturation of the haze color - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - - // blue hue of haze - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - - - // additional blue in indirect light - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - // change haze color to blue hue for strong fogging - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - - - // reduce haze intensity when looking at shaded surfaces, only in terminator region - float shadow = mix( min(1.0 + dot(n,lightDir),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); - hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - } - -// don't let the light fade out too rapidly -lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - -hazeColor.rgb *= eqColorFactor * eShade; -hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - - -fragColor.rgb = mix(hazeColor + secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission); - -} - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} - diff --git a/Compositor/Shaders/ALS/runway.frag b/Compositor/Shaders/ALS/runway.frag deleted file mode 100644 index c91239e8b..000000000 --- a/Compositor/Shaders/ALS/runway.frag +++ /dev/null @@ -1,537 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2011, based on default.frag -// Ambient term comes in gl_Color.rgb. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec2 rawPos; -varying vec3 worldPos; -varying vec3 ecViewdir; - - -uniform float fg_Fcoef; - -uniform sampler2D texture; -uniform sampler2D NormalTex; - -varying float steepness; - -varying float flogz; - - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float snowlevel; -uniform float dust_cover_factor; -uniform float lichen_cover_factor; -uniform float wetness; -uniform float rain_norm; -uniform float fogstructure; -uniform float snow_thickness_factor; -uniform float cloud_self_shading; -uniform float uvstretch; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; -uniform float air_pollution; -uniform float osg_SimulationTime; - -uniform int quality_level; -uniform int tquality_level; -uniform int cloud_shadow_flag; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; -uniform int overlay_flag; - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; -float yprime_alt; -float mie_angle; - -float shadow_func (in float x, in float y, in float noise, in float dist); -float Noise2D(in vec2 coord, in float wavelength); -float Noise3D(in vec3 coord, in float wavelength); -float DotNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density); -float fog_func (in float targ, in float alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); - -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 lightspot(in vec3 relPos); -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float light_arg); -vec3 filter_combined (in vec3 color) ; - -float getShadowing(); - - -void main() -{ - - yprime_alt = diffuse_term.a; - mie_angle = gl_Color.a; - float effective_scattering = min(scattering, cloud_self_shading); - - // distance to fragment - float dist = length(relPos); - // angle of view vector with horizon - float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV; - vec4 color = gl_Color; - color.a = 1.0; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 E = normalize(ecViewdir); - vec3 halfVector; - if (quality_level<6) - {halfVector = gl_LightSource[0].halfVector.xyz;} - else - {halfVector = normalize(normalize(lightDir) + E);} - - vec4 texel; - vec4 snow_texel; - vec4 detail_texel; - vec4 mix_texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - -// get noise at different wavelengths - -// used: 5m, 5m gradient, 10m, 10m gradient: heightmap of the closeup terrain, 10m also snow -// 50m: detail texel -// 250m: detail texel -// 500m: distortion and overlay -// 1500m: overlay, detail, dust, fog -// 2000m: overlay, detail, snow, fog - -float noise_01m; -float noise_1m = Noise2D(rawPos.xy, 1.0); -float noise_10m = Noise2D(rawPos.xy, 10.0); -float noise_20m = Noise2D(rawPos.xy, 20.0); -float noise_5m = Noise2D(rawPos.xy ,5.0); - - - -float noise_50m = Noise2D(rawPos.xy, 50.0); - - -float noise_1500m = Noise3D(worldPos.xyz, 1500.0); -float noise_2000m = Noise3D(worldPos.xyz, 2000.0); - - - - -// - - -// get the texels - - texel = texture2D(texture, vec2 (gl_TexCoord[0].s, gl_TexCoord[0].t * uvstretch)); - vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * 8.0); - vec3 N = nmap.rgb * 2.0 - 1.0; - - - // skid marks by procedural darkening - - float mix_factor = smoothstep(0.0, 0.3, 1.0 - gl_TexCoord[0].t)* smoothstep(0.0, 0.1, gl_TexCoord[0].t); - float threshold; - - if (overlay_flag > 0) - { - float centerness = 2.0 * (0.5 - abs(gl_TexCoord[0].s - 0.5)); - - if (overlay_flag == 1) - { - threshold = 0.4 + 0.3 * (1.0 -noise_50m); - } - else if (overlay_flag == 2) - { - threshold = mix(0.4 + 0.3 * (1.0 -noise_50m), 0.4, mix_factor); - } - else if (overlay_flag == 3) - { - threshold = 0.4 + 0.3 * (1.0 -noise_50m); - } - - centerness = smoothstep(threshold, 1.0, centerness); - - float sine_factor1 = smoothstep(0.6, 1.0, abs(sin(1.0 * noise_50m + 2.0 * gl_TexCoord[0].s + gl_TexCoord[0].s * 40.0))); - float sine_factor2 = smoothstep(0.7, 1.0, abs(sin(2.0 * noise_10m + gl_TexCoord[0].s + gl_TexCoord[0].s * 60.0))); - float sine_factor3 = smoothstep(0.7, 1.0, abs(sin(1.0 * noise_20m + gl_TexCoord[0].s + gl_TexCoord[0].s * 80.0))); - - float sine_factor = sine_factor1 * smoothstep(0.4, 0.6, noise_10m); - sine_factor += sine_factor2 * (1.0 - smoothstep(0.5, 0.7, noise_10m)); - sine_factor += sine_factor3 * smoothstep(0.5, 0.6, noise_20m); - sine_factor = min(sine_factor, 1.0); - - - centerness *=(0.7 + 0.3 *sine_factor); - - float t_factor; - - if (overlay_flag == 1) - {t_factor = smoothstep(0.0, 0.3, gl_TexCoord[0].t) * (0.4 + 0.2 * noise_50m);} - else if (overlay_flag == 2) - { - t_factor = mix (0.4 + 0.2 * noise_50m, 0.7 + 0.2 * noise_50m, mix_factor); - } - else if (overlay_flag == 3) - {t_factor = 0.3 + 0.2 * noise_50m;} - - centerness *= t_factor; - - - centerness = 1.0 - centerness; - texel.rgb = texel.rgb * (0.2 + 0.8 * centerness); - } - - float distortion_factor = 1.0; - vec2 stprime; - int flag = 1; - int mix_flag = 1; - float noise_term; - float snow_alpha; - - - if (quality_level > 3) - { - float sfactor; - noise_01m = Noise2D(rawPos.xy,0.1); - snow_texel = vec4 (0.95, 0.95, 0.95, 1.0) * (0.9 + 0.1* noise_50m + 0.1* (1.0 - noise_10m) ); - snow_texel.a = 1.0; - noise_term = 0.1 * (noise_50m-0.5); - sfactor = 1.0;//sqrt(2.0 * (1.0-steepness)/0.03) + abs(ct)/0.15; - noise_term = noise_term + 0.2 * (noise_10m -0.5) * (1.0 - smoothstep(10000.0*sfactor, 16000.0*sfactor, dist) ) ; - noise_term = noise_term + 0.3 * (noise_5m -0.5) * (1.0 - smoothstep(1200.0 * sfactor, 2000.0 * sfactor, dist) ) ; - noise_term = noise_term + 0.3 * (noise_1m -0.5) * (1.0 - smoothstep(500.0 * sfactor, 1000.0 *sfactor, dist) ); - noise_term = noise_term + 0.3 * (noise_01m -0.5) * (1.0 - smoothstep(20.0 * sfactor, 100.0 *sfactor, dist) ); - snow_texel.a = snow_texel.a * 0.2+0.8* smoothstep(0.2,0.8, 0.3 +noise_term + 0.2*snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) ); - - } - - -const vec3 dust_color = vec3 (0.76, 0.71, 0.56); -const vec3 lichen_color = vec3 (0.17, 0.20, 0.06); -//float snow_alpha; - -if (quality_level > 3) - { - - // mix vegetation - texel.rgb = mix(texel.rgb, lichen_color, 0.4 * lichen_cover_factor + 0.8 * lichen_cover_factor * 0.5 * (noise_10m + (1.0 - noise_5m)) ); - // mix dust - texel.rgb = mix(texel.rgb, dust_color, clamp(0.5 * dust_cover_factor + 3.0 * dust_cover_factor * (((noise_1500m - 0.5) * 0.125)+0.125 ),0.0, 1.0) ); - - // mix snow - if (relPos.z + eye_alt +500.0 > snowlevel) - { - snow_alpha = smoothstep(0.75, 0.85, abs(steepness)); - texel.rgb = mix(texel.rgb, snow_texel.rgb, snow_texel.a* smoothstep(snowlevel, snowlevel+200.0, snow_alpha * (relPos.z + eye_alt)+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0)); - } - } - - - -// get distribution of water when terrain is wet - -float water_threshold1; -float water_threshold2; -float water_factor =0.0; - - -if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0)) - { - water_threshold1 = 1.0-0.5* wetness; - water_threshold2 = 1.0 - 0.3 * wetness; - water_factor = smoothstep(water_threshold1, water_threshold2 , 0.5 * (noise_5m + (1.0 -noise_1m))) * (1.0 - smoothstep(1000.0, 3000.0, dist)); - } - -// darken wet terrain - - texel.rgb = texel.rgb * (1.0 - 0.6 * wetness - 0.1 * water_factor); - - -// light computations - - eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - vec4 light_specular = gl_LightSource[0].specular * eShade; - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - n = normal; - n = normalize(n); - - // primary reflection of the Sun - float fresnel; - NdotL = dot(n, lightDir); - - if (quality_level > 4) - { - NdotL = NdotL + (3.0 * N.r + 0.1 * (noise_01m-0.5))* (1.0 - water_factor) ; - } - if (NdotL > 0.0) - { - float shadowmap = getShadowing(); - if (cloud_shadow_flag == 1) - {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 1.0, dist);} - color += diffuse_term * NdotL * shadowmap; - NdotHV = max(dot(n, halfVector), 0.0); - fresnel = 1.0 + 5.0 * (1.0-smoothstep(0.0,0.2, dot(E,n))); - specular.rgb = ((vec3 (0.2,0.2,0.2) * fresnel + (water_factor * vec3 (1.0, 1.0, 1.0))) - * light_specular.rgb - * pow(NdotHV, max(4.0, (20.0 * water_factor))) - * shadowmap); - } - - // raindrops - float rain_factor = 0.0; - if (rain_norm > 0.0) - { - rain_factor += DotNoise2D(rawPos.xy, 0.2 ,0.5, rain_norm) * abs(sin(6.0*osg_SimulationTime)); - rain_factor += DotNoise2D(rawPos.xy, 0.3 ,0.4, rain_norm) * abs(sin(6.0*osg_SimulationTime + 2.094)); - rain_factor += DotNoise2D(rawPos.xy, 0.4 ,0.3, rain_norm)* abs(sin(6.0*osg_SimulationTime + 4.188)); - } - - // secondary reflection of sky irradiance - float fresnelW = ((0.8 * wetness) + (0.2* water_factor)) * (1.0-smoothstep(0.0,0.4, dot(E,n) * 1.0 - 0.2 * rain_factor * wetness)); - float sky_factor = (1.0-ct*ct);//mix((1.0 - ct * ct), 1.0-effective_scattering, effective_scattering); - vec3 sky_light = vec3 (1.0,1.0,1.0) * length(light_specular.rgb) * (1.0-effective_scattering); - specular.rgb += sky_factor * fresnelW * sky_light; - - - - //specular.rgb *= 1.0 - 0.2 * dotnoise_02m * wetness; - - color.a = 1.0;//diffuse_term.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light.rgb += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - - color.rgb +=secondary_light * light_distance_fading(dist) + lightspot(relPos); - - fragColor = color * texel + specular; - - -float lightArg = (terminator-yprime_alt)/100000.0; - -vec3 hazeColor = get_hazeColor(lightArg); - - -// Rayleigh color shifts - - if ((quality_level > 5) && (tquality_level > 5)) - { - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); -// Rayleigh color shift due to in-scattering - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - } - - -// here comes the terrain haze model - -float delta_z = hazeLayerAltitude - eye_alt; -float mvisibility = min(visibility, avisibility); - -if (dist > 0.04 * mvisibility) -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - - - -if (visibility < avisibility) - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility + 1.0 * visibility * fogstructure * 0.06 * (noise_1500m + noise_2000m -1.0) )); - - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0- effective_scattering); - - } -else - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility + 1.0 * avisibility * fogstructure * 0.06 * (noise_1500m + noise_2000m - 1.0) )); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 - effective_scattering); - } - - - -transmission = fog_func(transmission_arg, alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - -// Mie-like factor - - if (lightArg < 10.0) - { - intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -intensity = length(hazeColor); - -if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColor doesn't come out correctly -{ - - - // high altitude desaturation of the haze color - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - - // blue hue of haze - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - - - // additional blue in indirect light - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - // change haze color to blue hue for strong fogging - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - - - // reduce haze intensity when looking at shaded surfaces, only in terminator region - float shadow = mix( min(1.0 + dot(n,lightDir),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); - hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - } -//hazeColor = clamp(hazeColor, 0.0, 1.0); - -// don't let the light fade out too rapidly -lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - -hazeColor.rgb *= eqColorFactor * eShade; -hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - -fragColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission); - -} - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} - diff --git a/Compositor/Shaders/ALS/secondary_lights.frag b/Compositor/Shaders/ALS/secondary_lights.frag deleted file mode 100644 index ea11d38c4..000000000 --- a/Compositor/Shaders/ALS/secondary_lights.frag +++ /dev/null @@ -1,102 +0,0 @@ -// -*-C++-*- -#version 120 - -uniform int display_xsize; -uniform int display_ysize; -uniform float field_of_view; -uniform float view_pitch_offset; -uniform float view_heading_offset; - -float light_distance_fading(in float dist) -{ -return min(1.0, 10000.0/(dist*dist)); -} - -float fog_backscatter(in float avisibility) -{ -return 0.5* min(1.0,10000.0/(avisibility*avisibility)); -} - - - -vec3 searchlight() -{ - -vec2 center = vec2 (float(display_xsize) * 0.5, float(display_ysize) * 0.4); - -float headlightIntensity; -float lightRadius = (float(display_xsize) *9.16 /field_of_view); -float angularDist = length(gl_FragCoord.xy -center); - -if (angularDist < lightRadius) - { - headlightIntensity = pow(cos(angularDist/lightRadius * 1.57075),2.0); - //headlightIntensity = headlightIntensity * - //headlightIntensity*= clamp(1.0 + 0.15 * log(1000.0/(dist*dist)),0.0,1.0); - return headlightIntensity * vec3 (0.5,0.5, 0.5); - } -else return vec3 (0.0,0.0,0.0); -} - -vec3 flashlight(in vec3 color, in float radius) -{ - -vec2 center = vec2 (float(display_xsize) * 0.5, float(display_ysize) * 0.4); - -float headlightIntensity; -float lightRadius = (float(display_xsize) *radius /field_of_view); -float angularDist = length(gl_FragCoord.xy -center); - -if (angularDist < lightRadius) - { - headlightIntensity = pow(cos(angularDist/lightRadius * 1.57075),2.0); - return headlightIntensity * color; - } -else return vec3 (0.0,0.0,0.0); -} - -vec3 landing_light(in float offset, in float offsetv) -{ - -float fov_h = field_of_view; -float fov_v = float(display_ysize)/float(display_xsize) * field_of_view; - -float yaw_offset; - -if (view_heading_offset > 180.0) - {yaw_offset = -360.0+view_heading_offset;} -else - {yaw_offset = view_heading_offset;} - -float x_offset = (float(display_xsize) / fov_h * (yaw_offset + offset)); -float y_offset = -(float(display_ysize) / fov_v * (view_pitch_offset + offsetv)); - -vec2 center = vec2 (float(display_xsize) * 0.5 + x_offset, float(display_ysize) * 0.4 + y_offset); - - - -float landingLightIntensity; -float lightRadius = (float(display_xsize) *9.16 /field_of_view); -float angularDist = length(gl_FragCoord.xy -center); - -if (angularDist < lightRadius) - { - landingLightIntensity = pow(cos(angularDist/lightRadius * 1.57075),2.0); - //landingLightIntensity *= min(1.0, 10000.0/(dist*dist)); - return landingLightIntensity * vec3 (0.5,0.5, 0.5); - } -else return vec3 (0.0,0.0,0.0); - -} - - -vec3 addLights(in vec3 color1, in vec3 color2) -{ -vec3 outcolor; - -outcolor.r = 0.14 * log(exp(color1.r/0.14) + exp(color2.r/0.14)-1.0); -outcolor.g = 0.14 * log(exp(color1.g/0.14) + exp(color2.g/0.14)-1.0); -outcolor.b = 0.14 * log(exp(color1.b/0.14) + exp(color2.b/0.14)-1.0); - -return outcolor; -} diff --git a/Compositor/Shaders/ALS/skydome.frag b/Compositor/Shaders/ALS/skydome.frag deleted file mode 100644 index 9a97b33e9..000000000 --- a/Compositor/Shaders/ALS/skydome.frag +++ /dev/null @@ -1,385 +0,0 @@ -// -*-C++-*- - -#version 120 - -// Atmospheric scattering shader for flightgear -// Written by Lauri Peltonen (Zan) -// Implementation of O'Neil's algorithm -// Ground haze layer added by Thorsten Renk -// aurora and ice haze scattering Thorsten Renk 2016 - -varying vec3 rayleigh; -varying vec3 mie; -varying vec3 eye; -varying vec3 hazeColor; -varying vec3 viewVector; -varying float ct; -varying float cphi; -varying float delta_z; -varying float alt; -varying float earthShade; - - -uniform float overcast; -uniform float saturation; -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float cloud_self_shading; -uniform float horizon_roughness; -uniform float ice_hex_col; -uniform float ice_hex_sheet; -uniform float parhelic; -uniform float ring; -uniform float aurora_strength; -uniform float aurora_hsize; -uniform float aurora_vsize; -uniform float aurora_ray_factor; -uniform float aurora_penetration_factor; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; -uniform float osg_SimulationTime; - -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; - -const float EarthRadius = 5800000.0; - - -float Noise2D(in vec2 coord, in float wavelength); -float fog_backscatter(in float avisibility); - -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 filter_combined (in vec3 color) ; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -float miePhase(in float cosTheta, in float g) -{ - float g2 = g*g; - float a = 1.5 * (1.0 - g2); - float b = (2.0 + g2); - float c = 1.0 + cosTheta*cosTheta; - float d = pow(1.0 + g2 - 2.0 * g * cosTheta, 0.6667); - - return (a*c) / (b*d); -} - -float rayleighPhase(in float cosTheta) -{ - //return 1.5 * (1.0 + cosTheta*cosTheta); - return 1.5 * (2.0 + 0.5*cosTheta*cosTheta); -} - - -void main() -{ - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - float cosTheta = dot(normalize(eye), gl_LightSource[0].position.xyz); - - // some geometry - - vec3 nView = normalize(viewVector); - vec3 lightFull = normalize((gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz); - float calpha = dot(lightFull, nView); - float cbeta = dot ( normalize(lightFull.xy), normalize(nView.xy)); - float costheta = ct; - - // some noise - - float hNoise_03 = Noise2D(vec2(0.0,cphi), 0.3); - float hNoiseAurora = Noise2D(vec2(0.001 * osg_SimulationTime,cphi + nView.x + nView.y), 0.07) * 0.2 * aurora_ray_factor; - - // position of the horizon line - - float lAltitude = alt + delta_z; - float radiusEye = (EarthRadius + alt); - float radiusLayer = (EarthRadius + lAltitude); - float cthorizon; - float ctterrain; - //float ctsd; - - float SkydomeRadius = (EarthRadius + 100000.0); - float rEye = (EarthRadius + alt); - - if (radiusEye > radiusLayer) cthorizon = -sqrt(radiusEye * radiusEye - radiusLayer * radiusLayer)/radiusEye; - else cthorizon = sqrt(radiusLayer * radiusLayer - radiusEye * radiusEye)/radiusLayer; - - //if (rEye > SkydomeRadius) ctsd = -sqrt(rEye * rEye - SkydomeRadius * SkydomeRadius)/rEye; - //else ctsd = 0.0;//sqrt(SkydomeRadius * SkydomeRadius - rEye * rEye)/SkydomeRadius; - - ctterrain = -sqrt(radiusEye * radiusEye - EarthRadius * EarthRadius)/radiusEye; - - vec3 color = rayleigh * rayleighPhase(cosTheta); - color += mie * miePhase(cosTheta, -0.8); - - vec3 black = vec3(0.0,0.0,0.0); - - - float ovc = overcast; - - - float sat = 1.0 - ((1.0 - saturation) * 2.0); - if (sat < 0.3) sat = 0.3; - - if (color.r > 0.58) color.r = 1.0 - exp(-1.5 * color.r); - if (color.g > 0.58) color.g = 1.0 - exp(-1.5 * color.g); - if (color.b > 0.58) color.b = 1.0 - exp(-1.5 * color.b); - - - -// Aurora Borealis / Australis - - vec3 direction = vec3 (1.0, 0.0, 0.0); - - float hArg = dot(nView, direction); - - float aurora_vEdge = 0.2 - 0.6 * aurora_vsize * (1.0 - 0.8* aurora_ray_factor); - float aurora_vArg = costheta + hNoiseAurora; - float aurora_v = smoothstep(aurora_vEdge , 0.2 , costheta + hNoiseAurora) * (1.0- smoothstep(0.3, 0.3 + aurora_vsize, aurora_vArg)); - aurora_v *= (1.0 + 5.0 * aurora_ray_factor * (1.0 -smoothstep(aurora_vEdge, 0.3, aurora_vArg))); - - float aurora_h = smoothstep(1.0 - aurora_hsize, 1.0, hArg); - float aurora_time = 0.01 * osg_SimulationTime; - - vec3 auroraBaseColor = vec3 (0.0, 0.2, 0.1); - vec3 auroraFringeColor = vec3 (0.4, 0.15, 0.2); - - float fringe_factor = 1.0 - smoothstep(aurora_vEdge, aurora_vEdge + 0.08, aurora_vArg); - fringe_factor *= aurora_strength * aurora_penetration_factor; - auroraBaseColor = mix(auroraBaseColor, auroraFringeColor, fringe_factor ); - - float aurora_ray = mix(1.0, Noise2D(vec2(cbeta, 0.01 * aurora_time), 0.001), aurora_ray_factor); - - float aurora_visible_strength = 0.3 + 0.7 * Noise2D(vec2(costheta + aurora_time, 0.5 * nView.x + 0.3 * nView.y + aurora_time), 0.1) ; - aurora_visible_strength *= aurora_ray; - float aurora_fade_in = 1.0 - smoothstep(0.1, 0.2, length(color.rgb)); - - - - color.rgb += auroraBaseColor * aurora_v * aurora_h * aurora_fade_in * aurora_visible_strength * aurora_strength; - -// fog computations for a ground haze layer, extending from zero to lAltitude - -float transmission; -float vAltitude; -float delta_zv; - - - -float vis = min(visibility, avisibility); - - - if (delta_z > 0.0) // we're inside the layer - { - if (costheta>0.0 + ctterrain) // looking up, view ray intersecting upper layer edge - { - transmission = exp(-min((delta_z/max(costheta,0.1)),25000.0)/vis); - //transmission = 1.0; - vAltitude = min(vis * costheta, delta_z); - delta_zv = delta_z - vAltitude; - } - - else // looking down, view range intersecting terrain (which may not be drawn) - { - transmission = exp(alt/vis/costheta); - vAltitude = min(-vis * costheta, alt); - delta_zv = delta_z + vAltitude; - } - } - else // we see the layer from above - { - if (costheta < 0.0 + cthorizon) - { - transmission = exp(-min(lAltitude/abs(costheta),25000.0)/vis); - transmission = transmission * exp(-alt/avisibility/abs(costheta)); - transmission = 1.0 - (1.0 - transmission) * smoothstep(0+cthorizon, -0.02+cthorizon, costheta); - vAltitude = min(lAltitude, -vis * costheta); - delta_zv = vAltitude; - } - else - { - transmission = 1.0; - delta_zv = 0.0; - } - } - -// combined intensity reduction by cloud shading and fog self-shading, corrected for Weber-Fechner perception law -float eqColorFactor = 1.0 - 0.1 * delta_zv/vis - (1.0 - min(scattering,cloud_self_shading)); - - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - -// postprocessing of haze color -vec3 hColor = hazeColor; - - -// high altitude desaturation -float intensity = length(hColor); -hColor = intensity * normalize (mix(hColor, intensity * vec3 (1.0,1.0,1.0), 0.7 * smoothstep(5000.0, 50000.0, alt))); - -hColor = clamp(hColor,0.0,1.0); - -// blue hue -hColor.x = 0.83 * hColor.x; -hColor.y = 0.9 * hColor.y; - - - -// further blueshift when in shadow, either cloud shadow, or self-shadow or Earth shadow, dependent on indirect -// light - -float fade_out = max(0.65 - 0.3 *overcast, 0.45); -intensity = length(hColor); -vec3 oColor = hColor; -oColor = intensity * normalize(mix(oColor, shadedFogColor, (smoothstep(0.1,1.0,ovc)))); - -// ice crystal halo - -float sun_altitude = dot (lightFull, vec3 (0.0, 0.0, 1.0)); -float view_altitude = dot(nView, vec3 (0.0, 0.0, 1.0)); - -//float halo_ring_enhancement = smoothstep (0.88, 0.927, calpha) * (1.0 - smoothstep(0.927, 0.98, calpha)); -float halo_ring_enhancement = smoothstep (0.88, 0.927, calpha) * (1.0 - smoothstep(0.927, 0.94, calpha)); -halo_ring_enhancement *= halo_ring_enhancement; -halo_ring_enhancement *= ring; - -// parhelic circle - -float parhelic_circle_enhancement = 0.3 * smoothstep (sun_altitude-0.01, sun_altitude, view_altitude) * (1.0 - smoothstep(sun_altitude, sun_altitude+ 0.01, view_altitude)); - -parhelic_circle_enhancement += 0.8 * smoothstep (sun_altitude-0.08, sun_altitude, view_altitude) * (1.0 - smoothstep(sun_altitude, sun_altitude+ 0.08, view_altitude)); - -parhelic_circle_enhancement *= parhelic * (0.2 + 0.8 * smoothstep(0.5, 1.0, cbeta)); - -// sundogs - -float side_sun_enhancement = smoothstep (sun_altitude-0.03, sun_altitude, view_altitude) * (1.0 - smoothstep(sun_altitude, sun_altitude+ 0.03, view_altitude)); - -side_sun_enhancement *= halo_ring_enhancement * halo_ring_enhancement * ice_hex_sheet; - -// pillar - -float pillar_enhancement = smoothstep (sun_altitude-0.1, sun_altitude, view_altitude) * (1.0 - smoothstep(sun_altitude, sun_altitude+ 0.22, view_altitude)); -float beta_thickness = 0.6 * smoothstep(0.999, 1.0, cbeta); -beta_thickness += 0.8 * smoothstep(0.99998, 1.0, cbeta); -pillar_enhancement *= beta_thickness * beta_thickness * smoothstep(0.99, 1.0, calpha) * ice_hex_col; - - - -float scattering_enhancements = 0.25 * halo_ring_enhancement * ovc; -scattering_enhancements += side_sun_enhancement *0.4 * (1.0 - smoothstep(0.6, 0.95, transmission)); -scattering_enhancements += pillar_enhancement *0.25 * (1.0 - smoothstep(0.7, 1.0, transmission)); -scattering_enhancements += parhelic_circle_enhancement * 0.2 * (1.0 - smoothstep(0.7, 1.0, transmission)); - - -color.rgb += vec3(1.0, 1.0, 1.0) * (5.0-4.0* earthShade) * scattering_enhancements * hazeColor; - -oColor = clamp(oColor,0.0,1.0); -color = ovc * mix(color, oColor * earthShade ,smoothstep(-0.1+ctterrain, 0.0+ctterrain, ct)) + (1.0-ovc) * color; - - -hColor = intensity * normalize(mix(hColor, 1.5 * shadedFogColor, 1.0 -smoothstep(0.25, fade_out,earthShade) )); -hColor = intensity * normalize(mix(hColor, shadedFogColor, (1.0 - smoothstep(0.5,0.9,eqColorFactor)))); -hColor = hColor * earthShade; - -// accounting for overcast and saturation - - - -color = sat * color + (1.0 - sat) * mix(color, black, smoothstep(0.4+cthorizon,0.2+cthorizon,ct)); - - -// the terrain below the horizon gets drawn in one optical thickness -vec3 terrainHazeColor = eqColorFactor * hColor; - -// determine a visibility-dependent angle for how smoothly the haze blends over the skydome - -float hazeBlendAngle = max(0.01,1000.0/avisibility + 0.3 * (1.0 - smoothstep(5000.0, 30000.0, avisibility))); -float altFactor = smoothstep(-300.0, 0.0, delta_z); -float altFactor2 = 0.2 + 0.8 * smoothstep(-3000.0, 0.0, delta_z); -hazeBlendAngle = hazeBlendAngle + 0.1 * altFactor; -hazeBlendAngle = hazeBlendAngle + (1.0-horizon_roughness) * altFactor2 * 0.1 * hNoise_03; - -terrainHazeColor = clamp(terrainHazeColor,0.0,1.0); - - -// don't let the light fade out too rapidly -float lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - -// this is for the bare Rayleigh and Mie sky, highly altitude dependent -color.rgb = max(color.rgb, minLight.rgb * (1.0- min(alt/100000.0,1.0)) * (1.0 - costheta)); - -// this is for the terrain drawn -terrainHazeColor = max(terrainHazeColor.rgb, minLight.rgb); - -color = mix(color, terrainHazeColor ,smoothstep(hazeBlendAngle + ctterrain, 0.0+ctterrain, ct)); - - -// add the brightening of fog by lights - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light.rgb += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - - - - -// mix fog the skydome with the right amount of haze - -hColor *= eqColorFactor; -hColor = max(hColor.rgb, minLight.rgb); - -hColor = clamp(hColor,0.0,1.0); - -color = mix(hColor+secondary_light * fog_backscatter(avisibility),color, transmission); - -// blur the upper skydome edge when we're outside the atmosphere - -float asf = smoothstep (75000.0, 90000.0, alt); - -float asf_corr = clamp((alt-115000.0)/45000.0, 0.0,1.0) * 0.08; - - -color *= (1.0 - smoothstep( -0.12 -asf_corr, -0.06 - asf_corr, costheta) * asf); -color = filter_combined(color); - - - - - gl_FragColor = vec4(color, 1.0); - gl_FragDepth = 0.1; - - -} - diff --git a/Compositor/Shaders/ALS/skydome.vert b/Compositor/Shaders/ALS/skydome.vert deleted file mode 100644 index 91798e86a..000000000 --- a/Compositor/Shaders/ALS/skydome.vert +++ /dev/null @@ -1,301 +0,0 @@ -// -*-C++-*- - -#version 120 - -// Atmospheric scattering shader for flightgear -// Written by Lauri Peltonen (Zan) -// Implementation of O'Neil's algorithm - -uniform float fg_Fcoef; - -uniform mat4 osg_ViewMatrix; -uniform mat4 osg_ViewMatrixInverse; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float avisibility; -uniform float visibility; -uniform float terrain_alt; -uniform float air_pollution; -uniform float radius_modifier; - -varying vec3 rayleigh; -varying vec3 mie; -varying vec3 eye; -varying vec3 hazeColor; -varying vec3 viewVector; -varying float ct; -varying float cphi; -varying float delta_z; -varying float alt; -varying float earthShade; - - -// Dome parameters from FG and screen -const float domeSize = 80000.0; -const float realDomeSize = 100000.0; -const float groundRadius = 0.984503332 * domeSize; -const float altitudeScale = domeSize - groundRadius; -const float EarthRadius = 5800000.0; - -// Dome parameters when calculating scattering -// Assuming dome size is 5.0 -const float groundLevel = 0.984503332 * 5.0; -const float heightScale = (5.0 - groundLevel); - -// Integration parameters -const int nSamples = 7; -const float fSamples = float(nSamples); - -// Scattering parameters -uniform float rK = 0.0003; //0.00015; -uniform float mK = 0.003; //0.0025; -uniform float density = 0.5; //1.0 -//vec3 rayleighK = rK * vec3(5.602, 7.222, 19.644); -vec3 rayleighK = rK * vec3(4.5, 8.62, 17.3); -vec3 mieK = vec3(mK); -vec3 sunIntensity = 10.0*vec3(120.0, 125.0, 130.0); - -// light_func is a generalized logistic function fit to the light intensity as a function -// of scaled terminator position obtained from Flightgear core - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -// Find intersections of ray to skydome -// ray must be normalized -// cheight is camera height -float intersection (in float cheight, in vec3 ray, in float rad2) -{ - float B = 2.0 * cheight*ray.y; - float C = cheight*cheight - rad2; // 25.0 is skydome radius * radius - float fDet = max(0.0, B*B - 4.0 * C); - return 0.5 * (-B - sqrt(fDet)); -} - -// Return the scale function at height = 0 for different thetas -float outscatterscale(in float costheta) -{ - - - float x = 1.0 - costheta; - - float a = 1.16941; - float b = 0.618989; - float c = 6.34484; - float d = -31.4138; - float e = 75.3249; - float f = -80.1643; - float g = 32.2878; - - return exp(a+x*(b+x*(c+x*(d+x*(e+x*(f+x*g)))))); -} - -// Return the amount of outscatter for different heights and thetas -// assuming view ray hits the skydome -// height is 0 at ground level and 1 at space -// Assuming average density of atmosphere is at 1/4 height -// and atmosphere height is 100 km -float outscatter(in float costheta, in float height) -{ - return density * outscatterscale(costheta) * exp(-4.0 * height); -} - - -void main() -{ - // Make sure the dome is of a correct size - vec4 realVertex = gl_Vertex; //vec4(normalize(gl_Vertex.xyz) * domeSize, 1.0); - - - - // Ground point (skydome center) in eye coordinates - vec4 groundPoint = gl_ModelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0); - - - // Calculate altitude as the distance from skydome center to camera - // Make it so that 0.0 is ground level and 1.0 is 100km (space) level - // the correction ensures compatibility with Earthview for orbits farther out - float altitude = distance(groundPoint, vec4(0.0, 0.0, 0.0, 1.0)) * (1.0 -0.0013); - float scaledAltitude = altitude / realDomeSize; - - // the local horizon angle - float radiusEye = EarthRadius + altitude; - float ctterrain = -sqrt(radiusEye * radiusEye - EarthRadius * EarthRadius)/radiusEye; - - - // Camera's position, z is up! - float cameraRealAltitude = groundLevel + heightScale*scaledAltitude; - vec3 camera = vec3(0.0, 0.0, cameraRealAltitude); - vec3 sample = 5.0 * realVertex.xyz / domeSize; // Sample is the dome vertex - vec3 relativePosition = camera - sample; // Relative position - - viewVector = (sample-camera).xyz; - - // Find intersection of skydome and view ray - float space = intersection(cameraRealAltitude, -normalize(relativePosition), 25.0); - if(space > 0.0) { - // We are in space, calculate correct positiondelta! - relativePosition -= space * normalize(relativePosition); - } - - - vec3 positionDelta = relativePosition / fSamples; - float deltaLength = length(positionDelta); // Should multiply by something? - - vec3 lightDirection = gl_LightSource[0].position.xyz; - - - - // Cos theta of camera's position and sample point - // Since camera is 0,0,z, dot product is just the z coordinate - float cameraCosTheta; - - // If sample is above camera, reverse ray direction - if(positionDelta.z < 0.0) cameraCosTheta = -positionDelta.z / deltaLength; - else cameraCosTheta = positionDelta.z / deltaLength; - - - float cameraCosTheta1 = -positionDelta.z / deltaLength; - - - // Total attenuation from camera to skydome - float totalCameraScatter = outscatter(cameraCosTheta, scaledAltitude); - - - // Do numerical integration of scattering function from skydome to camera - vec3 color = vec3(0.0); - - // no scattering integrations where terrain is later drawn - if (cameraCosTheta1 > (ctterrain-0.05)) - { - for(int i = 0; i < nSamples; i++) - { - // Altitude of the sample point 0...1 - float sampleAltitude = (length(sample) - groundLevel) / heightScale; - - // Cosine between the angle of sample's up vector and sun - // Since lightDirection is in eye space, we must transform sample too - vec3 sampleUp = gl_NormalMatrix * normalize(sample); - float cosTheta = dot(sampleUp, lightDirection); - - // Scattering from sky to sample point - float skyScatter = outscatter(cosTheta, sampleAltitude); - - // Calculate the attenuation from this point to camera - // Again, reverse the direction if vertex is over the camera - float cameraScatter; - if(relativePosition.z < 0.0) { // Vertex is over the camera - cameraCosTheta = -dot(normalize(positionDelta), normalize(sample)); - - cameraScatter = totalCameraScatter - outscatter(cameraCosTheta, sampleAltitude); - } else { // Vertex is below camera - cameraCosTheta = dot(normalize(positionDelta), normalize(sample)); - cameraScatter = outscatter(cameraCosTheta, sampleAltitude) - totalCameraScatter; - } - - // Total attenuation - vec3 totalAttenuate = 4.0 * 3.14159 * (rayleighK + mieK) * (-skyScatter - cameraScatter); - - vec3 inScatter = exp(totalAttenuate - sampleAltitude*4.0); - - color += inScatter * deltaLength; - sample += positionDelta; - } - } - color *= sunIntensity; - ct = cameraCosTheta1; - rayleigh = rayleighK * color; - mie = mieK * color; - eye = gl_NormalMatrix * positionDelta; - - - - - // We need to move the camera so that the dome appears to be centered around earth - // to make the dome render correctly! - float moveDown = -altitude; // Center dome on camera - moveDown += groundRadius; - moveDown += scaledAltitude * altitudeScale; // And move correctly according to altitude - - // Vertex transformed correctly so that at 100km we are at space border - vec4 finalVertex = realVertex - vec4(0.0, 0.0, 1.0, 0.0) * moveDown; - - - // prepare some stuff for a ground haze layer - - delta_z = hazeLayerAltitude - altitude; - alt = altitude; - - - // establish coordinates relative to sun position - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0) ); - - - vec3 relVector = normalize(finalVertex.xyz - ep.xyz); - - // and compute the twilight shading - - - // yprime is the coordinate from/towards terminator - float yprime; - - if (alt > hazeLayerAltitude) // we're looking from above and can see far - { - if (ct < 0.0) - { - yprime = -dot(relVector,lightHorizon) * altitude/-ct;//(ct-0.001); - yprime = yprime -sqrt(2.0 * EarthRadius * hazeLayerAltitude); - } - else // the only haze we see looking up is overcast, assume its altitude - { - yprime = -dot(relVector,lightHorizon) * avisibility; - yprime = yprime -sqrt(2.0 * EarthRadius * 10000.0); - } - } - else - {yprime = -dot(relVector,lightHorizon) * avisibility; - yprime = yprime -sqrt(2.0 * EarthRadius * hazeLayerAltitude); - } - - if (terminator > 1000000.0){yprime = -sqrt(2.0 * EarthRadius * hazeLayerAltitude);} - - float terminator_width = 200000.0; - earthShade = 0.9 * smoothstep((terminator_width+ terminator), (-terminator_width + terminator), yprime) + 0.1; - - float lightArg = (terminator-yprime)/100000.0; - - hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 4.827-3.0*air_pollution, 3.04e-05, 1.0); - hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 1.527+2.0*air_pollution, 1.08e-05, 1.0); - - //new - //hazeColor.r = light_func(lightArg, 3.495e-05, 0.161, 3.878, 0.000129, 1.0); - //hazeColor.g = light_func(lightArg, 1.145e-05, 0.161, 3.827, 1.783e-05, 1.0); - //hazeColor.b = light_func(lightArg, 0.234, 0.141, 2.572, 0.257, 1.0); - - float intensity = length(hazeColor.xyz); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator -sqrt(2.0 * EarthRadius * terrain_alt)); - cphi = dot(normalize(relVector), normalize(lightHorizon)); - float mie_angle = (0.5 * dot(normalize(relVector), normalize(lightFull)) ) + 0.5; - - float mie_postfactor = clamp(mie_magnitude * (0.5 - 0.5 * mie_angle),0.001,1.0); - - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_postfactor ) ); - - - // Transform - gl_Position = gl_ModelViewProjectionMatrix * finalVertex; - // logarithmic depth - gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w; -} diff --git a/Compositor/Shaders/ALS/space-base.frag b/Compositor/Shaders/ALS/space-base.frag deleted file mode 100644 index 065c88285..000000000 --- a/Compositor/Shaders/ALS/space-base.frag +++ /dev/null @@ -1,365 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2011, based on default.frag -// Ambient term comes in gl_Color.rgb. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; - - -uniform float fg_Fcoef; - -uniform sampler2D texture; - - -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float cloud_self_shading; -uniform float air_pollution; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; - -uniform float geo_light_x; -uniform float geo_light_y; -uniform float geo_light_z; -uniform float geo_light_radius; -uniform float geo_ambience; - -uniform float geo_light_r; -uniform float geo_light_g; -uniform float geo_light_b; - -uniform int quality_level; -uniform int tquality_level; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; -uniform int use_geo_light; - - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; - - -float fog_func (in float targ, in float alt); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float light_arg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); - - -float luminance(vec3 color) -{ - return dot(vec3(0.212671, 0.715160, 0.072169), color); -} - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -// this determines how light is attenuated in the distance -// physically this should be exp(-arg) but for technical reasons we use a sharper cutoff -// for distance > visibility - - - - -void main() -{ - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = gl_LightSource[0].halfVector.xyz; - vec4 texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - float effective_scattering = min(scattering, cloud_self_shading); - - eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - vec4 light_specular = gl_LightSource[0].specular * (eShade - 0.1); - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - n = (2.0 * gl_Color.a - 1.0) * normal; - n = normalize(n); - - NdotL = dot(n, lightDir); - if (NdotL > 0.0) { - color += diffuse_term * NdotL; - NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = (gl_FrontMaterial.specular.rgb - * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess)); - } - - //vec3 up = (gl_ModelViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz; - - //vec3 sky_blue = vec3 (0.17, 0.52, 0.87); - - //NdotL = dot(n, -up); - //if (NdotL > 0.0) - //{ - //color.rgb += sky_blue * NdotL; - //} - - color.a = diffuse_term.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - float dist = length(relPos); - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if ((quality_level > 5) && (tquality_level > 5)) - { - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - - vec3 geo_light = vec3 (0.0, 0.0, 0.0); - - if (use_geo_light == 1) - { - vec3 geo_light_vec = vec3 (geo_light_x, geo_light_y, geo_light_z); - vec3 geo_light_rel_vec = geo_light_vec - (relPos + (gl_ModelViewMatrixInverse * vec4 (0.0, 0.0, 0.0, 1.0)).xyz); - - vec3 geo_lightdir = (gl_ModelViewMatrix * vec4 (geo_light_rel_vec, 0.0)).xyz; - float geo_light_incidence = geo_ambience + (1.0- geo_ambience) * clamp(dot(n, geo_lightdir),0.0, 1.0); - - geo_light = vec3 (geo_light_r, geo_light_g, geo_light_b) * (1.0 - smoothstep(0.5 * geo_light_radius, geo_light_radius, length(geo_light_rel_vec))) * geo_light_incidence; - } - - if (dist > 2.0) // we don't want to light the cockpit... - {color.rgb +=secondary_light * light_distance_fading(dist) + geo_light ;} - } - - - - - texel = texture2D(texture, gl_TexCoord[0].st); - fragColor = color * texel + specular; - - -float lightArg = (terminator-yprime_alt)/100000.0; - -vec3 hazeColor = get_hazeColor(lightArg); - - -// Rayleigh color shift due to in-scattering - - if ((quality_level > 5) && (tquality_level > 5)) - { - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - } - - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; -float mvisibility = min(visibility, avisibility); - -if (dist > 0.04 * mvisibility) -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - -// angle with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - -//float scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, relPos.z + eye_alt); - -if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 -effective_scattering); - - } -else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 -effective_scattering); - } - - - -transmission = fog_func(transmission_arg, alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - - - - - - -// Mie-like factor - -if (lightArg < 10.0) - {intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -// high altitude desaturation of the haze color - -intensity = length(hazeColor); -hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - -// blue hue of haze - -hazeColor.x = hazeColor.x * 0.83; -hazeColor.y = hazeColor.y * 0.9; - - -// additional blue in indirect light -float fade_out = max(0.65 - 0.3 *overcast, 0.45); -intensity = length(hazeColor); -hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - -// change haze color to blue hue for strong fogging -//intensity = length(hazeColor); -hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - -// reduce haze intensity when looking at shaded surfaces, only in terminator region - -float shadow = mix( min(1.0 + dot(normal,lightDir),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); -hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - -// don't let the light fade out too rapidly - -lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); -hazeColor *= eqColorFactor * eShade; -hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - -// determine the right mix of transmission and haze - - -fragColor.rgb = mix(hazeColor + secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission); - - - -} - - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} - diff --git a/Compositor/Shaders/ALS/space-base.vert b/Compositor/Shaders/ALS/space-base.vert deleted file mode 100644 index 7351aca74..000000000 --- a/Compositor/Shaders/ALS/space-base.vert +++ /dev/null @@ -1,269 +0,0 @@ -// -*-C++-*- -#version 120 - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -// Haze part added by Thorsten Renk, Oct. 2011 - - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; - -varying float yprime_alt; -varying float mie_angle; -varying float alt_factor; - -varying float flogz; - -uniform int colorMode; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; -uniform float moonlight; -uniform float eye_alt; - - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - - -float earthShade; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - - vec4 light_diffuse; - vec4 light_ambient; - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - - - //float yprime_alt; - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - -// this code is copied from default.vert - - //vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = gl_NormalMatrix * gl_Normal; - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - - - // here start computations for the haze layer - // we need several geometrical quantities - - // first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = gl_Vertex.xyz - ep.xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(gl_Vertex.z,100.0); - scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * scattering; - - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - - - - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - //light_ambient = light_ambient * (0.7 + 0.3 * smoothstep(0.2, 0.5, earthShade)); - intensity = length(light_ambient.rgb); - - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) )); - - - intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_diffuse = vec4 (1.0, 1.0, 1.0, 0.0); - light_ambient = vec4 (0.33, 0.4, 0.5, 0.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - light_diffuse.b = 0.78 + lightArg * 0.21; - light_diffuse.g = 0.907 + lightArg * 0.091; - light_diffuse.r = 0.904 + lightArg * 0.092; - light_diffuse.a = 1.0; - - light_ambient.r = 0.316 + lightArg * 0.016; - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - } - - light_diffuse = light_diffuse * scattering; - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - -// at high altitude, the light gets de-saturated and the ambient channel dies out -// whereas the diffuse channel is enhanced - - alt_factor = smoothstep(10000.0, 100000.0, eye_alt); - float ambient_reduction = 0.25 + 0.75 * (1.0-alt_factor); - float diffuse_enhancement = 1.0 + 1.0 * (1.0 - ambient_reduction); - - light_ambient.rgb = light_ambient.rgb * ambient_reduction; - light_diffuse.rgb = light_diffuse.rgb * diffuse_enhancement; - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - vec3 sky_blue = normalize (vec3 (0.17, 0.52, 0.87)); - intensity = length(light_ambient.rgb); - light_ambient.rgb = mix(light_ambient.rgb, intensity * sky_blue, alt_factor); - - intensity = length(light_diffuse.rgb); - light_diffuse.rgb = mix(light_diffuse.rgb, intensity * vec3 (1.0,1.0,1.0), alt_factor); - -// default lighting based on texture and material using the light we have just computed - - diffuse_term = diffuse_color* light_diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + light_ambient); - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = gl_Color.a; - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0; - gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; - -} - - - - diff --git a/Compositor/Shaders/ALS/space-ultra.frag b/Compositor/Shaders/ALS/space-ultra.frag deleted file mode 100644 index 143f17f3d..000000000 --- a/Compositor/Shaders/ALS/space-ultra.frag +++ /dev/null @@ -1,683 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Authors: Frederic Bouvier and Gijs de Rooy -// with major additions and revisions by -// Emilian Huminiuc and Vivian Meazza 2011 -// ported to Atmospheric Light Scattering -// by Thorsten Renk, 2013 -#version 120 - -varying vec3 VBinormal; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 rawpos; -varying vec3 reflVec; -varying vec3 vViewVec; -varying vec3 vertVec; - -varying float alpha; - -varying float flogz; - -uniform float fg_Fcoef; - -uniform sampler2D BaseTex; -uniform sampler2D LightMapTex; -uniform sampler2D NormalTex; -uniform sampler2D ReflMapTex; -uniform sampler2D ReflGradientsTex; -uniform sampler3D ReflNoiseTex; -uniform samplerCube Environment; -uniform sampler2D GrainTex; - -uniform int dirt_enabled; -uniform int dirt_multi; -uniform int dirt_modulates_reflection; -uniform int lightmap_enabled; -uniform int lightmap_multi; -uniform int nmap_dds; -uniform int nmap_enabled; -uniform int refl_enabled; -uniform int refl_type; -uniform int refl_map; -uniform int grain_texture_enabled; -uniform int darkmap_enabled; -uniform int rain_enabled; -uniform int cloud_shadow_flag; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; -uniform int use_geo_light; - -uniform float amb_correction; -uniform float dirt_b_factor; -uniform float dirt_g_factor; -uniform float dirt_r_factor; -uniform float dirt_reflection_factor; -uniform float lightmap_a_factor; -uniform float lightmap_b_factor; -uniform float lightmap_g_factor; -uniform float lightmap_r_factor; -uniform float nmap_tile; -uniform float refl_correction; -uniform float refl_fresnel; -uniform float refl_noise; -uniform float refl_rainbow; -uniform float grain_magnification; -uniform float wetness; -uniform float rain_norm; -uniform float darkmap_factor; -uniform float delta_T; - -uniform float avisibility; -uniform float cloud_self_shading; -uniform float eye_alt; -uniform float ground_scattering; -uniform float hazeLayerAltitude; -uniform float moonlight; -uniform float overcast; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float visibility; -uniform float air_pollution; - -uniform float osg_SimulationTime; - -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; - -uniform float geo_light_x; -uniform float geo_light_y; -uniform float geo_light_z; -uniform float geo_light_radius; -uniform float geo_ambience; - -// constants needed by the light and fog computations ################################################### - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -uniform vec3 lightmap_r_color; -uniform vec3 lightmap_g_color; -uniform vec3 lightmap_b_color; -uniform vec3 lightmap_a_color; - -uniform float geo_light_r; -uniform float geo_light_g; -uniform float geo_light_b; - -uniform vec3 dirt_r_color; -uniform vec3 dirt_g_color; -uniform vec3 dirt_b_color; - -float DotNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density); -float shadow_func (in float x, in float y, in float noise, in float dist); -float fog_func (in float targ, in float altitude); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float lightArg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 addLights(in vec3 color1, in vec3 color2); -vec4 color_temperature (in float T); -vec3 filter_combined (in vec3 color) ; -vec3 moonlight_perception (in vec3 light) ; - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) - { - if (x > 30.0) {return e;} - if (x < -15.0) {return 0.0;} - return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); - } - - - - - -void main (void) - { - vec4 texel = texture2D(BaseTex, gl_TexCoord[0].st); - vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * nmap_tile); - vec4 reflmap = texture2D(ReflMapTex, gl_TexCoord[0].st); - vec4 noisevec = texture3D(ReflNoiseTex, rawpos.xyz); - vec4 lightmapTexel = texture2D(LightMapTex, gl_TexCoord[0].st); - - vec4 grainTexel; - - vec3 mixedcolor; - vec3 N = vec3(0.0,0.0,1.0); - float pf = 0.0; - float pf1 = 0.0; - ///some generic light scattering parameters - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - moonLightColor = moonlight_perception(moonLightColor); - float alt = eye_alt; - float effective_scattering = min(scattering, cloud_self_shading); - - - /// BEGIN geometry for light - - vec3 up = (gl_ModelViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz; - //vec4 worldPos3D = (osg_ViewMatrixInverse * vec4 (0.0,0.0,0.0, 1.0)); - //worldPos3D.a = 0.0; - //vec3 up = (osg_ViewMatrix * worldPos3D).xyz; - float dist = length(vertVec); - float vertex_alt = max(100.0,dot(up, vertVec) + alt); - float vertex_scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - - vec3 lightHorizon = gl_LightSource[0].position.xyz - up * dot(up,gl_LightSource[0].position.xyz); - float yprime = -dot(vertVec, lightHorizon); - float yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - float lightArg = (terminator-yprime_alt)/100000.0; - - float earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - float mie_angle; - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(vertVec), normalize(gl_LightSource[0].position.xyz)) ) + 0.5;} - else - {mie_angle = 1.0;} - - float fog_vertex_alt = max(vertex_alt,hazeLayerAltitude); - float fog_yprime_alt = yprime_alt; - if (fog_vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - fog_vertex_alt = mix(fog_vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - fog_yprime_alt = yprime -sqrt(2.0 * EarthRadius * fog_vertex_alt); - } - } - else - { - fog_vertex_alt = hazeLayerAltitude; - fog_yprime_alt = yprime -sqrt(2.0 * EarthRadius * fog_vertex_alt); - } - - float fog_lightArg = (terminator-fog_yprime_alt)/100000.0; - float fog_earthShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, fog_yprime_alt) + 0.1; - - float ct = dot(normalize(up), normalize(vertVec)); - - /// END geometry for light - - - /// BEGIN light - vec4 light_diffuse; - vec4 light_ambient; - float intensity; - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * vertex_scattering; - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - - if (earthShade < 0.5) - { - intensity = length(light_ambient.rgb); - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.7,earthShade) )); - } - - // at high altitude, the light gets de-saturated and the ambient channel dies out - // whereas the diffuse channel is enhanced - - float alt_desat_factor = smoothstep(10000.0, 100000.0, eye_alt); - float ambient_reduction = 0.1 + 0.9 * (1.0-alt_desat_factor); - float diffuse_enhancement = 1.0 + 1.0 * (1.0 - ambient_reduction); - - light_ambient.rgb = light_ambient.rgb * ambient_reduction; - light_diffuse.rgb = light_diffuse.rgb * diffuse_enhancement; - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - //vec3 sky_blue = normalize (vec3 (0.17, 0.52, 0.87)); - //intensity = length(light_ambient.rgb); - //light_ambient.rgb = mix(light_ambient.rgb, intensity * sky_blue, alt_desat_factor); - - intensity = length(light_diffuse.rgb); - light_diffuse.rgb = mix(light_diffuse.rgb, intensity * vec3 (1.0,1.0,1.0), alt_desat_factor); - - float diffuse_reduction = 1; - - if (darkmap_enabled == 1) - { - diffuse_reduction = mix(1.0,lightmapTexel.a, darkmap_factor); - light_diffuse.rgb = light_diffuse.rgb * diffuse_reduction; - } - - light_diffuse.rgb = clamp(light_diffuse.rgb, 0.0, 1.2); - - /// END light - - /// BEGIN grain overlay - if (grain_texture_enabled ==1) - { - grainTexel = texture2D(GrainTex, gl_TexCoord[0].st * grain_magnification); - texel.rgb = mix(texel.rgb, grainTexel.rgb, grainTexel.a ); - } - else if (grain_texture_enabled == 2) - { - grainTexel = texture2D(GrainTex, rawpos.xy * grain_magnification); - texel.rgb = mix(texel.rgb, grainTexel.rgb, grainTexel.a ); - } - - /// END grain overlay - - ///BEGIN bump - if (nmap_enabled > 0){ - N = nmap.rgb * 2.0 - 1.0; - N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); - if (nmap_dds > 0) - N = -N; - } else { - N = normalize(VNormal); - } - ///END bump - vec4 reflection = textureCube(Environment, reflVec * dot(N,VNormal)); - vec3 viewVec = normalize(vViewVec); - float v = abs(dot(viewVec, normalize(VNormal)));// Map a rainbowish color - vec4 fresnel = texture2D(ReflGradientsTex, vec2(v, 0.75)); - vec4 rainbow = texture2D(ReflGradientsTex, vec2(v, 0.25)); - - float nDotVP = max(0.0, dot(N, normalize(gl_LightSource[0].position.xyz))); - float nDotHV = max(0.0, dot(N, normalize(gl_LightSource[0].halfVector.xyz))); - //glare on the backside of tranparent objects - if ((gl_FrontMaterial.diffuse.a < 1.0 || texel.a < 1.0) - && dot(N, normalize(gl_LightSource[0].position.xyz)) < 0.0) { - nDotVP = max(0.0, dot(-N, normalize(gl_LightSource[0].position.xyz))); - nDotHV = max(0.0, dot(-N, normalize(gl_LightSource[0].halfVector.xyz))); - } - - float nDotVP1 = 0.0; - float nDotHV1 = 0.0; - - - // try specular reflection of sky irradiance - nDotVP1 = max(0.0, dot(N, up)); - nDotHV1 = max(0.0, dot(N, normalize(normalize(up) + normalize(-vertVec)))); - - - if (nDotVP == 0.0) - {pf = 0.0;} - else - {pf = pow(nDotHV, gl_FrontMaterial.shininess);} - - if (nDotVP1 == 0.0) - {pf1 = 0.0;} - else - {pf1 = pow(nDotHV1, 0.5*gl_FrontMaterial.shininess);} - - - vec3 relPos = (gl_ModelViewMatrixInverse * vec4 (vertVec,0.0)).xyz; - if (cloud_shadow_flag == 1) - { - light_diffuse = light_diffuse * shadow_func(relPos.x, relPos.y, 1.0, dist); - } - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - - - vec3 geo_light_vec = (gl_ModelViewMatrix * vec4 (geo_light_x, geo_light_y, geo_light_z, 0.0)).xyz; - vec3 geo_light_rel_vec = geo_light_vec -(gl_ModelViewMatrix * vec4 (rawpos, 0.0)).xyz; - - float geo_light_incidence = geo_ambience + (1.0- geo_ambience) * clamp(dot(N, geo_light_rel_vec),0.0, 1.0); - - vec3 geo_light = vec3 (geo_light_r, geo_light_g, geo_light_b) * (1.0 - smoothstep(0.5 * geo_light_radius, geo_light_radius, length(geo_light_rel_vec))) * geo_light_incidence; - - vec4 Diffuse = light_diffuse * nDotVP; - //Diffuse.rgb += secondary_light * light_distance_fading(dist) + geo_light; - - Diffuse.rgb = addLights(Diffuse.rgb, secondary_light * light_distance_fading(dist)); - //if (use_geo_light == 1) - {Diffuse.rgb = addLights(Diffuse.rgb, geo_light * diffuse_reduction );} - - - ///BEGIN reflection correction by dirt - - float refl_d = 1.0; - - if ((dirt_enabled == 1) && (dirt_modulates_reflection == 1)) - { - refl_d = 1.0 - (reflmap.r * dirt_r_factor * (1.0 - dirt_reflection_factor)); - } - - ///END reflection correction by dirt - - vec4 Specular = gl_FrontMaterial.specular * light_diffuse * pf + gl_FrontMaterial.specular * light_ambient * pf1; - Specular+= gl_FrontMaterial.specular * pow(max(0.0,-dot(N,normalize(vertVec))),gl_FrontMaterial.shininess) * vec4(secondary_light,1.0); - - Specular *= refl_d; - - vec4 color = gl_Color * light_ambient + gl_FrontMaterial.emission; - - color = color + Diffuse * gl_FrontMaterial.diffuse; - color = clamp( color, 0.0, 1.0 ); - - //////////////////////////////////////////////////////////////////// - //BEGIN reflect - //////////////////////////////////////////////////////////////////// - if (refl_enabled > 0){ - float reflFactor = 0.0; - float transparency_offset = clamp(refl_correction, -1.0, 1.0);// set the user shininess offset - - if(refl_map > 0){ - // map the shininess of the object with user input - //float pam = (map.a * -2) + 1; //reverse map - reflFactor = reflmap.a + transparency_offset; - } else if (nmap_enabled > 0) { - // set the reflectivity proportional to shininess with user input - reflFactor = gl_FrontMaterial.shininess * 0.0078125 * nmap.a + transparency_offset; - } else { - reflFactor = gl_FrontMaterial.shininess* 0.0078125 + transparency_offset; - } - reflFactor = clamp(reflFactor, 0.0, 1.0); - - // add fringing fresnel and rainbow effects and modulate by reflection - vec4 reflcolor = mix(reflection, rainbow, refl_rainbow * v); - //vec4 reflcolor = reflection; - vec4 reflfrescolor = mix(reflcolor, fresnel, refl_fresnel * v); - vec4 noisecolor = mix(reflfrescolor, noisevec, refl_noise); - vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0); - raincolor += Specular; - raincolor *= light_diffuse; - - if (refl_type == 1) - {mixedcolor = mix(texel, raincolor, reflFactor * refl_d).rgb;} - else if (refl_type == 2) - {mixedcolor = ((texel +(reflcolor * reflFactor * refl_d))-(0.5*reflFactor * refl_d)).rgb;} - - } else { - mixedcolor = texel.rgb; - } - ///////////////////////////////////////////////////////////////////// - //END reflect - ///////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////// - //begin DIRT - ////////////////////////////////////////////////////////////////////// - if (dirt_enabled >= 1){ - vec3 dirtFactorIn = vec3 (dirt_r_factor, dirt_g_factor, dirt_b_factor); - vec3 dirtFactor = reflmap.rgb * dirtFactorIn.rgb; - //dirtFactor.r = smoothstep(0.0, 1.0, dirtFactor.r); - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_r_color, smoothstep(0.0, 1.0, dirtFactor.r)); - texel.rgb = mix(texel.rgb, dirt_r_color, smoothstep(0.0, 1.0, dirtFactor.r)); - if (dirt_multi > 0) { - //dirtFactor.g = smoothstep(0.0, 1.0, dirtFactor.g); - //dirtFactor.b = smoothstep(0.0, 1.0, dirtFactor.b); - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_g_color, smoothstep(0.0, 1.0, dirtFactor.g)); - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_b_color, smoothstep(0.0, 1.0, dirtFactor.b)); - } - } - ////////////////////////////////////////////////////////////////////// - //END Dirt - ////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////// - //begin WETNESS - ////////////////////////////////////////////////////////////////////// - - if (rain_enabled >0.0) - { - texel.rgb = texel.rgb * (1.0 - 0.6 * wetness); - float rain_factor = 0.0; - if (rain_norm > 0.0) - { - rain_factor += DotNoise2D(rawpos.xy, 0.2 ,0.5, rain_norm) * abs(sin(6.0*osg_SimulationTime)); - rain_factor += DotNoise2D(rawpos.xy, 0.3 ,0.4, rain_norm) * abs(sin(6.0*osg_SimulationTime + 2.094)); - rain_factor += DotNoise2D(rawpos.xy, 0.4 ,0.3, rain_norm)* abs(sin(6.0*osg_SimulationTime + 4.188)); - } - - // secondary reflection of sky irradiance in water film - float fresnelW = ((0.8 * wetness) ) * (1.0-smoothstep(0.0,0.4, dot(N,-normalize(vertVec)) * 1.0 - 0.2 * rain_factor * wetness)); - float sky_factor = (1.0-ct*ct); - vec3 sky_light = vec3 (1.0,1.0,1.0) * length(light_diffuse.rgb) * (1.0-effective_scattering); - Specular.rgb += sky_factor * fresnelW * sky_light; - } - ///////////////////////////////////////////////////////////////////// - //end WETNESS - ////////////////////////////////////////////////////////////////////// - - - // set ambient adjustment to remove bluiness with user input - float ambient_offset = clamp(amb_correction, -1.0, 1.0); - vec4 ambient = gl_LightModel.ambient + light_ambient; - vec4 ambient_Correction = vec4(ambient.rg, ambient.b * 0.6, 1.0) - * ambient_offset ; - ambient_Correction = clamp(ambient_Correction, -1.0, 1.0); - - ambient_Correction = vec4 (0.0, 0.0, 0.0, 1.0); - - - - color.a = texel.a * alpha; - vec4 fragColor = vec4(color.rgb * mixedcolor + ambient_Correction.rgb, color.a); - - fragColor += Specular * nmap.a; - - ////////////////////////////////////////////////////////////////////// - // BEGIN lightmap - ////////////////////////////////////////////////////////////////////// - if ( lightmap_enabled >= 1 ) { - vec3 lightmapcolor = vec3(0.0); - vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor, - lightmap_b_factor, lightmap_a_factor); - lightmapFactor = lightmapFactor * lightmapTexel; - if (lightmap_multi > 0 ){ - //lightmapcolor = lightmap_r_color * lightmapFactor.r + - //lightmap_g_color * lightmapFactor.g + - //lightmap_b_color * lightmapFactor.b + - //lightmap_a_color * lightmapFactor.a ; - lightmapcolor = lightmap_r_color * lightmapFactor.r; - lightmapcolor = addLights(lightmapcolor, lightmap_g_color * lightmapFactor.g); - lightmapcolor = addLights(lightmapcolor, lightmap_b_color * lightmapFactor.b); - if (darkmap_enabled == 0) - { - lightmapcolor = addLights(lightmapcolor, lightmap_a_color * lightmapFactor.a); - } - - } else { - lightmapcolor = lightmapTexel.rgb * lightmap_r_color * lightmapFactor.r; - } - fragColor.rgb = max(fragColor.rgb, lightmapcolor * gl_FrontMaterial.diffuse.rgb * smoothstep(0.0, 1.0, mixedcolor*.5 + lightmapcolor*.5)); - } - ////////////////////////////////////////////////////////////////////// - // END lightmap - ///////////////////////////////////////////////////////////////////// - - /// BEGIN glow - - float temperature = delta_T; - - if (darkmap_enabled == 2) - { - temperature *= (1.0 - darkmap_factor * lightmapTexel.a); - } - - vec4 glow = color_temperature(temperature); - float glowFactor = 0.3 + 0.6 * (1.0 - length(texel.rgb)/1.73); - glowFactor *= glow.a; - fragColor.rgb = mix(fragColor.rgb, glow.rgb, glowFactor); - - ////////////////////////////////////////////////////////////////////// - // END glow - ///////////////////////////////////////////////////////////////////// - - - /// BEGIN fog amount - - float transmission; - float vAltitude; - float delta_zv; - float H; - float distance_in_layer; - float transmission_arg; - float eqColorFactor; - - float delta_z = hazeLayerAltitude - eye_alt; - float mvisibility = min(visibility, avisibility); - - if (dist > 0.04 * mvisibility) - { - if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - transmission_arg = (dist-distance_in_layer)/avisibility; - - - if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 -effective_scattering); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 -effective_scattering); - } - transmission = fog_func(transmission_arg, alt); - if (eqColorFactor < 0.2) eqColorFactor = 0.2; - } - else - { - eqColorFactor = 1.0; - transmission = 1.0; - } - - /// END fog amount - - /// BEGIN fog color - - vec3 hazeColor = get_hazeColor(fog_lightArg); - - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - - if (transmission< 1.0) - { - - - - if (fog_lightArg < 10.0) - { - intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - - intensity = length(hazeColor); - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - - hazeColor.r = hazeColor.r * 0.83; - hazeColor.g = hazeColor.g * 0.9; - - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,fog_earthShade) )); - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - float shadow = mix( min(1.0 + dot(VNormal,gl_LightSource[0].position.xyz),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); - hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - } - else - { - hazeColor = vec3 (1.0, 1.0, 1.0); - } - - - /// END fog color - fragColor = clamp(fragColor, 0.0, 1.0); - //hazeColor = clamp(hazeColor, 0.0, 1.0); - - ///BEGIN Rayleigh fog /// - - // Rayleigh color shift due to out-scattering - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); - - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - - /// END Rayleigh fog - - // don't let the light fade out too rapidly - lightArg = (terminator + 200000.0)/100000.0; - float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); - vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - hazeColor *= eqColorFactor * fog_earthShade; - hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - - - - fragColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission); - - - gl_FragColor = fragColor; - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - - } diff --git a/Compositor/Shaders/ALS/space-ultra.vert b/Compositor/Shaders/ALS/space-ultra.vert deleted file mode 100644 index eee877d09..000000000 --- a/Compositor/Shaders/ALS/space-ultra.vert +++ /dev/null @@ -1,118 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// © Emilian Huminiuc and Vivian Meazza 2011 -#version 120 - -varying vec3 rawpos; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 vViewVec; -varying vec3 reflVec; -varying vec3 vertVec; - -varying float alpha; - -varying float flogz; - -attribute vec3 tangent; -attribute vec3 binormal; - -uniform float pitch; -uniform float roll; -uniform float hdg; -uniform int refl_dynamic; -uniform int nmap_enabled; -uniform int shader_qual; - -//////Fog Include/////////// -// uniform int fogType; -// void fog_Func(int type); -//////////////////////////// - -void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat) -{ - rotmat = mat4( cosRy , sinRx * sinRy , cosRx * sinRy, 0.0, - 0.0 , cosRx , -sinRx * cosRx, 0.0, - -sinRy, sinRx * cosRy, cosRx * cosRy , 0.0, - 0.0 , 0.0 , 0.0 , 1.0 ); -} - -void rotationMatrixH(in float sinRz, in float cosRz, out mat4 rotmat) -{ - rotmat = mat4( cosRz, -sinRz, 0.0, 0.0, - sinRz, cosRz, 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); -} - -void main(void) -{ - rawpos = gl_Vertex.xyz; - vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - //fog_Func(fogType); - - VNormal = normalize(gl_NormalMatrix * gl_Normal); - - vec3 n = normalize(gl_Normal); - vec3 tempTangent = cross(n, vec3(1.0,0.0,0.0)); - vec3 tempBinormal = cross(n, tempTangent); - - if (nmap_enabled > 0){ - tempTangent = tangent; - tempBinormal = binormal; - } - - VTangent = normalize(gl_NormalMatrix * tempTangent); - VBinormal = normalize(gl_NormalMatrix * tempBinormal); - vec3 t = tempTangent; - vec3 b = tempBinormal; - - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - alpha = gl_FrontMaterial.diffuse.a; - else - alpha = gl_Color.a; - - // Vertex in eye coordinates - vertVec = ecPosition.xyz; - vViewVec.x = dot(t, vertVec); - vViewVec.y = dot(b, vertVec); - vViewVec.z = dot(n, vertVec); - - // calculate the reflection vector - vec4 reflect_eye = vec4(reflect(vertVec, VNormal), 0.0); - vec3 reflVec_stat = normalize(gl_ModelViewMatrixInverse * reflect_eye).xyz; - if (refl_dynamic > 0){ - //prepare rotation matrix - mat4 RotMatPR; - mat4 RotMatH; - float _roll = roll; - if (_roll>90.0 || _roll < -90.0) - { - _roll = -_roll; - } - float cosRx = cos(radians(_roll)); - float sinRx = sin(radians(_roll)); - float cosRy = cos(radians(-pitch)); - float sinRy = sin(radians(-pitch)); - float cosRz = cos(radians(hdg)); - float sinRz = sin(radians(hdg)); - rotationMatrixPR(sinRx, cosRx, sinRy, cosRy, RotMatPR); - rotationMatrixH(sinRz, cosRz, RotMatH); - vec3 reflVec_dyn = (RotMatH * (RotMatPR * normalize(gl_ModelViewMatrixInverse * reflect_eye))).xyz; - - reflVec = reflVec_dyn; - } else { - reflVec = reflVec_stat; - } - - - gl_FrontColor = gl_Color; - - gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; -} diff --git a/Compositor/Shaders/ALS/surface-light.frag b/Compositor/Shaders/ALS/surface-light.frag deleted file mode 100644 index 812e23c70..000000000 --- a/Compositor/Shaders/ALS/surface-light.frag +++ /dev/null @@ -1,183 +0,0 @@ -// -*-C++-*- -#version 120 - -uniform float fg_Fcoef; - -uniform sampler2D texture; - -uniform float visibility; -uniform float avisibility; -uniform float hazeLayerAltitude; -uniform float eye_alt; -uniform float terminator; -uniform float size; - -uniform bool use_IR_vision; -uniform bool use_night_vision; - -varying vec3 relPos; -varying vec2 rawPos; -varying float pixelSize; - -varying float flogz; - -float alt; - -float Noise2D(in vec2 coord, in float wavelength); - -float fog_func (in float targ) -{ - - -float fade_mix; - -// for large altitude > 30 km, we switch to some component of quadratic distance fading to -// create the illusion of improved visibility range - -targ = 1.25 * targ * smoothstep(0.04,0.06,targ); // need to sync with the distance to which terrain is drawn - - -if (alt < 30000.0) - {return exp(-targ - targ * targ * targ * targ);} -else if (alt < 50000.0) - { - fade_mix = (alt - 30000.0)/20000.0; - return fade_mix * exp(-targ*targ - pow(targ,4.0)) + (1.0 - fade_mix) * exp(-targ - pow(targ,4.0)); - } -else - { - return exp(- targ * targ - pow(targ,4.0)); - } - -} - - -float light_sprite (in vec2 coord, in float transmission, in float noise) -{ - -coord.s = coord.s - 0.5; -coord.t = coord.t - 0.5; - -float r = length(coord); - -if (pixelSize<1.3) {return 0.08;} - -float angle = noise * 6.2832; - -float sinphi = dot(vec2 (sin(angle),cos(angle)), normalize(coord)); -float sinterm = sin(mod((sinphi-3.0) * (sinphi-3.0),6.2832)); -float ray = 0.0; -if (sinterm == 0.0) - {ray = 0.0;} -else - //{ray = clamp(pow(sinterm,10.0),0.0,1.0);} - {ray = sinterm * sinterm * sinterm * sinterm * sinterm * sinterm * sinterm * sinterm * sinterm * sinterm;} - - -float fogEffect = (1.0-smoothstep(0.4,0.8,transmission)); -float halo = 0.2 * exp(-10.0 * r * r); -float base = exp(-80.0*r*r); -ray *= exp(-40.0 * r * r); - - -float intensity = clamp(ray + base + halo,0.0,1.0) + 0.1 * fogEffect * (1.0-smoothstep(0.3, 0.6,r)); - -return intensity; - -} - - -void main() -{ - - float dist = length(relPos); - float delta_z = hazeLayerAltitude - eye_alt; - float transmission; - float vAltitude; - float delta_zv; - float H; - float distance_in_layer; - float transmission_arg; - - if (use_IR_vision) {discard;} - - // Discard the second and third vertex, which are used for directional lighting - if (gl_Color.a == 0.0) {discard;} - - float noise = Noise2D(rawPos.xy ,1.0); - - // angle with horizon - float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - - // we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - - if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,min(visibility, avisibility)) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - - // ground haze cannot be thinner than aloft visibility in the model, - // so we need to use aloft visibility otherwise - - - transmission_arg = (dist-distance_in_layer)/avisibility; - if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - } - - - - transmission = fog_func(transmission_arg); - float lightArg = terminator/100000.0; - float attenuationScale = 1.0 + 20.0 * (1.0 -smoothstep(-15.0, 0.0, lightArg)); - float dist_att = exp(-dist/200.0/size/attenuationScale); - - float intensity = light_sprite(gl_TexCoord[0].st,transmission, noise); - vec3 light_color = gl_Color.rgb; - - if (use_night_vision) - {light_color.rgb = vec3 (0.0, 1.0, 0.0);} - - light_color = mix(light_color, vec3 (1.0, 1.0, 1.0), 0.5 * intensity * intensity); - - gl_FragColor = vec4 (clamp(light_color.rgb,0.0,1.0), intensity * transmission * dist_att); - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} diff --git a/Compositor/Shaders/ALS/surface-light.vert b/Compositor/Shaders/ALS/surface-light.vert deleted file mode 100644 index 5172fc04a..000000000 --- a/Compositor/Shaders/ALS/surface-light.vert +++ /dev/null @@ -1,45 +0,0 @@ -// -*-C++-*- -#version 120 - -// Shader that uses OpenGL state values to do per-pixel lighting - -uniform float size; -uniform float max_size; - - -uniform bool is_directional; - -varying vec3 relPos; -varying vec2 rawPos; -varying float pixelSize; - -varying float flogz; - -bool light_directional = true; - -void main() -{ - gl_FrontColor= gl_Color; - gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; - - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - relPos = gl_Vertex.xyz - ep.xyz; - rawPos = gl_Vertex.xy; - float dist = length(relPos); - float angular_fade = 1.0; - - if (is_directional) - { - angular_fade = 2.0 * max(0.0,-dot(normalize(gl_Normal), normalize(relPos))); - } - - float size_use = size; - if (size_use < 10.0) {size_use = 20.0;} - - float lightScale = size_use * size_use * size_use * size_use * size_use/ 500.0 *angular_fade; - pixelSize = min(size_use * size_use/25.0,lightScale/dist) ; - pixelSize = min(pixelSize, max_size); - gl_PointSize = 2.0 * pixelSize; -} diff --git a/Compositor/Shaders/ALS/terrain-detailed.frag b/Compositor/Shaders/ALS/terrain-detailed.frag deleted file mode 100644 index 3a057d23b..000000000 --- a/Compositor/Shaders/ALS/terrain-detailed.frag +++ /dev/null @@ -1,511 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2011, based on default.frag -// Ambient term comes in gl_Color.rgb. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec2 rawPos; -varying vec3 worldPos; - - -uniform float fg_Fcoef; - -uniform sampler2D texture; -uniform sampler2D detail_texture; -uniform sampler2D mix_texture; - -//varying float yprime_alt; -//varying float mie_angle; -varying float steepness; - -varying float flogz; - - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float snowlevel; -uniform float dust_cover_factor; -uniform float lichen_cover_factor; -uniform float wetness; -uniform float fogstructure; -uniform float snow_thickness_factor; -uniform float cloud_self_shading; -uniform float season; -uniform float transition_model; -uniform float hires_overlay_bias; -uniform int quality_level; -uniform int tquality_level; - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; -float yprime_alt; -float mie_angle; - -float Noise2D(in vec2 coord, in float wavelength); -float Noise3D(in vec3 coord, in float wavelength); - -float fog_func (in float targ, in float alt); -vec3 get_hazeColor(in float light_arg); -vec3 filter_combined (in vec3 color) ; - -float getShadowing(); - - - -void main() -{ - - -yprime_alt = diffuse_term.a; -//diffuse_term.a = 1.0; -mie_angle = gl_Color.a; -float effective_scattering = min(scattering, cloud_self_shading); - -// distance to fragment -float dist = length(relPos); -// angle of view vector with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - color.a = 1.0; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = gl_LightSource[0].halfVector.xyz; - //vec3 halfVector = normalize(normalize(lightDir) + normalize(ecViewdir)); - vec4 texel; - vec4 snow_texel; - vec4 detail_texel; - vec4 mix_texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - -// get noise at different wavelengths - -// used: 5m, 5m gradient, 10m, 10m gradient: heightmap of the closeup terrain, 10m also snow -// 50m: detail texel -// 250m: detail texel -// 500m: distortion and overlay -// 1500m: overlay, detail, dust, fog -// 2000m: overlay, detail, snow, fog - -float noise_10m; -float noise_5m; -noise_10m = Noise2D(rawPos.xy, 10.0); -noise_5m = Noise2D(rawPos.xy ,5.0); - -float noisegrad_10m; -float noisegrad_5m; - -float noise_50m = Noise2D(rawPos.xy, 50.0);; - - -float noise_250m = Noise3D(worldPos.xyz,250.0); -float noise_500m = Noise3D(worldPos.xyz, 500.0); -float noise_1500m = Noise3D(worldPos.xyz, 1500.0); -float noise_2000m = Noise3D(worldPos.xyz, 2000.0); - - - -// - - -// get the texels - - texel = texture2D(texture, gl_TexCoord[0].st); - float local_autumn_factor = texel.a; - - float distortion_factor = 1.0; - vec2 stprime; - int flag = 1; - int mix_flag = 1; - float noise_term; - float snow_alpha; - - - - - //float view_angle = abs(dot(normal, normalize(ecViewdir))); - - if ((quality_level > 3)&&(relPos.z + eye_alt +500.0 > snowlevel)) - { - float sfactor; - snow_texel = vec4 (0.95, 0.95, 0.95, 1.0) * (0.9 + 0.1* noise_500m + 0.1* (1.0 - noise_10m) ); - snow_texel.r = snow_texel.r * (0.9 + 0.05 * (noise_10m + noise_5m)); - snow_texel.g = snow_texel.g * (0.9 + 0.05 * (noise_10m + noise_5m)); - snow_texel.a = 1.0; - noise_term = 0.1 * (noise_500m-0.5); - sfactor = sqrt(2.0 * (1.0-steepness)/0.03) + abs(ct)/0.15; - noise_term = noise_term + 0.2 * (noise_50m -0.5) * (1.0 - smoothstep(18000.0*sfactor, 40000.0*sfactor, dist) ) ; - noise_term = noise_term + 0.3 * (noise_10m -0.5) * (1.0 - smoothstep(4000.0 * sfactor, 8000.0 * sfactor, dist) ) ; - if (dist < 3000.0*sfactor){ noise_term = noise_term + 0.3 * (noise_5m -0.5) * (1.0 - smoothstep(1000.0 * sfactor, 3000.0 *sfactor, dist) );} - snow_texel.a = snow_texel.a * 0.2+0.8* smoothstep(0.2,0.8, 0.3 +noise_term + snow_thickness_factor +0.0001*(relPos.z +eye_alt -snowlevel) ); - - } - - if (tquality_level > 2) - { - mix_texel = texture2D(mix_texture, gl_TexCoord[0].st * 1.3); - if (mix_texel.a <0.1) {mix_flag = 0;} - } - - - if (tquality_level > 3) - { - stprime = vec2 (0.86*gl_TexCoord[0].s + 0.5*gl_TexCoord[0].t, 0.5*gl_TexCoord[0].s - 0.86*gl_TexCoord[0].t); - //distortion_factor = 0.9375 + (1.0 * nvL[2]); - distortion_factor = 0.97 + 0.06 * noise_500m; - stprime = stprime * distortion_factor * 15.0; - if (quality_level > 4) - { - stprime = stprime + normalize(relPos).xy * 0.02 * (noise_10m + 0.5 * noise_5m - 0.75); - } - detail_texel = texture2D(detail_texture, stprime); - if (detail_texel.a <0.1) {flag = 0;} - } - - -// texture preparation according to detail level - -// mix in hires texture patches - -float dist_fact; -float nSum; -float mix_factor; - -if (tquality_level > 2) - { - // first the second texture overlay - // transition model 0: random patch overlay without any gradient information - // transition model 1: only gradient-driven transitions, no randomness - - - if (mix_flag == 1) - { - nSum = 0.18 * (2.0 * noise_2000m + 2.0 * noise_1500m + noise_500m); - nSum = mix(nSum, 0.5, max(0.0, 2.0 * (transition_model - 0.5))); - nSum = nSum + 0.4 * (1.0 -smoothstep(0.9,0.95, abs(steepness)+ 0.05 * (noise_50m - 0.5))) * min(1.0, 2.0 * transition_model); - mix_factor = smoothstep(0.5, 0.54, nSum); - texel = mix(texel, mix_texel, mix_factor); - local_autumn_factor = texel.a; - } - - // then the detail texture overlay - } - -if (tquality_level > 3) - { - if (dist < 40000.0) - { - if (flag == 1) - { - //noise_50m = Noise2D(rawPos.xy, 50.0); - //noise_250m = Noise2D(rawPos.xy, 250.0); - dist_fact = 0.1 * smoothstep(15000.0,40000.0, dist) - 0.03 * (1.0 - smoothstep(500.0,5000.0, dist)); - nSum = ((1.0 -noise_2000m) + noise_1500m + 2.0 * noise_250m +noise_50m)/5.0; - nSum = nSum - 0.08 * (1.0 -smoothstep(0.9,0.95, abs(steepness))); - mix_factor = smoothstep(0.47, 0.54, nSum +hires_overlay_bias - dist_fact); - if (mix_factor > 0.8) {mix_factor = 0.8;} - texel = mix(texel, detail_texel,mix_factor); - local_autumn_factor = texel.a; - } - } - } - - - -// autumn colors - -float autumn_factor = season * 2.0 * (1.0 - local_autumn_factor) ; - - -texel.r = min(1.0, (1.0 + 2.5 * autumn_factor) * texel.r); -texel.g = texel.g; -texel.b = max(0.0, (1.0 - 4.0 * autumn_factor) * texel.b); - - -if (local_autumn_factor < 1.0) - { - intensity = length(texel.rgb) * (1.0 - 0.5 * smoothstep(1.1,2.0,season)); - texel.rgb = intensity * normalize(mix(texel.rgb, vec3(0.23,0.17,0.08), smoothstep(1.1,2.0, season))); - } - - - -const vec4 dust_color = vec4 (0.76, 0.71, 0.56, 1.0); -const vec4 lichen_color = vec4 (0.17, 0.20, 0.06, 1.0);; -//float snow_alpha; - -if (quality_level > 3) - { - - // mix vegetation - texel = mix(texel, lichen_color, 0.4 * lichen_cover_factor + 0.8 * lichen_cover_factor * 0.5 * (noise_10m + (1.0 - noise_5m)) ); - // mix dust - texel = mix(texel, dust_color, clamp(0.5 * dust_cover_factor + 3.0 * dust_cover_factor * (((noise_1500m - 0.5) * 0.125)+0.125 ),0.0, 1.0) ); - - // mix snow - if (relPos.z + eye_alt +500.0 > snowlevel) - { - snow_alpha = smoothstep(0.75, 0.85, abs(steepness)); - //texel = mix(texel, snow_texel, texel_snow_fraction); - texel = mix(texel, snow_texel, snow_texel.a* smoothstep(snowlevel, snowlevel+200.0, snow_alpha * (relPos.z + eye_alt)+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0)); - } - } - - - -// get distribution of water when terrain is wet - -float water_threshold1; -float water_threshold2; -float water_factor =0.0; - - -if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0)) - { - water_threshold1 = 1.0-0.5* wetness; - water_threshold2 = 1.0 - 0.3 * wetness; - water_factor = smoothstep(water_threshold1, water_threshold2 , (0.3 * (2.0 * (1.0-noise_10m) + (1.0 -noise_5m)) * (1.0 - smoothstep(2000.0, 5000.0, dist))) - 5.0 * (1.0 -steepness)); - } - -// darken wet terrain - - texel.rgb = texel.rgb * (1.0 - 0.6 * wetness); - - -// light computations - - - vec4 light_specular = gl_LightSource[0].specular; - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - //n = (2.0 * gl_Color.a - 1.0) * normal; - n = normal;//vec3 (nvec.x, nvec.y, sqrt(1.0 -pow(nvec.x,2.0) - pow(nvec.y,2.0) )); - n = normalize(n); - - NdotL = dot(n, lightDir); - if ((tquality_level > 3) && (mix_flag ==1)&& (dist < 2000.0) && (quality_level > 4)) - { - noisegrad_10m = (noise_10m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),10.0))/0.05; - noisegrad_5m = (noise_5m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),5.0))/0.05; - NdotL = NdotL + 1.0 * (noisegrad_10m + 0.5* noisegrad_5m) * mix_factor/0.8 * (1.0 - smoothstep(1000.0, 2000.0, dist)); - } - if (NdotL > 0.0) { - float shadowmap = getShadowing(); - color += diffuse_term * NdotL * shadowmap; - NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = ((gl_FrontMaterial.specular.rgb * 0.1 + (water_factor * vec3 (1.0, 1.0, 1.0))) - * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor)) - * shadowmap); - } - color.a = 1.0;//diffuse_term.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - - - - fragColor = color * texel + specular; - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; - -if (dist > 0.04 * min(visibility,avisibility)) -//if ((gl_FragCoord.y > ylimit) || (gl_FragCoord.x < zlimit1) || (gl_FragCoord.x > zlimit2)) -//if (dist > 40.0) -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,min(visibility, avisibility)) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - - - -if (visibility < avisibility) - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility + 1.0 * visibility * fogstructure * 0.06 * (noise_1500m + noise_2000m -1.0) )); - - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 - effective_scattering); - - } -else - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility + 1.0 * avisibility * fogstructure * 0.06 * (noise_1500m + noise_2000m - 1.0) )); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 - effective_scattering); - } - - - -transmission = fog_func(transmission_arg, alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - -float lightArg = (terminator-yprime_alt)/100000.0; -vec3 hazeColor = get_hazeColor(lightArg); - - - - -// now dim the light for haze -eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - - -// Mie-like factor - - if (lightArg < 10.0) - { - intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -intensity = length(hazeColor); - -if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColor doesn't come out correctly -{ - - - // high altitude desaturation of the haze color - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - - // blue hue of haze - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - - - // additional blue in indirect light - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - // change haze color to blue hue for strong fogging - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - - - // reduce haze intensity when looking at shaded surfaces, only in terminator region - float shadow = mix( min(1.0 + dot(n,lightDir),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); - hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - - // don't let the light fade out too rapidly - lightArg = (terminator + 200000.0)/100000.0; - float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); - vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - - hazeColor *= eqColorFactor * eShade; - hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - - } - - - - -fragColor.rgb = mix(clamp(hazeColor,0.0,1.0) , clamp(fragColor.rgb,0.0,1.0),transmission); - -} - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} - diff --git a/Compositor/Shaders/ALS/terrain-detailed.vert b/Compositor/Shaders/ALS/terrain-detailed.vert deleted file mode 100644 index 0162fedf8..000000000 --- a/Compositor/Shaders/ALS/terrain-detailed.vert +++ /dev/null @@ -1,311 +0,0 @@ -// -*-C++-*- -#version 120 - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -// Haze part added by Thorsten Renk, Oct. 2011 - - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec2 rawPos; -varying vec3 worldPos; - - -varying float mie_angle; -varying float steepness; - -varying float flogz; - - -uniform int colorMode; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; -uniform float eye_alt; -uniform float moonlight; - -uniform bool use_IR_vision; - -uniform mat4 osg_ViewMatrixInverse; - -float earthShade; -float yprime_alt; -//float mie_angle; - - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -vec3 moonlight_perception (in vec3 light); -void setupShadows(vec4 eyeSpacePos); - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - - vec4 light_diffuse; - vec4 light_ambient; - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - moonLightColor = moonlight_perception (moonLightColor); - - //float yprime_alt; - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - - rawPos = gl_Vertex.xy; - vec4 eyePos = gl_ModelViewMatrix * gl_Vertex; - worldPos = (osg_ViewMatrixInverse * eyePos).xyz; - steepness = dot(normalize(gl_Normal), vec3 (0.0, 0.0, 1.0)); - - -// this code is copied from default.vert - - //vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = gl_NormalMatrix * gl_Normal; - //nvec = (gl_NormalMatrix * gl_Normal).xy; - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - - - // here start computations for the haze layer - // we need several geometrical quantities - - -// first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = gl_Vertex.xyz - ep.xyz; - - //ecViewdir = (gl_ModelViewMatrix * (ep - gl_Vertex)).xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(gl_Vertex.z,100.0); - scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - -// early culling of vertices which can't be seen due to ground haze despite being in aloft visibility range - -//float delta_z = hazeLayerAltitude - eye_alt; -//if (((dist * (relPos.z - delta_z)/relPos.z > visibility ) && (relPos.z < 0.0) && (delta_z < 0.0) && (dist > 30000.0))) -if (0==1) - { - gl_Position = vec4(0.0, 0.0, -1000.0, 1.0); // move outside of view frustrum, gets culled before reaching fragment shader - earthShade = 1.0; - mie_angle = 1.0; - yprime_alt = 0.0; - } -else - { - - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * scattering; - - //light_ambient.b = light_func(lightArg, 0.000506, 0.131, -3.315, 0.000457, 0.5); - //light_ambient.g = light_func(lightArg, 2.264e-05, 0.134, 0.967, 3.66e-05, 0.4); - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; //light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.4); - light_ambient.b = light_ambient.r * 0.5/0.33; //light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.5); - light_ambient.a = 1.0; - - - - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - intensity = length(light_ambient.rgb); - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_diffuse = vec4 (1.0, 1.0, 1.0, 1.0); - light_ambient = vec4 (0.33, 0.4, 0.5, 1.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - light_diffuse.b = 0.78 + lightArg * 0.21; - light_diffuse.g = 0.907 + lightArg * 0.091; - light_diffuse.r = 0.904 + lightArg * 0.092; - light_diffuse.a = 1.0; - - //light_ambient.b = 0.41 + lightArg * 0.08; - //light_ambient.g = 0.333 + lightArg * 0.06; - light_ambient.r = 0.316 + lightArg * 0.016; - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - } - - light_diffuse = light_diffuse * scattering; - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - - -// a sky/earth irradiation map model - the sky creates much more diffuse radiation than the ground, so -// steep faces end up shaded more - -light_ambient = light_ambient * ((1.0+steepness)/2.0 * 1.2 + (1.0-steepness)/2.0 * 0.2); - - -// deeper shadows when there is lots of direct light - -float shade_depth = 1.0 * smoothstep (0.6,0.95,ground_scattering) * (1.0-smoothstep(0.1,0.5,overcast)) * smoothstep(0.4,1.5,earthShade); - - light_ambient.rgb = light_ambient.rgb * (1.0 - shade_depth); - light_diffuse.rgb = light_diffuse.rgb * (1.0 + 1.2 * shade_depth); - -if (use_IR_vision) - { - light_ambient.rgb = max(light_ambient.rgb, vec3 (0.5, 0.5, 0.5)); - } - -// default lighting based on texture and material using the light we have just computed - - diffuse_term = diffuse_color* light_diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + light_ambient); - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - // if (gl_FrontMaterial.diffuse.a < 1.0) - // diffuse_term.a = gl_FrontMaterial.diffuse.a; - //else - // diffuse_term.a = gl_Color.a; - diffuse_term.a = yprime_alt; - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = constant_term.rgb; //gl_FrontColor.a = 1.0; - gl_BackColor.rgb = constant_term.rgb; //gl_BackColor.a = 0.0; - gl_FrontColor.a = mie_angle; - gl_BackColor.a = mie_angle; -} - -setupShadows(eyePos); -} - - diff --git a/Compositor/Shaders/ALS/terrain-overlay.frag b/Compositor/Shaders/ALS/terrain-overlay.frag deleted file mode 100644 index ce546cd0c..000000000 --- a/Compositor/Shaders/ALS/terrain-overlay.frag +++ /dev/null @@ -1,176 +0,0 @@ -// -*-C++-*- -#version 120 - -#define MAX_DISTANCE 3000.0 - -uniform float fg_Fcoef; - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float overlay_bias; -uniform float season; -uniform float dust_cover_factor; -uniform float overlay_max_height; -uniform float overlay_hardness; -uniform float overlay_density; -uniform float overlay_scale; -uniform float overlay_steepness_factor; -uniform float overlay_brightness_bottom; -uniform float overlay_brightness_top; -uniform float overlay_secondary_hardness; -uniform float overlay_secondary_density; -uniform float snowlevel; -uniform float wetness; -uniform float snow_thickness_factor; - -uniform int overlay_autumn_flag; -uniform int overlay_secondary_flag; -uniform int cloud_shadow_flag; - -uniform sampler2D overlayPrimaryTex; -uniform sampler2D overlaySecondaryTex; - - -uniform float osg_SimulationTime; - -varying vec2 g_rawpos; // Horizontal position in model space -varying float g_distance_to_eye; // Distance to the camera. Layers were disregarded -varying vec3 g_normal; -varying float g_altitude; -varying float g_layer; // The layer where the fragment lives (0-1 range) - -varying float flogz; - - -float rand2D(in vec2 co); -float Noise2D(in vec2 co, in float wavelength); -vec3 filter_combined (in vec3 color) ; - -float shadow_func_nearest (in float x, in float y, in float noise, in float dist); - - -void main() -{ - - if (g_distance_to_eye > MAX_DISTANCE) {discard;} - - vec2 texCoord = gl_TexCoord[0].st; - - vec2 pos_rotated = vec2 (0.707 * g_rawpos.x + 0.707 * g_rawpos.y, 0.707 * g_rawpos.x - 0.707 * g_rawpos.y); - - - //float noise_1m = 0.5 * Noise2D(pos_rotated.xy, 1.0 * overlay_scale); - //noise_1m += 0.5 * Noise2D(g_rawpos.xy, 1.1 * overlay_scale); - - float noise_1m = Noise2D(pos_rotated.xy, 1.0 * overlay_scale); - - float noise_2m = Noise2D(g_rawpos.xy, 2.0 * overlay_scale); ; - float noise_10m = Noise2D(g_rawpos.xy, 10.0 * overlay_scale); - - - - float value = 0.0; - - float d_fade =smoothstep(100.0, MAX_DISTANCE, g_distance_to_eye); - - float steepness = dot (normalize(g_normal), vec3 (0.0, 0.0, 1.0)); - float steepness_bias = smoothstep(overlay_steepness_factor, overlay_steepness_factor + 0.1, steepness); - - float overlayPattern = 0.2 * noise_10m + 0.3 * noise_2m + 0.5 * noise_1m - 0.2 * g_layer - 0.1 + 0.2 * overlay_density ; - overlayPattern *= steepness_bias; - - float secondaryPattern = 0.2 * (1.0-noise_10m) + 0.3 * (1.0-noise_2m) + 0.5 * (1.0-noise_1m) - 0.4 * g_layer - 0.2 + 0.2 * overlay_secondary_density ; - secondaryPattern *= overlay_secondary_flag; - float secondaryMix = 0.0; - - if (overlayPattern > 0.5) - { - value = smoothstep(0.5, (0.8 - 0.25 * overlay_hardness), overlayPattern); - } - else if (secondaryPattern > 0.5) - { - value = smoothstep(0.5, (0.8 - 0.25 * overlay_secondary_hardness), secondaryPattern); - secondaryMix = 1.0; - } - else {discard;} - - vec3 texel = texture2D(overlayPrimaryTex, texCoord * 20.0).rgb; - vec3 secondary_texel = texture2D(overlaySecondaryTex, texCoord * 20.0).rgb; - - // autumn coloring - - if (overlay_autumn_flag == 1) - { - texel.r = min(1.0, (1.0 + 2.5 * 0.1 * season) * texel.r); - texel.g = texel.g; - texel.b = max(0.0, (1.0 - 4.0 * 0.1 * season) * texel.b); - float intensity = length(texel.rgb) * (1.0 - 0.5 * smoothstep(1.1,2.0,season)); - texel.rgb = intensity * normalize(mix(texel.rgb, vec3(0.23,0.17,0.08), smoothstep(1.1,2.0, season))); - } - - texel = mix (texel, secondary_texel, secondaryMix); - - - float layer_arg = mix(g_layer, 1.0, smoothstep(250.0, 5000.0, g_distance_to_eye)); - texel.rgb *= (overlay_brightness_bottom + (overlay_brightness_top - overlay_brightness_bottom) * g_layer); - texel.rgb *= (1.0 - 0.5 * wetness); - - // dust overlay - - const vec3 dust_color = vec3 (0.76, 0.65, 0.45); - texel = mix (texel, dust_color, 0.7 * dust_cover_factor); - - // snow overlay - - //vec3 snow_texel = vec3 (0.95, 0.95, 0.95); - - float snow_factor = 0.2+0.8* smoothstep(0.2,0.8, 0.3 + 0.5 * snow_thickness_factor +0.0001*(g_altitude -snowlevel) ); - snow_factor *= smoothstep(0.5, 0.7, steepness); - - snow_factor *= smoothstep(g_layer - 0.1, g_layer , snow_factor + 0.2); - - //texel.rgb = mix(texel.rgb, snow_texel.rgb, snow_factor * smoothstep(snowlevel, snowlevel+200.0, g_altitude - 100.0)); - value *= (1.0 - snow_factor * smoothstep(snowlevel, snowlevel+200.0, g_altitude - 100.0)); - - // do a conservative simple fog model, fading to alpha - - float min_visibility = min(visibility, avisibility); - - float base_alpha = clamp(0.4 * overlay_max_height/0.3, 0.4, 1.0); - value*= base_alpha * (1.0 - d_fade); - - float targ = 8.0 * g_distance_to_eye/min_visibility; - value *= exp(-targ - targ * targ * targ * targ); - value= clamp(value, 0.0, 1.0); - - // cloud shadows - - float cloud_shade = 1.0; - - if (cloud_shadow_flag == 1) - { - vec2 eyePos = (gl_ModelViewMatrixInverse * vec4 (0.0, 0.0, 0.0, 1.0)).xy; - vec2 relPos = g_rawpos - eyePos; - - - cloud_shade = shadow_func_nearest(relPos.x, relPos.y, 1.0, g_distance_to_eye); - } - - // lighting is very simple, the ground underneath should do most of it - - vec3 N = normalize (gl_NormalMatrix * g_normal); - float NdotL = 0.5 + 1.0 * clamp(dot (N, gl_LightSource[0].position.xyz), 0.0, 1.0) * cloud_shade; - - texel *= length(gl_LightSource[0].diffuse.rgb)/1.73 * scattering * NdotL; - texel = clamp(texel, 0.0, 1.0); - - - vec4 fragColor = vec4 (texel, value); - fragColor.rgb = filter_combined(fragColor.rgb); - fragColor = clamp(fragColor, 0.0, 1.0); - - gl_FragColor = fragColor; - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} diff --git a/Compositor/Shaders/ALS/terrain-overlay.geom b/Compositor/Shaders/ALS/terrain-overlay.geom deleted file mode 100644 index 0e12357b4..000000000 --- a/Compositor/Shaders/ALS/terrain-overlay.geom +++ /dev/null @@ -1,64 +0,0 @@ -// -*-C++-*- -#version 120 -#extension GL_EXT_geometry_shader4 : enable - -#define MAX_LAYERS 8 -#define MIN_LAYERS 2 -#define MAX_MINUS_MIN_LAYERS 6 - -uniform float overlay_max_height; - -varying in vec3 v_normal[3]; - -varying out vec2 g_rawpos; -varying out float g_distance_to_eye; -varying out vec3 g_normal; -varying out float g_altitude; -varying out float g_layer; - -varying out float flogz; - - - -float min3(in float a, in float b, in float c) -{ - float m = a; - if (m > b) m = b; - if (m > c) m = c; - return m; -} - -void main() -{ - float distances[3]; - distances[0] = -(gl_ModelViewMatrix * gl_PositionIn[0]).z; - distances[1] = -(gl_ModelViewMatrix * gl_PositionIn[1]).z; - distances[2] = -(gl_ModelViewMatrix * gl_PositionIn[2]).z; - float minDistance = min3(distances[0], distances[1], distances[2]); - //float avgDistance = (distances[0]+distances[1]+distances[2])*0.33; - - int numLayers = MIN_LAYERS + int((1.0 - smoothstep(250.0, 5000.0, minDistance)) * float(MAX_MINUS_MIN_LAYERS)); - - float deltaLayer = 1.0 / float(numLayers); - float currDeltaLayer = 1.5 * deltaLayer;// * 0.5; - - for (int layer = 0; layer < numLayers; ++layer) { - for (int i = 0; i < 3; ++i) { - vec4 pos = gl_PositionIn[i] + vec4(v_normal[i] * currDeltaLayer * overlay_max_height, 0.0); - g_rawpos = gl_PositionIn[i].xy; - g_distance_to_eye = distances[i]; - g_layer = currDeltaLayer; - g_normal = v_normal[i]; - g_altitude = gl_PositionIn[i].z; - - gl_Position = gl_ModelViewProjectionMatrix * pos; - // logarithmic depth - flogz = 1.0 + gl_Position.w; - gl_TexCoord[0] = gl_TexCoordIn[i][0]; - EmitVertex(); - } - EndPrimitive(); - - currDeltaLayer += deltaLayer; - } -} diff --git a/Compositor/Shaders/ALS/terrain-ultra.frag b/Compositor/Shaders/ALS/terrain-ultra.frag deleted file mode 100644 index b206f27fc..000000000 --- a/Compositor/Shaders/ALS/terrain-ultra.frag +++ /dev/null @@ -1,672 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2011, based on default.frag -// Ambient term comes in gl_Color.rgb. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec2 rawPos; -varying vec3 worldPos; -varying vec3 ecViewdir; -varying vec2 grad_dir; - - -uniform float fg_Fcoef; - -uniform sampler2D texture; -uniform sampler2D detail_texture; -uniform sampler2D mix_texture; -uniform sampler2D grain_texture; -uniform sampler2D dot_texture; -uniform sampler2D gradient_texture; - - -varying float steepness; - -varying float flogz; - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float snowlevel; -uniform float dust_cover_factor; -uniform float lichen_cover_factor; -uniform float wetness; -uniform float fogstructure; -uniform float snow_thickness_factor; -uniform float cloud_self_shading; -uniform float season; -uniform float air_pollution; -uniform float grain_strength; -uniform float intrinsic_wetness; -uniform float transition_model; -uniform float hires_overlay_bias; -uniform float dot_density; -uniform float dot_size; -uniform float dust_resistance; -uniform float WindE; -uniform float WindN; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; -uniform float osg_SimulationTime; - -uniform int wind_effects; -uniform int cloud_shadow_flag; -uniform int rock_strata; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -//float alt; -float eShade; -float yprime_alt; -float mie_angle; - -float shadow_func (in float x, in float y, in float noise, in float dist); -float DotNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density); -float Noise2D(in vec2 coord, in float wavelength); -float Noise3D(in vec3 coord, in float wavelength); -float SlopeLines2D(in vec2 coord, in vec2 gradDir, in float wavelength, in float steepness); -float Strata3D(in vec3 coord, in float wavelength, in float variation); -float fog_func (in float targ, in float alt); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float light_arg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 filter_combined (in vec3 color) ; - -float getShadowing(); - - -// a fade function for procedural scales which are smaller than a pixel - -float detail_fade (in float scale, in float angle, in float dist) -{ -float fade_dist = 2000.0 * scale * angle/max(pow(steepness,4.0), 0.1); - -return 1.0 - smoothstep(0.5 * fade_dist, fade_dist, dist); -} - - - -void main() -{ - -float alt; - -yprime_alt = diffuse_term.a; -//diffuse_term.a = 1.0; -mie_angle = gl_Color.a; -float effective_scattering = min(scattering, cloud_self_shading); - -// distance to fragment -float dist = length(relPos); -// angle of view vector with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; -// float altitude of fragment above sea level -float msl_altitude = (relPos.z + eye_alt); - - -// vec3 shadedFogColor = vec3(0.65, 0.67, 0.78); - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); -// this is taken from default.frag - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - color.a = 1.0; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = normalize(normalize(lightDir) + normalize(ecViewdir)); - vec4 texel; - vec4 snow_texel; - vec4 detail_texel; - vec4 mix_texel; - vec4 grain_texel; - vec4 dot_texel; - vec4 gradient_texel; - vec4 foam_texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - float intensity; - - - -// Wind motion of the overlay noise simulating movement of vegetation and loose debris - -vec2 windPos; - -if (wind_effects > 1) - { - float windSpeed = length(vec2 (WindE,WindN)) /3.0480; - // interfering sine wave wind pattern - float sineTerm = sin(0.35 * windSpeed * osg_SimulationTime + 0.05 * (rawPos.x + rawPos.y)); - sineTerm = sineTerm + sin(0.3 * windSpeed * osg_SimulationTime + 0.04 * (rawPos.x + rawPos.y)); - sineTerm = sineTerm + sin(0.22 * windSpeed * osg_SimulationTime + 0.05 * (rawPos.x + rawPos.y)); - sineTerm = sineTerm/3.0; - // non-linear amplification to simulate gusts - sineTerm = sineTerm * sineTerm;//smoothstep(0.2, 1.0, sineTerm); - - // wind starts moving dust and leaves at around 8 m/s - float timeArg = 0.01 * osg_SimulationTime * windSpeed * smoothstep(8.0, 15.0, windSpeed); - timeArg = timeArg + 0.02 * sineTerm; - - windPos = vec2 (rawPos.x + WindN * timeArg, rawPos.y + WindE * timeArg); - } -else - { - windPos = rawPos.xy; - } - - -// get noise at different wavelengths - -// used: 5m, 5m gradient, 10m, 10m gradient: heightmap of the closeup terrain, 10m also snow -// 50m: detail texel -// 250m: detail texel -// 500m: distortion and overlay -// 1500m: overlay, detail, dust, fog -// 2000m: overlay, detail, snow, fog - -// Perlin noise - -float noise_10m = Noise2D(rawPos.xy, 10.0); -float noise_5m = Noise2D(rawPos.xy ,5.0); -float noise_2m = Noise2D(rawPos.xy ,2.0); -float noise_1m = Noise2D(rawPos.xy ,1.0); -float noise_01m = Noise2D(windPos.xy, 0.1); - -float noisegrad_10m; -float noisegrad_5m; -float noisegrad_2m; -float noisegrad_1m; - - - -float noise_25m = Noise2D(rawPos.xy, 25.0); -float noise_50m = Noise2D(rawPos.xy, 50.0); - - -float noise_250m = Noise3D(worldPos.xyz,250.0); -float noise_500m = Noise3D(worldPos.xyz, 500.0); -float noise_1500m = Noise3D(worldPos.xyz, 1500.0); -float noise_2000m = Noise3D(worldPos.xyz, 2000.0); - -// dot noise - -float dotnoise_2m = DotNoise2D(rawPos.xy, 2.0 * dot_size,0.5, dot_density); -float dotnoise_10m = DotNoise2D(rawPos.xy, 10.0 * dot_size, 0.5, dot_density); -float dotnoise_15m = DotNoise2D(rawPos.xy, 15.0 * dot_size, 0.33, dot_density); - -float dotnoisegrad_10m; - - -// slope noise - -float slopenoise_50m = SlopeLines2D(rawPos, grad_dir, 50.0, steepness); -float slopenoise_100m = SlopeLines2D(rawPos, grad_dir, 100.0, steepness); - -float snownoise_25m = mix(noise_25m, slopenoise_50m, clamp(3.0*(1.0-steepness),0.0,1.0)); -float snownoise_50m = mix(noise_50m, slopenoise_100m, clamp(3.0*(1.0-steepness),0.0,1.0)); - -// get the texels - - - - float distortion_factor = 1.0; - vec2 stprime; - int flag = 1; - int mix_flag = 1; - float noise_term; - float snow_alpha; - - texel = texture2D(texture, gl_TexCoord[0].st); - float local_autumn_factor = texel.a; - grain_texel = texture2D(grain_texture, gl_TexCoord[0].st * 25.0); - gradient_texel = texture2D(gradient_texture, gl_TexCoord[0].st * 4.0); - - stprime = gl_TexCoord[0].st * 80.0; - stprime = stprime + normalize(relPos).xy * 0.01 * (dotnoise_10m + dotnoise_15m); - dot_texel = texture2D(dot_texture, vec2 (stprime.y, stprime.x) ); - - // we need to fade procedural structures when they get smaller than a single pixel, for this we need - // to know under what angle we see the surface - - float view_angle = abs(dot(normalize(normal), normalize(ecViewdir))); - float sfactor = sqrt(2.0 * (1.0-steepness)/0.03) + abs(ct)/0.15; - - // the snow texel is generated procedurally - if (msl_altitude +500.0 > snowlevel) - { - snow_texel = vec4 (0.95, 0.95, 0.95, 1.0) * (0.9 + 0.1* noise_500m + 0.1* (1.0 - noise_10m) ); - snow_texel.r = snow_texel.r * (0.9 + 0.05 * (noise_10m + noise_5m)); - snow_texel.g = snow_texel.g * (0.9 + 0.05 * (noise_10m + noise_5m)); - snow_texel.a = 1.0; - noise_term = 0.1 * (noise_500m-0.5) ; - noise_term = noise_term + 0.2 * (snownoise_50m -0.5) * detail_fade(50.0, view_angle, 0.5*dist) ; - noise_term = noise_term + 0.2 * (snownoise_25m -0.5) * detail_fade(25.0, view_angle, 0.5*dist) ; - noise_term = noise_term + 0.3 * (noise_10m -0.5) * detail_fade(10.0, view_angle, 0.8*dist) ; - noise_term = noise_term + 0.3 * (noise_5m - 0.5) * detail_fade(5.0, view_angle, dist); - noise_term = noise_term + 0.15 * (noise_2m -0.5) * detail_fade(2.0, view_angle, dist); - noise_term = noise_term + 0.08 * (noise_1m -0.5) * detail_fade(1.0, view_angle, dist); - snow_texel.a = snow_texel.a * 0.2+0.8* smoothstep(0.2,0.8, 0.3 +noise_term + snow_thickness_factor +0.0001*(msl_altitude -snowlevel) ); - } - - // the mixture/gradient texture - mix_texel = texture2D(mix_texture, gl_TexCoord[0].st * 1.3); - if (mix_texel.a <0.1) {mix_flag = 0;} - - // the hires overlay texture is loaded with parallax mapping - - stprime = vec2 (0.86*gl_TexCoord[0].s + 0.5*gl_TexCoord[0].t, 0.5*gl_TexCoord[0].s - 0.86*gl_TexCoord[0].t); - distortion_factor = 0.97 + 0.06 * noise_500m; - stprime = stprime * distortion_factor * 15.0; - stprime = stprime + normalize(relPos).xy * 0.022 * (noise_10m + 0.5 * noise_5m +0.25 * noise_2m - 0.875 ); - - detail_texel = texture2D(detail_texture, stprime); - if (detail_texel.a <0.1) {flag = 0;} - - - -// texture preparation according to detail level - -// mix in hires texture patches - -float dist_fact; -float nSum; -float mix_factor; - - // first the second texture overlay - // transition model 0: random patch overlay without any gradient information - // transition model 1: only gradient-driven transitions, no randomness - - - if (mix_flag == 1) - { - nSum = 0.18 * (2.0 * noise_2000m + 2.0 * noise_1500m + noise_500m); - nSum = mix(nSum, 0.5, max(0.0, 2.0 * (transition_model - 0.5))); - nSum = nSum + 0.4 * (1.0 -smoothstep(0.9,0.95, abs(steepness)+ 0.05 * (noise_50m - 0.5))) * min(1.0, 2.0 * transition_model); - mix_factor = smoothstep(0.5, 0.54, nSum); - texel = mix(texel, mix_texel, mix_factor); - local_autumn_factor = texel.a; - } - - // then the detail texture overlay - - mix_factor = 0.0; - if (dist < 40000.0) - { - if (flag == 1) - { - dist_fact = 0.1 * smoothstep(15000.0,40000.0, dist) - 0.03 * (1.0 - smoothstep(500.0,5000.0, dist)); - nSum = ((1.0 -noise_2000m) + noise_1500m + 2.0 * noise_250m +noise_50m)/5.0; - nSum = nSum - 0.08 * (1.0 -smoothstep(0.9,0.95, abs(steepness))); - mix_factor = smoothstep(0.47, 0.54, nSum +hires_overlay_bias- dist_fact); - if (mix_factor > 0.8) {mix_factor = 0.8;} - texel = mix(texel, detail_texel,mix_factor); - } - } - - // rock for very steep gradients - - if (gradient_texel.a > 0.0) - { - texel = mix(texel, gradient_texel, 1.0 - smoothstep(0.75,0.8,abs(steepness)+ 0.00002* msl_altitude + 0.05 * (noise_50m - 0.5))); - local_autumn_factor = texel.a; - } - - - // strata noise - - float stratnoise_50m; - float stratnoise_10m; - - if (rock_strata==1) - { - stratnoise_50m = Strata3D(vec3 (rawPos.x, rawPos.y, msl_altitude), 50.0, 0.2); - stratnoise_10m = Strata3D(vec3 (rawPos.x, rawPos.y, msl_altitude), 10.0, 0.2); - stratnoise_50m = mix(stratnoise_50m, 1.0, smoothstep(0.8,0.9, steepness)); - stratnoise_10m = mix(stratnoise_10m, 1.0, smoothstep(0.8,0.9, steepness)); - texel *= (0.4 + 0.4 * stratnoise_50m + 0.2 * stratnoise_10m); - } - - // the dot vegetation texture overlay - - texel.rgb = mix(texel.rgb, dot_texel.rgb, dot_texel.a * (dotnoise_10m + dotnoise_15m) * detail_fade(1.0 * (dot_size * (1.0 +0.1*dot_size)), view_angle,dist)); - texel.rgb = mix(texel.rgb, dot_texel.rgb, dot_texel.a * dotnoise_2m * detail_fade(0.1 * dot_size, view_angle,dist)); - - - // then the grain texture overlay - - texel.rgb = mix(texel.rgb, grain_texel.rgb, grain_strength * grain_texel.a * (1.0 - mix_factor) * (1.0-smoothstep(2000.0,5000.0, dist))); - - // for really hires, add procedural noise overlay - texel.rgb = texel.rgb * (1.0 + 0.4 * (noise_01m-0.5) * detail_fade(0.1, view_angle, dist)) ; - -// autumn colors - -float autumn_factor = season * 2.0 * (1.0 - local_autumn_factor) ; - - -texel.r = min(1.0, (1.0 + 2.5 * autumn_factor) * texel.r); -texel.g = texel.g; -texel.b = max(0.0, (1.0 - 4.0 * autumn_factor) * texel.b); - - -if (local_autumn_factor < 1.0) - { - intensity = length(texel.rgb) * (1.0 - 0.5 * smoothstep(1.1,2.0,season)); - texel.rgb = intensity * normalize(mix(texel.rgb, vec3(0.23,0.17,0.08), smoothstep(1.1,2.0, season))); - } - - // slope line overlay - texel.rgb = texel.rgb * (1.0 - 0.12 * slopenoise_50m - 0.08 * slopenoise_100m); - -//const vec4 dust_color = vec4 (0.76, 0.71, 0.56, 1.0); -const vec4 dust_color = vec4 (0.76, 0.65, 0.45, 1.0); -const vec4 lichen_color = vec4 (0.17, 0.20, 0.06, 1.0); - -// mix vegetation -float gradient_factor = smoothstep(0.5, 1.0, steepness); -texel = mix(texel, lichen_color, gradient_factor * (0.4 * lichen_cover_factor + 0.8 * lichen_cover_factor * 0.5 * (noise_10m + (1.0 - noise_5m))) ); -// mix dust -texel = mix(texel, dust_color, clamp(0.5 * dust_cover_factor *dust_resistance + 3.0 * dust_cover_factor * dust_resistance *(((noise_1500m - 0.5) * 0.125)+0.125 ),0.0, 1.0) ); -// mix snow -float snow_mix_factor = 0.0; -if (msl_altitude +500.0 > snowlevel) - { - snow_alpha = smoothstep(0.75, 0.85, abs(steepness)); - snow_mix_factor = snow_texel.a* smoothstep(snowlevel, snowlevel+200.0, snow_alpha * msl_altitude+ (noise_2000m + 0.1 * noise_10m -0.55) *400.0); - texel = mix(texel, snow_texel, snow_mix_factor); - } - - - - -// get distribution of water when terrain is wet - -float combined_wetness = min(1.0, wetness + intrinsic_wetness); -float water_threshold1; -float water_threshold2; -float water_factor =0.0; - - -if ((dist < 5000.0) && (combined_wetness>0.0)) - { - water_threshold1 = 1.0-0.5* combined_wetness; - water_threshold2 = 1.0 - 0.3 * combined_wetness; - water_factor = smoothstep(water_threshold1, water_threshold2 , (0.3 * (2.0 * (1.0-noise_10m) + (1.0 -noise_5m)) * (1.0 - smoothstep(2000.0, 5000.0, dist))) - 5.0 * (1.0 -steepness)); - } - -// darken wet terrain - - texel.rgb = texel.rgb * (1.0 - 0.6 * combined_wetness); - - - -// light computations - - - vec4 light_specular = gl_LightSource[0].specular; - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - //n = (2.0 * gl_Color.a - 1.0) * normal; - n = normal;//vec3 (nvec.x, nvec.y, sqrt(1.0 -pow(nvec.x,2.0) - pow(nvec.y,2.0) )); - n = normalize(n); - - NdotL = dot(n, lightDir); - - noisegrad_10m = (noise_10m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),10.0))/0.05; - noisegrad_5m = (noise_5m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),5.0))/0.05; - noisegrad_2m = (noise_2m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),2.0))/0.05; - noisegrad_1m = (noise_1m - Noise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),1.0))/0.05; - - dotnoisegrad_10m = (dotnoise_10m - DotNoise2D(rawPos.xy+ 0.05 * normalize(lightDir.xy),10.0 * dot_size,0.5, dot_density))/0.05; - - - NdotL = NdotL + (noisegrad_10m * detail_fade(10.0, view_angle,dist) + 0.5* noisegrad_5m * detail_fade(5.0, view_angle,dist)) * mix_factor/0.8; - NdotL = NdotL + 0.15 * noisegrad_2m * mix_factor/0.8 * detail_fade(2.0,view_angle,dist); - NdotL = NdotL + 0.1 * noisegrad_2m * detail_fade(2.0,view_angle,dist); - NdotL = NdotL + 0.05 * noisegrad_1m * detail_fade(1.0, view_angle,dist); - NdotL = NdotL + (1.0-snow_mix_factor) * 0.3* dot_texel.a * (0.5* dotnoisegrad_10m * detail_fade(1.0 * dot_size, view_angle, dist) +0.5 * dotnoisegrad_10m * noise_01m * detail_fade(0.1, view_angle, dist)) ; - - if (NdotL > 0.0) { - float shadowmap = getShadowing(); - if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 0.3 * noise_250m + 0.5 * noise_500m+0.2 * noise_1500m, dist);} - color += diffuse_term * NdotL * shadowmap; - NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = ((gl_FrontMaterial.specular.rgb * 0.1 + (water_factor * vec3 (1.0, 1.0, 1.0))) - * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor)) - * shadowmap); - } - color.a = 1.0;//diffuse_term.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - color.rgb +=secondary_light * light_distance_fading(dist); - - - fragColor = color * texel + specular; - - float lightArg = (terminator-yprime_alt)/100000.0; - vec3 hazeColor = get_hazeColor(lightArg); - - - -// Rayleigh color shift due to out-scattering - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter); - -// Rayleigh color shift due to in-scattering - - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - //float lightIntensity = length(diffuse_term.rgb)/1.73 * rShade; - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - - -// here comes the terrain haze model - -float delta_z = hazeLayerAltitude - eye_alt; -float mvisibility = min(visibility,avisibility); - - -if (dist > 0.04 * mvisibility) -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - -// blur of the haze layer edge - -float blur_thickness = 50.0; -float cphi = dot(vec3(0.0, 1.0, 0.0), relPos)/dist; -float ctlayer = delta_z/dist-0.01 + 0.02 * Noise2D(vec2(cphi,1.0),0.1) -0.01; -float ctblur = 0.035 ; - -float blur_dist; - -if (abs(delta_z) < 400.0) - { - blur_dist = dist * (1.0-smoothstep(0.0,300.0,-delta_z)) * smoothstep(-400.0,-200.0, -delta_z); - blur_dist = blur_dist * smoothstep(ctlayer-4.0*ctblur, ctlayer-ctblur, ct) * (1.0-smoothstep(ctlayer+0.5*ctblur, ctlayer+ctblur, ct)); - distance_in_layer = max(distance_in_layer, blur_dist); - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - -if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility + 1.0 * visibility * fogstructure * 0.06 * (noise_1500m + noise_2000m -1.0) )); - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 - effective_scattering); - } -else - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility + 1.0 * avisibility * fogstructure * 0.06 * (noise_1500m + noise_2000m - 1.0) )); - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 - effective_scattering); - } - - - -transmission = fog_func(transmission_arg, alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - - - -// now dim the light for haze -eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - -// Mie-like factor - - if (lightArg < 10.0) - { - intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -intensity = length(hazeColor); - -if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColor doesn't come out correctly -{ - - - // high altitude desaturation of the haze color - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - - // blue hue of haze - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - - - // additional blue in indirect light - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - - // change haze color to blue hue for strong fogging - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - - - // reduce haze intensity when looking at shaded surfaces, only in terminator region - float shadow = mix( min(1.0 + dot(n,lightDir),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); - hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - } - - -// don't let the light fade out too rapidly -lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - -hazeColor.rgb *= eqColorFactor * eShade; -hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - -// finally, mix fog in - - -fragColor.rgb = mix(hazeColor+secondary_light * fog_backscatter(mvisibility) , fragColor.rgb,transmission); -} - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} - diff --git a/Compositor/Shaders/ALS/terrain-ultra.vert b/Compositor/Shaders/ALS/terrain-ultra.vert deleted file mode 100644 index 3523a6e1e..000000000 --- a/Compositor/Shaders/ALS/terrain-ultra.vert +++ /dev/null @@ -1,303 +0,0 @@ -// -*-C++-*- -#version 120 - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -// Haze part added by Thorsten Renk, Oct. 2011 - - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; -varying vec3 relPos; -varying vec2 rawPos; -varying vec3 worldPos; -varying vec3 ecViewdir; -varying vec2 grad_dir; - -varying float mie_angle; -varying float steepness; - -varying float flogz; - -uniform int colorMode; - -uniform bool raise_vertex; - -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; -uniform float eye_alt; -uniform float moonlight; - -uniform bool use_IR_vision; - -uniform mat4 osg_ViewMatrixInverse; - -float earthShade; -float yprime_alt; - -void setupShadows(vec4 eyeSpacePos); - -vec3 moonlight_perception (in vec3 light); - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - - - vec4 light_diffuse; - vec4 light_ambient; - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight + vec3 (0.005, 0.005, 0.005); - - moonLightColor = moonlight_perception (moonLightColor); - - - //float yprime_alt; - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - - rawPos = gl_Vertex.xy; - vec4 eyePos = gl_ModelViewMatrix * gl_Vertex; - worldPos = (osg_ViewMatrixInverse * eyePos).xyz; - - - steepness = dot(normalize(gl_Normal), vec3 (0.0, 0.0, 1.0)); - grad_dir = normalize(gl_Normal.xy); - - vec4 pos = gl_Vertex; - if (raise_vertex) - { - pos.z+=0.1; - gl_Position = gl_ModelViewProjectionMatrix * pos; - } - else gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; - - -// this code is copied from default.vert - - //vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - //gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = gl_NormalMatrix * gl_Normal; - //nvec = (gl_NormalMatrix * gl_Normal).xy; - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - - - // here start computations for the haze layer - // we need several geometrical quantities - - -// first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = gl_Vertex.xyz - ep.xyz; - - ecViewdir = (gl_ModelViewMatrix * (ep - gl_Vertex)).xyz; - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(gl_Vertex.z,100.0); - scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * scattering; - - //light_ambient.b = light_func(lightArg, 0.000506, 0.131, -3.315, 0.000457, 0.5); - //light_ambient.g = light_func(lightArg, 2.264e-05, 0.134, 0.967, 3.66e-05, 0.4); - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; //light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.4); - light_ambient.b = light_ambient.r * 0.5/0.33; //light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.5); - light_ambient.a = 1.0; - - - - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - intensity = length(light_ambient.rgb); - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.rgb); - light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_diffuse = vec4 (1.0, 1.0, 1.0, 1.0); - light_ambient = vec4 (0.33, 0.4, 0.5, 1.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - light_diffuse.b = 0.78 + lightArg * 0.21; - light_diffuse.g = 0.907 + lightArg * 0.091; - light_diffuse.r = 0.904 + lightArg * 0.092; - light_diffuse.a = 1.0; - - //light_ambient.b = 0.41 + lightArg * 0.08; - //light_ambient.g = 0.333 + lightArg * 0.06; - light_ambient.r = 0.316 + lightArg * 0.016; - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - } - - light_diffuse = light_diffuse * scattering; - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - - -// a sky/earth irradiation map model - the sky creates much more diffuse radiation than the ground, so -// steep faces end up shaded more - -light_ambient = light_ambient * ((1.0+steepness)/2.0 * 1.2 + (1.0-steepness)/2.0 * 0.2); - -// deeper shadows when there is lots of direct light - -float shade_depth = 1.0 * smoothstep (0.6,0.95,ground_scattering) * (1.0-smoothstep(0.1,0.5,overcast)) * smoothstep(0.4,1.5,earthShade); - - light_ambient.rgb = light_ambient.rgb * (1.0 - shade_depth); - light_diffuse.rgb = light_diffuse.rgb * (1.0 + 1.2 * shade_depth); - -if (use_IR_vision) - { - light_ambient.rgb = max(light_ambient.rgb, vec3 (0.5, 0.5, 0.5)); - } - - -// default lighting based on texture and material using the light we have just computed - - diffuse_term = diffuse_color * light_diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + light_ambient); - - diffuse_term.a = yprime_alt; - gl_FrontColor.rgb = constant_term.rgb; //gl_FrontColor.a = 1.0; - gl_BackColor.rgb = constant_term.rgb; //gl_BackColor.a = 0.0; - gl_FrontColor.a = mie_angle; - gl_BackColor.a = mie_angle; - - setupShadows(eyePos); -} - - diff --git a/Compositor/Shaders/ALS/terrain-writedepth.frag b/Compositor/Shaders/ALS/terrain-writedepth.frag deleted file mode 100644 index 209a1afce..000000000 --- a/Compositor/Shaders/ALS/terrain-writedepth.frag +++ /dev/null @@ -1,12 +0,0 @@ -#version 120 - -uniform float fg_Fcoef; - -varying float flogz; - -void main() -{ - gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} diff --git a/Compositor/Shaders/ALS/terrain-writedepth.vert b/Compositor/Shaders/ALS/terrain-writedepth.vert deleted file mode 100644 index d213937b4..000000000 --- a/Compositor/Shaders/ALS/terrain-writedepth.vert +++ /dev/null @@ -1,10 +0,0 @@ -#version 120 - -varying float flogz; - -void main() -{ - gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; -} diff --git a/Compositor/Shaders/ALS/thrustflame.frag b/Compositor/Shaders/ALS/thrustflame.frag deleted file mode 100644 index f22d87817..000000000 --- a/Compositor/Shaders/ALS/thrustflame.frag +++ /dev/null @@ -1,148 +0,0 @@ -// -*-C++-*- - -#version 120 - -varying vec3 vertex; -varying vec3 viewDir; - -varying float flogz; - -uniform float fg_Fcoef; - -uniform float osg_SimulationTime; -uniform float thrust_collimation; -uniform float flame_radius_fraction; -uniform float thrust_density; -uniform float base_flame_density; -uniform float shock_frequency; -uniform float noise_strength; -uniform float noise_scale; -uniform float deflection_coeff; -uniform float random_seed; - -uniform float flame_color_low_r; -uniform float flame_color_low_g; -uniform float flame_color_low_b; - -uniform float flame_color_high_r; -uniform float flame_color_high_g; -uniform float flame_color_high_b; - -uniform float base_flame_r; -uniform float base_flame_g; -uniform float base_flame_b; - -uniform int use_shocks; -uniform int use_noise; - -float Noise2D(in vec2 coord, in float wavelength); - -const int n_steps = 15; - -float spherical_smoothstep (in vec3 pos) -{ - -float l = length(vec3 (pos.x/2.0, pos.y,pos.z) ); - -return 10.0 * thrust_density * base_flame_density * (1.0 - smoothstep(0.5* flame_radius_fraction, flame_radius_fraction, l)); - -} - - - -float thrust_flame (in vec3 pos) -{ - - -float noise = 0.0; - -pos.z +=8.0 * deflection_coeff; - -float d_rad = length(pos.yz - vec2 (0.0, deflection_coeff * pos.x * pos.x)); -//float longFade = smoothstep(0.0, 5.0, pos.x) ; -float longFade = pos.x/5.0; - -float density = 1.0 - longFade; -float radius = flame_radius_fraction + thrust_collimation * 1.0 * pow((pos.x+0.1),0.5); - -if (d_rad > radius) {return 0.0;} - - -if (use_noise ==1) - { - noise = Noise2D(vec2(pos.x - osg_SimulationTime * 30.0 + random_seed , d_rad), noise_scale); - } - -density *= (1.0 - smoothstep(0.125, radius, d_rad)) * (1.0 - noise_strength + noise_strength* noise); - -if (use_shocks == 1) - { - float shock = sin(pos.x * 10.0 * shock_frequency); - density += shock * shock * shock * shock * (1.0 - longFade) * (1.0 - smoothstep(0.25*flame_radius_fraction, 0.5*flame_radius_fraction, d_rad)) * (1.0 - smoothstep(0.0, 1.0, thrust_collimation)) * (1.0 + 0.5 * base_flame_density); - } - - -return 10.0 * thrust_density * density / (radius/0.2); -} - - - -void main() -{ - -vec3 vDir = normalize(viewDir); - -float x_E, y_E, z_E; - -if (vDir.x > 0.0) {x_E = 5.0;} else {x_E = 0.0;} -if (vDir.y > 0.0) {y_E = 1.0;} else {y_E = -1.0;} -if (vDir.z > 0.0) {z_E = 1.0;} else {z_E = -1.0;} - -float t_x = (x_E - vertex.x) / vDir.x; -float t_y = (y_E - vertex.y) / vDir.y; -float t_z = (z_E - vertex.z) / vDir.z; - -float t_min = min(t_x, t_y); -t_min = min(t_min, t_z); - - -float dt = t_min / float(n_steps); - -vec3 step = viewDir * dt; -vec3 pos = vertex; - -float density1 = 0.0; -float density2 = 0.0; - - - -for (int i = 0; i < n_steps; i++) - { - pos = pos + step; - density1 += spherical_smoothstep(pos) * dt; - density2 += thrust_flame(pos) * dt; - } - - - - -float density = density1 + density2; -//density = clamp(density,0.0,1.0); -density = 1.0 - exp(-density); - -density1 = 1.0 - exp(-density1); -density2 = 1.0 - exp(-density2); - - -vec3 flame_color_low = vec3 (flame_color_low_r, flame_color_low_g, flame_color_low_b); -vec3 flame_color_high = vec3 (flame_color_high_r, flame_color_high_g, flame_color_high_b); - -vec3 color = mix(flame_color_low, flame_color_high, density2); -color = mix(color, vec3(base_flame_r, base_flame_g, base_flame_b), density1); - -vec4 finalColor = vec4 (color.rgb, density); - -gl_FragColor = finalColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} diff --git a/Compositor/Shaders/ALS/thrustflame.vert b/Compositor/Shaders/ALS/thrustflame.vert deleted file mode 100644 index d40a75b09..000000000 --- a/Compositor/Shaders/ALS/thrustflame.vert +++ /dev/null @@ -1,25 +0,0 @@ -// -*-C++-*- - -#version 120 - -varying vec3 vertex; -varying vec3 viewDir; - -varying float flogz; - -void main() -{ - -vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - -vertex = gl_Vertex.xyz; -viewDir = normalize(vertex - ep.xyz); - -gl_Position = ftransform(); -// logarithmic depth -flogz = 1.0 + gl_Position.w; -gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - -gl_FrontColor = vec4 (1.0,1.0,1.0,1.0); -gl_BackColor = gl_FrontColor; -} diff --git a/Compositor/Shaders/ALS/tree-shadow.frag b/Compositor/Shaders/ALS/tree-shadow.frag deleted file mode 100644 index 2e5f418bd..000000000 --- a/Compositor/Shaders/ALS/tree-shadow.frag +++ /dev/null @@ -1,390 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2011, based on default.frag - - -varying vec3 relPos; - - -uniform sampler2D texture; - - -varying float yprime_alt; - -varying float is_shadow; -varying float autumn_flag; - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float ground_scattering; -uniform float cloud_self_shading; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float dust_cover_factor; -uniform float air_pollution; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; -uniform float cseason; - -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; -uniform int quality_level; -uniform int tquality_level; - - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float mie_angle; - - -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); - -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 get_hazeColor(in float light_arg); -vec3 filter_combined (in vec3 color) ; - -float luminance(vec3 color) -{ - return dot(vec3(0.212671, 0.715160, 0.072169), color); -} - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -// this determines how light is attenuated in the distance -// physically this should be exp(-arg) but for technical reasons we use a sharper cutoff -// for distance > visibility - -float tree_fog_func (in float targ) -{ - - -float fade_mix; - -// for large altitude > 30 km, we switch to some component of quadratic distance fading to -// create the illusion of improved visibility range - -targ = 1.25 * targ * smoothstep(0.07,0.1,targ); // need to sync with the distance to which terrain is drawn - - -if (alt < 30000.0) - {return exp(-targ - targ * targ * targ * targ);} -else if (alt < 50000.0) - { - fade_mix = (alt - 30000.0)/20000.0; - return fade_mix * exp(-targ*targ - pow(targ,4.0)) + (1.0 - fade_mix) * exp(-targ - pow(targ,4.0)); - } -else - { - return exp(- targ * targ - pow(targ,4.0)); - } - -} - -float rand2D(in vec2 co){ - return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); -} - - -float simple_interpolate(in float a, in float b, in float x) -{ -return a + smoothstep(0.0,1.0,x) * (b-a); -} - -float interpolatedNoise2D(in float x, in float y) -{ - float integer_x = x - fract(x); - float fractional_x = x - integer_x; - - float integer_y = y - fract(y); - float fractional_y = y - integer_y; - - float v1 = rand2D(vec2(integer_x, integer_y)); - float v2 = rand2D(vec2(integer_x+1.0, integer_y)); - float v3 = rand2D(vec2(integer_x, integer_y+1.0)); - float v4 = rand2D(vec2(integer_x+1.0, integer_y +1.0)); - - float i1 = simple_interpolate(v1 , v2 , fractional_x); - float i2 = simple_interpolate(v3 , v4 , fractional_x); - - return simple_interpolate(i1 , i2 , fractional_y); -} - - - -float Noise2D(in vec2 coord, in float wavelength) -{ -return interpolatedNoise2D(coord.x/wavelength, coord.y/wavelength); - -} - -void main() -{ - - if (is_shadow > 1.0) {discard;} - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - - - vec3 lightDir = gl_LightSource[0].position.xyz; - float intensity; - - mie_angle = gl_Color.a; - vec4 texel = texture2D(texture, gl_TexCoord[0].st); - - // angle with horizon - float dist = length(relPos); - float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - // determine tree shadow properties - if (is_shadow>0.0) - { - if (ct > -0.1) {discard;} // we eliminate shadows above the camera to avoid artifacts - float illumination = length(gl_Color.rgb); - texel = vec4 (0.1,0.1,0.1,texel.a); - texel.a *= illumination;// * smoothstep(0.0, 0.2, is_shadow); - texel.a *=0.6 * smoothstep(0.5,0.8,scattering); - texel.a = min(0.8, texel.a); - } - - float effective_scattering = min(scattering, cloud_self_shading); - - - if (quality_level > 3) - { - // seasonal color changes - - if ((cseason < 1.5)&& (autumn_flag > 0.0) && (is_shadow <0.0)) - { - texel.r = min(1.0, (1.0 + 5.0 *cseason * autumn_flag ) * texel.r); - texel.b = max(0.0, (1.0 - 8.0 * cseason) * texel.b); - } - - // mix dust - vec4 dust_color = vec4 (0.76, 0.71, 0.56, texel.a); - - texel = mix(texel, dust_color, clamp(0.6 * dust_cover_factor ,0.0, 1.0) ); - } - - -// ALS secondary light sources - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if ((quality_level>5) && (tquality_level>5)) - { - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - } - - vec4 fragColor = vec4 (gl_Color.rgb +secondary_light * light_distance_fading(dist),1.0) * texel; - - -// Rayleigh haze - -float lightArg = (terminator-yprime_alt)/100000.0; -vec3 hazeColor = get_hazeColor(lightArg); - -// Rayleigh color shift due to in-scattering - - if ((quality_level > 5) && (tquality_level > 5)) - { - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - } - - - - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; - - -if (dist > max(40.0, 0.07 * min(visibility,avisibility))) -{ - -alt = eye_alt; - - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,min(visibility, avisibility)) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// blur of the haze layer edge - -float blur_thickness = 50.0; -float cphi = dot(vec3(0.0, 1.0, 0.0), relPos)/dist; -float ctlayer; -float ctblur = 0.035 ; - -float blur_dist; - -if ((abs(delta_z) < 400.0)&&(quality_level>5)&&(tquality_level>5)) - { - ctlayer = delta_z/dist-0.01 + 0.02 * Noise2D(vec2(cphi,1.0),0.1) -0.01; - blur_dist = dist * (1.0-smoothstep(0.0,300.0,-delta_z)) * smoothstep(-400.0,-200.0, -delta_z); - blur_dist = blur_dist * smoothstep(ctlayer-4.0*ctblur, ctlayer-ctblur, ct) * (1.0-smoothstep(ctlayer+0.5*ctblur, ctlayer+ctblur, ct)); - distance_in_layer = max(distance_in_layer, blur_dist); - } - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - -//float scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, relPos.z + eye_alt); - -if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 -effective_scattering); - - } -else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 -effective_scattering); - } - - - -transmission = tree_fog_func(transmission_arg); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - - - -// now dim the light for haze -float eShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt) + 0.1; - -// Mie-like factor - -if (lightArg < 10.0) - {intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -// high altitude desaturation of the haze color - -intensity = length(hazeColor); -hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - -// blue hue of haze - -hazeColor.x = hazeColor.x * 0.83; -hazeColor.y = hazeColor.y * 0.9; - - -// additional blue in indirect light -float fade_out = max(0.65 - 0.3 *overcast, 0.45); -intensity = length(hazeColor); -hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - -// change haze color to blue hue for strong fogging - -hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - - -// determine the right mix of transmission and haze - -//hazeColor = clamp(hazeColor,0.0,1.0); -fragColor.rgb = mix(eqColorFactor * hazeColor * eShade + secondary_light * fog_backscatter(avisibility), fragColor.rgb,transmission); - -} - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; - -} - diff --git a/Compositor/Shaders/ALS/tree-shadow.vert b/Compositor/Shaders/ALS/tree-shadow.vert deleted file mode 100644 index b2cb49f2f..000000000 --- a/Compositor/Shaders/ALS/tree-shadow.vert +++ /dev/null @@ -1,365 +0,0 @@ -// -*-C++-*- -#version 120 - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -// Haze part added by Thorsten Renk, Oct. 2011 - - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -uniform float fg_Fcoef; - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. - - -varying vec3 relPos; -varying float yprime_alt; -varying float is_shadow; -varying float autumn_flag; - -uniform int colorMode; -uniform int wind_effects; -uniform int forest_effects; -uniform int num_deciduous_trees; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; -uniform float snow_level; -uniform float season; -uniform float forest_effect_size; -uniform float forest_effect_shape; -uniform float WindN; -uniform float WindE; - -uniform bool use_tree_shadows; -uniform bool use_forest_effect; -uniform bool use_optimization; -uniform bool tree_patches; - -uniform float osg_SimulationTime; - -uniform int cloud_shadow_flag; - -float earthShade; -float mie_angle; - -float shadow_func (in float x, in float y, in float noise, in float dist); -float VoronoiNoise2D(in vec2 coord, in float wavelength, in float xrand, in float yrand); - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - - //vec4 light_diffuse; - vec4 light_ambient; - - vec3 shadedFogColor = vec3(0.65, 0.67, 0.78); - - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - is_shadow = -1.0; - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - // eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - float rn_dist = length(gl_Color.xyz - ep.xyz) + 300.0 * mod(10.0 * gl_Color.x,1.0); - float rn = mod(100.0 * gl_Color.x + 100.0 * gl_Color.y,1.0); - - float numVarieties = gl_Normal.z; - - bool cull_flag = false; - - float factor = 1.0; - float factor1 = 1.0; - - - if ((rn_dist > 2000.0) && (tree_patches == true) && (use_optimization == true)) - { - - if (rn > 0.15) - {cull_flag = true;} - else - { - numVarieties *=0.25; - factor = 5.2; - } - if (gl_FogCoord !=0.0) {cull_flag = true;} - } - - - - if (cull_flag) - { - // move everything out of the view frustrum - gl_Position = vec4 (0.0,0.0,10.0,1.0); - gl_FrontColor.a = 0.0; - } - else - { - - float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties; - -// determine whether the tree changes color in autumn - if (texFract < float(num_deciduous_trees)/float(numVarieties)) {autumn_flag = 0.5 + fract(gl_Color.x);} - else {autumn_flag = 0.0;} - - texFract += floor(gl_MultiTexCoord0.x) / numVarieties; - - // Determine the rotation for the tree. The Fog Coordinate provides rotation information - // to rotate one of the quands by 90 degrees. We then apply an additional position seed - // so that trees aren't all oriented N/S - float sr; - float cr; - sr = sin(gl_FogCoord + gl_Color.x); - cr = cos(gl_FogCoord + gl_Color.x); - - if (gl_FogCoord < 0.0) - { - sr = dot(lightHorizon.xy, vec2 (0.0,1.0)); - cr = dot(lightHorizon.xy, vec2 (-1.0,0.0)); - } - - - gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0); - - // Determine the y texture coordinate based on whether it's summer, winter, snowy. - gl_TexCoord[0].y = gl_TexCoord[0].y + 0.25 * step(snow_level, gl_Color.z) + 0.5 * season; - - // scaling - vec3 position = gl_Vertex.xyz * gl_Normal.xxy; - - // Rotation of the generic quad to specific one for the tree. - position.xy = factor * vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr))); - - - // Shear by wind. Note that this only applies to the top vertices - if (wind_effects > 0) - { - position.x = position.x + position.z * (sin(osg_SimulationTime * 1.8 + (gl_Color.x + gl_Color.y + gl_Color.z) * 0.01) + 1.0) * 0.0025 * WindN; - position.y = position.y + position.z * (sin(osg_SimulationTime * 1.8 + (gl_Color.x + gl_Color.y + gl_Color.z) * 0.01) + 1.0) * 0.0025 * WindE; - } - - - - - - - // Scale by random domains - float voronoi; - if ((forest_effects > 0)&& use_forest_effect) - { - voronoi = 0.5 + 1.0 * VoronoiNoise2D(gl_Color.xy, forest_effect_size, forest_effect_shape, forest_effect_shape); - position.xyz = position.xyz * voronoi; - } - - // check if this is a shadow quad - if ((gl_FogCoord <0.0)&&(use_tree_shadows)) - { - is_shadow = 1.0; - float sinAlpha = dot(lightFull, vec3 (0.0,0.0,1.0)); - float cosAlpha = sqrt(1.0 - sinAlpha*sinAlpha); - float slope = dot(gl_SecondaryColor.xyz, vec3(0.0,0.0,1.0)); - //float slope = 1.0; - position.x += position.z * clamp(cosAlpha/sinAlpha,-5.0,5.0) * -dot(lightHorizon.xy, vec2(1.0,0.0)); - position.y += position.z * clamp(cosAlpha/sinAlpha,-5.0,5.0) * -dot(lightHorizon.xy, vec2 (0.0,1.0)); - if (position.z > 3.0) // we deal with an upper vertex - { - vec3 terrainNormal = gl_SecondaryColor.xyz; - position.z = 0.4 + 10.0*(1.0 - slope) ; - float sinPhi = dot(terrainNormal, vec3(1.0,0.0,0.0)); - float sinPsi = dot(terrainNormal, vec3(0.0,1.0,0.0)); - position.z -= position.x * sinPhi; - position.z -= position.y * sinPsi; - } - else - {position.z = 0.4 + 10.0* (1.0-slope);} - - } - - - // Move to correct location (stored in gl_Color) - position = position + gl_Color.xyz; - gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0); - // logarithmic depth - gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w; - - vec3 ecPosition = vec3(gl_ModelViewMatrix * vec4(position, 1.0)); - //normal = normalize(-ecPosition); - - //float n = dot(normalize(gl_LightSource[0].position.xyz), normalize(-ecPosition)); - - - //vec4 diffuse_color = gl_FrontMaterial.diffuse * max(0.1, n); - //diffuse_color.a = 1.0; - vec4 ambient_color = gl_FrontMaterial.ambient; - - // here start computations for the haze layer - // we need several geometrical quantities - - - - relPos = position - ep.xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(position.z,100.0); - scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - // check whether we should see a shadow - - if (is_shadow >0.0) - { - float view_angle = dot ((gl_SecondaryColor.xyz), normalize(relPos)); - if (view_angle < 0.0) {is_shadow = -view_angle;} - else {is_shadow = 5.0;} - - // the surface element will be in shadow - if (dot(normalize(lightFull),(gl_SecondaryColor.xyz)) < 0.0) - { is_shadow = 5.0;} - } - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - - - - - - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - //light_ambient = light_ambient * (0.4 + 0.6 * smoothstep(0.2, 0.5, earthShade)); - intensity = length(light_ambient.rgb); - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade) )); - - - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_ambient = vec4 (0.33, 0.4, 0.5, 1.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - - light_ambient.r = 0.316 + lightArg * 0.016; - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - } - - - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - - light_ambient.rgb = light_ambient.rgb * (1.0 + smoothstep(1000000.0, 3000000.0,terminator)); - -// tree shader lighting - -if (cloud_shadow_flag == 1) - {light_ambient.rgb = light_ambient.rgb * (0.5 + 0.5 * shadow_func(relPos.x, relPos.y, 1.0, dist));} - - - gl_FrontColor = light_ambient * gl_FrontMaterial.ambient; - gl_FrontColor.a = mie_angle; gl_BackColor.a = mie_angle; - - } - -} - diff --git a/Compositor/Shaders/ALS/tree.frag b/Compositor/Shaders/ALS/tree.frag deleted file mode 100644 index 2b5293c16..000000000 --- a/Compositor/Shaders/ALS/tree.frag +++ /dev/null @@ -1,370 +0,0 @@ -// -*-C++-*- -#version 120 - -// written by Thorsten Renk, Oct 2011, based on default.frag - - - -varying vec3 relPos; - - -uniform sampler2D texture; - - -varying float yprime_alt; -varying float autumn_flag; - -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float ground_scattering; -uniform float cloud_self_shading; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float dust_cover_factor; -uniform float air_pollution; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; -uniform float cseason; - -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; -uniform int quality_level; -uniform int tquality_level; - - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float mie_angle; - - -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); - -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 get_hazeColor(in float light_arg); -vec3 filter_combined (in vec3 color) ; - - - - -float tree_fog_func (in float targ) -{ - - -float fade_mix; - -// for large altitude > 30 km, we switch to some component of quadratic distance fading to -// create the illusion of improved visibility range - -targ = 1.25 * targ * smoothstep(0.07,0.1,targ); // need to sync with the distance to which terrain is drawn - - -if (alt < 30000.0) - {return exp(-targ - targ * targ * targ * targ);} -else if (alt < 50000.0) - { - fade_mix = (alt - 30000.0)/20000.0; - return fade_mix * exp(-targ*targ - pow(targ,4.0)) + (1.0 - fade_mix) * exp(-targ - pow(targ,4.0)); - } -else - { - return exp(- targ * targ - pow(targ,4.0)); - } - -} - -float rand2D(in vec2 co){ - return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); -} - - -float simple_interpolate(in float a, in float b, in float x) -{ -return a + smoothstep(0.0,1.0,x) * (b-a); -} - -float interpolatedNoise2D(in float x, in float y) -{ - float integer_x = x - fract(x); - float fractional_x = x - integer_x; - - float integer_y = y - fract(y); - float fractional_y = y - integer_y; - - float v1 = rand2D(vec2(integer_x, integer_y)); - float v2 = rand2D(vec2(integer_x+1.0, integer_y)); - float v3 = rand2D(vec2(integer_x, integer_y+1.0)); - float v4 = rand2D(vec2(integer_x+1.0, integer_y +1.0)); - - float i1 = simple_interpolate(v1 , v2 , fractional_x); - float i2 = simple_interpolate(v3 , v4 , fractional_x); - - return simple_interpolate(i1 , i2 , fractional_y); -} - - - -float Noise2D(in vec2 coord, in float wavelength) -{ -return interpolatedNoise2D(coord.x/wavelength, coord.y/wavelength); - -} - -void main() -{ - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - - - - vec3 lightDir = gl_LightSource[0].position.xyz; - float intensity; - - mie_angle = gl_Color.a; - vec4 texel = texture2D(texture, gl_TexCoord[0].st); - - float effective_scattering = min(scattering, cloud_self_shading); - float dist = length(relPos); - - if (quality_level > 3) - { - - // seasonal color changes - - if ((cseason < 1.5)&& (autumn_flag > 0.0)) - { - texel.r = min(1.0, (1.0 + 5.0 *cseason * autumn_flag ) * texel.r); - //texel.g = texel.g + 0.05 * (autumn_flag-0.5) * cseason; - texel.b = max(0.0, (1.0 - 8.0 * cseason) * texel.b); - } - - // mix dust - vec4 dust_color = vec4 (0.76, 0.71, 0.56, texel.a); - - texel = mix(texel, dust_color, clamp(0.6 * dust_cover_factor ,0.0, 1.0) ); - - - } - - -// ALS secondary light sources - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if ((quality_level>5) && (tquality_level>5)) - { - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - } - - vec4 fragColor = vec4 (gl_Color.rgb +secondary_light * light_distance_fading(dist),1.0) * texel; - - - - - float lightArg = (terminator-yprime_alt)/100000.0; - - vec3 hazeColor = get_hazeColor(lightArg); - - - -// Rayleigh color shift due to in-scattering - - if ((quality_level > 5) && (tquality_level > 5)) - { - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength); - } - - - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; -float mvisibility = min(visibility,avisibility); - -if (dist > max(40.0, 0.07 * mvisibility)) -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - -// angle with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// blur of the haze layer edge - -float blur_thickness = 50.0; -float cphi = dot(vec3(0.0, 1.0, 0.0), relPos)/dist; -float ctlayer; -float ctblur = 0.035 ; - -float blur_dist; - -if ((abs(delta_z) < 400.0)&&(quality_level>5)&&(tquality_level>5)) - { - ctlayer = delta_z/dist-0.01 + 0.02 * Noise2D(vec2(cphi,1.0),0.1) -0.01; - blur_dist = dist * (1.0-smoothstep(0.0,300.0,-delta_z)) * smoothstep(-400.0,-200.0, -delta_z); - blur_dist = blur_dist * smoothstep(ctlayer-4.0*ctblur, ctlayer-ctblur, ct) * (1.0-smoothstep(ctlayer+0.5*ctblur, ctlayer+ctblur, ct)); - distance_in_layer = max(distance_in_layer, blur_dist); - } - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - -//float scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, relPos.z + eye_alt); - -if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 -effective_scattering); - - } -else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 -effective_scattering); - } - - - -transmission = tree_fog_func(transmission_arg); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - - - - -// now dim the light for haze -float eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - -// Mie-like factor - -if (lightArg < 10.0) - {intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -// high altitude desaturation of the haze color - -intensity = length(hazeColor); -hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - -// blue hue of haze - -hazeColor.x = hazeColor.x * 0.83; -hazeColor.y = hazeColor.y * 0.9; - - -// additional blue in indirect light -float fade_out = max(0.65 - 0.3 *overcast, 0.45); -intensity = length(hazeColor); -hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - -// change haze color to blue hue for strong fogging - -hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - -// don't let the light fade out too rapidly -lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - -hazeColor.rgb *= eqColorFactor * eShade; -hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - -// determine the right mix of transmission and haze - -//hazeColor = clamp(hazeColor,0.0,1.0); -fragColor.rgb = mix( hazeColor + secondary_light * fog_backscatter(mvisibility), fragColor.rgb,transmission); - -} - - -fragColor.rgb = filter_combined(fragColor.rgb); - -gl_FragColor = fragColor; -} - diff --git a/Compositor/Shaders/ALS/tree.vert b/Compositor/Shaders/ALS/tree.vert deleted file mode 100644 index 1c8511562..000000000 --- a/Compositor/Shaders/ALS/tree.vert +++ /dev/null @@ -1,280 +0,0 @@ -// -*-C++-*- -#version 120 - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -// Haze part added by Thorsten Renk, Oct. 2011 - - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -uniform float fg_Fcoef; - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. - - -varying vec3 relPos; -varying float yprime_alt; -varying float autumn_flag; - -uniform int colorMode; -uniform int wind_effects; -uniform int forest_effects; -uniform int num_deciduous_trees; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; -uniform float snow_level; -uniform float season; -uniform float forest_effect_size; -uniform float forest_effect_shape; -uniform float WindN; -uniform float WindE; - -uniform float osg_SimulationTime; - -uniform int cloud_shadow_flag; - -uniform bool use_forest_effect; - -float earthShade; -float mie_angle; - -float shadow_func (in float x, in float y, in float noise, in float dist); -float VoronoiNoise2D(in vec2 coord, in float wavelength, in float xrand, in float yrand); - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - - vec4 light_ambient; - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - -// this code is copied from tree.vert - - float numVarieties = gl_Normal.z; - float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties; - -// determine whether the tree changes color in autumn - if (texFract < float(num_deciduous_trees)/float(numVarieties)) {autumn_flag = 0.5 + fract(gl_Color.x);} - else {autumn_flag = 0.0;} - - - texFract += floor(gl_MultiTexCoord0.x) / numVarieties; - - // Determine the rotation for the tree. The Fog Coordinate provides rotation information - // to rotate one of the quands by 90 degrees. We then apply an additional position seed - // so that trees aren't all oriented N/S - float sr = sin(gl_FogCoord + gl_Color.x); - float cr = cos(gl_FogCoord + gl_Color.x); - gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0); - - // Determine the y texture coordinate based on whether it's summer, winter, snowy. - gl_TexCoord[0].y = gl_TexCoord[0].y + 0.25 * step(snow_level, gl_Color.z) + 0.5 * season; - - // scaling - vec3 position = gl_Vertex.xyz * gl_Normal.xxy; - - // Rotation of the generic quad to specific one for the tree. - position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr))); - - - // Shear by wind. Note that this only applies to the top vertices - if (wind_effects > 0) - { - position.x = position.x + position.z * (sin(osg_SimulationTime * 1.8 + (gl_Color.x + gl_Color.y + gl_Color.z) * 0.01) + 1.0) * 0.0025 * WindN; - position.y = position.y + position.z * (sin(osg_SimulationTime * 1.8 + (gl_Color.x + gl_Color.y + gl_Color.z) * 0.01) + 1.0) * 0.0025 * WindE; - } - - // Scale by random domains - float voronoi; - if ((forest_effects > 0)&& use_forest_effect) - { - voronoi = 0.5 + 1.0 * VoronoiNoise2D(gl_Color.xy, forest_effect_size, forest_effect_shape, forest_effect_shape); - position.xyz = position.xyz * voronoi; - } - - // Move to correct location (stored in gl_Color) - position = position + gl_Color.xyz; - gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0); - // logarithmic depth - gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w; - - vec3 ecPosition = vec3(gl_ModelViewMatrix * vec4(position, 1.0)); - //normal = normalize(-ecPosition); - - //float n = dot(normalize(gl_LightSource[0].position.xyz), normalize(-ecPosition)); - - - //vec4 diffuse_color = gl_FrontMaterial.diffuse * max(0.1, n); - //diffuse_color.a = 1.0; - vec4 ambient_color = gl_FrontMaterial.ambient; - - // here start computations for the haze layer - // we need several geometrical quantities - - // first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = position - ep.xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(position.z,100.0); - scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - - - - - - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - //light_ambient = light_ambient * (0.4 + 0.6 * smoothstep(0.2, 0.5, earthShade)); - intensity = length(light_ambient.rgb); - light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade) )); - - - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_ambient = vec4 (0.33, 0.4, 0.5, 1.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - - light_ambient.r = 0.316 + lightArg * 0.016; - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - } - - - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - - light_ambient.rgb = light_ambient.rgb * (1.0 + smoothstep(1000000.0, 3000000.0,terminator)); - -// tree shader lighting - -if (cloud_shadow_flag == 1) - {light_ambient.rgb = light_ambient.rgb * (0.5 + 0.5 * shadow_func(relPos.x, relPos.y, 1.0, dist));} - - - //vec4 ambientColor = gl_FrontLightModelProduct.sceneColor + - //gl_FrontColor = ambientColor; - gl_FrontColor = light_ambient * gl_FrontMaterial.ambient; - gl_FrontColor.a = mie_angle; gl_BackColor.a = mie_angle; - - - - -} - diff --git a/Compositor/Shaders/ALS/urban.frag b/Compositor/Shaders/ALS/urban.frag deleted file mode 100644 index f74cc9e9e..000000000 --- a/Compositor/Shaders/ALS/urban.frag +++ /dev/null @@ -1,610 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Author: Frederic Bouvier. -// Adapted from the paper by F. Policarpo et al. : Real-time Relief Mapping on Arbitrary Polygonal Surfaces -// Adapted from the paper and sources by M. Drobot in GPU Pro : Quadtree Displacement Mapping with Height Blending - -#version 120 - -#extension GL_ATI_shader_texture_lod : enable -#extension GL_ARB_shader_texture_lod : enable - -#define TEXTURE_MIP_LEVELS 10 -#define TEXTURE_PIX_COUNT 1024 //pow(2,TEXTURE_MIP_LEVELS) -#define BINARY_SEARCH_COUNT 10 -#define BILINEAR_SMOOTH_FACTOR 2.0 - -varying vec3 worldPos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec4 constantColor; -varying vec3 light_diffuse; -varying vec3 relPos; - -varying float yprime_alt; -varying float mie_angle; -varying float steepness; - -uniform sampler2D BaseTex; -uniform sampler2D NormalTex; -uniform sampler2D QDMTex; -uniform sampler2D BackgroundTex; -uniform sampler2D OverlayTex; -uniform sampler2D GradientTex; -uniform float depth_factor; -uniform float tile_size; -uniform float quality_level; -uniform float visibility; -uniform float avisibility; -uniform float scattering; -uniform float terminator; -uniform float terrain_alt; -uniform float hazeLayerAltitude; -uniform float overcast; -uniform float eye_alt; -uniform float mysnowlevel; -uniform float dust_cover_factor; -uniform float wetness; -uniform float fogstructure; -uniform float cloud_self_shading; -uniform float air_pollution; -uniform float blend_bias; -uniform float urban_domain_size; -uniform float urban_domain_fraction; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; - -uniform vec3 night_color; - -uniform bool random_buildings; -uniform bool osm_buildings; - -uniform int cloud_shadow_flag; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; -uniform int gquality_level; -uniform int tquality_level; -uniform int urban_blend; -uniform int urban_domains; - -const float scale = 1.0; -int linear_search_steps = 10; -int GlobalIterationCount = 0; -int gIterationCap = 64; - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float alt; -float eShade; - -float shadow_func (in float x, in float y, in float noise, in float dist); -float Noise2D(in vec2 coord, in float wavelength); -float Noise3D(in vec3 coord, in float wavelength); -float VoronoiNoise2D(in vec2 coord, in float wavelength, in float xrand, in float yrand); -float fog_func (in float targ, in float alt); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - - - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float light_arg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 filter_combined (in vec3 color) ; - -void QDM(inout vec3 p, inout vec3 v) -{ - const int MAX_LEVEL = TEXTURE_MIP_LEVELS; - const float NODE_COUNT = TEXTURE_PIX_COUNT; - const float TEXEL_SPAN_HALF = 1.0 / NODE_COUNT / 2.0; - - float fDeltaNC = TEXEL_SPAN_HALF * depth_factor; - - vec3 p2 = p; - float level = MAX_LEVEL; - vec2 dirSign = (sign(v.xy) + 1.0) * 0.5; - GlobalIterationCount = 0; - float d = 0.0; - - while (level >= 0.0 && GlobalIterationCount < gIterationCap) - { - vec4 uv = vec4(p2.xyz, level); - d = texture2DLod(QDMTex, uv.xy, uv.w).w; - - if (d > p2.z) - { - //predictive point of ray traversal - vec3 tmpP2 = p + v * d; - - //current node count - float nodeCount = pow(2.0, (MAX_LEVEL - level)); - //current and predictive node ID - vec4 nodeID = floor(vec4(p2.xy, tmpP2.xy)*nodeCount); - - //check if we are crossing the current cell - if (nodeID.x != nodeID.z || nodeID.y != nodeID.w) - { - //calculate distance to nearest bound - vec2 a = p2.xy - p.xy; - vec2 p3 = (nodeID.xy + dirSign) / nodeCount; - vec2 b = p3.xy - p.xy; - - vec2 dNC = (b.xy * p2.z) / a.xy; - //take the nearest cell - d = min(d,min(dNC.x, dNC.y))+fDeltaNC; - - level++; - } - p2 = p + v * d; - } - level--; - GlobalIterationCount++; - } - - // - // Manual Bilinear filtering - // - float rayLength = length(p2.xy - p.xy) + fDeltaNC; - - float dA = p2.z * (rayLength - BILINEAR_SMOOTH_FACTOR * TEXEL_SPAN_HALF) / rayLength; - float dB = p2.z * (rayLength + BILINEAR_SMOOTH_FACTOR * TEXEL_SPAN_HALF) / rayLength; - - vec4 p2a = vec4(p + v * dA, 0.0); - vec4 p2b = vec4(p + v * dB, 0.0); - dA = texture2DLod(NormalTex, p2a.xy, p2a.w).w; - dB = texture2DLod(NormalTex, p2b.xy, p2b.w).w; - - dA = abs(p2a.z - dA); - dB = abs(p2b.z - dB); - - p2 = mix(p2a.xyz, p2b.xyz, dA / (dA + dB)); - - p = p2; -} - -float ray_intersect_QDM(vec2 dp, vec2 ds) -{ - vec3 p = vec3( dp, 0.0 ); - vec3 v = vec3( ds, 1.0 ); - QDM( p, v ); - return p.z; -} - -float ray_intersect_relief(vec2 dp, vec2 ds) -{ - float size = 1.0 / float(linear_search_steps); - float depth = 0.0; - float best_depth = 1.0; - - for(int i = 0; i < linear_search_steps - 1; ++i) - { - depth += size; - float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a); - if(best_depth > 0.996) - if(depth >= t) - best_depth = depth; - } - depth = best_depth; - - const int binary_search_steps = 5; - - for(int i = 0; i < binary_search_steps; ++i) - { - size *= 0.5; - float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a); - if(depth >= t) - { - best_depth = depth; - depth -= 2.0 * size; - } - depth += size; - } - - return(best_depth); -} - -float ray_intersect(vec2 dp, vec2 ds) -{ - if (( random_buildings ) || ( osm_buildings )) - return 0.0; - else if ( quality_level >= 4.0 ) - return ray_intersect_QDM( dp, ds ); - else - return ray_intersect_relief( dp, ds ); -} - -void main (void) -{ - if ( quality_level >= 3.0 ) { - linear_search_steps = 20; - } - - float depthfactor = depth_factor; - if (( random_buildings ) || (osm_buildings)) - depthfactor = 0.0; - - float steepness_factor = 1.0 -smoothstep(0.85, 0.9, steepness); - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - float effective_scattering = min(scattering, cloud_self_shading); - vec3 normal = normalize(VNormal); - vec3 tangent = normalize(VTangent); - vec3 binormal = normalize(cross(normal, tangent)); - vec3 ecPos3 = ecPosition.xyz / ecPosition.w; - vec3 V = normalize(ecPos3); - vec3 s = vec3(dot(V, tangent), dot(V, binormal), dot(normal, -V)); - vec2 ds = s.xy * depthfactor / s.z; - vec2 dp = gl_TexCoord[0].st - ds; - float d = ray_intersect(dp, ds); - - vec2 uv = dp + ds * d * (1.0-steepness_factor); - - vec2 samplePos = (relPos + (gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0)).xyz).xy; - - float vnoise = 0; - - if (urban_domains == 1) - { - vnoise = VoronoiNoise2D(samplePos, urban_domain_size, 1.5, 1.5); - float dir = 2.0 * 3.1415 * vnoise; - - mat2 rotMat = mat2 (cos(dir), sin(dir), -sin(dir), cos(dir)); - uv = rotMat * uv; - } - - vec3 N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0; - - - - float emis = N.z; - N.z = sqrt(1.0 - min(1.0,dot(N.xy, N.xy))); - float Nz = N.z; - N = normalize(N.x * tangent + N.y * binormal + N.z * normal); - - N = mix(N, normal, steepness_factor); - if ((vnoise > urban_domain_fraction) && (urban_blend == 1)) {N = mix(N,normal, 0.8);} - - - vec3 l = gl_LightSource[0].position.xyz; - vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l)); - - float dist = length(relPos); - if (cloud_shadow_flag == 1) - {diffuse = diffuse * shadow_func(relPos.x, relPos.y, 1.0, dist);} - - - - - float shadow_factor = 1.0; - - // Shadow - if ( quality_level >= 2.0 ) { - dp += ds * d; - vec3 sl = normalize( vec3( dot( l, tangent ), dot( l, binormal ), dot( -l, normal ) ) ); - ds = sl.xy * depthfactor / sl.z; - dp -= ds * d; - float dl = ray_intersect(dp, ds); - if ( dl < d - 0.05 ) - shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25; - - shadow_factor = mix(shadow_factor, 1.0, steepness_factor); - - if (vnoise > urban_domain_fraction) {shadow_factor = 0.5 * (1.0 +shadow_factor);} - - } - - - - - - // end shadow - - vec4 ambient_light = constantColor + vec4 (light_diffuse,1.0) * vec4(diffuse, 1.0); - float reflectance = ambient_light.r * 0.3 + ambient_light.g * 0.59 + ambient_light.b * 0.11; - if ( shadow_factor < 1.0 ) - ambient_light = constantColor + vec4(light_diffuse,1.0) * shadow_factor * vec4(diffuse, 1.0); - float emission_factor = (1.0 - smoothstep(0.15, 0.25, reflectance)) * emis; - vec4 tc = texture2D(BaseTex, uv); - emission_factor *= 0.5*pow(tc.r+0.8*tc.g+0.2*tc.b, 2.0) -0.2; - ambient_light += (emission_factor * vec4(night_color, 0.0)); - - - - vec4 baseTexel = texture2D(BaseTex, uv); - - vec4 finalColor = baseTexel; - - // blending effect - - if (urban_blend == 1) - { - vec4 backgroundTexel = texture2D(BackgroundTex, uv); - float vbias = 0.0; - if (vnoise > urban_domain_fraction) {vbias = 0.5 + 0.5 * vnoise;} - - finalColor.rgb = mix(backgroundTexel.rgb, baseTexel.rgb, clamp(baseTexel.a - blend_bias - vbias, 0.0, 1.0)); - } - - // steepness - - vec4 gradientTexel = texture2D(GradientTex, uv); - - if (gradientTexel.a > 0.0) - { - finalColor.rgb = mix(finalColor.rgb, gradientTexel.rgb, steepness_factor); - } - -// texel postprocessing by shader effects - - -// dust effect - -vec4 dust_color; - - -float noise_1500m = Noise3D(worldPos.xyz,1500.0); -float noise_2000m = Noise3D(worldPos.xyz,2000.0); - -if (gquality_level > 2) - { - // mix dust - dust_color = vec4 (0.76, 0.71, 0.56, 1.0); - - finalColor = mix(finalColor, dust_color, clamp(0.5 * dust_cover_factor + 3.0 * dust_cover_factor * (((noise_1500m - 0.5) * 0.125)+0.125 ),0.0, 1.0) ); - } - - -// darken wet terrain - - finalColor.rgb = finalColor.rgb * (1.0 - 0.6 * wetness); - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - ambient_light = clamp(ambient_light,0.0,1.0); - ambient_light.rgb +=secondary_light * light_distance_fading(dist); - - - - finalColor *= ambient_light; - - vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depthfactor / s.z, 1.0 ); - - - - - -float lightArg = (terminator-yprime_alt)/100000.0; - -vec3 hazeColor = get_hazeColor(lightArg); - - - -// Rayleigh color shifts - - if ((gquality_level > 5) && (tquality_level > 5)) - { - float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - float outscatter = 1.0-exp(-dist/rayleigh_length); - finalColor.rgb = rayleigh_out_shift(finalColor.rgb,outscatter); -// Rayleigh color shift due to in-scattering - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0); - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - finalColor.rgb = mix(finalColor.rgb, rayleighColor,rayleighStrength); - } - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; - -float mvisibility = min(visibility,avisibility); - -if (dist > 0.04 * mvisibility) -{ - -alt = eye_alt; - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; -float intensity; -vec3 lightDir = gl_LightSource[0].position.xyz; - -// angle with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - - - -if (visibility < avisibility) - { - if (gquality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility + 1.0 * visibility * fogstructure * 0.06 * (noise_1500m + noise_2000m -1.0) )); - - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 - effective_scattering); - - } -else - { - if (gquality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility + 1.0 * avisibility * fogstructure * 0.06 * (noise_1500m + noise_2000m - 1.0) )); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 - effective_scattering); - } - - - -transmission = fog_func(transmission_arg, alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - - - - -// now dim the light for haze -eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - -// Mie-like factor - - if (lightArg < 10.0) - { - intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - - -intensity = length(hazeColor); - -if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColor doesn't come out correctly - { - // Mie-like factor - - if (lightArg < 10.0) - { - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - - // high altitude desaturation of the haze color - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, alt))); - - // blue hue of haze - - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - - - // additional blue in indirect light - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - // change haze color to blue hue for strong fogging - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - - - // reduce haze intensity when looking at shaded surfaces, only in terminator region - - float shadow = mix( min(1.0 + dot(VNormal,lightDir),1.0), 1.0, 1.0-smoothstep(0.1, 0.4, transmission)); - hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator)); - } - - -// don't let the light fade out too rapidly -lightArg = (terminator + 200000.0)/100000.0; -float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); -vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); -hazeColor *= eqColorFactor * eShade; -hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - - -finalColor.rgb = mix( hazeColor +secondary_light * fog_backscatter(mvisibility), finalColor.rgb,transmission); - -} - - -finalColor.rgb = filter_combined(finalColor.rgb); - - -gl_FragColor = finalColor; - - - - - if (dot(normal,-V) > 0.1) { - vec4 iproj = gl_ProjectionMatrix * p; - iproj /= iproj.w; - gl_FragDepth = (iproj.z+1.0)/2.0; - } else { - gl_FragDepth = gl_FragCoord.z; - } - - -} diff --git a/Compositor/Shaders/ALS/urban.vert b/Compositor/Shaders/ALS/urban.vert deleted file mode 100644 index 75a6f2356..000000000 --- a/Compositor/Shaders/ALS/urban.vert +++ /dev/null @@ -1,291 +0,0 @@ -// -*-C++-*- -#version 120 - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -// Haze part added by Thorsten Renk, Oct. 2011 - - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -uniform float fg_Fcoef; - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. - - -varying vec3 relPos; -varying vec3 worldPos; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec4 ecPosition; -varying vec4 constantColor; -varying vec3 light_diffuse; - - -varying float yprime_alt; -varying float mie_angle; -varying float steepness; - -uniform int colorMode; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; -uniform float eye_alt; -uniform float moonlight; - -uniform bool use_IR_vision; - -uniform mat4 osg_ViewMatrixInverse; - -attribute vec3 tangent;//, binormal; - -float earthShade; - - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -void main() -{ - - - vec4 light_ambient; - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight; - - //float yprime_alt; - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - - //rawPos = gl_Vertex.xy; - worldPos = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex).xyz; - steepness = dot(normalize(gl_Normal), vec3 (0.0, 0.0, 1.0)); - - // hack: World Scenery 2.0 triangle mesh doesn't yield sensible tangents - // and normals, so we pretend that urban terrain is always close - // to flat to get rid of back triangles in urban terrain - - //VNormal = normalize(gl_NormalMatrix * gl_Normal); - //VTangent = gl_NormalMatrix * tangent; - VNormal = gl_NormalMatrix * vec3 (0.0,0.0,1.0); - VTangent = gl_NormalMatrix * vec3 (0.0,-1.0,0.0); - - ecPosition = gl_ModelViewMatrix * gl_Vertex; -// Normal = normalize(gl_Normal); -// VBinormal = gl_NormalMatrix * binormal; - - -// this code is copied from default.vert - - gl_Position = ftransform(); - // logarithmic depth - gl_Position.z = (log2(max(1e-6, 1.0 + gl_Position.w)) * fg_Fcoef - 1.0) * gl_Position.w; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - //normal = gl_NormalMatrix * gl_Normal; - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - - - // here start computations for the haze layer - // we need several geometrical quantities - - -// first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = gl_Vertex.xyz - ep.xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - - // altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(gl_Vertex.z,100.0); - scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - - -// early culling of vertices which can't be seen due to ground haze despite being in aloft visibility range - -float delta_z = hazeLayerAltitude - eye_alt; - - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), normalize(lightFull)) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - - light_diffuse = light_diffuse * scattering; - - light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33); - light_ambient.g = light_ambient.r * 0.4/0.33; - light_ambient.b = light_ambient.r * 0.5/0.33; - light_ambient.a = 1.0; - - - -// correct ambient light intensity and hue before sunrise -if (earthShade < 0.5) - { - //light_ambient = light_ambient * (0.7 + 0.3 * smoothstep(0.2, 0.5, earthShade)); - intensity = length(light_ambient.rgb); - - light_ambient.rgb = intensity * normalize(mix(light_ambient.xyz, shadedFogColor, 1.0 -smoothstep(0.4, 0.8,earthShade) )); - light_ambient.rgb = light_ambient.rgb + moonLightColor * (1.0 - smoothstep(0.4, 0.5, earthShade)); - - intensity = length(light_diffuse.xyz); - light_diffuse.xyz = intensity * normalize(mix(light_diffuse.xyz, shadedFogColor, 1.0 -smoothstep(0.4, 0.7,earthShade) )); - } - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {light_diffuse = vec3 (1.0, 1.0, 1.0); - light_ambient = vec4 (0.33, 0.4, 0.5, 0.0); } - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - light_diffuse.b = 0.78 + lightArg * 0.21; - light_diffuse.g = 0.907 + lightArg * 0.091; - light_diffuse.r = 0.904 + lightArg * 0.092; - - light_ambient.b = 0.41 + lightArg * 0.08; - light_ambient.g = 0.333 + lightArg * 0.06; - light_ambient.r = 0.316 + lightArg * 0.016; - - } - - light_diffuse = light_diffuse * scattering; - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); -} - - -// a sky/earth irradiation map model - the sky creates much more diffuse radiation than the ground, so -// steep faces end up shaded more - -light_ambient = light_ambient * ((1.0+steepness)/2.0 * 1.2 + (1.0-steepness)/2.0 * 0.2); - -// deeper shadows when there is lots of direct light - -float shade_depth = 1.0 * smoothstep (0.6,0.95,ground_scattering) * (1.0-smoothstep(0.1,0.5,overcast)) * smoothstep(0.4,1.5,earthShade); - - light_ambient.rgb = light_ambient.rgb * (1.0 - shade_depth); - light_diffuse.rgb = light_diffuse.rgb * (1.0 + 1.2 * shade_depth); - -if (use_IR_vision) - { - light_ambient.rgb = max(light_ambient.rgb, vec3 (0.5, 0.5, 0.5)); - } - - -// default lighting based on texture and material using the light we have just computed - - gl_FrontColor = gl_Color; - constantColor = gl_FrontMaterial.emission - + gl_Color * (gl_LightModel.ambient + light_ambient); - - -} - diff --git a/Compositor/Shaders/ALS/wake.vert b/Compositor/Shaders/ALS/wake.vert deleted file mode 100644 index dee6ee2a4..000000000 --- a/Compositor/Shaders/ALS/wake.vert +++ /dev/null @@ -1,233 +0,0 @@ -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// © Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// © Emilian Huminiuc and Vivian Meazza -// Optimisation - 2012-5-05 -// © Emilian Huminiuc and Vivian Meazza -// Ported to the Atmospheric Light Scattering Framework -// by Thorsten Renk, Aug. 2013 - -#version 120 -#define fps2kts 0.5925 - -varying vec4 waterTex1; -varying vec4 waterTex2; -varying vec3 relPos; -varying vec3 rawPos; -varying vec3 viewerdir; -varying vec3 lightdir; -varying vec3 normal; - -varying float steepness; -varying float earthShade; -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - -uniform float osg_SimulationTime; -uniform float WindE, WindN, spd, hdg; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; - -uniform mat4 osg_ViewMatrixInverse; - -vec3 specular_light; - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -///////////////////////// - - -/////// functions ///////// - -void relWind(out float rel_wind_speed_kts, float rel_wind_from_deg) -{ - //calculate the carrier speed north and east in kts - float speed_north_kts = cos(radians(hdg)) * spd ; - float speed_east_kts = sin(radians(hdg)) * spd ; - - //calculate the relative wind speed north and east in kts - float rel_wind_speed_from_east_kts = WindE*fps2kts + speed_east_kts; - float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts; - - //combine relative speeds north and east to get relative windspeed in kts - rel_wind_speed_kts = sqrt((rel_wind_speed_from_east_kts * rel_wind_speed_from_east_kts) + (rel_wind_speed_from_north_kts * rel_wind_speed_from_north_kts)); - - //calculate the relative wind direction - rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts)); -} - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - - -void main(void) -{ - - float relWindspd=0; - float relWinddir=0; - //compute relative wind speed and direction - relWind (relWindspd, relWinddir); - - vec3 N = normalize(gl_Normal); - normal = N; - - viewerdir = vec3(gl_ModelViewMatrixInverse[3]) - vec3(gl_Vertex); - lightdir = normalize(vec3(gl_ModelViewMatrixInverse * gl_LightSource[0].position)); - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - rawPos = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex).xyz; - - vec4 t1 = vec4(osg_SimulationTime*0.005217, 0.0, 0.0, 0.0); - vec4 t2 = vec4(osg_SimulationTime*-0.0012, 0.0, 0.0, 0.0); - - float windFactor = -relWindspd * 0.1; -// float windFactor = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.6; - - waterTex1 = gl_MultiTexCoord0 + t1 * windFactor; - waterTex2 = gl_MultiTexCoord0 + t2 * windFactor; - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; - - // here start computations for the haze layer - - - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - - // we need several geometrical quantities - - // first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = gl_Vertex.xyz - ep.xyz; - - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - -// altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(gl_Vertex.z,100.0); - scattering = 0.5 + 0.5 * ground_scattering + 0.5* (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - vec3 lightHorizon = normalize(vec3(lightdir.x,lightdir.y, 0.0)); - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - specular_light.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - specular_light.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - specular_light.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - - specular_light = max(specular_light * scattering, vec3 (0.05, 0.05, 0.05)); - - intensity = length(specular_light.rgb); - specular_light.rgb = intensity * normalize(mix(specular_light.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.6,ground_scattering) )); - - specular_light.rgb = intensity * normalize(mix(specular_light.rgb, shadedFogColor, 1.0 -smoothstep(0.5, 0.7,earthShade))); - - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), lightdir) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} - -else // the faster, full-day version without lightfields - -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {specular_light = vec3 (1.0, 1.0, 1.0);} - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - specular_light.b = 0.78 + lightArg * 0.21; - specular_light.g = 0.907 + lightArg * 0.091; - specular_light.r = 0.904 + lightArg * 0.092; - } - - specular_light = specular_light * scattering; - - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); - -} - -gl_FrontColor.rgb = specular_light; -gl_BackColor.rgb = gl_FrontColor.rgb; - -} diff --git a/Compositor/Shaders/ALS/water-base.frag b/Compositor/Shaders/ALS/water-base.frag deleted file mode 100644 index 1c118ef0c..000000000 --- a/Compositor/Shaders/ALS/water-base.frag +++ /dev/null @@ -1,565 +0,0 @@ -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// © Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// © Emilian Huminiuc and Vivian Meazza -// ported to lightfield shading Thorsten Renk 2012 - -#version 120 - -uniform float fg_Fcoef; - -uniform sampler2D water_normalmap; -uniform sampler2D water_dudvmap; -uniform sampler2D sea_foam; -uniform sampler2D perlin_normalmap; - - -uniform float saturation, Overcast, WindE, WindN; -uniform float osg_SimulationTime; - -varying vec4 waterTex1; //moving texcoords -varying vec4 waterTex2; //moving texcoords -varying vec4 waterTex4; //viewts -varying vec3 viewerdir; -varying vec3 lightdir; -//varying vec3 specular_light; -varying vec3 relPos; - -varying float earthShade; -varying float yprime_alt; -varying float mie_angle; - -varying float flogz; - -uniform float WaveFreq ; -uniform float WaveAmp ; -uniform float WaveSharp ; -uniform float WaveAngle ; -uniform float WaveFactor ; -uniform float WaveDAngle ; -uniform float normalmap_dds; - - -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float scattering; -uniform float ground_scattering; -uniform float cloud_self_shading; -uniform float eye_alt; -uniform float sea_r; -uniform float sea_g; -uniform float sea_b; - - -vec3 specular_light; - -//uniform int wquality_level; - -const float terminator_width = 200000.0; -const float EarthRadius = 5800000.0; - -float fog_func (in float targ, in float alt); -vec3 get_hazeColor(in float light_arg); -vec3 filter_combined (in vec3 color) ; - -/////// functions ///////// - -void rotationmatrix(in float angle, out mat4 rotmat) - { - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); - } - -// wave functions /////////////////////// - -struct Wave { - float freq; // 2*PI / wavelength - float amp; // amplitude - float phase; // speed * 2*PI / wavelength - vec2 dir; - }; - -Wave wave0 = Wave(1.0, 1.0, 0.5, vec2(0.97, 0.25)); -Wave wave1 = Wave(2.0, 0.5, 1.3, vec2(0.97, -0.25)); -Wave wave2 = Wave(1.0, 1.0, 0.6, vec2(0.95, -0.3)); -Wave wave3 = Wave(2.0, 0.5, 1.4, vec2(0.99, 0.1)); - - - - -float evaluateWave(in Wave w, vec2 pos, float t) - { - return w.amp * sin( dot(w.dir, pos) * w.freq + t * w.phase); - } - -// derivative of wave function -float evaluateWaveDeriv(Wave w, vec2 pos, float t) - { - return w.freq * w.amp * cos( dot(w.dir, pos)*w.freq + t*w.phase); - } - -// sharp wave functions -float evaluateWaveSharp(Wave w, vec2 pos, float t, float k) - { - return w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k); - } - -float evaluateWaveDerivSharp(Wave w, vec2 pos, float t, float k) - { - return k*w.freq*w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k - 1) * cos( dot(w.dir, pos)*w.freq + t*w.phase); - } - -void sumWaves(float angle, float dangle, float windScale, float factor, out float ddx, float ddy) - { - mat4 RotationMatrix; - float deriv; - vec4 P = waterTex1 * 1024; - - rotationmatrix(radians(angle + dangle * windScale + 0.6 * sin(P.x * factor)), RotationMatrix); - P *= RotationMatrix; - - P.y += evaluateWave(wave0, P.xz, osg_SimulationTime); - deriv = evaluateWaveDeriv(wave0, P.xz, osg_SimulationTime ); - ddx = deriv * wave0.dir.x; - ddy = deriv * wave0.dir.y; - - //P.y += evaluateWave(wave1, P.xz, osg_SimulationTime); - //deriv = evaluateWaveDeriv(wave1, P.xz, osg_SimulationTime); - //ddx += deriv * wave1.dir.x; - //ddy += deriv * wave1.dir.y; - - P.y += evaluateWaveSharp(wave2, P.xz, osg_SimulationTime, WaveSharp); - deriv = evaluateWaveDerivSharp(wave2, P.xz, osg_SimulationTime, WaveSharp); - ddx += deriv * wave2.dir.x; - ddy += deriv * wave2.dir.y; - - //P.y += evaluateWaveSharp(wave3, P.xz, osg_SimulationTime, WaveSharp); - //deriv = evaluateWaveDerivSharp(wave3, P.xz, osg_SimulationTime, WaveSharp); - //ddx += deriv * wave3.dir.x; - //ddy += deriv * wave3.dir.y; - } - - - -void main(void) - { - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - float effective_scattering = min(scattering, cloud_self_shading); - - float dist = length(relPos); - const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005); - const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02); - const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25); - - mat4 RotationMatrix; - - // compute direction to viewer - vec3 E = normalize(viewerdir); - - // compute direction to light source - vec3 L = lightdir; // normalize(lightdir); - - // half vector - vec3 Hv = normalize(L + E); - - //vec3 Normal = normalize(normal); - vec3 Normal = vec3 (0.0, 0.0, 1.0); - - const float water_shininess = 240.0; - - // approximate cloud cover - //float cover = 0.0; - //bool Status = true; - - float windEffect = sqrt( WindE*WindE + WindN*WindN ) * 0.6; //wind speed in kt - float windScale = 15.0/(3.0 + windEffect); //wave scale - float windEffect_low = 0.3 + 0.7 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter - float waveRoughness = 0.01 + smoothstep(0.0, 40.0, windEffect); //wave roughness filter - - float mixFactor = 0.2 + 0.02 * smoothstep(0.0, 50.0, windEffect); - //mixFactor = 0.2; - mixFactor = clamp(mixFactor, 0.3, 0.8); - - // there's no need to do wave patterns or foam for pixels which are so far away that we can't actually see them - // we only need detail in the near zone or where the sun reflection is - - int detail_flag; - if ((dist > 15000.0) && (dot(normalize(vec3 (lightdir.x, lightdir.y, 0.0) ), normalize(relPos)) < 0.7 )) {detail_flag = 0;} - else {detail_flag = 1;} - - //detail_flag = 1; - - // sine waves - float ddx, ddx1, ddx2, ddx3, ddy, ddy1, ddy2, ddy3; - float angle; - - - ddx = 0.0, ddy = 0.0; - ddx1 = 0.0, ddy1 = 0.0; - ddx2 = 0.0, ddy2 = 0.0; - ddx3 = 0.0, ddy3 = 0.0; - if (detail_flag == 1) - { - angle = 0.0; - - wave0.freq = WaveFreq ; - wave0.amp = WaveAmp; - wave0.dir = vec2 (0.0, 1.0); //vec2(cos(radians(angle)), sin(radians(angle))); - - angle -= 45; - wave1.freq = WaveFreq * 2.0 ; - wave1.amp = WaveAmp * 1.25; - wave1.dir = vec2(0.70710, -0.7071); //vec2(cos(radians(angle)), sin(radians(angle))); - - angle += 30; - wave2.freq = WaveFreq * 3.5; - wave2.amp = WaveAmp * 0.75; - wave2.dir = vec2(0.96592, -0.2588);// vec2(cos(radians(angle)), sin(radians(angle))); - - angle -= 50; - wave3.freq = WaveFreq * 3.0 ; - wave3.amp = WaveAmp * 0.75; - wave3.dir = vec2(0.42261, -0.9063); //vec2(cos(radians(angle)), sin(radians(angle))); - - // sum waves - - sumWaves(WaveAngle, -1.5, windScale, WaveFactor, ddx, ddy); - sumWaves(WaveAngle, 1.5, windScale, WaveFactor, ddx1, ddy1); - - //reset the waves - angle = 0.0; - float waveamp = WaveAmp * 0.75; - - wave0.freq = WaveFreq ; - wave0.amp = waveamp; - wave0.dir = vec2 (0.0, 1.0); //vec2(cos(radians(angle)), sin(radians(angle))); - - angle -= 20; - wave1.freq = WaveFreq * 2.0 ; - wave1.amp = waveamp * 1.25; - wave1.dir = vec2(0.93969, -0.34202);// vec2(cos(radians(angle)), sin(radians(angle))); - - angle += 35; - wave2.freq = WaveFreq * 3.5; - wave2.amp = waveamp * 0.75; - wave2.dir = vec2(0.965925, 0.25881); //vec2(cos(radians(angle)), sin(radians(angle))); - - angle -= 45; - wave3.freq = WaveFreq * 3.0 ; - wave3.amp = waveamp * 0.75; - wave3.dir = vec2(0.866025, -0.5); //vec2(cos(radians(angle)), sin(radians(angle))); - - - //sumWaves(WaveAngle + WaveDAngle, -1.5, windScale, WaveFactor, ddx2, ddy2); - //sumWaves(WaveAngle + WaveDAngle, 1.5, windScale, WaveFactor, ddx3, ddy3); - - } - // end sine stuff - - //cover = 5.0 * smoothstep(0.6, 1.0, scattering); - //cover = 5.0 * ground_scattering; - - vec4 viewt = normalize(waterTex4); - - vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale) * 2.0 - 1.0; - - vec4 vNorm; - - - //normalmaps - vec4 nmap = texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0; - vec4 nmap1 = texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0; - - rotationmatrix(radians(3.0 * sin(osg_SimulationTime * 0.0075)), RotationMatrix); - nmap += texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0; - //nmap1 += texture2D(perlin_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0; - - nmap *= windEffect_low; - nmap1 *= windEffect_low; - - // mix water and noise, modulated by factor - vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness); - vNorm.r += ddx + ddx1 + ddx2 + ddx3; - - - if (normalmap_dds > 0) - {vNorm = -vNorm;} //dds fix - - - //load reflection - - vec4 refl ; - - refl.r = sea_r; - refl.g = sea_g; - refl.b = sea_b; - refl.a = 1.0; - - - float intensity; - // de-saturate for reduced light - refl.rgb = mix(refl.rgb, vec3 (0.248, 0.248, 0.248), 1.0 - smoothstep(0.1, 0.8, ground_scattering)); - - // de-saturate light for overcast haze - intensity = length(refl.rgb); - refl.rgb = mix(refl.rgb, intensity * vec3 (1.0, 1.0, 1.0), 0.5 * smoothstep(0.1, 0.9, overcast)); - - vec3 N; - - - - - vec3 N0 = vec3(texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0); - vec3 N1 = vec3(texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca) * windScale) * 2.0 - 1.0); - - N0 += vec3(texture2D(water_normalmap, vec2(waterTex1 * tscale) * windScale) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2 * tscale) * windScale) * 2.0 - 1.0); - - - - rotationmatrix(radians(2.0 * sin(osg_SimulationTime * 0.005)), RotationMatrix); - N0 += vec3(texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale) * 2.0 - 1.0); - - rotationmatrix(radians(-4.0 * sin(osg_SimulationTime * 0.003)), RotationMatrix); - N0 += vec3(texture2D(water_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca) * windScale) * 2.0 - 1.0); - - - N0 *= windEffect_low; - N1 *= windEffect_low; - - N0.r += (ddx + ddx1 + ddx2 + ddx3); - N0.g += (ddy + ddy1 + ddy2 + ddy3); - - N = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness); - - if (normalmap_dds > 0) - {N = -N;} //dds fix - - - - - - specular_light = gl_Color.rgb * earthShade; - - - vec3 specular_color = vec3(specular_light) - * pow(max(0.0, dot(N, Hv)), water_shininess) * 6.0; - - // secondary reflection of sky irradiance - - vec3 ER = E - 2.0 * N * dot(E,N); - float ctrefl = dot(vec3(0.0,0.0,1.0), -normalize(ER)); - //float fresnel = -0.5 + 8.0 * (1.0-smoothstep(0.0,0.4, dot(E,N))); - float fresnel = 8.0 * (1.0-smoothstep(0.0,0.4, dot(E,N))); - //specular_color += (ctrefl*ctrefl) * fresnel* specular_light.rgb; - - specular_color += ((0.15*(1.0-ctrefl* ctrefl) * fresnel) - 0.3) * specular_light.rgb; - - - - vec4 specular = vec4(specular_color, 0.5); - - specular = specular * saturation * 0.3 * earthShade ; - - //calculate fresnel - vec4 invfres = vec4( dot(vNorm, viewt) ); - vec4 fres = vec4(1.0) + invfres; - refl *= fres; - - - - vec4 ambient_light; - //intensity = length(specular_light.rgb); - ambient_light.rgb = max(specular_light.rgb, vec3(0.05, 0.05, 0.05)); - //ambient_light.rgb = max(intensity * normalize(vec3 (0.33, 0.4, 0.5)), vec3 (0.1,0.1,0.1)); - ambient_light.a = 1.0; - - - vec4 finalColor; - - - - finalColor = refl + specular * smoothstep(0.3, 0.6, ground_scattering); - - //add foam - vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 25.0); - - if (dist < 10000.0) - { - float foamSlope = 0.10 + 0.1 * windScale; - float waveSlope = N.g; - - if (windEffect >= 8.0) - if (waveSlope >= foamSlope){ - finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.50, N.g)); - } - } - - - - finalColor *= ambient_light; - - - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; -float mvisibility = min(visibility,avisibility); - - -if (dist > 0.04 * mvisibility) -{ - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - -// angle with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - - -if (visibility < avisibility) - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 -effective_scattering); - - } -else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 -effective_scattering); - } - - -transmission = fog_func(transmission_arg, eye_alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) {eqColorFactor = 0.2;} - - -float lightArg = (terminator-yprime_alt)/100000.0; -vec3 hazeColor = get_hazeColor(lightArg); - - -// now dim the light for haze -float eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - -// Mie-like factor - -if (lightArg < 10.0) - {intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -// high altitude desaturation of the haze color - -intensity = length(hazeColor); - - -if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColor doesn't come out correctly - { - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, eye_alt))); - - // blue hue of haze - - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - - - // additional blue in indirect light - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - // change haze color to blue hue for strong fogging - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - } - - // don't let the light fade out too rapidly - lightArg = (terminator + 200000.0)/100000.0; - float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); - vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - - hazeColor *= eqColorFactor * eShade; - hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - - - finalColor.rgb = mix(hazeColor, finalColor.rgb,transmission); - - - } - - finalColor.rgb = filter_combined(finalColor.rgb); - - gl_FragColor = finalColor; - // logarithmic depth - gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; -} diff --git a/Compositor/Shaders/ALS/water-high.frag b/Compositor/Shaders/ALS/water-high.frag deleted file mode 100644 index d850d7c96..000000000 --- a/Compositor/Shaders/ALS/water-high.frag +++ /dev/null @@ -1,748 +0,0 @@ -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// © Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// © Emilian Huminiuc and Vivian Meazza -// ported to ALS Thorsten Renk 2012 - -#version 120 - -uniform float fg_Fcoef; - -uniform sampler2D water_normalmap; -uniform sampler2D water_dudvmap; -uniform sampler2D sea_foam; -uniform sampler2D perlin_normalmap; -uniform sampler2D ice_texture; -uniform sampler2D topo_map; - - -uniform float saturation, Overcast, WindE, WindN; -uniform float osg_SimulationTime; - -varying vec4 waterTex1; //moving texcoords -varying vec4 waterTex2; //moving texcoords -varying vec4 waterTex4; //viewts -varying vec3 viewerdir; -varying vec3 lightdir; -varying vec3 relPos; -varying vec3 rawPos; -varying vec2 TopoUV; - - -varying float earthShade; -varying float yprime_alt; -varying float mie_angle; -varying float steepness; - -varying float flogz; - -uniform float WaveFreq ; -uniform float WaveAmp ; -uniform float WaveSharp ; -uniform float WaveAngle ; -uniform float WaveFactor ; -uniform float WaveDAngle ; -uniform float normalmap_dds; - - -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float scattering; -uniform float ground_scattering; -uniform float cloud_self_shading; -uniform float eye_alt; -uniform float fogstructure; -uniform float ice_cover; -uniform float sea_r; -uniform float sea_g; -uniform float sea_b; -uniform float air_pollution; -uniform float landing_light1_offset; -uniform float landing_light2_offset; -uniform float landing_light3_offset; - -uniform float wash_x; -uniform float wash_y; -uniform float wash_strength; - -uniform int quality_level; -uniform int tquality_level; -uniform int ocean_flag; -uniform int cloud_shadow_flag; -uniform int use_searchlight; -uniform int use_landing_light; -uniform int use_alt_landing_light; - -vec3 specular_light; - - -const float terminator_width = 200000.0; -const float EarthRadius = 5800000.0; - -////included functions ///// - -float Noise3D(in vec3 coord, in float wavelength); -float Noise2D(in vec2 coord, in float wavelength); -float shadow_func (in float x, in float y, in float noise, in float dist); -float fog_func (in float targ, in float alt); -float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt); -float alt_factor(in float eye_alt, in float vertex_alt); -float light_distance_fading(in float dist); -float fog_backscatter(in float avisibility); - -vec3 rayleigh_out_shift(in vec3 color, in float outscatter); -vec3 get_hazeColor(in float light_arg); -vec3 searchlight(); -vec3 landing_light(in float offset, in float offsetv); -vec3 filter_combined (in vec3 color) ; - - -////////////////////// - -/////// functions ///////// - - -void rotationmatrix(in float angle, out mat4 rotmat) - { - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); - } - -// wave functions /////////////////////// - -struct Wave { - float freq; // 2*PI / wavelength - float amp; // amplitude - float phase; // speed * 2*PI / wavelength - vec2 dir; - }; - -Wave wave0 = Wave(1.0, 1.0, 0.5, vec2(0.97, 0.25)); -Wave wave1 = Wave(2.0, 0.5, 1.3, vec2(0.97, -0.25)); -Wave wave2 = Wave(1.0, 1.0, 0.6, vec2(0.95, -0.3)); -Wave wave3 = Wave(2.0, 0.5, 1.4, vec2(0.99, 0.1)); - - - - -float evaluateWave(in Wave w, vec2 pos, float t) - { - return w.amp * sin( dot(w.dir, pos) * w.freq + t * w.phase); - } - -// derivative of wave function -float evaluateWaveDeriv(Wave w, vec2 pos, float t) - { - return w.freq * w.amp * cos( dot(w.dir, pos)*w.freq + t*w.phase); - } - -// sharp wave functions -float evaluateWaveSharp(Wave w, vec2 pos, float t, float k) - { - return w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k); - } - -float evaluateWaveDerivSharp(Wave w, vec2 pos, float t, float k) - { - return k*w.freq*w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k - 1) * cos( dot(w.dir, pos)*w.freq + t*w.phase); - } - -void sumWaves(float angle, float dangle, float windScale, float factor, out float ddx, float ddy) - { - mat4 RotationMatrix; - float deriv; - vec4 P = waterTex1 * 1024; - - rotationmatrix(radians(angle + dangle * windScale + 0.6 * sin(P.x * factor)), RotationMatrix); - P *= RotationMatrix; - - P.y += evaluateWave(wave0, P.xz, osg_SimulationTime); - deriv = evaluateWaveDeriv(wave0, P.xz, osg_SimulationTime ); - ddx = deriv * wave0.dir.x; - ddy = deriv * wave0.dir.y; - - P.y += evaluateWave(wave1, P.xz, osg_SimulationTime); - deriv = evaluateWaveDeriv(wave1, P.xz, osg_SimulationTime); - ddx += deriv * wave1.dir.x; - ddy += deriv * wave1.dir.y; - - P.y += evaluateWaveSharp(wave2, P.xz, osg_SimulationTime, WaveSharp); - deriv = evaluateWaveDerivSharp(wave2, P.xz, osg_SimulationTime, WaveSharp); - ddx += deriv * wave2.dir.x; - ddy += deriv * wave2.dir.y; - - P.y += evaluateWaveSharp(wave3, P.xz, osg_SimulationTime, WaveSharp); - deriv = evaluateWaveDerivSharp(wave3, P.xz, osg_SimulationTime, WaveSharp); - ddx += deriv * wave3.dir.x; - ddy += deriv * wave3.dir.y; - } - - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -x = x - 0.5; - -// use the asymptotics to shorten computations -if (x > 30.0) {return e;} -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -// this determines how light is attenuated in the distance -// physically this should be exp(-arg) but for technical reasons we use a sharper cutoff -// for distance > visibility - - - -void main(void) - { - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - float effective_scattering = min(scattering, cloud_self_shading); - - float dist = length(relPos); - const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005); - const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02); - const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25); - - float noise_50m = Noise3D(rawPos.xyz, 50.0); - float noise_250m = Noise3D(rawPos.xyz,250.0); - float noise_500m = Noise3D(rawPos.xyz,500.0); - float noise_1500m = Noise3D(rawPos.xyz,1500.0); - float noise_2000m = Noise3D(rawPos.xyz,2000.0); - float noise_2500m = Noise3D(rawPos.xyz, 2500.0); - - // get depth map - vec4 topoTexel = texture2D(topo_map, TopoUV); - float floorMixFactor = smoothstep(0.3, 0.985, topoTexel.a); - vec3 floorColour = topoTexel.rgb; - - mat4 RotationMatrix; - - // compute direction to viewer - vec3 E = normalize(viewerdir); - - // compute direction to light source - vec3 L = lightdir; // normalize(lightdir); - - // half vector - vec3 Hv = normalize(L + E); - - //vec3 Normal = normalize(normal); - vec3 Normal = vec3 (0.0, 0.0, 1.0); - - const float water_shininess = 240.0; - - // approximate cloud cover - //float cover = 0.0; - //bool Status = true; - - float windEffect = sqrt( WindE*WindE + WindN*WindN ) * 0.6; //wind speed in kt - float windScale = 15.0/(3.0 + windEffect); //wave scale - float windEffect_low = 0.3 + 0.7 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter - float waveRoughness = 0.01 + smoothstep(0.0, 40.0, windEffect); //wave roughness filter - - float mixFactor = 0.2 + 0.02 * smoothstep(0.0, 50.0, windEffect); - //mixFactor = 0.2; - mixFactor = clamp(mixFactor, 0.3, 0.8); - - // there's no need to do wave patterns or foam for pixels which are so far away that we can't actually see them - // we only need detail in the near zone or where the sun reflection is - - int detail_flag; - if ((dist > 15000.0) && (dot(normalize(vec3 (lightdir.x, lightdir.y, 0.0) ), normalize(relPos)) < 0.7 )) {detail_flag = 0;} - else {detail_flag = 1;} - - //detail_flag = 1; - - // sine waves - float ddx, ddx1, ddx2, ddx3, ddy, ddy1, ddy2, ddy3; - float angle; - - ddx = 0.0, ddy = 0.0; - ddx1 = 0.0, ddy1 = 0.0; - ddx2 = 0.0, ddy2 = 0.0; - ddx3 = 0.0, ddy3 = 0.0; - - if (detail_flag == 1) - { - angle = 0.0; - - wave0.freq = WaveFreq ; - wave0.amp = WaveAmp; - wave0.dir = vec2 (0.0, 1.0); //vec2(cos(radians(angle)), sin(radians(angle))); - - angle -= 45; - wave1.freq = WaveFreq * 2.0 ; - wave1.amp = WaveAmp * 1.25; - wave1.dir = vec2(0.70710, -0.7071); //vec2(cos(radians(angle)), sin(radians(angle))); - - angle += 30; - wave2.freq = WaveFreq * 3.5; - wave2.amp = WaveAmp * 0.75; - wave2.dir = vec2(0.96592, -0.2588);// vec2(cos(radians(angle)), sin(radians(angle))); - - angle -= 50; - wave3.freq = WaveFreq * 3.0 ; - wave3.amp = WaveAmp * 0.75; - wave3.dir = vec2(0.42261, -0.9063); //vec2(cos(radians(angle)), sin(radians(angle))); - - // sum waves - - - sumWaves(WaveAngle, -1.5, windScale, WaveFactor, ddx, ddy); - sumWaves(WaveAngle, 1.5, windScale, WaveFactor, ddx1, ddy1); - - //reset the waves - angle = 0.0; - float waveamp = WaveAmp * 0.75; - - wave0.freq = WaveFreq ; - wave0.amp = waveamp; - wave0.dir = vec2 (0.0, 1.0); //vec2(cos(radians(angle)), sin(radians(angle))); - - angle -= 20; - wave1.freq = WaveFreq * 2.0 ; - wave1.amp = waveamp * 1.25; - wave1.dir = vec2(0.93969, -0.34202);// vec2(cos(radians(angle)), sin(radians(angle))); - - angle += 35; - wave2.freq = WaveFreq * 3.5; - wave2.amp = waveamp * 0.75; - wave2.dir = vec2(0.965925, 0.25881); //vec2(cos(radians(angle)), sin(radians(angle))); - - angle -= 45; - wave3.freq = WaveFreq * 3.0 ; - wave3.amp = waveamp * 0.75; - wave3.dir = vec2(0.866025, -0.5); //vec2(cos(radians(angle)), sin(radians(angle))); - - - sumWaves(WaveAngle + WaveDAngle, -1.5, windScale, WaveFactor, ddx2, ddy2); - sumWaves(WaveAngle + WaveDAngle, 1.5, windScale, WaveFactor, ddx3, ddy3); - - } - // end sine stuff - - //cover = 5.0 * smoothstep(0.6, 1.0, scattering); - //cover = 5.0 * ground_scattering; - - vec4 viewt = normalize(waterTex4); - vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale) * 2.0 - 1.0; - vec4 vNorm; - - - //normalmaps - vec4 nmap = texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0; - vec4 nmap1 = texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0; - - rotationmatrix(radians(3.0 * sin(osg_SimulationTime * 0.0075)), RotationMatrix); - nmap += texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0; - nmap1 += texture2D(perlin_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0; - - nmap *= windEffect_low; - nmap1 *= windEffect_low; - - // mix water and noise, modulated by factor - vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness); - vNorm.r += ddx + ddx1 + ddx2 + ddx3; - - - if (normalmap_dds > 0) - {vNorm = -vNorm;} //dds fix - - vNorm = vNorm * (0.5 + 0.5 * noise_250m); - - //load reflection - - vec4 refl ; - - refl.r = sea_r; - refl.g = sea_g; - refl.b = sea_b; - refl.a = 1.0; - - refl.g = refl.g * (0.9 + 0.2* noise_2500m); - - - // the depth map works perfectly fine for both ocean and inland water texels - refl.rgb = mix(refl.rgb, 0.65* floorColour, floorMixFactor); - refl.rgb = refl.rgb * (0.5 + 0.5 * smoothstep(0.0,0.3,topoTexel.a)); - - - float intensity; - // de-saturate for reduced light - refl.rgb = mix(refl.rgb, vec3 (0.248, 0.248, 0.248), 1.0 - smoothstep(0.1, 0.8, ground_scattering)); - - // de-saturate light for overcast haze - intensity = length(refl.rgb); - refl.rgb = mix(refl.rgb, intensity * vec3 (1.0, 1.0, 1.0), 0.5 * smoothstep(0.1, 0.9, overcast)); - - vec3 N; - - - - - vec3 N0 = vec3(texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0); - vec3 N1 = vec3(texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca) * windScale) * 2.0 - 1.0); - - N0 += vec3(texture2D(water_normalmap, vec2(waterTex1 * tscale) * windScale) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2 * tscale) * windScale) * 2.0 - 1.0); - - - - rotationmatrix(radians(2.0 * sin(osg_SimulationTime * 0.005)), RotationMatrix); - N0 += vec3(texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale) * 2.0 - 1.0); - - rotationmatrix(radians(-4.0 * sin(osg_SimulationTime * 0.003)), RotationMatrix); - N0 += vec3(texture2D(water_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca) * windScale) * 2.0 - 1.0); - - - N0 *= windEffect_low; - N1 *= windEffect_low; - - N0.r += (ddx + ddx1 + ddx2 + ddx3); - N0.g += (ddy + ddy1 + ddy2 + ddy3); - - N = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness); - - if (normalmap_dds > 0) - {N = -N;} //dds fix - - // primary reflection of the sun - specular_light = gl_Color.rgb * earthShade; - - - vec3 specular_color = vec3(specular_light) - * pow(max(0.0, dot(N, Hv)), water_shininess) * 6.0; - - // secondary reflection of sky irradiance - - vec3 ER = E - 2.0 * N * dot(E,N); - float ctrefl = dot(vec3(0.0,0.0,1.0), -normalize(ER)); - //float fresnel = -0.5 + 8.0 * (1.0-smoothstep(0.0,0.4, dot(E,N))); - float fresnel = 8.0 * (1.0-smoothstep(0.0,0.4, dot(E,N))); - //specular_color += (ctrefl*ctrefl) * fresnel* specular_light.rgb; - - specular_color += ((0.15*(1.0-ctrefl* ctrefl) * fresnel) - 0.3) * specular_light.rgb; - - - vec4 specular = vec4(specular_color, 0.5); - - specular = specular * saturation * 0.3 * earthShade ; - - //calculate fresnel - vec4 invfres = vec4( dot(vNorm, viewt) ); - vec4 fres = vec4(1.0) + invfres; - refl *= fres; - - - - vec4 ambient_light; - //intensity = length(specular_light.rgb); - ambient_light.rgb = max(specular_light.rgb, vec3(0.05, 0.05, 0.05)); - //ambient_light.rgb = max(intensity * normalize(vec3 (0.33, 0.4, 0.5)), vec3 (0.1,0.1,0.1)); - ambient_light.a = 1.0; - - - vec4 finalColor; - - // compute cloud shadow effect - - float shadowValue; - if (cloud_shadow_flag == 1) - { - shadowValue = shadow_func(relPos.x, relPos.y, 0.3 * noise_250m + 0.5 * noise_500m+0.2 * noise_1500m, dist); - specular = specular * shadowValue; - refl = refl * (0.7 + 0.3 *shadowValue); - } - - // compute secondary light effect - - - vec3 secondary_light = vec3 (0.0,0.0,0.0); - - if ((quality_level >5)&&(tquality_level > 5)) - { - if (use_searchlight == 1) - { - secondary_light += searchlight(); - } - if (use_landing_light == 1) - { - secondary_light += landing_light(landing_light1_offset, landing_light3_offset); - } - if (use_alt_landing_light == 1) - { - secondary_light += landing_light(landing_light2_offset, landing_light3_offset); - } - } - - - - finalColor = refl + specular * smoothstep(0.3, 0.6, ground_scattering) + vec4 (secondary_light, 0.0) * light_distance_fading(dist) * 2.0 * pow(max(0.0,dot(E,N)), water_shininess); - - finalColor = clamp(finalColor, 0.0,1.0); - - //add foam - vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 25.0); - - - if (dist < 10000.0) - { - float foamSlope = 0.10 + 0.1 * windScale; - - // rotor wash - vec2 washDir = vec2 (wash_x, wash_y) - relPos.xy; - - float washDist = length(washDir); - float washStrength = 3.0 * min(14.0 * wash_strength/(washDist + 1.0), 1.0); - - float timeFact = sin(-30.0 * osg_SimulationTime + 1.5 * washDist + dot(normalize(washDir), vec2(1.0, 0.0))); - - float noiseFact = 0.5 * Noise2D(vec2 (relPos.x + 30.0 * osg_SimulationTime, relPos.y), 1.1); - noiseFact+= 0.5 * Noise2D(vec2 (relPos.x - 31.0 *osg_SimulationTime, relPos.y ), 1.0); - - washStrength *= (0.5 + (0.3 * noiseFact) + (0.2 * noiseFact * clamp(timeFact, -0.2, 1.0))); - //washStrength *= (0.5 + (0.3 * noiseFact * clamp(timeFact, -0.2, 1.0))); - - float waveSlope = N.g; - float surfFact = 0.0; - surfFact += washStrength; - - - if ((windEffect >= 8.0) || (steepness < 0.999) || (topoTexel.a > 0.98) || (washStrength > 0.5)) - { - if ((waveSlope > 0.0) && (ocean_flag ==1)) - { - surfFact = surfFact +(1.0 -smoothstep(0.97,1.0,steepness)); - surfFact += 0.5 * smoothstep(0.98,1.0,topoTexel.a); - - } - waveSlope = waveSlope + 2.0 * surfFact; - - - if (waveSlope >= foamSlope){ - finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.50, N.g+0.2 * surfFact)); - } - } - } - - - - // add ice - vec4 ice_texel = texture2D(ice_texture, vec2(waterTex2) * 0.2 ); - - float nSum = 0.5 * (noise_250m + noise_50m); - float mix_factor = smoothstep(1.0 - ice_cover, 1.04-ice_cover, nSum); - finalColor = mix(finalColor, ice_texel, mix_factor * ice_texel.a); - finalColor.a = 1.0; - - - - - - - finalColor *= vec4 (ambient_light.rgb + secondary_light * light_distance_fading(dist), ambient_light.a); - - float lightArg = (terminator-yprime_alt)/100000.0; - vec3 hazeColor = get_hazeColor(lightArg); ; - - - -// Rayleigh color shift due to out-scattering - - float rayleigh_length; - float outscatter; - - if ((quality_level > 5) && (tquality_level > 5)) - { - rayleigh_length = 0.4 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z); - outscatter = 1.0-exp(-dist/rayleigh_length); - finalColor.rgb = rayleigh_out_shift(finalColor.rgb,outscatter); - } - -// Rayleigh color shift due to in-scattering - - if ((quality_level > 5) && (tquality_level > 5)) - { - float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt+420000.0); - //float lightIntensity = length(gl_Color.rgb* gl_FrontMaterial.diffuse.rgb)/1.73 * rShade; - float lightIntensity = length(hazeColor * effective_scattering) * rShade; - vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity; - float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z); - finalColor.rgb = mix(finalColor.rgb, rayleighColor, rayleighStrength); - } - - -// here comes the terrain haze model - - -float delta_z = hazeLayerAltitude - eye_alt; -float mvisibility = min(visibility,avisibility); - -if (dist > 0.04 * mvisibility) -{ - - -float transmission; -float vAltitude; -float delta_zv; -float H; -float distance_in_layer; -float transmission_arg; - - -// angle with horizon -float ct = dot(vec3(0.0, 0.0, 1.0), relPos)/dist; - - -// we solve the geometry what part of the light path is attenuated normally and what is through the haze layer - -if (delta_z > 0.0) // we're inside the layer - { - if (ct < 0.0) // we look down - { - distance_in_layer = dist; - vAltitude = min(distance_in_layer,mvisibility) * ct; - delta_zv = delta_z - vAltitude; - } - else // we may look through upper layer edge - { - H = dist * ct; - if (H > delta_z) {distance_in_layer = dist/H * delta_z;} - else {distance_in_layer = dist;} - vAltitude = min(distance_in_layer,visibility) * ct; - delta_zv = delta_z - vAltitude; - } - } - else // we see the layer from above, delta_z < 0.0 - { - H = dist * -ct; - if (H < (-delta_z)) // we don't see into the layer at all, aloft visibility is the only fading - { - distance_in_layer = 0.0; - delta_zv = 0.0; - } - else - { - vAltitude = H + delta_z; - distance_in_layer = vAltitude/H * dist; - vAltitude = min(distance_in_layer,visibility) * (-ct); - delta_zv = vAltitude; - } - } - - -// ground haze cannot be thinner than aloft visibility in the model, -// so we need to use aloft visibility otherwise - - -transmission_arg = (dist-distance_in_layer)/avisibility; - - -float eqColorFactor; - -if (visibility < avisibility) - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility + 1.0 * visibility * fogstructure * 0.06 * (noise_1500m + noise_2000m -1.0) )); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/visibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0 -effective_scattering); - } -else - { - if (quality_level > 3) - { - transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility + 1.0 * avisibility * fogstructure * 0.06 * (noise_1500m + noise_2000m - 1.0) )); - } - else - { - transmission_arg = transmission_arg + (distance_in_layer/avisibility); - } - // this combines the Weber-Fechner intensity - eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 -effective_scattering); - } - - -transmission = fog_func(transmission_arg, eye_alt); - -// there's always residual intensity, we should never be driven to zero -if (eqColorFactor < 0.2) eqColorFactor = 0.2; - - - - -// now dim the light for haze -float eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt); - -// Mie-like factor - -if (lightArg < 10.0) - {intensity = length(hazeColor); - float mie_magnitude = 0.5 * smoothstep(350000.0, 150000.0, terminator-sqrt(2.0 * EarthRadius * terrain_alt)); - hazeColor = intensity * ((1.0 - mie_magnitude) + mie_magnitude * mie_angle) * normalize(mix(hazeColor, vec3 (0.5, 0.58, 0.65), mie_magnitude * (0.5 - 0.5 * mie_angle)) ); - } - -// high altitude desaturation of the haze color - -intensity = length(hazeColor); - - -if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColor doesn't come out correctly - { - hazeColor = intensity * normalize (mix(hazeColor, intensity * vec3 (1.0,1.0,1.0), 0.7* smoothstep(5000.0, 50000.0, eye_alt))); - - // blue hue of haze - - hazeColor.x = hazeColor.x * 0.83; - hazeColor.y = hazeColor.y * 0.9; - - - // additional blue in indirect light - float fade_out = max(0.65 - 0.3 *overcast, 0.45); - intensity = length(hazeColor); - hazeColor = intensity * normalize(mix(hazeColor, 1.5* shadedFogColor, 1.0 -smoothstep(0.25, fade_out,eShade) )); - - // change haze color to blue hue for strong fogging - hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor)))); - } - - - // don't let the light fade out too rapidly - lightArg = (terminator + 200000.0)/100000.0; - float minLightIntensity = min(0.2,0.16 * lightArg + 0.5); - vec3 minLight = minLightIntensity * vec3 (0.2, 0.3, 0.4); - - hazeColor *= eqColorFactor * eShade; - hazeColor.rgb = max(hazeColor.rgb, minLight.rgb); - - finalColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility), finalColor.rgb,transmission); - } - -finalColor.rgb = filter_combined(finalColor.rgb); - - - -gl_FragColor = finalColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; - -} diff --git a/Compositor/Shaders/ALS/water.vert b/Compositor/Shaders/ALS/water.vert deleted file mode 100644 index 24ebfcb0e..000000000 --- a/Compositor/Shaders/ALS/water.vert +++ /dev/null @@ -1,299 +0,0 @@ -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// © Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// © Emilian Huminiuc and Vivian Meazza - -#version 120 - -varying float flogz; - -varying vec4 waterTex1; -varying vec4 waterTex2; -varying vec4 waterTex4; -varying vec3 relPos; -varying vec3 rawPos; -varying vec2 TopoUV; - -varying vec3 viewerdir; -varying vec3 lightdir; -varying float steepness; - - -varying float earthShade; -varying float yprime_alt; -varying float mie_angle; - -uniform float osg_SimulationTime; -uniform float WindE, WindN; -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; - -uniform int ocean_flag; - -uniform mat4 osg_ViewMatrixInverse; - -// constants for the cartesian to geodetic conversion. - -const float a = 6378137.0; //float a = equRad; -const float squash = 0.9966471893352525192801545; -const float latAdjust = 0.9999074159800018; //geotiff source for the depth map -const float lonAdjust = 0.9999537058469516; //actual extents: +-180.008333333333326/+-90.008333333333340 - - -vec3 specular_light; - -// This is the value used in the skydome scattering shader - use the same here for consistency? -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ -//x = x - 0.5; - -// use the asymptotics to shorten computations -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - - -////fog "include"//////// -// uniform int fogType; -// -// void fog_Func(int type); -///////////////////////// - -/////// functions ///////// - -void rotationmatrix(in float angle, out mat4 rotmat) -{ - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); -} - -void main(void) -{ - - mat4 RotationMatrix; - - - vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); - rawPos = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex).xyz; - - vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - - viewerdir = vec3(gl_ModelViewMatrixInverse[3]) - vec3(gl_Vertex); - lightdir = normalize(vec3(gl_ModelViewMatrixInverse * gl_LightSource[0].position)); - if (ocean_flag == 1) - {steepness = dot(normalize(gl_Normal), vec3 (0.0, 0.0, 1.0));} - else - {steepness = 0.0;} - - - waterTex4 = vec4( ecPosition.xzy, 0.0 ); - - vec4 t1 = vec4(0.0, osg_SimulationTime * 0.005217, 0.0, 0.0); - vec4 t2 = vec4(0.0, osg_SimulationTime * -0.0012, 0.0, 0.0); - - float Angle; - - float windFactor = sqrt(WindE * WindE + WindN * WindN) * 0.05; - if (WindN == 0.0 && WindE == 0.0) { - Angle = 0.0; - }else{ - Angle = atan(-WindN, WindE) - atan(1.0); - } - - rotationmatrix(Angle, RotationMatrix); - waterTex1 = gl_MultiTexCoord0 * RotationMatrix - t1 * windFactor; - - rotationmatrix(Angle, RotationMatrix); - waterTex2 = gl_MultiTexCoord0 * RotationMatrix - t2 * windFactor; - -// fog_Func(fogType); - gl_Position = ftransform(); - // logarithmic depth - flogz = 1.0 + gl_Position.w; - - -// here start computations for the haze layer - - - float yprime; - float lightArg; - float intensity; - float vertex_alt; - float scattering; - - // we need several geometrical quantities - - // first current altitude of eye position in model space - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - - // and relative position to vector - relPos = gl_Vertex.xyz - ep.xyz; - - // unfortunately, we need the distance in the vertex shader, although the more accurate version - // is later computed in the fragment shader again - float dist = length(relPos); - - -// altitude of the vertex in question, somehow zero leads to artefacts, so ensure it is at least 100m - vertex_alt = max(gl_Vertex.z,100.0); - scattering = 0.5 + 0.5 * ground_scattering + 0.5* (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - - // branch dependent on daytime - -if (terminator < 1000000.0) // the full, sunrise and sunset computation -{ - - - // establish coordinates relative to sun position - - //vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - //vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - vec3 lightHorizon = normalize(vec3(lightdir.x,lightdir.y, 0.0)); - - - // yprime is the distance of the vertex into sun direction - yprime = -dot(relPos, lightHorizon); - - // this gets an altitude correction, higher terrain gets to see the sun earlier - yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - - // two times terminator width governs how quickly light fades into shadow - // now the light-dimming factor - earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - - // parametrized version of the Flightgear ground lighting function - lightArg = (terminator-yprime_alt)/100000.0; - - specular_light.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - specular_light.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - specular_light.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - - specular_light = max(specular_light * scattering, vec3 (0.05, 0.05, 0.05)); - - intensity = length(specular_light.rgb); - specular_light.rgb = intensity * normalize(mix(specular_light.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.6,ground_scattering) )); - - specular_light.rgb = intensity * normalize(mix(specular_light.rgb, shadedFogColor, 1.0 -smoothstep(0.5, 0.7,earthShade))); - - // correct ambient light intensity and hue before sunrise - seems unnecessary and create artefacts though... - //if (earthShade < 0.5) - //{ - //specular_light.rgb = intensity * normalize(mix(specular_light.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.7,earthShade) )); - //} - - // directional scattering for low sun - if (lightArg < 10.0) - {mie_angle = (0.5 * dot(normalize(relPos), lightdir) ) + 0.5;} - else - {mie_angle = 1.0;} - - - - - -// the haze gets the light at the altitude of the haze top if the vertex in view is below -// but the light at the vertex if the vertex is above - -vertex_alt = max(vertex_alt,hazeLayerAltitude); - -if (vertex_alt > hazeLayerAltitude) - { - if (dist > 0.8 * avisibility) - { - vertex_alt = mix(vertex_alt, hazeLayerAltitude, smoothstep(0.8*avisibility, avisibility, dist)); - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - } -else - { - vertex_alt = hazeLayerAltitude; - yprime_alt = yprime -sqrt(2.0 * EarthRadius * vertex_alt); - } - -} -else // the faster, full-day version without lightfields -{ - //vertex_alt = max(gl_Vertex.z,100.0); - - earthShade = 1.0; - mie_angle = 1.0; - - if (terminator > 3000000.0) - {specular_light = vec3 (1.0, 1.0, 1.0);} - else - { - - lightArg = (terminator/100000.0 - 10.0)/20.0; - specular_light.b = 0.78 + lightArg * 0.21; - specular_light.g = 0.907 + lightArg * 0.091; - specular_light.r = 0.904 + lightArg * 0.092; - } - - specular_light = specular_light * scattering; - - float shade_depth = 1.0 * smoothstep (0.6,0.95,ground_scattering) * (1.0-smoothstep(0.1,0.5,overcast)) * smoothstep(0.4,1.5,earthShade); - - specular_light.rgb *= (1.0 + 1.2 * shade_depth); - - yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude); - -} - -// Geodesy lookup for depth map - float e2 = abs(1.0 - squash * squash); - float ra2 = 1.0/(a * a); - float e4 = e2 * e2; - float XXpYY = rawPos.x * rawPos.x + rawPos.y * rawPos.y; - float Z = rawPos.z; - float sqrtXXpYY = sqrt(XXpYY); - float p = XXpYY * ra2; - float q = Z*Z*(1.0-e2)*ra2; - float r = 1.0/6.0*(p + q - e4); - float s = e4 * p * q/(4.0*r*r*r); - if ( s >= 2.0 && s <= 0.0) - s = 0.0; - float t = pow(1.0+s+sqrt(s*2.0+s*s), 1.0/3.0); - float u = r + r*t + r/t; - float v = sqrt(u*u + e4*q); - float w = (e2*u+ e2*v-e2*q)/(2.0*v); - float k = sqrt(u+v+w*w)-w; - float D = k*sqrtXXpYY/(k+e2); - - vec2 NormPosXY = normalize(rawPos.xy); - vec2 NormPosXZ = normalize(vec2(D, rawPos.z)); - float signS = sign(rawPos.y); - if (-0.00015 <= rawPos.y && rawPos.y<=.00015) - signS = 1.0; - float signT = sign(rawPos.z); - if (-0.0002 <= rawPos.z && rawPos.z<=.0002) - signT = 1.0; - float cosLon = dot(NormPosXY, vec2(1.0,0.0)); - float cosLat = dot(abs(NormPosXZ), vec2(1.0,0.0)); - TopoUV.s = signS * lonAdjust * degrees(acos(cosLon))/180.; - TopoUV.t = signT * latAdjust * degrees(acos(cosLat))/90.; - TopoUV.s = TopoUV.s * 0.5 + 0.5; - TopoUV.t = TopoUV.t * 0.5 + 0.5; - -// - - - - -gl_FrontColor.rgb = specular_light; -gl_BackColor.rgb = gl_FrontColor.rgb; - - -} diff --git a/Compositor/Shaders/Default/3dcloud.frag b/Compositor/Shaders/Default/3dcloud.frag deleted file mode 100644 index 728c8cf92..000000000 --- a/Compositor/Shaders/Default/3dcloud.frag +++ /dev/null @@ -1,17 +0,0 @@ -#version 120 - -uniform sampler2D baseTexture; -varying float fogFactor; -varying vec4 cloudColor; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - if (base.a < 0.02) - discard; - - vec4 finalColor = base * cloudColor; - gl_FragColor.rgb = mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor ); - gl_FragColor.a = finalColor.a; -} - diff --git a/Compositor/Shaders/Default/3dcloud.vert b/Compositor/Shaders/Default/3dcloud.vert deleted file mode 100644 index 28455e34c..000000000 --- a/Compositor/Shaders/Default/3dcloud.vert +++ /dev/null @@ -1,90 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; -varying vec4 cloudColor; - -uniform float range; // From /sim/rendering/clouds3d-vis-range -uniform float detail_range; // From /sim/rendering/clouds3d_detail-range - -attribute vec3 usrAttr1; -attribute vec3 usrAttr2; - -float shade_factor = usrAttr1.g; -float cloud_height = usrAttr1.b; -float bottom_factor = usrAttr2.r; -float middle_factor = usrAttr2.g; -float top_factor = usrAttr2.b; - -void main(void) -{ - gl_TexCoord[0] = gl_MultiTexCoord0; - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - // Find a rotation matrix that rotates 1,0,0 into u. u, r and w are - // the columns of that matrix. - vec3 absu = abs(u); - vec3 r = normalize(vec3(-u.y, u.x, 0.0)); - vec3 w = cross(u, r); - - // Do the matrix multiplication by [ u r w pos]. Assume no - // scaling in the homogeneous component of pos. - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.xyz = gl_Vertex.x * u; - gl_Position.xyz += gl_Vertex.y * r; - gl_Position.xyz += gl_Vertex.z * w; - // Apply Z scaling to allow sprites to be squashed in the z-axis - gl_Position.z = gl_Position.z * gl_Color.w; - - // Now shift the sprite to the correct position in the cloud. - gl_Position.xyz += gl_Color.xyz; - - // Determine the position - used for fog and shading calculations - float fogCoord = length(vec3(gl_ModelViewMatrix * vec4(gl_Color.x, gl_Color.y, gl_Color.z, 1.0))); - float center_dist = length(vec3(gl_ModelViewMatrix * vec4(0.0,0.0,0.0,1.0))); - - if ((fogCoord > detail_range) && (fogCoord > center_dist) && (shade_factor < 0.7)) { - // More than detail_range away, so discard all sprites on opposite side of - // cloud center by shifting them beyond the view fustrum - gl_Position = vec4(0.0,0.0,10.0,1.0); - cloudColor = vec4(0.0); - } else { - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(vec3(gl_ModelViewMatrix * vec4(- gl_Position.x, - gl_Position.y, - gl_Position.z, 0.0)))); - - // Determine the shading of the vertex. We shade it based on it's position - // in the cloud relative to the sun, and it's vertical position in the cloud. - float shade = mix(shade_factor, top_factor, smoothstep(-0.3, 0.3, n)); - //if (n < 0) { - // shade = mix(top_factor, shade_factor, abs(n)); - //} - - if (gl_Position.z < 0.5 * cloud_height) { - shade = min(shade, mix(bottom_factor, middle_factor, gl_Position.z * 2.0 / cloud_height)); - } else { - shade = min(shade, mix(middle_factor, top_factor, gl_Position.z * 2.0 / cloud_height - 1.0)); - } - - // Final position of the sprite - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - cloudColor = gl_LightSource[0].diffuse * shade + gl_FrontLightModelProduct.sceneColor; - - if ((fogCoord > (0.9 * detail_range)) && (fogCoord > center_dist) && (shade_factor < 0.7)) { - // cloudlet is almost at the detail range, so fade it out. - cloudColor.a = 1.0 - smoothstep(0.9 * detail_range, detail_range, fogCoord); - } else { - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - cloudColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(0.9 * range, range, fogCoord)); - } - - //gl_BackColor = cloudColor; - - // Fog doesn't affect clouds as much as other objects. - fogFactor = exp( -gl_Fog.density * fogCoord * 0.5); - fogFactor = clamp(fogFactor, 0.0, 1.0); - } -} diff --git a/Compositor/Shaders/Default/bowwave.frag b/Compositor/Shaders/Default/bowwave.frag deleted file mode 100644 index f25e0b082..000000000 --- a/Compositor/Shaders/Default/bowwave.frag +++ /dev/null @@ -1,217 +0,0 @@ -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// © Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// © Emilian Huminiuc and Vivian Meazza -// Optimisation - 2012-5-05 -// © Emilian Huminiuc and Vivian Meazza - -#version 120 -#define fps2kts 0.5925 - -uniform sampler2D water_normalmap; -uniform sampler2D water_reflection; -uniform sampler2D water_dudvmap; -uniform sampler2D water_reflection_grey; -uniform sampler2D sea_foam; -uniform sampler2D alpha_tex; -uniform sampler2D bowwave_nmap; - -uniform float saturation, Overcast, WindE, WindN, spd, hdg; -uniform float CloudCover0, CloudCover1, CloudCover2, CloudCover3, CloudCover4; -uniform int Status; - -varying vec4 waterTex1; //moving texcoords -varying vec4 waterTex2; //moving texcoords -varying vec3 viewerdir; -varying vec3 lightdir; -varying vec3 normal; - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -/////// functions ///////// - -float normalize_range(float _val) - { - if (_val > 180.0) - return _val - 360.0; - else - return _val; - } - - -void relWind(out float rel_wind_speed_kts, out float rel_wind_from_rad) - { - //calculate the carrier speed north and east in kts - float speed_north_kts = cos(radians(hdg)) * spd ; - float speed_east_kts = sin(radians(hdg)) * spd ; - - //calculate the relative wind speed north and east in kts - float rel_wind_speed_from_east_kts = WindE*fps2kts + speed_east_kts; - float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts; - - //combine relative speeds north and east to get relative windspeed in kts - rel_wind_speed_kts = sqrt(rel_wind_speed_from_east_kts*rel_wind_speed_from_east_kts - + rel_wind_speed_from_north_kts*rel_wind_speed_from_north_kts); - - //calculate the relative wind direction - float rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts)); - // rel_wind_from_rad = atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts); - float rel_wind = rel_wind_from_deg - hdg; - rel_wind = normalize_range(rel_wind); - rel_wind_from_rad = radians(rel_wind); - } - -void rotationmatrix(in float angle, out mat4 rotmat) - { - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); - } - -////////////////////// - -void main(void) - { - const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005); - const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02); - const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25); - - mat4 RotationMatrix; - - float relWindspd=0; - float relWinddir=0; - - // compute relative wind speed and direction - relWind (relWindspd, relWinddir); - - rotationmatrix(relWinddir, RotationMatrix); - - // compute direction to viewer - vec3 E = normalize(viewerdir); - - // compute direction to light source - vec3 L = normalize(lightdir); - - // half vector - vec3 H = normalize(L + E); - - const float water_shininess = 240.0; - // approximate cloud cover - float cover = 0.0; - //bool Status = true; - - float windEffect = relWindspd; //wind speed in kt - // float windEffect = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.6; //wind speed in kt - float windScale = 15.0/(5.0 + windEffect); //wave scale - float waveRoughness = 0.05 + smoothstep(0.0, 50.0, windEffect); //wave roughness filter - - - if (Status == 1){ - cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4); - } else { - // hack to allow for Overcast not to be set by Local Weather - - if (Overcast == 0){ - cover = 5; - } else { - cover = Overcast * 5; - } - - } - - //vec4 viewt = normalize(waterTex4); - vec4 viewt = vec4(-E, 0.0) * 0.6; - - vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale * 2.0) * 2.0 - 1.0; - vec4 dist = texture2D(water_dudvmap, vec2(waterTex1 + disdis*sca2)* windScale * 2.0) * 2.0 - 1.0; - vec4 fdist = normalize(dist); - fdist = -fdist; - fdist *= sca; - - //normalmap - rotationmatrix(-relWinddir, RotationMatrix); - - vec4 nmap0 = texture2D(water_normalmap, vec2((waterTex1 + disdis*sca2) * RotationMatrix ) * windScale * 2.0) * 2.0 - 1.0; - vec4 nmap2 = texture2D(water_normalmap, vec2(waterTex2 * tscale * RotationMatrix ) * windScale * 2.0) * 2.0 - 1.0; - vec4 nmap3 = texture2D(bowwave_nmap, gl_TexCoord[0].st) * 2.0 - 1.0; - vec4 vNorm = normalize(mix(nmap3, nmap0 + nmap2, 0.3 )* waveRoughness); - vNorm = -vNorm; - - //load reflection - vec4 tmp = vec4(lightdir, 0.0); - vec4 refTex = texture2D(water_reflection, vec2(tmp + waterTex1) * 32.0) ; - vec4 refTexGrey = texture2D(water_reflection_grey, vec2(tmp + waterTex1) * 32.0) ; - vec4 refl ; - // cover = 0; - - if(cover >= 1.5){ - refl= normalize(refTex); - } - else - { - refl = normalize(refTexGrey); - refl.r *= (0.75 + 0.15 * cover); - refl.g *= (0.80 + 0.15 * cover); - refl.b *= (0.875 + 0.125 * cover); - refl.a *= 1.0; - } - - vec3 N0 = vec3(texture2D(water_normalmap, vec2((waterTex1 + disdis*sca2)* RotationMatrix) * windScale * 2.0) * 2.0 - 1.0); - vec3 N1 = vec3(texture2D(water_normalmap, vec2(waterTex2 * tscale * RotationMatrix ) * windScale * 2.0) * 2.0 - 1.0); - vec3 N2 = vec3(texture2D(bowwave_nmap, gl_TexCoord[0].st)*2.0-1.0); - //vec3 Nf = normalize((normal+N0+N1)*waveRoughness); - vec3 N = normalize(mix(normal+N2, normal+N0+N1, 0.3)* waveRoughness); - N = -N; - - // specular - vec3 specular_color = vec3(gl_LightSource[0].diffuse) - * pow(max(0.0, dot(N, H)), water_shininess) * 6.0; - vec4 specular = vec4(specular_color, 0.5); - - specular = specular * saturation * 0.3; - - //calculate fresnel - vec4 invfres = vec4( dot(vNorm, viewt) ); - vec4 fres = vec4(1.0) + invfres; - refl *= fres; - - vec4 alpha0 = texture2D(alpha_tex, gl_TexCoord[0].st); - - //calculate final colour - vec4 ambient_light = gl_LightSource[0].diffuse; - vec4 finalColor; - - // cover = 0; - - if(cover >= 1.5){ - finalColor = refl + specular; - } else { - finalColor = refl; - } - - //add foam - - float foamSlope = 0.05 + 0.01 * windScale; - //float waveSlope = mix(N0.g, N1.g, 0.25); - - vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 50.0); - float waveSlope = N.g; - - if (windEffect >= 12.0) - if (waveSlope >= foamSlope){ - finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(foamSlope, 0.5, N.g)); - } - - //generate final colour - finalColor *= ambient_light+ alpha0 * 0.35; - finalColor.rgb = fog_Func(finalColor.rgb, fogType); - gl_FragColor = vec4(finalColor.rgb, alpha0.a * 1.35); - - } diff --git a/Compositor/Shaders/Default/building-default.vert b/Compositor/Shaders/Default/building-default.vert deleted file mode 100644 index 0079abdce..000000000 --- a/Compositor/Shaders/Default/building-default.vert +++ /dev/null @@ -1,135 +0,0 @@ -// -*-C++-*- - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -#version 120 -#extension GL_EXT_draw_instanced : enable -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -attribute vec3 instancePosition; // (x,y,z) -attribute vec3 instanceScale ; // (width, depth, height) -attribute vec3 attrib1; // Generic packed attributes -attribute vec3 attrib2; - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; - -uniform int colorMode; - -////fog "include"//////// -//uniform int fogType; -// -//void fog_Func(int type); -///////////////////////// - -const float c_precision = 128.0; -const float c_precisionp1 = c_precision + 1.0; - -vec3 float2vec(float value) { - vec3 val; - val.x = mod(value, c_precisionp1) / c_precision; - val.y = mod(floor(value / c_precisionp1), c_precisionp1) / c_precision; - val.z = floor(value / (c_precisionp1 * c_precisionp1)) / c_precision; - return val; -} - -void main() -{ - // Unpack generic attributes - vec3 attr1 = float2vec(attrib1.x); - vec3 attr2 = float2vec(attrib1.z); - vec3 attr3 = float2vec(attrib2.x); - - // Determine the rotation for the building. - float sr = sin(6.28 * attr1.x); - float cr = cos(6.28 * attr1.x); - - vec3 position = gl_Vertex.xyz; - // Adjust the very top of the roof to match the rooftop scaling. This shapes - // the rooftop - gambled, gabled etc. These vertices are identified by gl_Color.z - position.x = (1.0 - gl_Color.z) * position.x + gl_Color.z * ((position.x + 0.5) * attr3.z - 0.5); - position.y = (1.0 - gl_Color.z) * position.y + gl_Color.z * (position.y * attrib2.y ); - - // Adjust pitch of roof to the correct height. These vertices are identified by gl_Color.z - // Scale down by the building height (instanceScale.z) because - // immediately afterwards we will scale UP the vertex to the correct scale. - position.z = position.z + gl_Color.z * attrib1.y / instanceScale.z; - position = position * instanceScale.xyz; - - // Rotation of the building and movement into position - position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr))); - position = position + instancePosition.xyz; - - gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0); - - // Texture coordinates are stored as: - // - a separate offset (x0, y0) for the wall (wtex0x, wtex0y), and roof (rtex0x, rtex0y) - // - a semi-shared (x1, y1) so that the front and side of the building can have - // different texture mappings - // - // The vertex color value selects between them: - // gl_Color.x=1 indicates front/back walls - // gl_Color.y=1 indicates roof - // gl_Color.z=1 indicates top roof vertexs (used above) - // gl_Color.a=1 indicates sides - // Finally, the roof texture is on the right of the texture sheet - float wtex0x = attr1.y; // Front/Side texture X0 - float wtex0y = attr1.z; // Front/Side texture Y0 - float rtex0x = attr2.z; // Roof texture X0 - float rtex0y = attr3.x; // Roof texture Y0 - float wtex1x = attr2.x; // Front/Roof texture X1 - float stex1x = attr3.y; // Side texture X1 - float wtex1y = attr2.y; // Front/Roof/Side texture Y1 - vec2 tex0 = vec2(sign(gl_MultiTexCoord0.x) * (gl_Color.x*wtex0x + gl_Color.y*rtex0x + gl_Color.a*wtex0x), - gl_Color.x*wtex0y + gl_Color.y*rtex0y + gl_Color.a*wtex0y); - - vec2 tex1 = vec2(gl_Color.x*wtex1x + gl_Color.y*wtex1x + gl_Color.a*stex1x, - wtex1y); - - gl_TexCoord[0].x = tex0.x + gl_MultiTexCoord0.x * tex1.x; - gl_TexCoord[0].y = tex0.y + gl_MultiTexCoord0.y * tex1.y; - - // Rotate the normal. - normal = gl_Normal; - normal.xy = vec2(dot(normal.xy, vec2(cr, sr)), dot(normal.xy, vec2(-sr, cr))); - normal = gl_NormalMatrix * normal; - - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = vec4(1.0,1.0,1.0,1.0); - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = vec4(1.0,1.0,1.0,1.0); - ambient_color = vec4(1.0,1.0,1.0,1.0); - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - diffuse_term = diffuse_color * gl_LightSource[0].diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + gl_LightSource[0].ambient); - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = 1.0; - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0; - gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; - //fogCoord = abs(ecPosition.z / ecPosition.w); - //fog_Func(fogType); -} diff --git a/Compositor/Shaders/Default/building-ubershader.vert b/Compositor/Shaders/Default/building-ubershader.vert deleted file mode 100644 index 6615dffef..000000000 --- a/Compositor/Shaders/Default/building-ubershader.vert +++ /dev/null @@ -1,126 +0,0 @@ -// -*- mode: C; -*- -// RANDOM BUILDINGS for the UBERSHADER vertex shader -// Licence: GPL v2 -// © Emilian Huminiuc and Vivian Meazza 2011 -#version 120 -#extension GL_EXT_draw_instanced : enable - -varying vec4 diffuseColor; -varying vec3 VBinormal; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 eyeVec; -varying vec3 normal; - -uniform int refl_dynamic; -uniform int nmap_enabled; -uniform int shader_qual; -uniform int rembrandt_enabled; - -attribute vec3 instancePosition; // (x,y,z) -attribute vec3 instanceScale; // (width, depth, height) -attribute vec3 attrib1; // Generic packed attributes -attribute vec3 attrib2; - -const float c_precision = 128.0; -const float c_precisionp1 = c_precision + 1.0; - -vec3 float2vec(float value) { - vec3 val; - val.x = mod(value, c_precisionp1) / c_precision; - val.y = mod(floor(value / c_precisionp1), c_precisionp1) / c_precision; - val.z = floor(value / (c_precisionp1 * c_precisionp1)) / c_precision; - return val; -} - -void main(void) -{ - // Unpack generic attributes - vec3 attr1 = float2vec(attrib1.x); - vec3 attr2 = float2vec(attrib1.z); - vec3 attr3 = float2vec(attrib2.x); - - // Determine the rotation for the building. - float sr = sin(6.28 * attr1.x); - float cr = cos(6.28 * attr1.x); - - vec3 position = gl_Vertex.xyz; - // Adjust the very top of the roof to match the rooftop scaling. This shapes - // the rooftop - gambled, gabled etc. These vertices are identified by gl_Color.z - position.x = (1.0 - gl_Color.z) * position.x + gl_Color.z * ((position.x + 0.5) * attr3.z - 0.5); - position.y = (1.0 - gl_Color.z) * position.y + gl_Color.z * (position.y * attrib2.y ); - - // Adjust pitch of roof to the correct height. These vertices are identified by gl_Color.z - // Scale down by the building height (instanceScale.z) because - // immediately afterwards we will scale UP the vertex to the correct scale. - position.z = position.z + gl_Color.z * attrib1.y / instanceScale.z; - position = position * instanceScale.xyz; - - // Rotation of the building and movement into position - position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr))); - position = position + instancePosition.xyz; - - gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0); - vec4 ecPosition = gl_ModelViewMatrix * vec4(position, 1.0); - - eyeVec = ecPosition.xyz; - - // Rotate the normal. - normal = gl_Normal; - - // Rotate the normal as per the building. - normal.xy = vec2(dot(normal.xy, vec2(cr, sr)), dot(normal.xy, vec2(-sr, cr))); - vec3 n = normalize(normal); - - vec3 c1 = cross(n, vec3(0.0,0.0,1.0)); - vec3 c2 = cross(n, vec3(0.0,1.0,0.0)); - VNormal = normalize(gl_NormalMatrix * normal); - - VTangent = c1; - if(length(c2)>length(c1)){ - VTangent = c2; - } - - VBinormal = cross(n, VTangent); - - VTangent = normalize(gl_NormalMatrix * -VTangent); - VBinormal = normalize(gl_NormalMatrix * VBinormal); - -// Force no alpha on random buildings - diffuseColor = vec4(gl_FrontMaterial.diffuse.rgb,1.0); - - if(rembrandt_enabled < 1){ - gl_FrontColor = gl_FrontMaterial.emission + vec4(1.0) - * (gl_LightModel.ambient + gl_LightSource[0].ambient); - } else { - gl_FrontColor = vec4(1.0); - } - gl_ClipVertex = ecPosition; - - // Texture coordinates are stored as: - // - a separate offset (x0, y0) for the wall (wtex0x, wtex0y), and roof (rtex0x, rtex0y) - // - a semi-shared (x1, y1) so that the front and side of the building can have - // different texture mappings - // - // The vertex color value selects between them: - // gl_Color.x=1 indicates front/back walls - // gl_Color.y=1 indicates roof - // gl_Color.z=1 indicates top roof vertexs (used above) - // gl_Color.a=1 indicates sides - // Finally, the roof texture is on the right of the texture sheet - float wtex0x = attr1.y; // Front/Side texture X0 - float wtex0y = attr1.z; // Front/Side texture Y0 - float rtex0x = attr2.z; // Roof texture X0 - float rtex0y = attr3.x; // Roof texture Y0 - float wtex1x = attr2.x; // Front/Roof texture X1 - float stex1x = attr3.y; // Side texture X1 - float wtex1y = attr2.y; // Front/Roof/Side texture Y1 - vec2 tex0 = vec2(sign(gl_MultiTexCoord0.x) * (gl_Color.x*wtex0x + gl_Color.y*rtex0x + gl_Color.a*wtex0x), - gl_Color.x*wtex0y + gl_Color.y*rtex0y + gl_Color.a*wtex0y); - - vec2 tex1 = vec2(gl_Color.x*wtex1x + gl_Color.y*wtex1x + gl_Color.a*stex1x, - wtex1y); - - gl_TexCoord[0].x = tex0.x + gl_MultiTexCoord0.x * tex1.x; - gl_TexCoord[0].y = tex0.y + gl_MultiTexCoord0.y * tex1.y; -} diff --git a/Compositor/Shaders/Default/cloud-static.frag b/Compositor/Shaders/Default/cloud-static.frag deleted file mode 100644 index bac1712e7..000000000 --- a/Compositor/Shaders/Default/cloud-static.frag +++ /dev/null @@ -1,14 +0,0 @@ -#version 120 - -uniform sampler2D baseTexture; -varying float fogFactor; - -vec3 filter_combined (in vec3 color) ; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - vec4 finalColor = base * gl_Color; - gl_FragColor.rgb = mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor ); - gl_FragColor.a = mix(0.0, finalColor.a, fogFactor); -} diff --git a/Compositor/Shaders/Default/cloud-static.vert b/Compositor/Shaders/Default/cloud-static.vert deleted file mode 100644 index 96c2ec80a..000000000 --- a/Compositor/Shaders/Default/cloud-static.vert +++ /dev/null @@ -1,55 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; - - -float shade = 0.8; -float cloud_height = 1000.0; - -void main(void) -{ - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - //gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0); - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.x = gl_Vertex.x; - gl_Position.y += gl_Vertex.y; - gl_Position.z += gl_Vertex.z; - gl_Position.xyz += gl_Color.xyz; - - - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - -// Determine the shading of the sprite based on its vertical position and position relative to the sun. - n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front - vec4 backlight = gl_LightSource[0].diffuse * shade; - - gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n); - gl_FrontColor += gl_FrontLightModelProduct.sceneColor; - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(100.0, 250.0, fogCoord), 1.0 - smoothstep(70000.0, 75000.0, fogCoord)); - gl_BackColor = gl_FrontColor; - - // Fog doesn't affect rain as much as other objects. - fogFactor = exp( -gl_Fog.density * fogCoord * 0.4); - fogFactor = clamp(fogFactor, 0.0, 1.0); -} diff --git a/Compositor/Shaders/Default/clouds-box.frag b/Compositor/Shaders/Default/clouds-box.frag deleted file mode 100644 index 8bf1aa59f..000000000 --- a/Compositor/Shaders/Default/clouds-box.frag +++ /dev/null @@ -1,13 +0,0 @@ -#version 120 - -uniform sampler2D baseTexture; -varying float fogFactor; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - vec4 finalColor = base * gl_Color; - gl_FragColor.rgb = mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor ); - gl_FragColor.a = mix(0.0, finalColor.a, fogFactor); -} - diff --git a/Compositor/Shaders/Default/clouds-box.vert b/Compositor/Shaders/Default/clouds-box.vert deleted file mode 100644 index 11b2cbb75..000000000 --- a/Compositor/Shaders/Default/clouds-box.vert +++ /dev/null @@ -1,72 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; - -//attribute vec3 usrAttr3; -//attribute vec3 usrAttr4; - -//float textureIndexX = usrAttr3.r; -//float textureIndexY = usrAttr3.g; -//float wScale = usrAttr3.b; -//float hScale = usrAttr4.r; -//float shade = usrAttr4.g; -//float cloud_height = usrAttr4.b; - -void main(void) -{ - - float shade = 0.9; - float cloud_height = 1000.0; - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - //gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0); - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - // Find a rotation matrix that rotates 1,0,0 into u. u, r and w are - // the columns of that matrix. - vec3 absu = abs(u); - vec3 r = normalize(vec3(-u.y, u.x, 0.0)); - vec3 w = cross(u, r); - - // Do the matrix multiplication by [ u r w pos]. Assume no - // scaling in the homogeneous component of pos. - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.xyz = gl_Vertex.x * u; - gl_Position.xyz += gl_Vertex.y * r * 1.0; - gl_Position.xyz += gl_Vertex.z * w * 1.0; - //gl_Position.xyz += gl_Vertex.y * r * wScale; - //gl_Position.xyz += gl_Vertex.z * w * hScale; - gl_Position.xyz += gl_Color.xyz; - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - // Final position of the sprite - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - -// Determine the shading of the sprite based on its vertical position and position relative to the sun. - n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front - vec4 backlight = gl_LightSource[0].diffuse * shade; - - gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n); - gl_FrontColor += gl_FrontLightModelProduct.sceneColor; - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(25000.0, 30000.0, fogCoord)); - gl_BackColor = gl_FrontColor; - - // Fog doesn't affect clouds as much as other objects. - fogFactor = exp( -gl_Fog.density * fogCoord * 0.2); - fogFactor = clamp(fogFactor, 0.0, 1.0); -} diff --git a/Compositor/Shaders/Default/clouds-layered.frag b/Compositor/Shaders/Default/clouds-layered.frag deleted file mode 100644 index 8bf1aa59f..000000000 --- a/Compositor/Shaders/Default/clouds-layered.frag +++ /dev/null @@ -1,13 +0,0 @@ -#version 120 - -uniform sampler2D baseTexture; -varying float fogFactor; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - vec4 finalColor = base * gl_Color; - gl_FragColor.rgb = mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor ); - gl_FragColor.a = mix(0.0, finalColor.a, fogFactor); -} - diff --git a/Compositor/Shaders/Default/clouds-layered.vert b/Compositor/Shaders/Default/clouds-layered.vert deleted file mode 100644 index e0e6be78e..000000000 --- a/Compositor/Shaders/Default/clouds-layered.vert +++ /dev/null @@ -1,63 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; - -float shade = 0.4; -float cloud_height = 1000.0; - -void main(void) -{ - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - // Find a rotation matrix that rotates 1,0,0 into u. u, r and w are - // the columns of that matrix. - vec3 absu = abs(u); - vec3 r = normalize(vec3(-u.y, u.x, 0.0)); - vec3 w = cross(u, r); - - // Do the matrix multiplication by [ u r w pos]. Assume no - // scaling in the homogeneous component of pos. - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.xyz = gl_Vertex.x * u ; - gl_Position.xyz += gl_Vertex.y * r * 1.0; - gl_Position.xyz += gl_Vertex.z * w * 1.0;//0.4; - //gl_Position.xyz += gl_Vertex.y * r * wScale; - //gl_Position.xyz += gl_Vertex.z * w * hScale; - gl_Position.xyz += gl_Color.xyz; - - gl_Position.z = gl_Position.z * 0.4; - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - // Final position of the sprite - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - -// Determine the shading of the sprite based on its vertical position and position relative to the sun. - n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front - vec4 backlight = gl_LightSource[0].diffuse * shade; - - gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n); - gl_FrontColor += gl_FrontLightModelProduct.sceneColor; - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(100.0, 300.0, fogCoord), 1.0 - smoothstep(40000.0, 45000.0, fogCoord)); - gl_BackColor = gl_FrontColor; - - // Fog doesn't affect clouds as much as other objects. - fogFactor = exp( -gl_Fog.density * fogCoord * 0.5); - fogFactor = clamp(fogFactor, 0.0, 1.0); -} diff --git a/Compositor/Shaders/Default/clouds-thick.frag b/Compositor/Shaders/Default/clouds-thick.frag deleted file mode 100644 index 8bf1aa59f..000000000 --- a/Compositor/Shaders/Default/clouds-thick.frag +++ /dev/null @@ -1,13 +0,0 @@ -#version 120 - -uniform sampler2D baseTexture; -varying float fogFactor; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - vec4 finalColor = base * gl_Color; - gl_FragColor.rgb = mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor ); - gl_FragColor.a = mix(0.0, finalColor.a, fogFactor); -} - diff --git a/Compositor/Shaders/Default/clouds-thick.vert b/Compositor/Shaders/Default/clouds-thick.vert deleted file mode 100644 index d25947f2a..000000000 --- a/Compositor/Shaders/Default/clouds-thick.vert +++ /dev/null @@ -1,63 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; - -float shade = 0.4; -float cloud_height = 1000.0; - -void main(void) -{ - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - //gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0); - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - // Find a rotation matrix that rotates 1,0,0 into u. u, r and w are - // the columns of that matrix. - vec3 absu = abs(u); - vec3 r = normalize(vec3(-u.y, u.x, 0.0)); - vec3 w = cross(u, r); - - // Do the matrix multiplication by [ u r w pos]. Assume no - // scaling in the homogeneous component of pos. - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.xyz = gl_Vertex.x * u; - gl_Position.xyz += gl_Vertex.y * r; - gl_Position.xyz += gl_Vertex.z * w; - //gl_Position.xyz += gl_Vertex.y * r * wScale; - //gl_Position.xyz += gl_Vertex.z * w * hScale; - gl_Position.xyz += gl_Color.xyz; - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - //float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - // Final position of the sprite - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - -// Determine the shading of the sprite based on its vertical position and position relative to the sun. - n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front - vec4 backlight = gl_LightSource[0].diffuse * shade; - - gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n); - gl_FrontColor += gl_FrontLightModelProduct.sceneColor; - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(40000.0, 45000.0, fogCoord)); - gl_BackColor = gl_FrontColor; - - // Fog doesn't affect clouds as much as other objects. - fogFactor = exp( -gl_Fog.density * fogCoord * 0.2); - fogFactor = clamp(fogFactor, 0.0, 1.0); -} diff --git a/Compositor/Shaders/Default/clouds-thin.frag b/Compositor/Shaders/Default/clouds-thin.frag deleted file mode 100644 index 8bf1aa59f..000000000 --- a/Compositor/Shaders/Default/clouds-thin.frag +++ /dev/null @@ -1,13 +0,0 @@ -#version 120 - -uniform sampler2D baseTexture; -varying float fogFactor; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - vec4 finalColor = base * gl_Color; - gl_FragColor.rgb = mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor ); - gl_FragColor.a = mix(0.0, finalColor.a, fogFactor); -} - diff --git a/Compositor/Shaders/Default/clouds-thin.vert b/Compositor/Shaders/Default/clouds-thin.vert deleted file mode 100644 index 2cb900d83..000000000 --- a/Compositor/Shaders/Default/clouds-thin.vert +++ /dev/null @@ -1,72 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; - -//attribute vec3 usrAttr3; -//attribute vec3 usrAttr4; - -//float textureIndexX = usrAttr3.r; -//float textureIndexY = usrAttr3.g; -//float wScale = usrAttr3.b; -//float hScale = usrAttr4.r; -//float shade = usrAttr4.g; -//float cloud_height = usrAttr4.b; - -void main(void) -{ - - float shade = 0.8; - float cloud_height = 1000.0; - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - //gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0); - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - // Find a rotation matrix that rotates 1,0,0 into u. u, r and w are - // the columns of that matrix. - vec3 absu = abs(u); - vec3 r = normalize(vec3(-u.y, u.x, 0.0)); - vec3 w = cross(u, r); - - // Do the matrix multiplication by [ u r w pos]. Assume no - // scaling in the homogeneous component of pos. - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.xyz = gl_Vertex.x * u; - gl_Position.xyz += gl_Vertex.y * r * 0.35; - gl_Position.xyz += gl_Vertex.z * w * 0.35; - //gl_Position.xyz += gl_Vertex.y * r * wScale; - //gl_Position.xyz += gl_Vertex.z * w * hScale; - gl_Position.xyz += gl_Color.xyz; - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - // Final position of the sprite - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - -// Determine the shading of the sprite based on its vertical position and position relative to the sun. - n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front - vec4 backlight = gl_LightSource[0].diffuse * shade; - - gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n); - gl_FrontColor += gl_FrontLightModelProduct.sceneColor; - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(40000.0, 45000.0, fogCoord)); - gl_BackColor = gl_FrontColor; - - // Fog doesn't affect clouds as much as other objects. - fogFactor = exp( -gl_Fog.density * fogCoord * 0.2); - fogFactor = clamp(fogFactor, 0.0, 1.0); -} diff --git a/Compositor/Shaders/Default/clouds-thinlayer.frag b/Compositor/Shaders/Default/clouds-thinlayer.frag deleted file mode 100644 index 8bf1aa59f..000000000 --- a/Compositor/Shaders/Default/clouds-thinlayer.frag +++ /dev/null @@ -1,13 +0,0 @@ -#version 120 - -uniform sampler2D baseTexture; -varying float fogFactor; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - vec4 finalColor = base * gl_Color; - gl_FragColor.rgb = mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor ); - gl_FragColor.a = mix(0.0, finalColor.a, fogFactor); -} - diff --git a/Compositor/Shaders/Default/clouds-thinlayer.vert b/Compositor/Shaders/Default/clouds-thinlayer.vert deleted file mode 100644 index 75802b752..000000000 --- a/Compositor/Shaders/Default/clouds-thinlayer.vert +++ /dev/null @@ -1,63 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; - -float shade = 0.7; -float cloud_height = 1000.0; - -void main(void) -{ - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - // Find a rotation matrix that rotates 1,0,0 into u. u, r and w are - // the columns of that matrix. - vec3 absu = abs(u); - vec3 r = normalize(vec3(-u.y, u.x, 0.0)); - vec3 w = cross(u, r); - - // Do the matrix multiplication by [ u r w pos]. Assume no - // scaling in the homogeneous component of pos. - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.xyz = gl_Vertex.x * u ; - gl_Position.xyz += gl_Vertex.y * r * 1.0; - gl_Position.xyz += gl_Vertex.z * w * 1.0;//0.4; - //gl_Position.xyz += gl_Vertex.y * r * wScale; - //gl_Position.xyz += gl_Vertex.z * w * hScale; - gl_Position.xyz += gl_Color.xyz; - - gl_Position.z = gl_Position.z * 0.2; - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - // Final position of the sprite - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - -// Determine the shading of the sprite based on its vertical position and position relative to the sun. - n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front - vec4 backlight = gl_LightSource[0].diffuse * shade; - - gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n); - gl_FrontColor += gl_FrontLightModelProduct.sceneColor; - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(100.0, 300.0, fogCoord), 1.0 - smoothstep(40000.0, 45000.0, fogCoord)); - gl_BackColor = gl_FrontColor; - - // Fog doesn't affect clouds as much as other objects. - fogFactor = exp( -gl_Fog.density * fogCoord * 0.2); - fogFactor = clamp(fogFactor, 0.0, 1.0); -} diff --git a/Compositor/Shaders/Default/crop.frag b/Compositor/Shaders/Default/crop.frag deleted file mode 100644 index fb7a69e3b..000000000 --- a/Compositor/Shaders/Default/crop.frag +++ /dev/null @@ -1,79 +0,0 @@ -#version 120 - -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 Normal; - -uniform sampler3D NoiseTex; -uniform sampler2D SampleTex; -uniform sampler1D ColorsTex; - -varying vec4 constantColor; - -uniform float snowlevel; // From /sim/rendering/snow-level-m - -const float scale = 1.0; - -#define BLA 1 -#define BLA2 0 - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -void main (void) -{ - - vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000144); - basecolor = texture1D(ColorsTex, basecolor.r+0.00); - - vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale); - - vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale); - vec4 km = floor((rawpos)/1000.0); - - float fogFactor; - float fogCoord = ecPosition.z; - const float LOG2 = 1.442695; - fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2); -// float biasFactor = exp2(-0.00000002 * fogCoord * fogCoord * LOG2); - float biasFactor = fogFactor = clamp(fogFactor, 0.0, 1.0); - - float n=0.06; - n += nvL[0]*0.4; - n += nvL[1]*0.6; - n += nvL[2]*2.0; - n += nvL[3]*4.0; - n += noisevec[0]*0.1; - n += noisevec[1]*0.4; - - n += noisevec[2]*0.8; - n += noisevec[3]*2.1; - n = mix(0.6, n, biasFactor); - - // good - vec4 c1; - c1 = basecolor * vec4(smoothstep(0.0, 1.15, n), smoothstep(0.0, 1.2, n), smoothstep(0.1, 1.3, n), 1.0); - - //"steep = gray" - c1 = mix(vec4(n-0.42, n-0.44, n-0.51, 1.0), c1, smoothstep(0.970, 0.990, abs(normalize(Normal).z)+nvL[2]*1.3)); - - //"snow" - c1 = mix(c1, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0)); - - vec3 diffuse = gl_Color.rgb * max(0.0, dot(VNormal, gl_LightSource[0].position.xyz)); - vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0); - - c1 *= ambient_light; - vec4 finalColor = c1; - -// if(gl_Fog.density == 1.0) -// fogFactor=1.0; -// -// gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor); - finalColor.rgb = fog_Func(finalColor.rgb, fogType); - gl_FragColor = finalColor; -} diff --git a/Compositor/Shaders/Default/crop.vert b/Compositor/Shaders/Default/crop.vert deleted file mode 100644 index 9e70bfa6d..000000000 --- a/Compositor/Shaders/Default/crop.vert +++ /dev/null @@ -1,24 +0,0 @@ -#version 120 - -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 Normal; -varying vec4 constantColor; - -void main(void) -{ - gl_TexCoord[0] = gl_MultiTexCoord0; - - rawpos = gl_Vertex; - ecPosition = gl_ModelViewMatrix * gl_Vertex; - VNormal = normalize(gl_NormalMatrix * gl_Normal); - Normal = normalize(gl_Normal); - - gl_FrontColor = gl_Color; - - constantColor = gl_FrontMaterial.emission - + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); - - gl_Position = ftransform(); -} \ No newline at end of file diff --git a/Compositor/Shaders/Default/default.frag b/Compositor/Shaders/Default/default.frag deleted file mode 100644 index 1c3fbaf84..000000000 --- a/Compositor/Shaders/Default/default.frag +++ /dev/null @@ -1,57 +0,0 @@ -// -*-C++-*- - -// Ambient term comes in gl_Color.rgb. -#version 120 - -varying vec4 diffuse_term; -varying vec3 normal; - -uniform sampler2D texture; - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -float luminance(vec3 color) -{ - return dot(vec3(0.212671, 0.715160, 0.072169), color); -} - -void main() -{ - vec3 n; - float NdotL, NdotHV, fogFactor; - vec4 color = gl_Color; - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = gl_LightSource[0].halfVector.xyz; - vec4 texel; - vec4 fragColor; - vec4 specular = vec4(0.0); - - // If gl_Color.a == 0, this is a back-facing polygon and the - // normal should be reversed. - n = (2.0 * gl_Color.a - 1.0) * normal; - n = normalize(n); - - NdotL = dot(n, lightDir); - if (NdotL > 0.0) { - color += diffuse_term * NdotL; - NdotHV = max(dot(n, halfVector), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = (gl_FrontMaterial.specular.rgb - * gl_LightSource[0].specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess)); - } - color.a = diffuse_term.a; - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - color = clamp(color, 0.0, 1.0); - texel = texture2D(texture, gl_TexCoord[0].st); - fragColor = color * texel + specular; - - fragColor.rgb = fog_Func(fragColor.rgb, fogType); - gl_FragColor = fragColor; -} \ No newline at end of file diff --git a/Compositor/Shaders/Default/default.vert b/Compositor/Shaders/Default/default.vert deleted file mode 100644 index 1bc240585..000000000 --- a/Compositor/Shaders/Default/default.vert +++ /dev/null @@ -1,61 +0,0 @@ -// -*-C++-*- - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -#version 120 -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -// The constant term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; - -uniform int colorMode; - -////fog "include"//////// -//uniform int fogType; -// -//void fog_Func(int type); -///////////////////////// - -void main() -{ - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = gl_NormalMatrix * gl_Normal; - vec4 ambient_color, diffuse_color; - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - diffuse_term = diffuse_color * gl_LightSource[0].diffuse; - vec4 constant_term = gl_FrontMaterial.emission + ambient_color * - (gl_LightModel.ambient + gl_LightSource[0].ambient); - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = gl_Color.a; - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0; - gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; - //fogCoord = abs(ecPosition.z / ecPosition.w); - //fog_Func(fogType); -} diff --git a/Compositor/Shaders/Default/flutter.vert b/Compositor/Shaders/Default/flutter.vert deleted file mode 100644 index 0d07a042f..000000000 --- a/Compositor/Shaders/Default/flutter.vert +++ /dev/null @@ -1,143 +0,0 @@ -// -*-C++-*- -// © Vivian Meazza - 2011 - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. - -#version 120 -#define fps2kts 0.5925 - -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -// The ambient term of the lighting equation that doesn't depend on -// the surface normal is passed in gl_{Front,Back}Color. The alpha -// component is set to 1 for front, 0 for back in order to work around -// bugs with gl_FrontFacing in the fragment shader. -varying vec4 diffuse_term; -varying vec3 normal; -//varying float fogCoord; - -uniform int colorMode; -uniform float osg_SimulationTime; -uniform float Offset, AmpFactor, WindE, WindN, spd, hdg; -uniform sampler3D Noise; - -////fog "include"//////// -//uniform int fogType; -// -//void fog_Func(int type); -///////////////////////// - -/////// functions ///////// - -float normalize_range(float _val) - { - if (_val > 180.0) - return _val - 360.0; - else - return _val; - } - -void relWind(out float rel_wind_speed_kts, out float rel_wind_from_rad) - { - //calculate speed north and east in kts - float speed_north_kts = cos(radians(hdg)) * spd ; - float speed_east_kts = sin(radians(hdg)) * spd ; - - //calculate the relative wind speed north and east in kts - float rel_wind_speed_from_east_kts = WindE*fps2kts + speed_east_kts; - float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts; - - //combine relative speeds north and east to get relative windspeed in kts - rel_wind_speed_kts = sqrt(pow(abs(rel_wind_speed_from_east_kts), 2.0) - + pow(abs(rel_wind_speed_from_north_kts), 2.0)); - - //calculate the relative wind direction - float rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts)); - //rel_wind_from_rad = atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts); - float rel_wind = rel_wind_from_deg - hdg; - rel_wind = normalize_range(rel_wind); - rel_wind_from_rad = radians(rel_wind); - } - -void rotationmatrix(in float angle, out mat4 rotmat) - { - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); - } - -void main() - { - mat4 RotationMatrix; - - float relWindspd=0.0; - float relWinddir=0.0; - - // compute relative wind speed and direction - relWind (relWindspd, relWinddir); - - // map noise vector - vec4 noisevec = texture3D(Noise, gl_Vertex.xyz); - - //waving effect - float tsec = osg_SimulationTime; - vec4 pos = gl_Vertex; - vec4 oldpos = gl_Vertex; - - float freq = (10.0 * relWindspd) + 10.0; - pos.y = sin((pos.x * 5.0 + tsec * freq )/5.0) * 0.5 ; - pos.y += sin((pos.z * 5.0 + tsec * freq/2.0)/5.0) * 0.125 ; - - pos.y *= pow(pos.x - Offset, 2.0) * AmpFactor; - - //rotate the flag to align with relative wind - rotationmatrix(-relWinddir, RotationMatrix); - pos *= RotationMatrix; - gl_Position = gl_ModelViewProjectionMatrix * pos; - - //do the colour and fog - vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = gl_NormalMatrix * gl_Normal; - vec4 ambient_color, diffuse_color; - - if (colorMode == MODE_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_FrontMaterial.ambient; - } else if (colorMode == MODE_AMBIENT_AND_DIFFUSE) { - diffuse_color = gl_Color; - ambient_color = gl_Color; - } else { - diffuse_color = gl_FrontMaterial.diffuse; - ambient_color = gl_FrontMaterial.ambient; - } - - diffuse_term = diffuse_color * gl_LightSource[0].diffuse; - vec4 ambient_term = ambient_color * gl_LightSource[0].ambient; - - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuse_term.a = gl_FrontMaterial.diffuse.a; - else - diffuse_term.a = gl_Color.a; - - // Another hack for supporting two-sided lighting without using - // gl_FrontFacing in the fragment shader. - gl_FrontColor.rgb = ambient_term.rgb; gl_FrontColor.a = 0.0; - gl_BackColor.rgb = ambient_term.rgb; gl_FrontColor.a = 1.0; -// fogCoord = abs(ecPosition.z / ecPosition.w); - - //fog_Func(fogType); - - } diff --git a/Compositor/Shaders/Default/forest.frag b/Compositor/Shaders/Default/forest.frag deleted file mode 100644 index 4d8a7d349..000000000 --- a/Compositor/Shaders/Default/forest.frag +++ /dev/null @@ -1,193 +0,0 @@ -#version 120 - -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 VNormal; -varying vec3 Normal; - -uniform sampler3D NoiseTex; -uniform sampler2D SampleTex; -uniform sampler1D ColorsTex; -uniform sampler2D SampleTex2; -uniform sampler2D NormalTex; -uniform float depth_factor; - -uniform float red, green, blue, alpha; - -uniform float quality_level; // From /sim/rendering/quality-level -uniform float snowlevel; // From /sim/rendering/snow-level-m - -const float scale = 1.0; -int linear_search_steps = 10; - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds) -{ - - float size = 1.0 / float(linear_search_steps); - float depth = 0.0; - float best_depth = 1.0; - - for(int i = 0; i < linear_search_steps - 1; ++i) - { - depth += size; - float t = texture2D(reliefMap, dp + ds * depth).a; - if(best_depth > 0.996) - if(depth >= t) - best_depth = depth; - } - depth = best_depth; - - const int binary_search_steps = 5; - - for(int i = 0; i < binary_search_steps; ++i) - { - size *= 0.5; - float t = texture2D(reliefMap, dp + ds * depth).a; - if(depth >= t) - { - best_depth = depth; - depth -= 2.0 * size; - } - depth += size; - } - - return(best_depth); -} - - -void main (void) -{ - float bump = 1.0; - - if ( quality_level >= 3.5 ) { - linear_search_steps = 20; - } - vec2 uv, dp, ds; - vec3 N; - float d; - if ( bump > 0.9 && quality_level >= 2.0 ) - { - vec3 V = normalize(ecPosition.xyz); - float a = dot(VNormal, -V); - vec2 s = vec2(dot(V, VTangent), dot(V, VBinormal)); - s *= depth_factor / a; - ds = s; - dp = gl_TexCoord[0].st; - d = ray_intersect(NormalTex, dp, ds); - - uv = dp + ds * d; - N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0; - } - else - { - uv = gl_TexCoord[0].st; - N = vec3(0.0, 0.0, 1.0); - } - - - vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000344); - vec4 basecolor2 = texture2D(SampleTex2, rawpos.xy*0.000144); - - basecolor = texture1D(ColorsTex, basecolor.r+0.0); - - vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale); - - vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale); - - float vegetationlevel = (rawpos.z)+nvL[2]*3000.0; - - const float LOG2 = 1.442695; - float fogCoord = abs(ecPosition.z / ecPosition.w); - float fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord); - float biasFactor = exp2(-0.00000002 * fogCoord * fogCoord * LOG2); - - float n = 0.06; - n += nvL[0]*0.4; - n += nvL[1]*0.6; - n += nvL[2]*2.0; - n += nvL[3]*4.0; - n += noisevec[0]*0.1; - n += noisevec[1]*0.4; - - n += noisevec[2]*0.8; - n += noisevec[3]*2.1; - - //very low n/biasFactor mix, to keep forest color - n = mix(0.05, n, biasFactor); - - vec4 c1; - c1 = basecolor * vec4(smoothstep(-1.3, 0.5, n), smoothstep(-1.3, 0.5, n), smoothstep(-2.0, 0.9, n), 0.0); - - vec4 c2; - c2 = basecolor2 * vec4(smoothstep(-1.3, 0.5, n), smoothstep(-1.3, 0.5, n), smoothstep(-2.0, 0.9, n), 0.0); - - N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); - vec3 l = gl_LightSource[0].position.xyz; - vec3 diffuse; - - //draw floor where !steep, and another blurb for smoothing transitions - vec4 c3, c4, c5, c3a, c4a, c5a; - float subred = 1.0 - red; float subgreen = 1.0 - green; float subblue = 1.0 - blue; - c3 = mix(vec4(n-subred, n-subgreen, -n-subblue, 0.0), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.3)); - c4 = mix(vec4(n-subred, n-subgreen-0.6, -n-subblue, 0.0), c1, smoothstep(0.990, 0.890, abs(normalize(Normal).z)+nvL[2]*0.9)); - c4a = mix(vec4(n-subred+0.12, n-subgreen-0.52, -n-subblue, 0.3), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.32)); - c5 = mix(c3, c4, 1.0); - c5a = mix(c3, c4a, 1.0); - - - if (vegetationlevel <= 2200.0) { - c1 = mix(c2, c5, clamp(0.65, n*0.1, 0.5)); - diffuse = gl_Color.rgb * max(0.7, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz)); - } - - if (vegetationlevel > 2200.0 && vegetationlevel < 2300.0) { - c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.35)); - diffuse = gl_Color.rgb * max(0.7, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz)); - } - - if (vegetationlevel >= 2300.0 && vegetationlevel < 2480.0) { - c1 = mix(c2, c5a, clamp(0.65, n*0.5, 0.30)); - diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz)); - } - - if (vegetationlevel >= 2480.0 && vegetationlevel < 2530.0) { - c1 = mix(c2, c5a, clamp(0.65, n*0.5, 0.20)); - diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz)); - } - - if (vegetationlevel >= 2530.0 && vegetationlevel < 2670.0) { - c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.10)); - diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz)); - } - - if (vegetationlevel >= 2670.0) { - c1 = mix(c2, c5, clamp(0.0, n*0.1, 0.4)); - diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz)); - } - - - //adding snow and permanent snow/glacier - if (vegetationlevel > snowlevel) { - c3 = mix(vec4(n+1.0, n+1.0, n+1.0, 0.0), c1, smoothstep(0.990, 0.965, abs(normalize(Normal).z)+nvL[2]*1.3)); - c4 = mix(vec4(n+1.0, n+1.0, n+1.0, 0.0), c1, smoothstep(0.990, 0.965, abs(normalize(Normal).z)+nvL[2]*0.9)); - c5 = mix(c3, c4, 1.0); - c1 = mix(c1, c5, clamp(0.65, n*0.5, 0.6)); - diffuse = gl_Color.rgb * max(0.8, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz)); - } - - vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 0.0); - - c1 *= ambient_light; - vec4 finalColor = c1; - - finalColor.rgb = fog_Func(finalColor.rgb, fogType); - gl_FragColor = finalColor; -} diff --git a/Compositor/Shaders/Default/forest.vert b/Compositor/Shaders/Default/forest.vert deleted file mode 100644 index 226ebb141..000000000 --- a/Compositor/Shaders/Default/forest.vert +++ /dev/null @@ -1,34 +0,0 @@ -#version 120 -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 Normal; -varying vec4 constantColor; - -attribute vec3 tangent; -attribute vec3 binormal; - -// ////fog "include"//////// -// uniform int fogType; -// -// void fog_Func(int type); -// ///////////////////////// - -void main(void) -{ - rawpos = gl_Vertex; - ecPosition = gl_ModelViewMatrix * rawpos; - Normal = normalize(gl_Normal); - VNormal = gl_NormalMatrix * gl_Normal; - VTangent = gl_NormalMatrix * tangent; - VBinormal = gl_NormalMatrix * binormal; - - gl_FrontColor = gl_Color; - constantColor = gl_FrontMaterial.emission - + gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient); - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; -// fog_Func(fogType); -} diff --git a/Compositor/Shaders/Default/include_fog.frag b/Compositor/Shaders/Default/include_fog.frag deleted file mode 100644 index 0ada4dc0e..000000000 --- a/Compositor/Shaders/Default/include_fog.frag +++ /dev/null @@ -1,18 +0,0 @@ -#version 120 - -//#define fog_FuncTION -//varying vec3 PointPos; - -vec3 fog_Func(vec3 color, int type) -{ - //if (type == 0){ - const float LOG2 = 1.442695; - //float fogCoord =length(PointPos); - float fogCoord = gl_ProjectionMatrix[3].z/(gl_FragCoord.z * -2.0 + 1.0 - gl_ProjectionMatrix[2].z); - float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2); - - if(gl_Fog.density == 1.0) - fogFactor=1.0; - - return mix(gl_Fog.color.rgb, color, fogFactor); -} diff --git a/Compositor/Shaders/Default/include_fog.vert b/Compositor/Shaders/Default/include_fog.vert deleted file mode 100644 index 6e3657517..000000000 --- a/Compositor/Shaders/Default/include_fog.vert +++ /dev/null @@ -1,12 +0,0 @@ -#version 120 -//varying float fogCoord; -varying vec3 PointPos; -//varying vec4 EyePos; - -void fog_Func(int type) -{ - PointPos = (gl_ModelViewMatrix * gl_Vertex).xyz; - //PointPos = gl_Vertex; - //EyePos = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - //fogCoord = abs(ecPosition.z); -} diff --git a/Compositor/Shaders/Default/landmass-g.vert b/Compositor/Shaders/Default/landmass-g.vert deleted file mode 100644 index 199134a37..000000000 --- a/Compositor/Shaders/Default/landmass-g.vert +++ /dev/null @@ -1,59 +0,0 @@ -#version 120 - -// "landmass" effect with forest construction using a geometry -// shader. The landmass effect includes a bumpmap effect as well as -// variation by altitude. -// -// The fragment shader needs position and normals in model and eye -// coordinates. This vertex shader calculates the positions and -// normals of the forest polygons so the geometry shader can do as -// little as possible. - -// Input for the geometry shader. "raw" means terrain model -// coordinates; that's a tile-local coordinate system, with z as local -// up. "ec" means eye coordinates. - -// model position of original terrain poly; the bottom of the forest. -varying vec4 rawposIn; -// model normal -varying vec3 NormalIn; -varying vec4 ecPosIn; -varying vec3 ecNormalIn; -// eye spacce tangent and binormal -varying vec3 VTangentIn; -varying vec3 VBinormalIn; -// screen-space position of top -// constant color component -varying vec4 constantColorIn; - -attribute vec3 tangent; -attribute vec3 binormal; - -uniform float canopy_height; - -////fog "include"//////// -// uniform int fogType; -// -// void fog_Func(int type); -///////////////////////// - -void main(void) - { - rawposIn = gl_Vertex; - ecPosIn = gl_ModelViewMatrix * gl_Vertex; - NormalIn = normalize(gl_Normal); - //rawTopIn = rawposIn + vec4(0.0, 0.0, canopy_height, 0.0); - //ecTopIn = gl_ModelViewMatrix * rawTopIn; - ecNormalIn = gl_NormalMatrix * NormalIn; - VTangentIn = gl_NormalMatrix * tangent; - VBinormalIn = gl_NormalMatrix * binormal; - - gl_FrontColor = gl_Color; - gl_Position = ftransform(); - //positionTopIn = gl_ModelViewProjectionMatrix * rawTopIn; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - constantColorIn = gl_FrontMaterial.emission - + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); - -// fog_Func(fogType); - } diff --git a/Compositor/Shaders/Default/landmass.frag b/Compositor/Shaders/Default/landmass.frag deleted file mode 100644 index 6f0c35ef7..000000000 --- a/Compositor/Shaders/Default/landmass.frag +++ /dev/null @@ -1,152 +0,0 @@ -#version 120 - -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 Normal; -varying vec4 constantColor; - -uniform sampler3D NoiseTex; -uniform sampler2D BaseTex; -uniform sampler2D NormalTex; -uniform float depth_factor; -uniform float quality_level; // From /sim/rendering/quality-level -uniform float snowlevel; // From /sim/rendering/snow-level-m - -const float scale = 1.0; -int linear_search_steps = 10; - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds) - { - - float size = 1.0 / float(linear_search_steps); - float depth = 0.0; - float best_depth = 1.0; - - for(int i = 0; i < linear_search_steps - 1; ++i) - { - depth += size; - float t = texture2D(reliefMap, dp + ds * depth).a; - if(best_depth > 0.996) - if(depth >= t) - best_depth = depth; - } - depth = best_depth; - - const int binary_search_steps = 5; - - for(int i = 0; i < binary_search_steps; ++i) - { - size *= 0.5; - float t = texture2D(reliefMap, dp + ds * depth).a; - if(depth >= t) - { - best_depth = depth; - depth -= 2.0 * size; - } - depth += size; - } - - return(best_depth); - } - -void main (void) - { - float bump = 1.0; - - if ( quality_level >= 3.0 ) { - linear_search_steps = 20; - } - - vec2 uv, dp = vec2(0, 0), ds = vec2(0, 0); - vec3 N; - float d = 0; - if ( bump > 0.9 && quality_level > 2.0 && quality_level <= 4.0) - { - vec3 V = normalize(ecPosition.xyz); - float a = dot(VNormal, -V); - vec2 s = vec2(dot(V, VTangent), dot(V, VBinormal)); - - // prevent a divide by zero - if (a > -1e-3 && a < 1e-3) a = 1e-3; - s *= depth_factor / a; - ds = s; - dp = gl_TexCoord[0].st; - d = ray_intersect(NormalTex, dp, ds); - - uv = dp + ds * d; - N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0; - } - else - { - uv = gl_TexCoord[0].st; - N = vec3(0.0, 0.0, 1.0); - } - - vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale); - vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale); - - float fogFactor; - float fogCoord = ecPosition.z; - const float LOG2 = 1.442695; - fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2); - float biasFactor = fogFactor = clamp(fogFactor, 0.0, 1.0); - - float n=0.06; - n += nvL[0]*0.4; - n += nvL[1]*0.6; - n += nvL[2]*2.0; - n += nvL[3]*4.0; - n += noisevec[0]*0.1; - n += noisevec[1]*0.4; - - n += noisevec[2]*0.8; - n += noisevec[3]*2.1; - n = mix(0.6, n, biasFactor); - // good - vec4 c1 = texture2D(BaseTex, uv); - //brown - //c1 = mix(c1, vec4(n-0.46, n-0.45, n-0.53, 1.0), smoothstep(0.50, 0.55, nvL[2]*6.6)); - //"steep = gray" - c1 = mix(vec4(n-0.30, n-0.29, n-0.37, 1.0), c1, smoothstep(0.970, 0.990, abs(normalize(Normal).z)+nvL[2]*1.3)); - //"snow" - c1 = mix(c1, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0)); - - N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); - vec3 l = gl_LightSource[0].position.xyz; - vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l)); - float shadow_factor = 1.0; - - // Shadow - if ( quality_level >= 3.0 ) { - dp += ds * d; - vec3 sl = normalize( vec3( dot( l, VTangent ), dot( l, VBinormal ), dot( -l, VNormal ) ) ); - ds = sl.xy * depth_factor / sl.z; - dp -= ds * d; - float dl = ray_intersect(NormalTex, dp, ds); - if ( dl < d - 0.05 ) - shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25; - } - // end shadow - - vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * shadow_factor * vec4(diffuse, 1.0); - - c1 *= ambient_light; - vec4 finalColor = c1; - - //if(gl_Fog.density == 1.0) - // fogFactor=1.0; - -// gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor); - finalColor.rgb = fog_Func(finalColor.rgb, fogType); - gl_FragColor = finalColor; - - } diff --git a/Compositor/Shaders/Default/landmass.geom b/Compositor/Shaders/Default/landmass.geom deleted file mode 100644 index 41f15b253..000000000 --- a/Compositor/Shaders/Default/landmass.geom +++ /dev/null @@ -1,124 +0,0 @@ -#version 150 -#extension GL_EXT_geometry_shader4 : enable - -// Geometry shader that creates a prism from a terrain triangle, -// resulting in a forest effect. -// -// A geometry shader should do as little computation as possible. - -// See landmass-g.vert for a description of the inputs. -in vec4 rawposIn[3]; -in vec3 NormalIn[3]; -in vec4 ecPosIn[3]; -in vec3 ecNormalIn[3]; -in vec3 VTangentIn[3]; -in vec3 VBinormalIn[3]; -in vec4 constantColorIn[3]; - -uniform float canopy_height; - -// model position -out vec4 rawpos; -// eye position -out vec4 ecPosition; -// eye space surface matrix -out vec3 VNormal; -out vec3 VTangent; -out vec3 VBinormal; -// model normal -out vec3 Normal; -out vec4 constantColor; -out float bump; - -// Emit one vertex of the forest geometry. -// parameters: -// i - index into original terrain triangle -void doVertex(in int i, in vec4 pos, in vec4 ecpos, in vec4 screenpos, - in vec3 rawNormal, in vec3 normal, in float s) -{ - rawpos = pos; - ecPosition = ecpos; - Normal = rawNormal; - VNormal = normal; - VTangent = VTangentIn[i]; - VBinormal = VBinormalIn[i]; - bump = s; - - gl_FrontColor = gl_FrontColorIn[i]; - constantColor = constantColorIn[i]; - gl_Position = screenpos; - gl_TexCoord[0] = gl_TexCoordIn[i][0]; - EmitVertex(); -} - -vec3 rawSideNormal[3]; -vec3 sideNormal[3]; - -// Emit a vertex for a forest side triangle -void doSideVertex(in int vertIdx, in int sideIdx, vec4 pos, in vec4 ecpos, - in vec4 screenpos) -{ - doVertex(vertIdx, pos, ecpos, screenpos, rawSideNormal[sideIdx], - sideNormal[sideIdx], 0.0); -} - -void main(void) -{ - vec4 rawTopDisp = vec4(0.0, 0.0, canopy_height, 0.0); - vec4 ecTopDisp = gl_ModelViewMatrix * rawTopDisp; - vec4 mvpTopDisp = gl_ModelViewProjectionMatrix * rawTopDisp; - // model forest top - vec4 rawTopIn[3]; - vec4 ecTopIn[3]; - vec4 positionTopIn[3]; - rawSideNormal[0] = normalize(cross((rawposIn[1] - rawposIn[0]).xyz, - NormalIn[0])); - rawSideNormal[1] = normalize(cross((rawposIn[2] - rawposIn[1]).xyz, - NormalIn[1])); - rawSideNormal[2] = normalize(cross((rawposIn[0] - rawposIn[2]).xyz, - NormalIn[2])); - for (int i = 0; i < 3; ++i) { - sideNormal[i] = gl_NormalMatrix * rawSideNormal[i]; - rawTopIn[i] = rawposIn[i] + rawTopDisp; - ecTopIn[i] = ecPosIn[i] + ecTopDisp; - positionTopIn[i] = gl_PositionIn[i] + mvpTopDisp; - } - if (canopy_height > 0.01) { - // Sides - doSideVertex(0, 0, rawTopIn[0], ecTopIn[0], positionTopIn[0]); - doSideVertex(0, 0, rawposIn[0], ecPosIn[0], gl_PositionIn[0]); - doSideVertex(1, 0, rawTopIn[1], ecTopIn[1], positionTopIn[1]); - doSideVertex(1, 0, rawposIn[1], ecPosIn[1], gl_PositionIn[1]); - - doSideVertex(2, 1, rawTopIn[2], ecTopIn[2], positionTopIn[2]); - doSideVertex(2, 1, rawposIn[2], ecPosIn[2], gl_PositionIn[2]); - - doSideVertex(0, 2, rawTopIn[0], ecTopIn[0], positionTopIn[0]); - doSideVertex(0, 2, rawposIn[0], ecPosIn[0], gl_PositionIn[0]); - // Degenerate triangles; avoids EndPrimitive() - doSideVertex(0, 2, rawposIn[0], ecPosIn[0], gl_PositionIn[0]); - doVertex(0, rawTopIn[0], ecTopIn[0], positionTopIn[0], NormalIn[0], - ecNormalIn[0], 1.0); - // Top - } - doVertex(0, rawTopIn[0], ecTopIn[0], positionTopIn[0], NormalIn[0], - ecNormalIn[0], 1.0); - doVertex(1, rawTopIn[1], ecTopIn[1], positionTopIn[1], NormalIn[1], - ecNormalIn[1], 1.0); - doVertex(2, rawTopIn[2], ecTopIn[2], positionTopIn[2], NormalIn[2], - ecNormalIn[2], 1.0); - // Don't render "bottom" triangle for now; it's hidden. -#if 0 - // degenerate - doVertex(2, rawTopIn[2], ecTopIn[2], positionTopIn[2], NormalIn[2], - ecNormalIn[2], 1.0); - // bottom - doVertex(0, rawposIn[0], ecPosIn[0], gl_PositionIn[0], NormalIn[0], - ecNormalIn[0], 1.0); - doVertex(1, rawposIn[1], ecPosIn[1], gl_PositionIn[1], NormalIn[1], - ecNormalIn[1], 1.0); - doVertex(2, rawposIn[2], ecPosIn[2], gl_PositionIn[2], NormalIn[2], - ecNormalIn[2], 1.0); -#endif - EndPrimitive(); -} diff --git a/Compositor/Shaders/Default/landmass.vert b/Compositor/Shaders/Default/landmass.vert deleted file mode 100644 index 83ea4bc7b..000000000 --- a/Compositor/Shaders/Default/landmass.vert +++ /dev/null @@ -1,37 +0,0 @@ -#version 120 - -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 Normal; -varying vec4 constantColor; - -attribute vec3 tangent; -attribute vec3 binormal; - -// ////fog "include" ///// -// uniform int fogType; -// -// void fog_Func(int type); -// -// ////////////////////// - -void main(void) - { - rawpos = gl_Vertex; - ecPosition = gl_ModelViewMatrix * rawpos; - Normal = normalize(gl_Normal); - VNormal = gl_NormalMatrix * gl_Normal; - VTangent = gl_NormalMatrix * tangent; - VBinormal = gl_NormalMatrix * binormal; - - gl_FrontColor = gl_Color; - constantColor = gl_FrontMaterial.emission - + gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient); - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - -// fog_Func(fogType); - } diff --git a/Compositor/Shaders/Default/rain-layer.frag b/Compositor/Shaders/Default/rain-layer.frag deleted file mode 100644 index 41c1e4a23..000000000 --- a/Compositor/Shaders/Default/rain-layer.frag +++ /dev/null @@ -1,12 +0,0 @@ -#version 120 - -uniform sampler2D baseTexture; -varying float fogFactor; - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - vec4 finalColor = base * gl_Color; - gl_FragColor.rgb = mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor ); - gl_FragColor.a = mix(0.0, finalColor.a, fogFactor); -} diff --git a/Compositor/Shaders/Default/rain-layer.vert b/Compositor/Shaders/Default/rain-layer.vert deleted file mode 100644 index a0f677297..000000000 --- a/Compositor/Shaders/Default/rain-layer.vert +++ /dev/null @@ -1,56 +0,0 @@ -// -*-C++-*- -#version 120 - -varying float fogFactor; - -uniform float range; // From /sim/rendering/clouds3d-vis-range - -float shade = 0.8; -float cloud_height = 1000.0; - -void main(void) -{ - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - //gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0); - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0); - vec3 u = normalize(ep.xyz - l.xyz); - - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); - gl_Position.x = gl_Vertex.x; - gl_Position.y += gl_Vertex.y; - gl_Position.z += gl_Vertex.z; - gl_Position.xyz += gl_Color.xyz; - - - - // Determine a lighting normal based on the vertex position from the - // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. - float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));; - - // Determine the position - used for fog and shading calculations - vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); - float fogCoord = abs(ecPosition.z); - float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); - - - gl_Position = gl_ModelViewProjectionMatrix * gl_Position; - -// Determine the shading of the sprite based on its vertical position and position relative to the sun. - n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front - vec4 backlight = gl_LightSource[0].diffuse * shade; - - gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n); - gl_FrontColor += gl_FrontLightModelProduct.sceneColor; - - // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(100.0, 250.0, fogCoord), 1.0 - smoothstep(range*0.9, range, fogCoord)); - gl_BackColor = gl_FrontColor; - - // Fog doesn't affect rain as much as other objects. - fogFactor = exp( -gl_Fog.density * fogCoord * 0.4); - fogFactor = clamp(fogFactor, 0.0, 1.0); -} diff --git a/Compositor/Shaders/Default/reflect-bump-spec.frag b/Compositor/Shaders/Default/reflect-bump-spec.frag deleted file mode 100644 index 5245f36ff..000000000 --- a/Compositor/Shaders/Default/reflect-bump-spec.frag +++ /dev/null @@ -1,141 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Author: Vivian Meazza. - -#version 120 - -varying vec3 rawpos; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 Normal; -varying vec3 vViewVec; -varying vec3 reflVec; - -varying vec4 Diffuse; -varying float alpha; -//varying float fogCoord; - -uniform samplerCube Environment; -uniform sampler2D Rainbow; -uniform sampler2D BaseTex; -uniform sampler2D Fresnel; -uniform sampler2D Map; -uniform sampler2D NormalTex; -uniform sampler3D Noise; - -uniform float refl_correction; -uniform float rainbowiness; -uniform float fresneliness; -uniform float noisiness; -uniform float ambient_correction; -uniform float reflect_map; -uniform float normalmap_dds; - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -void main (void) -{ - vec3 halfV; - float NdotL, NdotHV; - - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = gl_LightSource[0].halfVector.xyz; - - - vec4 color = gl_Color; - vec4 specular = vec4(0.0); - vec4 ns = texture2D(NormalTex, gl_TexCoord[0].st); - vec3 n = ns.rgb * 2.0 - 1.0; - n = normalize(n.x * VTangent + n.y * VBinormal + n.z * VNormal); - - //fix dds normal - if (normalmap_dds > 0.0) { - n = -n; - } - - NdotL = max(0.0, dot(n, lightDir)); - - // calculate the specular light - if (NdotL > 0.0) { - color += Diffuse * NdotL; - halfV = normalize(halfVector); - NdotHV = max(dot(n, halfV), 0.0); - if (gl_FrontMaterial.shininess > 0.0) - specular.rgb = (gl_FrontMaterial.specular.rgb * ns.a - * gl_LightSource[0].specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess)); - } - - //color.a = alpha; - vec4 texel = texture2D(BaseTex, gl_TexCoord[0].st); - //vec4 texelcolor = color * texel + specular; - color.a = texel.a * alpha; - color = clamp(color, 0.0, 1.0); - - // calculate the fog factor -// const float LOG2 = 1.442695; -// float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2); -// fogFactor = clamp(fogFactor, 0.0, 1.0); -// -// if(gl_Fog.density == 1.0) -// fogFactor=1.0; - - vec3 normal = normalize(VNormal); - vec3 viewVec = normalize(vViewVec); - - // Map a rainbowish color - float v = dot(viewVec, normal); - vec4 rainbow = texture2D(Rainbow, vec2(v, 0.0)); - - // Map a fresnel effect - vec4 fresnel = texture2D(Fresnel, vec2(v, 0.0)); - - // map the refection of the environment - vec4 reflection = textureCube(Environment, reflVec); - - // set the user shininess offse - float transparency_offset = clamp(refl_correction, -1.0, 1.0); - float reflFactor = 0.0; - - if(reflect_map > 0.0){ - // map the shininess of the object with user input - vec4 map = texture2D(Map, gl_TexCoord[0].st); - //float pam = (map.a * -2) + 1; //reverse map - reflFactor = map.a + transparency_offset; - } else { - // set the reflectivity proportional to shininess with user input - reflFactor = (gl_FrontMaterial.shininess / 128.0) * ns.a + transparency_offset; - } - - reflFactor = clamp(reflFactor, 0.0, 1.0); - - // set ambient adjustment to remove bluiness with user input - float ambient_offset = clamp(ambient_correction, -1.0, 1.0); - vec4 ambient_Correction = vec4(gl_LightSource[0].ambient.rg, gl_LightSource[0].ambient.b * 0.6, 0.5) * ambient_offset ; - ambient_Correction = clamp(ambient_Correction, -1.0, 1.0); - - // map noise vector - vec4 noisevec = texture3D(Noise, rawpos.xyz); - - // add fringing fresnel and rainbow effects and modulate by reflection - vec4 reflcolor = mix(reflection, rainbow, rainbowiness * v); - vec4 reflfrescolor = mix(reflcolor, fresnel, fresneliness * v); - vec4 noisecolor = mix(reflfrescolor, noisevec, noisiness); - vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0); - - vec4 mixedcolor = mix(texel, raincolor, reflFactor); - - // the final reflection - vec4 reflColor = vec4(color.rgb * mixedcolor.rgb + specular.rgb + ambient_Correction.rgb, color.a); - - reflColor = clamp(reflColor, 0.0, 1.0); - -// gl_FragColor = mix(gl_Fog.color, reflColor, fogFactor); - reflColor.rgb = fog_Func(reflColor.rgb, fogType); - gl_FragColor = reflColor; -} \ No newline at end of file diff --git a/Compositor/Shaders/Default/reflect-bump-spec.vert b/Compositor/Shaders/Default/reflect-bump-spec.vert deleted file mode 100644 index 45d6f7273..000000000 --- a/Compositor/Shaders/Default/reflect-bump-spec.vert +++ /dev/null @@ -1,71 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// © Emilian Huminiuc and Vivian Meazza 2011 -#version 120 - -varying vec3 rawpos; -varying float fogCoord; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 Normal; -varying vec3 vViewVec; -varying vec3 reflVec; - -varying vec4 Diffuse; -varying float alpha; - -uniform mat4 osg_ViewMatrixInverse; - -attribute vec3 tangent; -attribute vec3 binormal; - -////fog "include"//////// -// uniform int fogType; -// -// void fog_Func(int type); -///////////////////////// - -void main(void) -{ - rawpos = gl_Vertex.xyz / gl_Vertex.w; - vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - ecPosition.xyz = ecPosition.xyz / ecPosition.w; - //fogCoord = ecPosition.z; - //fog_Func(fogType); - - vec3 n = normalize(gl_Normal); - vec3 t = cross(gl_Normal, vec3(1.0,0.0,0.0)); - vec3 b = cross(n,t); - - VNormal = normalize(gl_NormalMatrix * gl_Normal); - VTangent = normalize(gl_NormalMatrix * tangent); - VBinormal = normalize(gl_NormalMatrix * binormal); - Normal = normalize(gl_Normal); - - Diffuse = gl_Color * gl_LightSource[0].diffuse; - //Diffuse= gl_Color.rgb * max(0.0, dot(normalize(VNormal), gl_LightSource[0].position.xyz)); - - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - alpha = gl_FrontMaterial.diffuse.a; - else - alpha = gl_Color.a; - - // Vertex in eye coordinates - vec3 vertVec = ecPosition.xyz; - - vViewVec.x = dot(t, vertVec); - vViewVec.y = dot(b, vertVec); - vViewVec.z = dot(n, vertVec); - - // calculate the reflection vector - vec4 reflect_eye = vec4(reflect(vertVec, VNormal), 0.0); - reflVec = normalize(gl_ModelViewMatrixInverse * reflect_eye).xyz; - - gl_FrontColor = gl_FrontMaterial.emission + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); - - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; -} diff --git a/Compositor/Shaders/Default/runway.frag b/Compositor/Shaders/Default/runway.frag deleted file mode 100644 index ca7b5ab00..000000000 --- a/Compositor/Shaders/Default/runway.frag +++ /dev/null @@ -1,132 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// © Emilian Huminiuc and Vivian Meazza 2011 - -#version 120 - -varying vec3 rawpos; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 vViewVec; -varying vec3 reflVec; - -varying vec4 Diffuse; -varying float alpha; -//varying float fogCoord; - -uniform samplerCube Environment; -uniform sampler2D Rainbow; -uniform sampler2D BaseTex; -uniform sampler2D Fresnel; -uniform sampler2D Map; -uniform sampler2D NormalTex; -uniform sampler3D Noise; - -uniform float spec_adjust; -uniform float rainbowiness; -uniform float fresneliness; -uniform float noisiness; -uniform float ambient_correction; -uniform float normalmap_dds; - -//uniform int fogType; - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -void main (void) -{ - //vec3 halfV; - //float NdotL, NdotHV; - - vec4 texel = texture2D(BaseTex, gl_TexCoord[0].st); - vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * 8.0); - vec4 map = texture2D(Map, gl_TexCoord[0].st * 8.0); - vec4 specNoise = texture3D(Noise, rawpos.xyz * 0.0045); - vec4 noisevec = texture3D(Noise, rawpos.xyz); - - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = gl_LightSource[0].halfVector.xyz; - vec3 N; - float pf; - - N = nmap.rgb * 2.0 - 1.0; - N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); - if (normalmap_dds > 0) - N = -N; - - float lightness = dot(texel.rgb, vec3( 0.3, 0.59, 0.11 )); - // calculate the specular light - float refl_correction = spec_adjust * 2.5 - 1.0; - float shininess = max (0.35, refl_correction); - float nDotVP = max(0.0, dot(N, normalize(gl_LightSource[0].position.xyz))); - float nDotHV = max(0.0, dot(N, normalize(gl_LightSource[0].halfVector.xyz))); - - if (nDotVP == 0.0) - pf = 0.0; - else - pf = pow(nDotHV, /*gl_FrontMaterial.*/shininess); - - vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP; - //vec4 Specular = vec4(vec3(0.5*shininess), 1.0)* gl_LightSource[0].specular * pf; - vec4 Specular = vec4(1.0)* lightness * gl_LightSource[0].specular * pf; - - vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse; - //color += Specular * vec4(vec3(0.5*shininess), 1.0) * nmap.a; - float nFactor = 1.0 - N.z; - color += Specular * vec4(1.0) * nmap.a * nFactor; - color.a = texel.a * alpha; - color = clamp(color, 0.0, 1.0); - - vec3 viewVec = normalize(vViewVec); - - // Map a rainbowish color - float v = abs(dot(viewVec, normalize(VNormal))); - vec4 rainbow = texture2D(Rainbow, vec2(v, 0.0)); - - // Map a fresnel effect - vec4 fresnel = texture2D(Fresnel, vec2(v, 0.0)); - - // map the refection of the environment - vec4 reflection = textureCube(Environment, reflVec * dot(N,VNormal)); - - - // set the user shininess offset - float transparency_offset = clamp(refl_correction, -1.0, 1.0); - float reflFactor = 0.0; - - float MixFactor = specNoise.r * specNoise.g * specNoise.b * 350.0; - - MixFactor = 0.75 * smoothstep(0.0, 1.0, MixFactor); - - reflFactor = max(map.a * (texel.r + texel.g), 1.0 - MixFactor) * (1.0- N.z) + transparency_offset ; - - reflFactor =0.75 * smoothstep(0.05, 1.0, reflFactor); - - // set ambient adjustment to remove bluiness with user input - float ambient_offset = clamp(ambient_correction, -1.0, 1.0); - vec4 ambient_Correction = vec4(gl_LightSource[0].ambient.rg, gl_LightSource[0].ambient.b * 0.6, 0.5) * ambient_offset ; - ambient_Correction = clamp(ambient_Correction, -1.0, 1.0); - - // add fringing fresnel and rainbow effects and modulate by reflection - vec4 reflcolor = mix(reflection, rainbow, rainbowiness * v); - reflcolor += Specular * nmap.a * nFactor; - vec4 reflfrescolor = mix(reflcolor, fresnel, fresneliness * v); - vec4 noisecolor = mix(reflfrescolor, noisevec, noisiness); - vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0); - raincolor += Specular * nmap.a * nFactor; - - - vec4 mixedcolor = mix(texel, raincolor * (1.0 - refl_correction * (1.0 - lightness)), reflFactor); //* (1.0 - 0.5 * transparency_offset ) - - // the final reflection - vec4 fragColor = vec4(color.rgb * mixedcolor.rgb + ambient_Correction.rgb * (1.0 - refl_correction * (1.0 - 0.8 * lightness)) * nFactor, color.a); - fragColor += Specular * nmap.a * nFactor; - - fragColor.rgb = fog_Func(fragColor.rgb, fogType); - gl_FragColor = fragColor; -} \ No newline at end of file diff --git a/Compositor/Shaders/Default/terrain-nocolor.frag b/Compositor/Shaders/Default/terrain-nocolor.frag deleted file mode 100644 index 7943cc1a7..000000000 --- a/Compositor/Shaders/Default/terrain-nocolor.frag +++ /dev/null @@ -1,26 +0,0 @@ -// -*-C++-*- -#version 120 - -uniform sampler2D texture; - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - - -void main() -{ - vec4 color = vec4(1.0, 1.0, 1.0, 1.0); - vec4 texel; - vec4 fragColor; - vec4 finalColor; - - texel = texture2D(texture, gl_TexCoord[0].st); - fragColor = color * texel; - - finalColor.rgb = fog_Func(fragColor.rgb, fogType); - gl_FragColor = finalColor; - -} diff --git a/Compositor/Shaders/Default/transition.frag b/Compositor/Shaders/Default/transition.frag deleted file mode 100644 index 521755f1f..000000000 --- a/Compositor/Shaders/Default/transition.frag +++ /dev/null @@ -1,171 +0,0 @@ -// -*-C++-*- -// Texture switching based on face slope and snow level -// based on earlier work by Frederic Bouvier, Tim Moore, and Yves Sablonier. -// © Emilian Huminiuc 2011 - -#version 120 - -varying float RawPosZ; -varying vec3 WorldPos; -varying vec3 normal; -varying vec3 Vnormal; - -uniform float SnowLevel; -uniform float Transitions; -uniform float InverseSlope; -uniform float RainNorm; - -uniform float CloudCover0; -uniform float CloudCover1; -uniform float CloudCover2; -uniform float CloudCover3; -uniform float CloudCover4; - -uniform sampler2D BaseTex; -uniform sampler2D SecondTex; -uniform sampler2D ThirdTex; -uniform sampler2D SnowTex; - -uniform sampler3D NoiseTex; - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -void main() - { - float pf = 0.0; - - vec3 lightDir = gl_LightSource[0].position.xyz; - vec3 halfVector = gl_LightSource[0].halfVector.xyz; - - vec4 texel = vec4(0.0); - vec4 specular = vec4(0.0); - - float cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4); - - vec4 Noise = texture3D(NoiseTex, WorldPos.xyz*0.0011); - vec4 Noise2 = texture3D(NoiseTex, WorldPos.xyz * 0.00008); - float MixFactor = Noise.r * Noise.g * Noise.b; //Mixing Factor to create a more organic looking boundary - float MixFactor2 = Noise2.r * Noise2.g * Noise2.b; - MixFactor *= 300.0; - MixFactor2 *= 300.0; - MixFactor = clamp(MixFactor, 0.0, 1.0); - MixFactor2 = clamp(MixFactor2, 0.0, 1.0); - float L1 = 0.90 - 0.02 * MixFactor; //first transition slope - float L2 = 0.78 + 0.04 * MixFactor; //Second transition slope - - // If gl_Color.a == 0, this is a back-facing polygon and the - // Vnormal should be reversed. - // vec3 n = (2.0 * gl_Color.a - 1.0) * Vnormal; - vec3 n = normalize(Vnormal); - - float nDotVP = max(0.0, dot(n, normalize(gl_LightSource[0].position.xyz))); - float nDotHV = max(0.0, dot(n, normalize(gl_LightSource[0].halfVector.xyz))); - vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP; - - if (nDotVP > 0.0) - pf = pow(nDotHV, gl_FrontMaterial.shininess); - - if (gl_FrontMaterial.shininess > 0.0) - specular = gl_FrontMaterial.specular * gl_LightSource[0].diffuse * pf; - -// vec4 diffuseColor = gl_FrontMaterial.emission + -// vec4(1.0) * (gl_LightModel.ambient + gl_LightSource[0].ambient) + -// Diffuse * gl_FrontMaterial.diffuse; - vec4 ambientColor = gl_LightModel.ambient + gl_LightSource[0].ambient; - //vec4 diffuseColor = gl_Color + Diffuse * gl_FrontMaterial.diffuse + ambientColor; - vec4 diffuseColor = vec4(Diffuse) + ambientColor; //ATI workaround - diffuseColor += specular * gl_FrontMaterial.specular; - - // This shouldn't be necessary, but our lighting becomes very - // saturated. Clamping the color before modulating by the texture - // is closer to what the OpenGL fixed function pipeline does. - diffuseColor = clamp(diffuseColor, 0.0, 1.0); - - - //Select texture based on slope - float slope = normalize(normal).z; - - //pull the texture fetch outside flow control to fix aliasing artefacts :( - vec4 baseTexel = texture2D(BaseTex, gl_TexCoord[0].st); - vec4 secondTexel = texture2D(SecondTex, gl_TexCoord[0].st); - vec4 thirdTexel = texture2D(ThirdTex, gl_TexCoord[0].st); - vec4 snowTexel = texture2D(SnowTex, gl_TexCoord[0].st); - - //Normal transition. For more abrupt faces apply another texture (or 2). - if (InverseSlope == 0.0) { - //Do we do an intermediate transition - if (Transitions >= 1.5) { - if (slope >= L1) { - texel = baseTexel; - } - if (slope >= L2 && slope < L1){ - texel = mix(secondTexel, baseTexel, smoothstep(L2, L1 - 0.06 * MixFactor, slope)); - } - if (slope < L2){ - texel = mix(thirdTexel, secondTexel, smoothstep(L2 - 0.13 * MixFactor, L2, slope)); - } - // Just one transition - } else if (Transitions < 1.5) { - if (slope >= L1) { - texel = baseTexel; - } - if (slope < L1) { - texel = mix(thirdTexel, baseTexel, smoothstep(L2 - 0.13 * MixFactor, L1, slope)); - } - } - - //Invert the transition: keep original texture on abrupt slopes and switch to another on flatter terrain - } else if (InverseSlope > 0.0) { - //Interemdiate transition ? - if (Transitions >= 1.5) { - if (slope >= L1 + 0.1) { - texel = thirdTexel; - } - if (slope >= L2 && slope < L1 + 0.1){ - texel = mix(secondTexel, thirdTexel, smoothstep(L2 + 0.06 * MixFactor, L1 + 0.1, slope)); - } - if (slope <= L2){ - texel = mix(baseTexel, secondTexel, smoothstep(L2 - 0.06 * MixFactor, L2, slope)); - } - //just one - } else if (Transitions < 1.5) { - if (slope > L1 + 0.1) { - texel = thirdTexel; - } - if (slope <= L1 + 0.1){ - texel = mix(baseTexel, thirdTexel, smoothstep(L2 - 0.06 * MixFactor, L1 + 0.1, slope)); - } - } - } - - //darken textures with wetness - float wetness = 1.0 - 0.3 * RainNorm; - texel.rgb = texel.rgb * wetness; - - float altitude = RawPosZ; - //Snow texture for areas higher than SnowLevel - if (altitude >= SnowLevel - (1000.0 * slope + 300.0 * MixFactor) && slope > L2 - 0.12) { - texel = mix(texel, mix(texel, snowTexel, smoothstep(L2 - 0.09 * MixFactor, L2, slope)), - smoothstep(SnowLevel - (1000.0 * slope + 300.0 * MixFactor), - SnowLevel - (1000.0 * slope - 150.0 * MixFactor), - altitude) - ); - } - - vec4 fragColor = diffuseColor * texel + specular; - - if(cover >= 2.5){ - fragColor.rgb = fragColor.rgb * 1.2; - } else { - fragColor.rg = fragColor.rg * (0.6 + 0.2 * cover); - fragColor.b = fragColor.b * (0.5 + 0.25 * cover); - } - - fragColor.rgb *= 1.2 - 0.6 * MixFactor * MixFactor2; - fragColor.rgb = fog_Func(fragColor.rgb, fogType); - gl_FragColor = fragColor; - } diff --git a/Compositor/Shaders/Default/transition.vert b/Compositor/Shaders/Default/transition.vert deleted file mode 100644 index fdfade826..000000000 --- a/Compositor/Shaders/Default/transition.vert +++ /dev/null @@ -1,25 +0,0 @@ -// -*-C++-*- -// -*-C++-*- -// Texture switching based on face slope and snow level -// based on earlier work by Frederic Bouvier, Tim Moore, and Yves Sablonier. -// © Emilian Huminiuc 2011 - - -#version 120 - -varying float RawPosZ; -varying vec3 WorldPos; -varying vec3 normal; -varying vec3 Vnormal; - -uniform mat4 osg_ViewMatrixInverse; - -void main() - { - RawPosZ = gl_Vertex.z; - WorldPos = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex).xyz; - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = normalize(gl_Normal); - Vnormal = normalize(gl_NormalMatrix * gl_Normal); - } diff --git a/Compositor/Shaders/Default/tree.frag b/Compositor/Shaders/Default/tree.frag deleted file mode 100644 index 30b7ceaa2..000000000 --- a/Compositor/Shaders/Default/tree.frag +++ /dev/null @@ -1,22 +0,0 @@ -#version 120 -uniform sampler2D baseTexture; -//varying float fogFactor; -//varying vec4 PointPos; -//varying vec4 EyePos; - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - if (base.a <= 0.01) - discard; - vec4 fragColor = base * gl_Color; - //gl_FragColor = vec4(mix(gl_Fog.color.rgb, finalColor.rgb, fogFactor ), finalColor.a); - fragColor.rgb = fog_Func(fragColor.rgb, fogType); - gl_FragColor = fragColor; -} diff --git a/Compositor/Shaders/Default/tree.vert b/Compositor/Shaders/Default/tree.vert deleted file mode 100644 index 0f03a4d0e..000000000 --- a/Compositor/Shaders/Default/tree.vert +++ /dev/null @@ -1,52 +0,0 @@ -// Tree instance scheme: -// vertex - local position of quad vertex. -// normal - x y scaling, z number of varieties -// fog coord - rotation -// color - xyz of tree quad origin, replicated 4 times. -#version 120 -//varying float fogCoord; -// varying vec3 PointPos; -//varying vec4 EyePos; -// ////fog "include"//////// -// uniform int fogType; -// -// void fog_Func(int type); -// ///////////////////////// -uniform float season; - -void main(void) -{ - float numVarieties = gl_Normal.z; - float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties; - texFract += floor(gl_MultiTexCoord0.x) / numVarieties; - - // Determine the rotation for the tree. The Fog Coordinate provides rotation information - // to rotate one of the quands by 90 degrees. We then apply an additional position seed - // so that trees aren't all oriented N/S - float sr = sin(gl_FogCoord + gl_Color.x); - float cr = cos(gl_FogCoord + gl_Color.x); - gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0); - gl_TexCoord[0].y = gl_TexCoord[0].y + 0.5 * season; - - // scaling - vec3 position = gl_Vertex.xyz * gl_Normal.xxy; - - // Rotation of the generic quad to specific one for the tree. - position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr))); - position = position + gl_Color.xyz; - gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0); - vec3 ecPosition = vec3(gl_ModelViewMatrix * vec4(position, 1.0)); - - float n = dot(normalize(gl_LightSource[0].position.xyz), normalize(-ecPosition)); - - vec3 diffuse = gl_FrontMaterial.diffuse.rgb * max(0.1, n); - vec4 ambientColor = gl_FrontLightModelProduct.sceneColor + gl_LightSource[0].ambient * gl_FrontMaterial.ambient; - gl_FrontColor = ambientColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0); - - //fogCoord = abs(ecPosition.z); - //fogFactor = exp( -gl_Fog.density * gl_Fog.density * fogCoord * fogCoord); - //fogFactor = clamp(fogFactor, 0.0, 1.0); -// fog_Func(fogType); -// PointPos = ecPosition; - //EyePos = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); -} diff --git a/Compositor/Shaders/Default/trivial.frag b/Compositor/Shaders/Default/trivial.frag deleted file mode 100644 index e15ff0a53..000000000 --- a/Compositor/Shaders/Default/trivial.frag +++ /dev/null @@ -1,12 +0,0 @@ -// -*-C++-*- -#version 120 - - - -void main() -{ - - gl_FragColor = vec4 (1.0, 1.0, 1.0, 1.0); - - -} diff --git a/Compositor/Shaders/Default/trivial.vert b/Compositor/Shaders/Default/trivial.vert deleted file mode 100644 index f4240d0c6..000000000 --- a/Compositor/Shaders/Default/trivial.vert +++ /dev/null @@ -1,18 +0,0 @@ -// -*-C++-*- - -// Shader that uses OpenGL state values to do per-pixel lighting -// -// The only light used is gl_LightSource[0], which is assumed to be -// directional. -// -// Diffuse colors come from the gl_Color, ambient from the material. This is -// equivalent to osg::Material::DIFFUSE. -#version 120 -#define MODE_OFF 0 -#define MODE_DIFFUSE 1 -#define MODE_AMBIENT_AND_DIFFUSE 2 - -void main() -{ - gl_Position = ftransform(); -} diff --git a/Compositor/Shaders/Default/trivial_transparent.frag b/Compositor/Shaders/Default/trivial_transparent.frag deleted file mode 100644 index c03ed6e8f..000000000 --- a/Compositor/Shaders/Default/trivial_transparent.frag +++ /dev/null @@ -1,12 +0,0 @@ -#version 120 -uniform sampler2D baseTexture; - - -void main(void) -{ - vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); - if (base.a <= 0.01) - discard; - - gl_FragColor = vec4 (1.0, 1.0, 1.0, 1.0); -} diff --git a/Compositor/Shaders/Default/ubershader.frag b/Compositor/Shaders/Default/ubershader.frag deleted file mode 100644 index 1a8507ee4..000000000 --- a/Compositor/Shaders/Default/ubershader.frag +++ /dev/null @@ -1,287 +0,0 @@ -// -*- mode: C; -*- -// UBERSHADER - default forward rendering - fragment shader -// Licence: GPL v2 -// Authors: Frederic Bouvier and Gijs de Rooy -// with major additions and revisions by -// Emilian Huminiuc and Vivian Meazza 2011 -#version 120 - -varying vec4 diffuseColor; -varying vec3 VBinormal; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 rawpos; -varying vec3 eyeVec; -varying vec3 eyeDir; - -uniform sampler2D BaseTex; -uniform sampler2D LightMapTex; -uniform sampler2D NormalTex; -uniform sampler2D ReflGradientsTex; -uniform sampler2D ReflMapTex; -uniform sampler3D ReflNoiseTex; -uniform samplerCube Environment; - -uniform int dirt_enabled; -uniform int dirt_multi; -uniform int lightmap_enabled; -uniform int lightmap_multi; -uniform int nmap_dds; -uniform int nmap_enabled; -uniform int refl_enabled; -uniform int refl_dynamic; -uniform int refl_map; - -uniform float amb_correction; -uniform float dirt_b_factor; -uniform float dirt_g_factor; -uniform float dirt_r_factor; -uniform float lightmap_a_factor; -uniform float lightmap_b_factor; -uniform float lightmap_g_factor; -uniform float lightmap_r_factor; -uniform float nmap_tile; -uniform float refl_correction; -uniform float refl_fresnel; -uniform float refl_noise; -uniform float refl_rainbow; - -uniform vec3 lightmap_r_color; -uniform vec3 lightmap_g_color; -uniform vec3 lightmap_b_color; -uniform vec3 lightmap_a_color; - -uniform vec3 dirt_r_color; -uniform vec3 dirt_g_color; -uniform vec3 dirt_b_color; - -///reflection orientation -uniform mat4 osg_ViewMatrixInverse; -uniform float latDeg; -uniform float lonDeg; - -///fog include////////////////////// -uniform int fogType; -vec3 fog_Func(vec3 color, int type); -//////////////////////////////////// - - -//////rotation matrices///////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -mat3 rotX(in float angle) -{ - mat3 rotmat = mat3( - 1.0, 0.0, 0.0, - 0.0, cos(angle), -sin(angle), - 0.0, sin(angle), cos(angle) - ); - return rotmat; -} - -mat3 rotY(in float angle) -{ - mat3 rotmat = mat3( - cos(angle), 0.0, sin(angle), - 0.0, 1.0, 0.0, - -sin(angle), 0.0, cos(angle) - ); - return rotmat; -} - -mat3 rotZ(in float angle) -{ - mat3 rotmat = mat3( - cos(angle), -sin(angle), 0.0, - sin(angle), cos(angle), 0.0, - 0.0, 0.0, 1.0 - ); - return rotmat; -} - -//////////////////////////////////////////////////////////////////////////////// - - -void main (void) -{ - vec4 texel = texture2D(BaseTex, gl_TexCoord[0].st); - vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * nmap_tile); - vec4 reflmap = texture2D(ReflMapTex, gl_TexCoord[0].st); - vec4 noisevec = texture3D(ReflNoiseTex, rawpos.xyz); - vec4 lightmapTexel = texture2D(LightMapTex, gl_TexCoord[0].st); - - vec3 mixedcolor; - vec3 N = vec3(0.0,0.0,1.0); - float pf = 0.0; - - ///BEGIN bump ////////////////////////////////////////////////////////////////// - if (nmap_enabled > 0 ){ - N = nmap.rgb * 2.0 - 1.0; - N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); - if (nmap_dds > 0) - N = -N; - } else { - N = normalize(VNormal); - } - ///END bump //////////////////////////////////////////////////////////////////// - vec3 viewN = normalize((gl_ModelViewMatrixTranspose * vec4(N,0.0)).xyz); - vec3 viewVec = normalize(eyeVec); - float v = abs(dot(viewVec, viewN));// Map a rainbowish color - vec4 fresnel = texture2D(ReflGradientsTex, vec2(v, 0.75)); - vec4 rainbow = texture2D(ReflGradientsTex, vec2(v, 0.25)); - - mat4 reflMatrix = gl_ModelViewMatrixInverse; - vec3 wRefVec = reflect(viewVec,N); - - ////dynamic reflection ///////////////////////////// - if (refl_dynamic > 0){ - reflMatrix = osg_ViewMatrixInverse; - - vec3 wVertVec = normalize(reflMatrix * vec4(viewVec,0.0)).xyz; - vec3 wNormal = normalize(reflMatrix * vec4(N,0.0)).xyz; - - float latRad = radians(90.-latDeg); - float lonRad = radians(lonDeg); - - mat3 rotCorrY = rotY(latRad); - mat3 rotCorrZ = rotZ(lonRad); - mat3 reflCorr = rotCorrY * rotCorrZ; - wRefVec = reflect(wVertVec,wNormal); - wRefVec = normalize(reflCorr * wRefVec); - } else { ///static reflection - wRefVec = normalize(reflMatrix * vec4(wRefVec,0.0)).xyz; - } - - vec3 reflection = textureCube(Environment, wRefVec).xyz; - - vec3 E = eyeDir; - E = normalize(E); - - vec3 L = normalize((gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz); - vec3 H = normalize(L + E); - - N = viewN; - - float nDotVP = dot(N,L); - float nDotHV = dot(N,H); - float eDotLV = max(0.0, dot(-E,L)); - - //glare on the backside of tranparent objects - if ((gl_Color.a < .999 || texel.a < 1.0) && nDotVP < 0.0) { - nDotVP = dot(-N, L); - nDotHV = dot(-N, H); - } - - nDotVP = max(0.0, nDotVP); - nDotHV = max(0.0, nDotHV); - - if (nDotVP == 0.0) - pf = 0.0; - else - pf = pow(nDotHV, gl_FrontMaterial.shininess); - - vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP; - vec4 Specular = gl_FrontMaterial.specular * gl_LightSource[0].diffuse * pf; - - vec4 color = gl_Color + Diffuse*diffuseColor; - color = clamp( color, 0.0, 1.0 ); - color.a = texel.a * diffuseColor.a; - //////////////////////////////////////////////////////////////////// - //BEGIN reflect - //////////////////////////////////////////////////////////////////// - if (refl_enabled > 0 ){ - float reflFactor = 0.0; - float transparency_offset = clamp(refl_correction, -1.0, 1.0);// set the user shininess offset - - if(refl_map > 0){ - // map the shininess of the object with user input - reflFactor = reflmap.a + transparency_offset; - } else if (nmap_enabled > 0) { - // set the reflectivity proportional to shininess with user input - reflFactor = gl_FrontMaterial.shininess * 0.0078125 * nmap.a + transparency_offset; - } else { - reflFactor = gl_FrontMaterial.shininess* 0.0078125 + transparency_offset; - } - reflFactor = clamp(reflFactor, 0.0, 1.0); - - // add fringing fresnel and rainbow effects and modulate by reflection - vec3 reflcolor = mix(reflection, rainbow.rgb, refl_rainbow * v); - vec3 reflfrescolor = mix(reflcolor, fresnel.rgb, refl_fresnel * v); - vec3 noisecolor = mix(reflfrescolor, noisevec.rgb, refl_noise); - vec3 raincolor = noisecolor * reflFactor; - raincolor += Specular.rgb; - raincolor *= gl_LightSource[0].diffuse.rgb; - mixedcolor = mix(texel.rgb, raincolor, reflFactor); - } else { - mixedcolor = texel.rgb; - } - ///////////////////////////////////////////////////////////////////// - //END reflect - ///////////////////////////////////////////////////////////////////// - - if (color.a<1.0){ - color.a += .1 * eDotLV; - } - ////////////////////////////////////////////////////////////////////// - //begin DIRT - ////////////////////////////////////////////////////////////////////// - if (dirt_enabled >= 1){ - vec3 dirtFactorIn = vec3 (dirt_r_factor, dirt_g_factor, dirt_b_factor); - vec3 dirtFactor = reflmap.rgb * dirtFactorIn.rgb; - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_r_color, smoothstep(0.0, 1.0, dirtFactor.r)); - if (color.a < 1.0) { - color.a += dirtFactor.r * eDotLV; - } - if (dirt_multi > 0) { - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_g_color, smoothstep(0.0, 1.0, dirtFactor.g)); - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_b_color, smoothstep(0.0, 1.0, dirtFactor.b)); - if (color.a < 1.0) { - color.a += dirtFactor.g * eDotLV; - color.a += dirtFactor.b * eDotLV; - } - } - - } - ////////////////////////////////////////////////////////////////////// - //END Dirt - ////////////////////////////////////////////////////////////////////// - - - // set ambient adjustment to remove bluiness with user input - float ambient_offset = clamp(amb_correction, -1.0, 1.0); - vec4 ambient = gl_LightModel.ambient + gl_LightSource[0].ambient; - - vec3 ambient_Correction = vec3(ambient.rg, ambient.b * 0.6); - - ambient_Correction *= ambient_offset; - ambient_Correction = clamp(ambient_Correction, -1.0, 1.0); - - vec4 fragColor = vec4(color.rgb * mixedcolor + ambient_Correction.rgb, color.a); - - fragColor += Specular * nmap.a; - - ////////////////////////////////////////////////////////////////////// - // BEGIN lightmap - ////////////////////////////////////////////////////////////////////// - if ( lightmap_enabled >= 1 ) { - vec3 lightmapcolor = vec3(0.0); - vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor, - lightmap_b_factor, lightmap_a_factor); - lightmapFactor = lightmapFactor * lightmapTexel; - if (lightmap_multi > 0 ){ - lightmapcolor = lightmap_r_color * lightmapFactor.r + - lightmap_g_color * lightmapFactor.g + - lightmap_b_color * lightmapFactor.b + - lightmap_a_color * lightmapFactor.a ; - } else { - lightmapcolor = lightmapTexel.rgb * lightmap_r_color * lightmapFactor.r; - } - fragColor.rgb = max(fragColor.rgb, lightmapcolor * smoothstep(0.0, 1.0, mixedcolor*.5 + lightmapcolor*.5)); - } - ////////////////////////////////////////////////////////////////////// - // END lightmap - ///////////////////////////////////////////////////////////////////// - - fragColor.rgb = fog_Func(fragColor.rgb, fogType); - - gl_FragColor = fragColor; -} diff --git a/Compositor/Shaders/Default/ubershader.vert b/Compositor/Shaders/Default/ubershader.vert deleted file mode 100644 index 5379107a0..000000000 --- a/Compositor/Shaders/Default/ubershader.vert +++ /dev/null @@ -1,67 +0,0 @@ -// -*- mode: C; -*- -// UBERSHADER - vertex shader -// Licence: GPL v2 -// © Emilian Huminiuc and Vivian Meazza 2011 -#version 120 - -varying vec4 diffuseColor; -varying vec3 VBinormal; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 rawpos; -varying vec3 eyeVec; -varying vec3 eyeDir; - -attribute vec3 tangent; -attribute vec3 binormal; - -uniform int nmap_enabled; -uniform int rembrandt_enabled; - -void main(void) -{ - rawpos = gl_Vertex.xyz; - vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - eyeVec = ecPosition.xyz; - eyeDir = gl_ModelViewMatrixInverse[3].xyz - gl_Vertex.xyz; - - VNormal = normalize(gl_NormalMatrix * gl_Normal); - - vec3 n = normalize(gl_Normal); - -// generate "fake" binormals/tangents - vec3 c1 = cross(n, vec3(0.0,0.0,1.0)); - vec3 c2 = cross(n, vec3(0.0,1.0,0.0)); - vec3 tempTangent = c1; - - if(length(c2)>length(c1)){ - tempTangent = c2; - } - - vec3 tempBinormal = cross(n, tempTangent); - - if (nmap_enabled > 0){ - tempTangent = tangent; - tempBinormal = binormal; - } - - VTangent = normalize(gl_NormalMatrix * tempTangent); - VBinormal = normalize(gl_NormalMatrix * tempBinormal); - - diffuseColor = gl_Color; - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - diffuseColor.a = gl_FrontMaterial.diffuse.a; - - if(rembrandt_enabled < 1){ - gl_FrontColor = gl_FrontMaterial.emission + gl_Color - * (gl_LightModel.ambient + gl_LightSource[0].ambient); - } else { - gl_FrontColor = gl_Color; - } - - gl_Position = ftransform(); - gl_ClipVertex = ecPosition; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; -} diff --git a/Compositor/Shaders/Default/urban.frag b/Compositor/Shaders/Default/urban.frag deleted file mode 100644 index 057a8b92a..000000000 --- a/Compositor/Shaders/Default/urban.frag +++ /dev/null @@ -1,255 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Author: Frederic Bouvier. -// Adapted from the paper by F. Policarpo et al. : Real-time Relief Mapping on Arbitrary Polygonal Surfaces -// Adapted from the paper and sources by M. Drobot in GPU Pro : Quadtree Displacement Mapping with Height Blending - -#version 120 - -#extension GL_ATI_shader_texture_lod : enable -#extension GL_ARB_shader_texture_lod : enable - -#define TEXTURE_MIP_LEVELS 10 -#define TEXTURE_PIX_COUNT 1024 //pow(2,TEXTURE_MIP_LEVELS) -#define BINARY_SEARCH_COUNT 10 -#define BILINEAR_SMOOTH_FACTOR 2.0 - -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 VTangent; -//varying vec3 VBinormal; -varying vec3 Normal; -varying vec4 constantColor; - -uniform sampler3D NoiseTex; -uniform sampler2D BaseTex; -uniform sampler2D NormalTex; -uniform sampler2D QDMTex; -uniform float depth_factor; -uniform float tile_size; -uniform float quality_level; -uniform float snowlevel; -uniform vec3 night_color; -uniform bool random_buildings; -uniform bool osm_buildings; - -const float scale = 1.0; -int linear_search_steps = 10; -int GlobalIterationCount = 0; -int gIterationCap = 64; - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -void QDM(inout vec3 p, inout vec3 v) -{ - const int MAX_LEVEL = TEXTURE_MIP_LEVELS; - const float NODE_COUNT = TEXTURE_PIX_COUNT; - const float TEXEL_SPAN_HALF = 1.0 / NODE_COUNT / 2.0; - - float fDeltaNC = TEXEL_SPAN_HALF * depth_factor; - - vec3 p2 = p; - float level = MAX_LEVEL; - vec2 dirSign = (sign(v.xy) + 1.0) * 0.5; - GlobalIterationCount = 0; - float d = 0.0; - - while (level >= 0.0 && GlobalIterationCount < gIterationCap) - { - vec4 uv = vec4(p2.xyz, level); - d = texture2DLod(QDMTex, uv.xy, uv.w).w; - - if (d > p2.z) - { - //predictive point of ray traversal - vec3 tmpP2 = p + v * d; - - //current node count - float nodeCount = pow(2.0, (MAX_LEVEL - level)); - //current and predictive node ID - vec4 nodeID = floor(vec4(p2.xy, tmpP2.xy)*nodeCount); - - //check if we are crossing the current cell - if (nodeID.x != nodeID.z || nodeID.y != nodeID.w) - { - //calculate distance to nearest bound - vec2 a = p2.xy - p.xy; - vec2 p3 = (nodeID.xy + dirSign) / nodeCount; - vec2 b = p3.xy - p.xy; - - vec2 dNC = (b.xy * p2.z) / a.xy; - //take the nearest cell - d = min(d,min(dNC.x, dNC.y))+fDeltaNC; - - level++; - } - p2 = p + v * d; - } - level--; - GlobalIterationCount++; - } - - // - // Manual Bilinear filtering - // - float rayLength = length(p2.xy - p.xy) + fDeltaNC; - - float dA = p2.z * (rayLength - BILINEAR_SMOOTH_FACTOR * TEXEL_SPAN_HALF) / rayLength; - float dB = p2.z * (rayLength + BILINEAR_SMOOTH_FACTOR * TEXEL_SPAN_HALF) / rayLength; - - vec4 p2a = vec4(p + v * dA, 0.0); - vec4 p2b = vec4(p + v * dB, 0.0); - dA = texture2DLod(NormalTex, p2a.xy, p2a.w).w; - dB = texture2DLod(NormalTex, p2b.xy, p2b.w).w; - - dA = abs(p2a.z - dA); - dB = abs(p2b.z - dB); - - p2 = mix(p2a.xyz, p2b.xyz, dA / (dA + dB)); - - p = p2; -} - -float ray_intersect_QDM(vec2 dp, vec2 ds) -{ - vec3 p = vec3( dp, 0.0 ); - vec3 v = vec3( ds, 1.0 ); - QDM( p, v ); - return p.z; -} - -float ray_intersect_relief(vec2 dp, vec2 ds) -{ - float size = 1.0 / float(linear_search_steps); - float depth = 0.0; - float best_depth = 1.0; - - for(int i = 0; i < linear_search_steps - 1; ++i) - { - depth += size; - float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a); - if(best_depth > 0.996) - if(depth >= t) - best_depth = depth; - } - depth = best_depth; - - const int binary_search_steps = 5; - - for(int i = 0; i < binary_search_steps; ++i) - { - size *= 0.5; - float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a); - if(depth >= t) - { - best_depth = depth; - depth -= 2.0 * size; - } - depth += size; - } - - return(best_depth); -} - -float ray_intersect(vec2 dp, vec2 ds) -{ - if (( random_buildings ) || (osm_buildings)) - {return 0.0;} - else if ( quality_level >= 4.0 ) - {return ray_intersect_QDM( dp, ds );} - else - {return ray_intersect_relief( dp, ds );} -} - -void main (void) -{ - if ( quality_level >= 3.0 ) { - linear_search_steps = 20; - } - - float depthfactor = depth_factor; - if (( random_buildings ) || (osm_buildings)) {depthfactor = 0.0;} - - vec3 normal = normalize(VNormal); - vec3 tangent = normalize(VTangent); - //vec3 binormal = normalize(VBinormal); - vec3 binormal = normalize(cross(normal, tangent)); - vec3 ecPos3 = ecPosition.xyz / ecPosition.w; - vec3 V = normalize(ecPos3); - vec3 s = vec3(dot(V, tangent), dot(V, binormal), dot(normal, -V)); - vec2 ds = s.xy * depthfactor / s.z; - vec2 dp = gl_TexCoord[0].st - ds; - float d = ray_intersect(dp, ds); - - vec2 uv = dp + ds * d; - vec3 N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0; - - - float emis = N.z; - N.z = sqrt(1.0 - min(1.0,dot(N.xy, N.xy))); - float Nz = N.z; - N = normalize(N.x * tangent + N.y * binormal + N.z * normal); - - vec3 l = gl_LightSource[0].position.xyz; - vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l)); - float shadow_factor = 1.0; - - // Shadow - if ( quality_level >= 2.0 ) { - dp += ds * d; - vec3 sl = normalize( vec3( dot( l, tangent ), dot( l, binormal ), dot( -l, normal ) ) ); - ds = sl.xy * depthfactor / sl.z; - dp -= ds * d; - float dl = ray_intersect(dp, ds); - if ( dl < d - 0.05 ) - shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25; - } - // end shadow - - vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0); - float reflectance = ambient_light.r * 0.3 + ambient_light.g * 0.59 + ambient_light.b * 0.11; - if ( shadow_factor < 1.0 ) - ambient_light = constantColor + gl_LightSource[0].diffuse * shadow_factor * vec4(diffuse, 1.0); - float emission_factor = (1.0 - smoothstep(0.15, 0.25, reflectance)) * emis; - vec4 tc = texture2D(BaseTex, uv); - emission_factor *= 0.5*pow(tc.r+0.8*tc.g+0.2*tc.b, 2.0) -0.2; - ambient_light += (emission_factor * vec4(night_color, 0.0)); - - vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale); - vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale); - - float n=0.06; - n += nvL[0]*0.4; - n += nvL[1]*0.6; - n += nvL[2]*2.0; - n += nvL[3]*4.0; - n += noisevec[0]*0.1; - n += noisevec[1]*0.4; - - n += noisevec[2]*0.8; - n += noisevec[3]*2.1; - n = mix(0.6, n, length(ecPosition.xyz) ); - - vec4 finalColor = texture2D(BaseTex, uv); - finalColor = mix(finalColor, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), - step(0.8,Nz)*(1.0-emis)*smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0)); - finalColor *= ambient_light; - - vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depthfactor / s.z, 1.0 ); - - finalColor.rgb = fog_Func(finalColor.rgb, fogType); - gl_FragColor = finalColor; - - if (dot(normal,-V) > 0.1) { - vec4 iproj = gl_ProjectionMatrix * p; - iproj /= iproj.w; - gl_FragDepth = (iproj.z+1.0)/2.0; - } else { - gl_FragDepth = gl_FragCoord.z; - } -} diff --git a/Compositor/Shaders/Default/urban.vert b/Compositor/Shaders/Default/urban.vert deleted file mode 100644 index c065bc59e..000000000 --- a/Compositor/Shaders/Default/urban.vert +++ /dev/null @@ -1,36 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Author: Frederic Bouvier -#version 120 - -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 Normal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec4 constantColor; - -attribute vec3 tangent, binormal; - -////fog "include"//////// -// uniform int fogType; -// -// void fog_Func(int type); -///////////////////////// - -void main(void) -{ - rawpos = gl_Vertex; - ecPosition = gl_ModelViewMatrix * gl_Vertex; - VNormal = normalize(gl_NormalMatrix * gl_Normal); - Normal = normalize(gl_Normal); - VTangent = gl_NormalMatrix * tangent; - VBinormal = gl_NormalMatrix * binormal; - gl_FrontColor = gl_Color; - constantColor = gl_FrontMaterial.emission - + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; -// fog_Func(fogType); -} diff --git a/Compositor/Shaders/Default/wake.vert b/Compositor/Shaders/Default/wake.vert deleted file mode 100644 index d95ba57ec..000000000 --- a/Compositor/Shaders/Default/wake.vert +++ /dev/null @@ -1,70 +0,0 @@ -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// © Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// © Emilian Huminiuc and Vivian Meazza -// Optimisation - 2012-5-05 -// © Emilian Huminiuc and Vivian Meazza - -#version 120 -#define fps2kts 0.5925 - -varying vec4 waterTex1; -varying vec4 waterTex2; -varying vec3 viewerdir; -varying vec3 lightdir; -varying vec3 normal; - -uniform float osg_SimulationTime; -uniform float WindE, WindN, spd, hdg; - -///////////////////////// - - -/////// functions ///////// - -void relWind(out float rel_wind_speed_kts, float rel_wind_from_deg) -{ - //calculate the carrier speed north and east in kts - float speed_north_kts = cos(radians(hdg)) * spd ; - float speed_east_kts = sin(radians(hdg)) * spd ; - - //calculate the relative wind speed north and east in kts - float rel_wind_speed_from_east_kts = WindE*fps2kts + speed_east_kts; - float rel_wind_speed_from_north_kts = WindN*fps2kts + speed_north_kts; - - //combine relative speeds north and east to get relative windspeed in kts - rel_wind_speed_kts = sqrt((rel_wind_speed_from_east_kts * rel_wind_speed_from_east_kts) + (rel_wind_speed_from_north_kts * rel_wind_speed_from_north_kts)); - - //calculate the relative wind direction - rel_wind_from_deg = degrees(atan(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts)); -} - -void main(void) -{ - - float relWindspd=0; - float relWinddir=0; - //compute relative wind speed and direction - relWind (relWindspd, relWinddir); - - vec3 N = normalize(gl_Normal); - normal = N; - - viewerdir = vec3(gl_ModelViewMatrixInverse[3]) - vec3(gl_Vertex); - lightdir = normalize(vec3(gl_ModelViewMatrixInverse * gl_LightSource[0].position)); - - vec4 t1 = vec4(osg_SimulationTime*0.005217, 0.0, 0.0, 0.0); - vec4 t2 = vec4(osg_SimulationTime*-0.0012, 0.0, 0.0, 0.0); - - float windFactor = -relWindspd * 0.1; -// float windFactor = sqrt(pow(abs(WindE),2)+pow(abs(WindN),2)) * 0.6; - - waterTex1 = gl_MultiTexCoord0 + t1 * windFactor; - waterTex2 = gl_MultiTexCoord0 + t2 * windFactor; - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_Position = ftransform(); - -} diff --git a/Compositor/Shaders/Default/water-orig.frag b/Compositor/Shaders/Default/water-orig.frag deleted file mode 100644 index 4262ac1c2..000000000 --- a/Compositor/Shaders/Default/water-orig.frag +++ /dev/null @@ -1,93 +0,0 @@ -#version 120 - -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 Normal; -varying vec3 lightVec; - -uniform sampler3D NoiseTex; -uniform float osg_SimulationTime; - -//const float scale = 1.0; -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -void main (void) -{ - vec4 noisevecS = texture3D(NoiseTex, (rawpos.xyz)*0.0126); - vec4 nvLS = texture3D(NoiseTex, (rawpos.xyz)*-0.0003323417); - - vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.00423+vec3(0.0,0.0,osg_SimulationTime*0.035217)); - vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.001223417+(0.0,0.0,osg_SimulationTime*-0.0212)); - -// float fogFactor; -// if (gl_Fog.density == 1.0) -// { -// fogFactor=1.0; -// } -// else -// { -// float fogCoord = ecPosition.z; -// const float LOG2 = 1.442695; -// fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2); -// fogFactor = clamp(fogFactor, 0.0, 1.0); -// } - - float a=1.0; - float n=0.00; - n += nvLS[0]*a; - a/=2.0; - n += nvLS[1]*a; - a/=2.0; - n += nvLS[2]*a; - a/=2.0; - n += nvLS[3]*a; - - a=4.0; - float na=n; - na += nvL[0]*1.1; - a*=1.2; - na += nvL[1]*a; - a*=1.2; - na += nvL[2]*a; - a*=1.2; - na += nvL[3]*a; - a=2.0; - na += noisevec[0]*a*0.2; - a*=1.2; - na += noisevec[1]*a; - a*=1.2; - na += noisevec[2]*a; - a*=1.2; - na += noisevec[3]*a; - - vec4 c1; - c1 = asin(vec4(smoothstep(0.0, 2.2, n), smoothstep(-0.1, 2.10, n), smoothstep(-0.2, 2.0, n), 1.0)); - - vec3 Eye = normalize(-ecPosition.xyz); - vec3 Reflected = normalize(reflect(-normalize(lightVec), normalize(VNormal+vec3(0.0,0.0,na*0.10-0.24)))); - - vec3 bump = normalize(VNormal+vec3(0.0, 0.0, na)-0.9); - vec3 bumped = max(normalize(refract(lightVec, normalize(bump), 0.16)), 0.0); - - vec4 ambientColor = gl_LightSource[0].ambient; - vec4 light = ambientColor; - c1 *= light; - - float bumpFact = (bumped.r+bumped.g+bumped.b); - float ReflectedEye = max(dot(Reflected, Eye), 0.0); - float eyeFact = pow(ReflectedEye, 20.0); - c1 += 0.3 * gl_LightSource[0].diffuse * (1.0-eyeFact) * bumpFact*bumpFact; - c1 += 0.4 * gl_LightSource[0].diffuse * eyeFact * 3.0*bumpFact; - eyeFact = pow(eyeFact, 20.0); - c1 += gl_LightSource[0].specular * eyeFact * 4.0*bumpFact; - - vec4 finalColor = c1; -// gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor); - finalColor.rgb = fog_Func(finalColor.rgb, fogType); - gl_FragColor = finalColor; -} diff --git a/Compositor/Shaders/Default/water-orig.vert b/Compositor/Shaders/Default/water-orig.vert deleted file mode 100644 index a191481ba..000000000 --- a/Compositor/Shaders/Default/water-orig.vert +++ /dev/null @@ -1,17 +0,0 @@ -#version 120 - -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 Normal; -varying vec3 lightVec; - -void main(void) -{ - rawpos = gl_Vertex; - ecPosition = gl_ModelViewMatrix * gl_Vertex; - VNormal = normalize(gl_NormalMatrix * gl_Normal); - Normal = normalize(gl_Normal); - lightVec = normalize(gl_LightSource[0].position.xyz/* - ecPosition*/); - gl_Position = ftransform(); -} diff --git a/Compositor/Shaders/Default/water.frag b/Compositor/Shaders/Default/water.frag deleted file mode 100644 index dfd7f5746..000000000 --- a/Compositor/Shaders/Default/water.frag +++ /dev/null @@ -1,222 +0,0 @@ -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// © Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// © Emilian Huminiuc and Vivian Meazza -// Optimisation - 2012-5-05 -// Based on ideas by Thorsten Renk -// © Emilian Huminiuc and Vivian Meazza - -#version 120 - -uniform sampler2D perlin_normalmap; -uniform sampler2D sea_foam; -uniform sampler2D water_dudvmap; -uniform sampler2D water_normalmap; -uniform sampler2D water_reflection; -uniform sampler2D water_reflection_grey; - -uniform float CloudCover0; -uniform float CloudCover1; -uniform float CloudCover2; -uniform float CloudCover3; -uniform float CloudCover4; -uniform float Overcast; -uniform float WaveAmp; -uniform float WaveFreq; -uniform float WaveSharp; -uniform float WindE; -uniform float WindN; -uniform float normalmap_dds; -uniform float osg_SimulationTime; -uniform float saturation; - -uniform int Status; - -varying vec3 lightdir; -varying vec3 normal; -varying vec3 viewerdir; -varying vec4 waterTex1; //moving texcoords -varying vec4 waterTex2; //moving texcoords - - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -/////// functions ///////// - -void rotationmatrix(in float angle, out mat4 rotmat) - { - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); - } - -void main(void) - { - const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005); - const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02); - const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25); - - mat4 RotationMatrix; - // compute direction to viewer - vec3 E = normalize(viewerdir); - - // compute direction to light source - vec3 L = normalize(lightdir); - - // half vector - vec3 H = normalize(L + E); - - vec3 Normal = normalize(normal); - - const float water_shininess = 240.0; - - // approximate cloud cover - float cover = 0.0; - //bool Status = true; - - - float windEffect = sqrt( WindE*WindE + WindN*WindN ) * 0.6; //wind speed in kt - float windScale = 15.0/(3.0 + windEffect); //wave scale - float windEffect_low = 0.3 + 0.7 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter - float waveRoughness = 0.05 + smoothstep(0.0, 20.0, windEffect); //wave roughness filter - - float mixFactor = 0.75 - 0.15 * smoothstep(0.0, 40.0, windEffect); - mixFactor = clamp(mixFactor, 0.3, 0.8); - - if (Status == 1){ - cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4); - } else { - // hack to allow for Overcast not to be set by Local Weather - if (Overcast == 0.0){ - cover = 5.0; - } else { - cover = Overcast * 5.0; - } - } - - vec4 viewt = vec4(-E, 0.0) * 0.6; - - vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale) * 2.0 - 1.0; - - vec4 dist = texture2D(water_dudvmap, vec2(waterTex1 + disdis*sca2)* windScale) * 2.0 - 1.0; - dist *= (0.6 + 0.5 * smoothstep(0.0, 15.0, windEffect)); - vec4 fdist = normalize(dist); - if (normalmap_dds > 0) - fdist = -fdist; //dds fix - fdist *= sca; - - //normalmaps - rotationmatrix(radians(3.0 * windScale + 0.6 * sin(waterTex1.s * 0.2)), RotationMatrix); - vec4 nmap = texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0; - vec4 nmap1 = texture2D(perlin_normalmap, vec2(waterTex1/** RotationMatrix*/ + disdis * sca2) * windScale) * 2.0 - 1.0; - - rotationmatrix(radians(-2.0 * windScale -0.4 * sin(waterTex1.s * 0.32)), RotationMatrix); - nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 1.5) * 2.0 - 1.0; - //nmap1 += texture2D(perlin_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0; - rotationmatrix(radians(1.5 * windScale + 0.3 * sin(waterTex1.s * 0.16)), RotationMatrix); - nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 2.1) * 2.0 - 1.0; - rotationmatrix(radians(-0.5 * windScale - 0.45 * sin(waterTex1.s * 0.28)), RotationMatrix); - nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 0.8) * 2.0 - 1.0; - - rotationmatrix(radians(-1.2 * windScale - 0.35 * sin(waterTex1.s * 0.28)), RotationMatrix); - nmap += texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix* tscale) * windScale * 1.7) * 2.0 - 1.0; - nmap1 += texture2D(perlin_normalmap, vec2(waterTex2/** RotationMatrix*/ * tscale) * windScale) * 2.0 - 1.0; - - nmap *= windEffect_low; - nmap1 *= windEffect_low; - // mix water and noise, modulated by factor - vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness); - if (normalmap_dds > 0) - vNorm = -vNorm; //dds fix - - //load reflection - vec4 tmp = vec4(lightdir, 0.0); - vec4 refTex = texture2D(water_reflection, vec2(tmp + waterTex1) * 32.0) ; - vec4 refTexGrey = texture2D(water_reflection_grey, vec2(tmp + waterTex1) * 32.0) ; - vec4 refl ; - - // cover = 0; - - if(cover >= 1.5){ - refl = normalize(refTex); - refl.a = 1.0; - } - else - { - refl = normalize(refTexGrey); - refl.r *= (0.75 + 0.15 * cover); - refl.g *= (0.80 + 0.15 * cover); - refl.b *= (0.875 + 0.125 * cover); - refl.a = 1.0; - } - - rotationmatrix(radians(2.1* windScale + 0.25 * sin(waterTex1.s *0.14)), RotationMatrix); - vec3 N0 = vec3(texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 1.15) * 2.0 - 1.0); - vec3 N1 = vec3(texture2D(perlin_normalmap, vec2(waterTex1/** RotationMatrix*/ + disdis * sca) * windScale) * 2.0 - 1.0); - - rotationmatrix(radians(-1.5 * windScale -0.32 * sin(waterTex1.s *0.24)), RotationMatrix); - N0 += vec3(texture2D(water_normalmap, vec2(waterTex2* RotationMatrix * tscale) * windScale * 1.8) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2/** RotationMatrix*/ * tscale) * windScale) * 2.0 - 1.0); - - rotationmatrix(radians(3.8 * windScale + 0.45 * sin(waterTex1.s *0.32)), RotationMatrix); - N0 += vec3(texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale * 0.85) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2/** RotationMatrix*/ * (tscale + sca2)) * windScale) * 2.0 - 1.0); - - rotationmatrix(radians(-2.8 * windScale - 0.38 * sin(waterTex1.s * 0.26)), RotationMatrix); - N0 += vec3(texture2D(water_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca2) * windScale * 2.1) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex1 /** RotationMatrix*/ + disdis * sca) * windScale) * 2.0 - 1.0); - - N0 *= windEffect_low; - N1 *= windEffect_low; - - vec3 N = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness); - - if (normalmap_dds > 0) - N = -N; //dds fix - - // specular - vec3 specular_color = vec3(gl_LightSource[0].diffuse) - * pow(max(0.0, dot(N, H)), water_shininess) * 6.0; - vec4 specular = vec4(specular_color, 0.5); - - specular = specular * saturation * 0.3 ; - - //calculate fresnel - vec4 invfres = vec4( dot(vNorm, viewt) ); - vec4 fres = vec4(1.0) + invfres; - refl *= fres; - - //calculate final colour - vec4 ambient_light = gl_LightSource[0].diffuse; - vec4 finalColor; - - if(cover >= 1.5){ - finalColor = refl + specular; - } else { - finalColor = refl; - } - - float foamSlope = 0.10 + 0.1 * windScale; - - vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 25.0); - float waveSlope = N.g; - - if (windEffect >= 8.0) - if (waveSlope >= foamSlope){ - finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.50, N.g)); - } - - - finalColor *= ambient_light; - - //gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor); - finalColor.rgb = fog_Func(finalColor.rgb, fogType); - gl_FragColor = finalColor; - } diff --git a/Compositor/Shaders/Default/water.vert b/Compositor/Shaders/Default/water.vert deleted file mode 100644 index 40f49be78..000000000 --- a/Compositor/Shaders/Default/water.vert +++ /dev/null @@ -1,112 +0,0 @@ -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// Emilian Huminiuc and Vivian Meazza - -#version 120 - -varying vec4 waterTex1; -varying vec4 waterTex2; - -varying vec3 viewerdir; -varying vec3 lightdir; -varying vec3 normal; - -varying vec3 WorldPos; -varying vec2 TopoUV; - -uniform float osg_SimulationTime; -uniform mat4 osg_ViewMatrixInverse; -uniform float WindE, WindN; - -// constants for the cartezian to geodetic conversion. - -const float a = 6378137.0; //float a = equRad; -const float squash = 0.9966471893352525192801545; -const float latAdjust = 0.9999074159800018; //geotiff source for the depth map -const float lonAdjust = 0.9999537058469516; //actual extents: +-180.008333333333326/+-90.008333333333340 - -/////// functions ///////// - -void rotationmatrix(in float angle, out mat4 rotmat) - { - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); - } - -void main(void) - { - mat4 RotationMatrix; - normal = normalize(gl_Normal); - viewerdir = vec3(gl_ModelViewMatrixInverse[3]) - vec3(gl_Vertex); - lightdir = normalize(vec3(gl_ModelViewMatrixInverse * gl_LightSource[0].position)); - - vec4 t1 = vec4(0.0, osg_SimulationTime * 0.005217, 0.0, 0.0); - vec4 t2 = vec4(0.0, osg_SimulationTime * -0.0012, 0.0, 0.0); - - float Angle; - - float windFactor = sqrt(WindE * WindE + WindN * WindN) * 0.05; - - if (WindN == 0.0 && WindE == 0.0) { - Angle = 0.0; - }else{ - Angle = atan(-WindN, WindE) - atan(1.0); - } - - rotationmatrix(Angle, RotationMatrix); - waterTex1 = gl_MultiTexCoord0 * RotationMatrix - t1 * windFactor; - - rotationmatrix(Angle, RotationMatrix); - waterTex2 = gl_MultiTexCoord0 * RotationMatrix - t2 * windFactor; - - // fog_Func(fogType); - WorldPos = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex).xyz; - - - ///FIXME: convert cartezian coordinates to geodetic, this - ///FIXME: duplicates parts of code in SGGeodesy.cxx - //////////////////////////////////////////////////////////////////////////// - - float e2 = abs(1.0 - squash * squash); - float ra2 = 1.0/(a * a); - float e4 = e2 * e2; - float XXpYY = WorldPos.x * WorldPos.x + WorldPos.y * WorldPos.y; - float Z = WorldPos.z; - float sqrtXXpYY = sqrt(XXpYY); - float p = XXpYY * ra2; - float q = Z*Z*(1.0-e2)*ra2; - float r = 1.0/6.0*(p + q - e4); - float s = e4 * p * q/(4.0*r*r*r); - if ( s >= 2.0 && s <= 0.0) - s = 0.0; - float t = pow(1.0+s+sqrt(s*2.0+s*s), 1.0/3.0); - float u = r + r*t + r/t; - float v = sqrt(u*u + e4*q); - float w = (e2*u+ e2*v-e2*q)/(2.0*v); - float k = sqrt(u+v+w*w)-w; - float D = k*sqrtXXpYY/(k+e2); - - vec2 NormPosXY = normalize(WorldPos.xy); - vec2 NormPosXZ = normalize(vec2(D, WorldPos.z)); - float signS = sign(WorldPos.y); - if (-0.00015 <= WorldPos.y && WorldPos.y<=.00015) - signS = 1.0; - float signT = sign(WorldPos.z); - if (-0.0002 <= WorldPos.z && WorldPos.z<=.0002) - signT = 1.0; - float cosLon = dot(NormPosXY, vec2(1.0,0.0)); - float cosLat = dot(abs(NormPosXZ), vec2(1.0,0.0)); - TopoUV.s = signS * lonAdjust * degrees(acos(cosLon))/180.; - TopoUV.t = signT * latAdjust * degrees(acos(cosLat))/90.; - TopoUV.s = TopoUV.s * 0.5 + 0.5; - TopoUV.t = TopoUV.t * 0.5 + 0.5; - - //FIXME end///////////////////////////////////////////////////////////////// - - gl_Position = ftransform(); - } \ No newline at end of file diff --git a/Compositor/Shaders/Default/water_sine.frag b/Compositor/Shaders/Default/water_sine.frag deleted file mode 100644 index 96538b557..000000000 --- a/Compositor/Shaders/Default/water_sine.frag +++ /dev/null @@ -1,391 +0,0 @@ -// FRAGMENT SHADER -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// ©Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// ©Emilian Huminiuc and Vivian Meazza -// Optimisation - 2012-5-05 -// Based on ideas by Thorsten Renk -// ©Emilian Huminiuc and Vivian Meazza - -#version 120 - -varying vec2 TopoUV; -varying vec3 WorldPos; -varying vec3 lightdir; -varying vec3 normal; -varying vec3 viewerdir; -varying vec4 waterTex1; //moving texcoords -varying vec4 waterTex2; //moving texcoords - -uniform sampler2D perlin_normalmap; -uniform sampler2D sea_foam; -uniform sampler2D topo_map; -uniform sampler2D water_dudvmap; -uniform sampler2D water_normalmap; -uniform sampler2D water_reflection; -uniform sampler2D water_reflection_grey; -uniform sampler3D Noise; - -uniform float CloudCover0; -uniform float CloudCover1; -uniform float CloudCover2; -uniform float CloudCover3; -uniform float CloudCover4; -uniform float Overcast; -uniform float WindE; -uniform float WindN; -uniform float osg_SimulationTime; -uniform float saturation; -uniform int Status; - -uniform float WaveAmp; -uniform float WaveAngle; -uniform float WaveDAngle; -uniform float WaveFactor; -uniform float WaveFreq; -uniform float WaveSharp; -uniform float normalmap_dds; - -////fog "include" ///// -uniform int fogType; - -vec3 fog_Func(vec3 color, int type); -////////////////////// - -const vec4 AllOnes = vec4(1.0); -const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005); -const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02); -const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25); -const float water_shininess = 240.0; - -/////// functions ///////// - -void rotationmatrix(in float angle, out mat4 rotmat) -{ - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); -} - -// wave functions /////////////////////// - -struct Wave { - float freq; // 2*PI / wavelength - float amp; // amplitude - float phase; // speed * 2*PI / wavelength - vec2 dir; -}; - -Wave wave0 = Wave(1.0, 1.0, 0.5, vec2(0.97, 0.25)); -Wave wave1 = Wave(2.0, 0.5, 1.3, vec2(0.97, -0.25)); -Wave wave2 = Wave(1.0, 1.0, 0.6, vec2(0.95, -0.3)); -Wave wave3 = Wave(2.0, 0.5, 1.4, vec2(0.99, 0.1)); - -float evaluateWave(in Wave w, vec2 pos, float t) -{ - return w.amp * sin( dot(w.dir, pos) * w.freq + t * w.phase); -} - -// derivative of wave function -float evaluateWaveDeriv(Wave w, vec2 pos, float t) -{ - return w.freq * w.amp * cos( dot(w.dir, pos)*w.freq + t*w.phase); -} - -// sharp wave functions -float evaluateWaveSharp(Wave w, vec2 pos, float t, float k) -{ - return w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k); -} - -float evaluateWaveDerivSharp(Wave w, vec2 pos, float t, float k) -{ - return k*w.freq*w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k - 1.0) * cos( dot(w.dir, pos)*w.freq + t*w.phase); -} - -void sumWaves(float angle, float dangle, float windScale, float factor, out float ddx, out float ddy) -{ - mat4 RotationMatrix; - float deriv; - vec4 P = waterTex1 * 1024.0; - - rotationmatrix(radians(angle + dangle * windScale + 0.6 * sin(P.x * factor)), RotationMatrix); - P *= RotationMatrix; - - P.y += evaluateWave(wave0, P.xz, osg_SimulationTime); - deriv = evaluateWaveDeriv(wave0, P.xz, osg_SimulationTime ); - ddx = deriv * wave0.dir.x; - ddy = deriv * wave0.dir.y; - - P.y += evaluateWave(wave1, P.xz, osg_SimulationTime); - deriv = evaluateWaveDeriv(wave1, P.xz, osg_SimulationTime); - ddx += deriv * wave1.dir.x; - ddy += deriv * wave1.dir.y; - - P.y += evaluateWaveSharp(wave2, P.xz, osg_SimulationTime, WaveSharp); - deriv = evaluateWaveDerivSharp(wave2, P.xz, osg_SimulationTime, WaveSharp); - ddx += deriv * wave2.dir.x; - ddy += deriv * wave2.dir.y; - - P.y += evaluateWaveSharp(wave3, P.xz, osg_SimulationTime, WaveSharp); - deriv = evaluateWaveDerivSharp(wave3, P.xz, osg_SimulationTime, WaveSharp); - ddx += deriv * wave3.dir.x; - ddy += deriv * wave3.dir.y; -} - -void main(void) -{ - mat4 RotationMatrix; - - // compute direction to viewer - vec3 E = normalize(viewerdir); - - // compute direction to light source - vec3 L = normalize(lightdir); - - // half vector - vec3 H = normalize(L + E); - - vec3 Normal = normalize(normal); - - // approximate cloud cover - float cover = 0.0; - //bool Status = true; - -// try some aliasing fix for low angles -// float viewAngle = smoothstep(0.0,0.5,abs(dot(E,Normal))); - - // Global bathymetry texture - vec4 topoTexel = texture2D(topo_map, TopoUV); - vec4 mixNoise = texture3D(Noise, WorldPos.xyz * 0.00005); - vec4 mixNoise1 = texture3D(Noise, WorldPos.xyz * 0.00008); - float mixNoiseFactor = mixNoise.r * mixNoise.g * mixNoise.b; - float mixNoise1Factor = mixNoise1.r * mixNoise1.g * mixNoise1.b; - mixNoiseFactor *= 300.0; - mixNoise1Factor *= 300.0; - mixNoiseFactor = 0.8 + 0.2 * smoothstep(0.0,1.0, mixNoiseFactor)* smoothstep(0.0,1.0, mixNoise1Factor); - float floorMixFactor = smoothstep(0.3, 0.985, topoTexel.a * mixNoiseFactor); - vec3 floorColour = mix(topoTexel.rgb, mixNoise.rgb * mixNoise1.rgb, 0.3); - - float windFloorFactor = 1.0 + 0.5 * smoothstep(0.8, 0.985, topoTexel.a); - float windEffect = sqrt( WindE*WindE + WindN*WindN ) * 0.6; //wind speed in kt - float windFloorEffect = windEffect * windFloorFactor; - float windScale = 15.0/(3.0 + windEffect); //wave scale - float windEffect_low = 0.3 + 0.7 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter - float waveRoughness = 0.01 + smoothstep(0.0, 40.0, windEffect); //wave roughness filter - - float mixFactor = 0.2 + 0.02 * smoothstep(0.0, 50.0, windFloorEffect); - mixFactor = clamp(mixFactor, 0.3, 0.95); - - // sine waves - // - // Test data - // float WaveFreq =1.0; - // float WaveAmp = 1000.0; - // float WaveSharp = 10.0; - - vec4 ddxVec = vec4(0.0); - vec4 ddyVec = vec4(0.0); - - float ddx = 0.0, ddy = 0.0; - float ddx1 = 0.0, ddy1 = 0.0; - float ddx2 = 0.0, ddy2 = 0.0; - float ddx3 = 0.0, ddy3 = 0.0; - float waveamp; - - float angle = 0.0; - float WaveAmpFromDepth = WaveAmp * windFloorFactor; - float phaseFloorFactor = 1.0 - 0.2 * smoothstep(0.8, 0.9, topoTexel.a); - wave0.freq = WaveFreq; // * (smoothstep(0.8, 0.9, topoTexel.a)*1.5 + 0.25); - wave0.amp = WaveAmpFromDepth; - wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))); - wave0.phase *= phaseFloorFactor; - - angle -= 45.0; - wave1.freq = WaveFreq * 2.0 ; - wave1.amp = WaveAmpFromDepth * 1.25; - wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))); - wave1.phase *= phaseFloorFactor; - - angle += 30.0; - wave2.freq = WaveFreq * 3.5; - wave2.amp = WaveAmpFromDepth * 0.75; - wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))); - wave2.phase *= phaseFloorFactor; - - angle -= 50.0; - wave3.freq = WaveFreq * 3.0 ; - wave3.amp = WaveAmpFromDepth * 0.75; - wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))); - wave3.phase *= phaseFloorFactor; - - // sum waves - ddx = 0.0, ddy = 0.0; - sumWaves(WaveAngle, -1.5, windScale, WaveFactor, ddx, ddy); - - ddx1 = 0.0, ddy1 = 0.0; - sumWaves(WaveAngle, 1.5, windScale, WaveFactor, ddx1, ddy1); - - //reset the waves - angle = 0.0; - waveamp = WaveAmpFromDepth * 0.75; - - wave0.freq = WaveFreq ; - wave0.amp = waveamp; - wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))); - - angle -= 20.0; - wave1.freq = WaveFreq * 2.0 ; - wave1.amp = waveamp * 1.25; - wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))); - - angle += 35.0; - wave2.freq = WaveFreq * 3.5; - wave2.amp = waveamp * 0.75; - wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))); - - angle -= 45.0; - wave3.freq = WaveFreq * 3.0 ; - wave3.amp = waveamp * 0.75; - wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))); - - // sum waves - ddx2 = 0.0, ddy2 = 0.0; - sumWaves(WaveAngle + WaveDAngle, -1.5, windScale, WaveFactor, ddx2, ddy2); - - ddx3 = 0.0, ddy3 = 0.0; - sumWaves(WaveAngle + WaveDAngle, 1.5, windScale, WaveFactor, ddx3, ddy3); - - ddxVec = vec4(ddx, ddx1, ddx2, ddx3); - ddyVec = vec4(ddy, ddy1, ddy2, ddy3); - - float ddxSum = dot(ddxVec, AllOnes); - float ddySum = dot(ddyVec, AllOnes); - - if (Status == 1){ - cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4); - } else { - // hack to allow for Overcast not to be set by Local Weather - if (Overcast == 0.0){ - cover = 5.0; - } else { - cover = Overcast * 5.0; - } - } - - vec4 viewt = vec4(-E, 0.0) * 0.6; - - vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale) * 2.0 - 1.0; - - vec2 uvAnimSca2 = (waterTex1 + disdis * sca2).st * windScale; - //normalmaps - vec4 nmap = texture2D(water_normalmap, uvAnimSca2) * 2.0 - 1.0; - vec4 nmap1 = texture2D(perlin_normalmap, uvAnimSca2) * 2.0 - 1.0; - - rotationmatrix(radians(3.0 * sin(osg_SimulationTime * 0.0075)), RotationMatrix); - vec2 uvAnimTscale = (waterTex2 * RotationMatrix * tscale).st * windScale; - - nmap += texture2D(water_normalmap, uvAnimTscale) * 2.0 - 1.0; - nmap1 += texture2D(perlin_normalmap, uvAnimTscale) * 2.0 - 1.0; - - nmap *= windEffect_low; - nmap1 *= windEffect_low; - - // mix water and noise, modulated by factor - vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness); - vNorm.r += ddxSum; - - if (normalmap_dds > 0) - vNorm = -vNorm; //dds fix - - //load reflection - vec4 tmp = vec4(lightdir, 0.0); - vec2 refTexUV = (tmp + waterTex1).st * 32.0; - vec4 refTex = texture2D(water_reflection, refTexUV) ; - vec4 refTexGrey = texture2D(water_reflection_grey, refTexUV) ; - vec4 refl = vec4(0.0,0.0,0.0,1.0) ; - - // Test data - // cover = 0; - - if(cover >= 1.5){ - refl.rgb = normalize(refTex).rgb; - } - else - { - refl.rgb = normalize(refTexGrey).rgb; - refl.r *= (0.75 + 0.15 * cover ); - refl.g *= (0.80 + 0.15 * cover ); - refl.b *= (0.875 + 0.125 * cover); - } - -// refl.rgb = mix(refl.rgb, floorColour, 0.99 * floorMixFactor); - - vec4 N0 = texture2D(water_normalmap, uvAnimSca2) * 2.0 - 1.0; - vec4 N1 = texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca) * windScale) * 2.0 - 1.0; - - N0 += texture2D(water_normalmap, vec2(waterTex1 * tscale) * windScale) * 2.0 - 1.0; - N1 += texture2D(perlin_normalmap, vec2(waterTex2 * tscale) * windScale) * 2.0 - 1.0; - - - rotationmatrix(radians(2.0 * sin(osg_SimulationTime * 0.005)), RotationMatrix); - vec2 uvAnimTscaleSca2 = (waterTex2 * RotationMatrix * (tscale + sca2)).st * windScale; - N0 += texture2D(water_normalmap, uvAnimTscaleSca2) * 2.0 - 1.0; - N1 += texture2D(perlin_normalmap, uvAnimTscaleSca2) * 2.0 - 1.0; - - rotationmatrix(radians(-4.0 * sin(osg_SimulationTime * 0.003)), RotationMatrix); - N0 += texture2D(water_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0; - N1 += texture2D(perlin_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca) * windScale) * 2.0 - 1.0; - - N0 *= windEffect_low; - N1 *= windEffect_low; - - N0.r += ddxSum; - N0.g += ddySum; - - Normal = normalize(mix(Normal + N0.rgb, Normal + N1.rgb, mixFactor) * waveRoughness); - - if (normalmap_dds > 0) - Normal = -Normal; //dds fix - - float NdotH = max(0.0, dot(Normal, H)); - vec3 specular_color = vec3(gl_LightSource[0].diffuse) - * pow(NdotH, water_shininess) * 6.0; - vec4 specular = vec4(specular_color, 0.5); - - specular = specular * saturation * 0.3 ; - - //calculate fresnel - float vNormDotViewT = dot(vNorm, viewt); - vec4 invfres = vec4( vNormDotViewT); - vec4 fres = vec4(1.0) + invfres; - refl *= fres; - - refl.rgb = mix(refl.rgb, floorColour, floorMixFactor); - //calculate final colour - vec4 ambient_light = gl_LightSource[0].diffuse; - vec4 finalColor; - - finalColor = refl + step(1.5, cover) * specular; - - //add foam - vec4 foam_texel = texture2D(sea_foam, (waterTex2 * tscale).st * 50.0); - float foamSlope = 0.1 + 0.1 * windScale; - - float waveSlope1 = Normal.g * windFloorFactor * 0.65; - float waveSlope2 = vNorm.r * windFloorFactor * 0.3; - float waveSlope = waveSlope1 + waveSlope2; - - finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), - smoothstep(7.0, 8.0, windFloorEffect) - * step(foamSlope, waveSlope) - * smoothstep(0.01, 0.50, waveSlope)) ; - - finalColor *= ambient_light ; - - finalColor.rgb = fog_Func(finalColor.rgb, fogType) ; - gl_FragColor = finalColor ; -} diff --git a/Compositor/als-projection-2d.xml b/Compositor/als-projection-2d.xml index 8dda3e5ed..68bc045ee 100644 --- a/Compositor/als-projection-2d.xml +++ b/Compositor/als-projection-2d.xml @@ -137,6 +137,6 @@ color 2 - Compositor/Effects/projection-2d + Effects/projection-2d diff --git a/Compositor/als.xml b/Compositor/als.xml deleted file mode 100644 index 5ff5869c6..000000000 --- a/Compositor/als.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - ALS - - - color - 2d - screen - screen - rgba8 - - - depth - 2d - screen - screen - depth32f - - - sun-shadowmap-atlas - 2d - /sim/rendering/als/shadows/sun-atlas-size - /sim/rendering/als/shadows/sun-atlas-size - depth32f - clamp-to-border - clamp-to-border - clamp-to-border - linear - linear - 1.0 1.0 1.0 1.0 - true - - - - - - csm0 - 0.1 - 3.0 - - 0.0 - 0.0 - 0.5 - 0.5 - - - - csm1 - 3.0 - 50.0 - - 0.5 - 0.0 - 0.5 - 0.5 - - - - csm2 - 50.0 - 150.0 - - 0.0 - 0.5 - 0.5 - 0.5 - - - - csm3 - 150.0 - 1500.0 - - 0.5 - 0.5 - 0.5 - 0.5 - - - - - forward - scene - als-lighting - - - 128 - 1 - 1 - - - csm0 - csm1 - csm2 - csm3 - - - sun-shadowmap-atlas - 10 - - - - color - color0 - 4 - 4 - - - depth - depth - 4 - 4 - - - - - display - quad - - color - 0 - - - diff --git a/Compositor/default.xml b/Compositor/default.xml index 3e3c5126d..f2a4ce02e 100644 --- a/Compositor/default.xml +++ b/Compositor/default.xml @@ -4,4 +4,4 @@ This Compositor is used by default when none has been specified in the CameraGroup settings. --> - + diff --git a/Compositor/low-spec.xml b/Compositor/low-spec.xml deleted file mode 100644 index 8a22a859b..000000000 --- a/Compositor/low-spec.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - low-spec - - far - scene - 100.0 - - - near - scene - 0xfff7ff - - depth - 100.0 - - diff --git a/Compositor/Effects/ALS/shadow-pass.eff b/Effects/Fallback/classic-shadow.eff similarity index 79% rename from Compositor/Effects/ALS/shadow-pass.eff rename to Effects/Fallback/classic-shadow.eff index 0b049c937..29073f2dc 100644 --- a/Compositor/Effects/ALS/shadow-pass.eff +++ b/Effects/Fallback/classic-shadow.eff @@ -1,8 +1,8 @@ - Effects/ALS/shadow-pass - - als-shadow + Effects/Fallback/classic-shadow + + classic-shadow false 0 0 0 0 diff --git a/Effects/Fallback/legacy-shadow.eff b/Effects/Fallback/legacy-shadow.eff new file mode 100644 index 000000000..29073f2dc --- /dev/null +++ b/Effects/Fallback/legacy-shadow.eff @@ -0,0 +1,19 @@ + + + Effects/Fallback/classic-shadow + + classic-shadow + + false + 0 0 0 0 + back + + false + + + greater + 0.5 + + + + diff --git a/Effects/agriculture.eff b/Effects/agriculture.eff index a5a2c9818..89f9a30af 100644 --- a/Effects/agriculture.eff +++ b/Effects/agriculture.eff @@ -240,12 +240,14 @@ Shaders/terrain-ALS-ultra.vert Shaders/filters-ALS.vert + Shaders/shadows-include.vert Shaders/agriculture-ALS.frag Shaders/cloud-shadowfunc.frag - Shaders/noise.frag - Shaders/hazes.frag - Shaders/secondary_lights.frag + Shaders/noise.frag + Shaders/hazes.frag + Shaders/secondary_lights.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag grain_strength @@ -760,6 +762,27 @@ 2 + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + lequal diff --git a/Effects/airfield.eff b/Effects/airfield.eff index ea34136ab..1a3bd60f4 100644 --- a/Effects/airfield.eff +++ b/Effects/airfield.eff @@ -139,12 +139,14 @@ Shaders/terrain-ALS-ultra.vert Shaders/filters-ALS.vert + Shaders/shadows-include.vert Shaders/airfield-ALS.frag - Shaders/cloud-shadowfunc.frag - Shaders/noise.frag - Shaders/hazes.frag - Shaders/secondary_lights.frag + Shaders/cloud-shadowfunc.frag + Shaders/noise.frag + Shaders/hazes.frag + Shaders/secondary_lights.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag visibility @@ -619,6 +621,27 @@ int 2 + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + lequal false diff --git a/Effects/ambient.eff b/Effects/ambient.eff deleted file mode 100644 index d5bd2ad4a..000000000 --- a/Effects/ambient.eff +++ /dev/null @@ -1,94 +0,0 @@ - - - Effects/ambient - - /sim/rendering/rembrandt/ambient-occlusion - /sim/rendering/rembrandt/ambient-occlusion-strength - - - - false - - false - - - 0 - RenderBin - - - 0 - buffer - depth - - - 1 - buffer - normal - - - 2 - buffer - diffuse - - - 3 - buffer - spec-emis - - - 4 - buffer - ao-3 - - - Shaders/fullscreen.vert - Shaders/ambient.frag - - - depth_tex - sampler-2d - 0 - - - normal_tex - sampler-2d - 1 - - - color_tex - sampler-2d - 2 - - - spec_emis_tex - sampler-2d - 3 - - - ao_tex - sampler-2d - 4 - - - ambientOcclusion - bool - ambient-occlusion - - - ambientOcclusionStrength - float - ambient-occlusion-strength - - - - - diff --git a/Effects/bloom-blur-1.eff b/Effects/bloom-blur-1.eff deleted file mode 100644 index 2e5f259f5..000000000 --- a/Effects/bloom-blur-1.eff +++ /dev/null @@ -1,10 +0,0 @@ - - - Effects/bloom-blur-1 - Effects/blur - - 4.0 - 0.0 - bloom-1 - - diff --git a/Effects/bloom-blur-2.eff b/Effects/bloom-blur-2.eff deleted file mode 100644 index a764658b6..000000000 --- a/Effects/bloom-blur-2.eff +++ /dev/null @@ -1,10 +0,0 @@ - - - Effects/bloom-blur-2 - Effects/blur - - 0.0 - 4.0 - bloom-2 - - diff --git a/Effects/bloom-combine.eff b/Effects/bloom-combine.eff deleted file mode 100644 index d07a5b242..000000000 --- a/Effects/bloom-combine.eff +++ /dev/null @@ -1,34 +0,0 @@ - - - Effects/bloom-combine - - - - - - 0 - buffer - spec-emis - - - 1 - buffer - diffuse - - - Shaders/fullscreen.vert - Shaders/bloom-combine.frag - - - spec_emis_tex - sampler-2d - 0 - - - color_tex - sampler-2d - 1 - - - - diff --git a/Effects/blur.eff b/Effects/blur.eff deleted file mode 100644 index b80ddb095..000000000 --- a/Effects/blur.eff +++ /dev/null @@ -1,37 +0,0 @@ - - - Effects/blur - - 0.0 - 0.0 - - - - - - 0 - buffer - buffer-name - - - Shaders/fullscreen.vert - Shaders/blur.frag - - - input_tex - sampler-2d - 0 - - - blurOffset_x - float - blurOffset_x - - - blurOffset_y - float - blurOffset_y - - - - diff --git a/Effects/chute.eff b/Effects/chute.eff index f991365d2..163322f6d 100644 --- a/Effects/chute.eff +++ b/Effects/chute.eff @@ -74,11 +74,13 @@ Shaders/chute-ALS.vert + Shaders/shadows-include.vert Shaders/model-ALS-base.frag Shaders/hazes.frag Shaders/secondary_lights.frag Shaders/noise.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag visibility @@ -325,6 +327,27 @@ int tquality_level + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Effects/cliffs.eff b/Effects/cliffs.eff index e9fcaa4ec..373f097dc 100644 --- a/Effects/cliffs.eff +++ b/Effects/cliffs.eff @@ -89,12 +89,14 @@ Shaders/terrain-ALS-ultra.vert Shaders/filters-ALS.vert + Shaders/shadows-include.vert Shaders/cliffs-ALS.frag Shaders/cloud-shadowfunc.frag - Shaders/noise.frag - Shaders/hazes.frag - Shaders/secondary_lights.frag - Shaders/filters-ALS.frag + Shaders/noise.frag + Shaders/hazes.frag + Shaders/secondary_lights.frag + Shaders/filters-ALS.frag + Shaders/shadows-include.frag intrinsic_wetness diff --git a/Effects/crop.eff b/Effects/crop.eff index 5e7d265fa..961b44163 100644 --- a/Effects/crop.eff +++ b/Effects/crop.eff @@ -25,10 +25,6 @@ /sim/rendering/shaders/quality-level /sim/rendering/shaders/crop - - 0.0 - /sim/rendering/rembrandt/enabled - 2.0 @@ -89,8 +85,10 @@ Shaders/crop.vert - Shaders/include_fog.frag + Shaders/shadows-include.vert + Shaders/include_fog.frag Shaders/crop.frag + Shaders/shadows-include.frag NoiseTex @@ -112,6 +110,27 @@ float snow-level + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Effects/default-pipeline.xml b/Effects/default-pipeline.xml deleted file mode 100644 index c6c641505..000000000 --- a/Effects/default-pipeline.xml +++ /dev/null @@ -1,428 +0,0 @@ - - - - - depth - - - false - /sim/rendering/rembrandt/use-color-for-depth - - - depth-component32 - depth-component - float - screen - screen - 1.0 - clamp-to-border - - - real-depth - - - true - /sim/rendering/rembrandt/use-color-for-depth - - - depth-component32 - depth-component - float - screen - screen - 1.0 - clamp-to-border - - - depth - - - true - /sim/rendering/rembrandt/use-color-for-depth - - - rgba8 - rgba - unsigned-byte - screen - screen - 1.0 - clamp-to-border - - - normal - - - true - /sim/rendering/rembrandt/no-16bit-buffer - - - rgba8 - rgba - unsigned-byte - screen - screen - 1.0 - clamp-to-border - - - normal - - - false - /sim/rendering/rembrandt/no-16bit-buffer - - - rg16 - rg - unsigned-short - screen - screen - 1.0 - clamp-to-border - - - shadow - depth-component32 - depth-component - float - /sim/rendering/shadows/map-size - /sim/rendering/shadows/map-size - 1.0 - true - luminance - 1.0 1.0 1.0 1.0 - clamp-to-border - - - diffuse - rgba8 - rgba - unsigned-byte - screen - screen - 1.0 - clamp-to-border - - - spec-emis - rgba8 - rgba - unsigned-byte - screen - screen - 1.0 - clamp-to-border - - - ao-1 - - /sim/rendering/rembrandt/ambient-occlusion-buffers - - rgba8 - rgba - unsigned-byte - screen - screen - 0.25 - clamp-to-border - - - ao-2 - - /sim/rendering/rembrandt/ambient-occlusion-buffers - - rgba8 - rgba - unsigned-byte - screen - screen - 0.25 - clamp-to-border - - - ao-3 - - /sim/rendering/rembrandt/ambient-occlusion-buffers - - rgba8 - rgba - unsigned-byte - screen - screen - 0.25 - clamp-to-border - - - lighting - rgba8 - rgba - unsigned-byte - screen - screen - 1.0 - clamp-to-border - - - bloom-1 - - /sim/rendering/rembrandt/bloom-buffers - - rgba8 - rgba - unsigned-byte - screen - screen - 0.25 - clamp-to-border - - - bloom-2 - - /sim/rendering/rembrandt/bloom-buffers - - rgba8 - rgba - unsigned-byte - screen - screen - 0.25 - clamp-to-border - - - bloom-3 - - /sim/rendering/rembrandt/bloom-buffers - - rgba8 - rgba - unsigned-byte - screen - screen - 0.25 - clamp-to-border - - - - - geometry - 0 - - depth - depth - - - false - /sim/rendering/rembrandt/use-color-for-depth - - - - - depth - real-depth - - - true - /sim/rendering/rembrandt/use-color-for-depth - - - - - color3 - depth - - - true - /sim/rendering/rembrandt/use-color-for-depth - - - - - - color0 - normal - - - color1 - diffuse - - - color2 - spec-emis - - - - shadow - 1 - - depth - shadow - - - - ssao-1 - fullscreen - - /sim/rendering/rembrandt/ambient-occlusion-buffers - - 2 - Effects/ssao - true - 0.25 - - color0 - ao-1 - - - - ssao-2 - fullscreen - - /sim/rendering/rembrandt/ambient-occlusion-buffers - - 3 - Effects/ssao-blur-1 - 0.25 - - color0 - ao-2 - - - - ssao-3 - fullscreen - - /sim/rendering/rembrandt/ambient-occlusion-buffers - - 4 - Effects/ssao-blur-2 - 0.25 - - color0 - ao-3 - - - - lighting - 50 - - depth - depth - - - false - /sim/rendering/rembrandt/use-color-for-depth - - - - - depth - real-depth - - - true - /sim/rendering/rembrandt/use-color-for-depth - - - - - color0 - lighting - - - - sky-clouds - /sim/rendering/rembrandt/debug/lighting/sky - - - ambient - fullscreen - Effects/ambient - 1 - /sim/rendering/rembrandt/debug/lighting/ambient - - - sunlight - fullscreen - Effects/sunlight - 2 - /sim/rendering/rembrandt/debug/lighting/sunlight - - - fog - fullscreen - Effects/fog - 3 - /sim/rendering/rembrandt/debug/lighting/fog - - - lights - 4 - /sim/rendering/rembrandt/debug/lighting/lights - - - - - - bloom-1 - fullscreen - - /sim/rendering/rembrandt/bloom-buffers - - 60 - Effects/bloom-combine - 0.25 - - color0 - bloom-1 - - - - bloom-2 - fullscreen - - /sim/rendering/rembrandt/bloom-buffers - - 61 - Effects/bloom-blur-1 - 0.25 - - color0 - bloom-2 - - - - bloom-3 - fullscreen - - /sim/rendering/rembrandt/bloom-buffers - - 62 - Effects/bloom-blur-2 - 0.25 - - color0 - bloom-3 - - - - - display - 99 - Effects/display - - diff --git a/Effects/dirt-runway.eff b/Effects/dirt-runway.eff index 5c09702b2..333fc3776 100644 --- a/Effects/dirt-runway.eff +++ b/Effects/dirt-runway.eff @@ -140,12 +140,14 @@ Shaders/terrain-ALS-ultra.vert Shaders/filters-ALS.vert + Shaders/shadows-include.vert Shaders/drunway-ALS.frag - Shaders/cloud-shadowfunc.frag - Shaders/noise.frag - Shaders/hazes.frag - Shaders/secondary_lights.frag - Shaders/filters-ALS.frag + Shaders/cloud-shadowfunc.frag + Shaders/noise.frag + Shaders/hazes.frag + Shaders/secondary_lights.frag + Shaders/filters-ALS.frag + Shaders/shadows-include.frag visibility @@ -655,6 +657,27 @@ 2 + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + lequal diff --git a/Effects/display.eff b/Effects/display.eff deleted file mode 100644 index 3aaa20cc6..000000000 --- a/Effects/display.eff +++ /dev/null @@ -1,394 +0,0 @@ - - - Effects/display - - /sim/rendering/rembrandt/show-buffers - /sim/rendering/rembrandt/bloom - /sim/rendering/rembrandt/bloom-strength - /sim/rendering/rembrandt/bloom-buffers - - Textures\noise_tex.jpg - linear-mipmap-linear - repeat - repeat - normalized - - - Textures\film-dirt.png - linear-mipmap-linear - repeat - repeat - normalized - - - - /sim/rendering/rembrandt/cinema/vignette - /sim/rendering/rembrandt/cinema/inner-circle - /sim/rendering/rembrandt/cinema/outer-circle - /sim/rendering/rembrandt/cinema/color-shift - /sim/rendering/rembrandt/cinema/red-shift - /sim/rendering/rembrandt/cinema/green-shift - /sim/rendering/rembrandt/cinema/blue-shift - /sim/rendering/rembrandt/cinema/distortion - /sim/rendering/rembrandt/cinema/distortion-factor - /sim/rendering/rembrandt/cinema/color-fringe - /sim/rendering/rembrandt/cinema/color-fringe-factor - /sim/rendering/rembrandt/cinema/film-wear - - - /sim/rendering/rembrandt/debug-buffer[0]/enabled - /sim/rendering/rembrandt/debug-buffer[0]/name - /sim/rendering/rembrandt/debug-buffer[1]/enabled - /sim/rendering/rembrandt/debug-buffer[1]/name - /sim/rendering/rembrandt/debug-buffer[2]/enabled - /sim/rendering/rembrandt/debug-buffer[2]/name - /sim/rendering/rembrandt/debug-buffer[3]/enabled - /sim/rendering/rembrandt/debug-buffer[3]/name - - - - - /sim/rendering/rembrandt/night-vision - - 0.0 - /sim/rendering/rembrandt/show-buffers - - - - - - 99999 - RenderBin - - - 0 - buffer - lighting - - - 1 - buffer - bloom-3 - - - 2 - buffer - spec-emis - - - 3 - buffer - diffuse - - - 4 - texture[0]/image - texture[0]/filter - texture[0]/wrap-s - texture[0]/wrap-t - texture[0]/internal-format - - - - Shaders/fullscreen.vert - Shaders/night-vision.frag - - - lighting_tex - sampler-2d - 0 - - - bloom_tex - sampler-2d - 1 - - - spec_emis_tex - sampler-2d - 2 - - - color_tex - sampler-2d - 3 - - - noise_tex - sampler-2d - 4 - - - - bloomEnabled - bool - bloom - - - bloomStrength - float - bloom-strength - - - bloomBuffers - bool - bloom-buffers - - - - - - - - /sim/rendering/rembrandt/cinema/vignette - /sim/rendering/rembrandt/cinema/color-shift - /sim/rendering/rembrandt/cinema/distortion - - - 0.0 - /sim/rendering/rembrandt/show-buffers - - - - - - 99999 - RenderBin - - - 0 - buffer - lighting - - - 1 - buffer - bloom-3 - - - 2 - texture[1]/image - texture[1]/filter - texture[1]/wrap-s - texture[1]/wrap-t - texture[1]/internal-format - - - - Shaders/fullscreen.vert - Shaders/cinema.frag - - - lighting_tex - sampler-2d - 0 - - - bloom_tex - sampler-2d - 1 - - - film_tex - sampler-2d - 2 - - - - bloomEnabled - bool - bloom - - - bloomStrength - float - bloom-strength - - - bloomBuffers - bool - bloom-buffers - - - - vignette - bool - cinema/vignette - - - innerCircle - float - cinema/inner-circle - - - outerCircle - float - cinema/outer-circle - - - colorShift - bool - cinema/color-shift - - - redShift - float-vec3 - cinema/red-shift - - - greenShift - float-vec3 - cinema/green-shift - - - blueShift - float-vec3 - cinema/blue-shift - - - - distortion - bool - cinema/distortion - - - distortionFactor - float-vec3 - cinema/distortion-factor - - - - colorFringe - bool - cinema/color-fringe - - - colorFringeFactor - float - cinema/color-fringe-factor - - - - filmWear - bool - cinema/film-wear - - - - - - - 99999 - RenderBin - - - 0 - buffer - lighting - - - 1 - buffer - bloom-3 - - - - 2 - buffer - buffer-nw-name - - - 3 - buffer - buffer-ne-name - - - 4 - buffer - buffer-sw-name - - - 5 - buffer - buffer-se-name - - - - Shaders/fullscreen.vert - Shaders/display.frag - - - lighting_tex - sampler-2d - 0 - - - bloom_tex - sampler-2d - 1 - - - bufferNW_tex - sampler-2d - 2 - - - bufferNE_tex - sampler-2d - 3 - - - bufferSW_tex - sampler-2d - 4 - - - bufferSE_tex - sampler-2d - 5 - - - showBuffers - bool - show-buffers - - - - bufferNW_enabled - bool - buffer-nw-enabled - - - bufferNE_enabled - bool - buffer-ne-enabled - - - bufferSW_enabled - bool - buffer-sw-enabled - - - bufferSE_enabled - bool - buffer-se-enabled - - - - bloomEnabled - bool - bloom - - - bloomStrength - float - bloom-strength - - - bloomBuffers - bool - bloom-buffers - - - - diff --git a/Effects/flutter.eff b/Effects/flutter.eff index f3b3bb642..2f965b850 100644 --- a/Effects/flutter.eff +++ b/Effects/flutter.eff @@ -145,10 +145,12 @@ Shaders/flutter-ALS.vert + Shaders/shadows-include.vert Shaders/terrain-ALS-base.frag Shaders/hazes.frag Shaders/noise.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag colorMode @@ -299,7 +301,28 @@ int display_ysize - + + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + @@ -406,8 +429,10 @@ Shaders/flutter.vert + Shaders/shadows-include.vert Shaders/include_fog.frag Shaders/default.frag + Shaders/shadows-include.frag + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Effects/fog.eff b/Effects/fog.eff deleted file mode 100644 index b35de4b16..000000000 --- a/Effects/fog.eff +++ /dev/null @@ -1,78 +0,0 @@ - - - Effects/fog - - - false - - false - - - src-alpha - one-minus-src-alpha - - - 1 - RenderBin - - - 0 - buffer - depth - - - 1 - buffer - normal - - - 2 - buffer - diffuse - - - 3 - buffer - spec-emis - - - Shaders/fog.vert - Shaders/fog.frag - Shaders/gbuffer-functions.frag - - - depth_tex - sampler-2d - 0 - - - normal_tex - sampler-2d - 1 - - - color_tex - sampler-2d - 2 - - - spec_emis_tex - sampler-2d - 3 - - - - - - diff --git a/Effects/forest.eff b/Effects/forest.eff index 1405c9eca..f4737cd04 100644 --- a/Effects/forest.eff +++ b/Effects/forest.eff @@ -75,10 +75,6 @@ /sim/rendering/shaders/quality-level /sim/rendering/shaders/transition - - 0.0 - /sim/rendering/rembrandt/enabled - 2.0 @@ -162,8 +158,10 @@ Shaders/forest.vert + Shaders/shadows-include.vert Shaders/include_fog.frag Shaders/forest.frag + Shaders/shadows-include.frag tangent 6 @@ -277,6 +275,27 @@ + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Effects/glacier.eff b/Effects/glacier.eff index 77baa46c7..287ecc642 100644 --- a/Effects/glacier.eff +++ b/Effects/glacier.eff @@ -75,10 +75,6 @@ /sim/rendering/shaders/quality-level /sim/rendering/shaders/transition - - 0.0 - /sim/rendering/rembrandt/enabled - 2.0 @@ -162,8 +158,10 @@ Shaders/forest.vert + Shaders/shadows-include.vert Shaders/include_fog.frag Shaders/forest.frag + Shaders/shadows-include.frag tangent 6 @@ -277,6 +275,27 @@ + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Effects/grass.eff b/Effects/grass.eff old mode 100755 new mode 100644 index d01d89ba1..34898b1b1 --- a/Effects/grass.eff +++ b/Effects/grass.eff @@ -39,10 +39,6 @@ 1.0 /sim/rendering/shaders/vegetation-effects - - 0.0 - /sim/rendering/rembrandt/enabled - 2.0 @@ -136,12 +132,14 @@ Shaders/terrain-ALS-ultra.vert Shaders/filters-ALS.vert + Shaders/shadows-include.vert Shaders/airfield-ALS.frag Shaders/cloud-shadowfunc.frag Shaders/noise.frag Shaders/hazes.frag Shaders/secondary_lights.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag visibility @@ -616,6 +614,27 @@ int 2 + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + lequal false @@ -663,6 +682,7 @@ Shaders/grass-ALS.frag Shaders/noise.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag 96 triangles triangle-strip @@ -812,6 +832,27 @@ int wind_effects + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + true diff --git a/Effects/herbtundra.eff b/Effects/herbtundra.eff index 6a13b6f61..d1834bcc4 100644 --- a/Effects/herbtundra.eff +++ b/Effects/herbtundra.eff @@ -76,10 +76,6 @@ /sim/rendering/shaders/quality-level /sim/rendering/shaders/transition - - 0.0 - /sim/rendering/rembrandt/enabled - 2.0 @@ -162,8 +158,10 @@ Shaders/forest.vert + Shaders/shadows-include.vert Shaders/include_fog.frag Shaders/forest.frag + Shaders/shadows-include.frag tangent 6 @@ -277,6 +275,27 @@ + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Effects/landmass.eff b/Effects/landmass.eff index 3198ff71f..107c3bef8 100644 --- a/Effects/landmass.eff +++ b/Effects/landmass.eff @@ -54,10 +54,6 @@ 4.0 /sim/rendering/shaders/landmass - - 0.0 - /sim/rendering/rembrandt/enabled - 2.0 @@ -388,10 +384,6 @@ /sim/rendering/shaders/quality-level /sim/rendering/shaders/landmass - - 0.0 - /sim/rendering/rembrandt/enabled - 2.0 diff --git a/Effects/light-point.eff b/Effects/light-point.eff index 3d1f74814..0b9996e02 100644 --- a/Effects/light-point.eff +++ b/Effects/light-point.eff @@ -1,107 +1,8 @@ + Effects/light-point - - - - - false - false - - front - - 2 - RenderBin - - - one - one - - - 0 - buffer - depth - - - 1 - buffer - normal - - - 2 - buffer - diffuse - - - 3 - buffer - spec-emis - - - Shaders/light-spot.vert - Shaders/light-point.frag - Shaders/gbuffer-functions.frag - - attenuation - 12 - - - - depth_tex - sampler-2d - 0 - - - normal_tex - sampler-2d - 1 - - - color_tex - sampler-2d - 2 - - - spec_emis_tex - sampler-2d - 3 - - - LightPosition - float-vec4 - position - true - - - Ambient - float-vec4 - ambient - - - Diffuse - float-vec4 - diffuse - - - Specular - float-vec4 - specular - - - Attenuation - float-vec3 - attenuation - - - Near - float - near - - - Far - float - far - - - diff --git a/Effects/light-spot.eff b/Effects/light-spot.eff index 2b8630e52..549f6d8ea 100644 --- a/Effects/light-spot.eff +++ b/Effects/light-spot.eff @@ -1,128 +1,8 @@ + Effects/light-spot - - - - - false - false - - front - - 2 - RenderBin - - - one - one - - - 0 - buffer - depth - - - 1 - buffer - normal - - - 2 - buffer - diffuse - - - 3 - buffer - spec-emis - - - Shaders/light-spot.vert - Shaders/light-spot.frag - Shaders/gbuffer-functions.frag - - attenuation - 12 - - - - depth_tex - sampler-2d - 0 - - - normal_tex - sampler-2d - 1 - - - color_tex - sampler-2d - 2 - - - spec_emis_tex - sampler-2d - 3 - - - LightPosition - float-vec4 - position - true - - - LightDirection - float-vec4 - direction - true - - - Ambient - float-vec4 - ambient - - - Diffuse - float-vec4 - diffuse - - - Specular - float-vec4 - specular - - - Attenuation - float-vec3 - attenuation - - - Exponent - float - exponent - - - Cutoff - float - cutoff - - - CosCutoff - float - cosCutoff - - - Near - float - near - - - Far - float - far - - - diff --git a/Effects/model-combined-deferred.eff b/Effects/model-combined-deferred.eff index f4e0a87ff..37968b334 100644 --- a/Effects/model-combined-deferred.eff +++ b/Effects/model-combined-deferred.eff @@ -1,607 +1,9 @@ - Effects/model-combined-deferred Effects/model-combined - - - - - /sim/rendering/shaders/model - /sim/rendering/rembrandt/enabled - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - transparent - - - transparent - - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - - 1 - noise - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - - 5 - - texture[5]/type - - - - - - - texture[5]/images - - - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - - - - - vertex-program-two-side - - - - Shaders/ubershader.vert - Shaders/ubershader-gbuffer.frag - Shaders/gbuffer-functions.frag - Shaders/gbuffer-encode.frag - - - - BaseTex - sampler-2d - 0 - - - - ReflNoiseTex - sampler-3d - 1 - - - - NormalTex - sampler-2d - 2 - - - - LightMapTex - sampler-2d - 3 - - - - ReflMapTex - sampler-2d - 4 - - - - Environment - sampler-cube - 5 - - - - ReflGradientsTex - sampler-2d - 6 - - - - - - nmap_enabled - int - - normalmap-enabled - - - - - - nmap_dds - int - - normalmap-dds - - - - - nmap_tile - float - - normalmap-tiling - - - - - - - lightmap_enabled - int - - lightmap-enabled - - - - - lightmap_multi - int - - lightmap-multi - - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - - - - - refl_enabled - int - - reflection-enabled - - - - - refl_correction - float - - reflection-correction - - - - - - refl_map - int - - reflect-map-enabled - - - - - refl_dynamic - int - - reflection-dynamic - - - - - - refl_rainbow - float - - reflection-rainbow - - - - - - refl_fresnel - float - - reflection-fresnel - - - - - - refl_noise - float - - reflection-noise - - - - - - dirt_enabled - int - - dirt-enabled - - - - - dirt_multi - int - - dirt-multi - - - - - dirt_r_color - float-vec3 - - dirt-color[0] - - - - - dirt_r_factor - float - - dirt-factor[0] - - - - - dirt_g_color - float-vec3 - - dirt-color[1] - - - - - dirt_g_factor - float - - dirt-factor[1] - - - - - dirt_b_color - float-vec3 - - dirt-color[2] - - - - - dirt_b_factor - float - - dirt-factor[2] - - - - - - amb_correction - float - - ambient-correction - - - - - lonDeg - float - - pos-lon - - - - - latDeg - float - - pos-lat - - - - - - - - rembrandt_enabled - int - - rembrandt - - - - - \ No newline at end of file + diff --git a/Effects/model-combined-transparent.eff b/Effects/model-combined-transparent.eff index ad8ea1a57..936fb32d5 100644 --- a/Effects/model-combined-transparent.eff +++ b/Effects/model-combined-transparent.eff @@ -112,581 +112,4 @@ and fallback to plain transparency when the model shader is disabled. --> - - - - - - /sim/rendering/shaders/model - /sim/rendering/rembrandt/enabled - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - false - - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - transparent - - - transparent - - - 111 - DepthSortedBin - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - - 1 - noise - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - - 5 - - texture[5]/type - - - - - - - texture[5]/images - - - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - - vertex-program-two-side - - - - Shaders/ubershader.vert - Shaders/include_fog.frag - Shaders/ubershader.frag - - - - BaseTex - sampler-2d - 0 - - - - ReflNoiseTex - sampler-3d - 1 - - - - NormalTex - sampler-2d - 2 - - - - LightMapTex - sampler-2d - 3 - - - - ReflMapTex - sampler-2d - 4 - - - - Environment - sampler-cube - 5 - - - - ReflGradientsTex - sampler-2d - 6 - - - - - - nmap_enabled - int - - normalmap-enabled - - - - - - nmap_dds - int - - normalmap-dds - - - - - nmap_tile - float - - normalmap-tiling - - - - - - - lightmap_enabled - int - - lightmap-enabled - - - - - lightmap_multi - int - - lightmap-multi - - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - - - - - refl_enabled - int - - reflection-enabled - - - - - refl_correction - float - - reflection-correction - - - - - - refl_map - int - - reflect-map-enabled - - - - - refl_dynamic - int - - reflection-dynamic - - - - - - refl_rainbow - float - - reflection-rainbow - - - - - - refl_fresnel - float - - reflection-fresnel - - - - - - refl_noise - float - - reflection-noise - - - - - - dirt_enabled - int - - dirt-enabled - - - - - dirt_multi - int - - dirt-multi - - - - - dirt_r_color - float-vec3 - - dirt-color[0] - - - - - dirt_r_factor - float - - dirt-factor[0] - - - - - dirt_g_color - float-vec3 - - dirt-color[1] - - - - - dirt_g_factor - float - - dirt-factor[1] - - - - - dirt_b_color - float-vec3 - - dirt-color[2] - - - - - dirt_b_factor - float - - dirt-factor[2] - - - - - - amb_correction - float - - ambient-correction - - - - - lonDeg - float - - pos-lon - - - - - latDeg - float - - pos-lat - - - - - - - fogType - int - - fogtype - - - - - rembrandt_enabled - int - - rembrandt - - - - diff --git a/Effects/model-combined.eff b/Effects/model-combined.eff index fc8b9c895..1ffb95bbb 100644 --- a/Effects/model-combined.eff +++ b/Effects/model-combined.eff @@ -193,7 +193,6 @@ please see Docs/README.model-combined.eff for documentation /local-weather/cloud-shadows/cloudpos-x[19] /local-weather/cloud-shadows/cloudpos-y[19] /local-weather/cloud-shadows/cloud-shadow-flag - /sim/rendering/rembrandt/enabled 0 @@ -443,12 +442,14 @@ please see Docs/README.model-combined.eff for documentation Shaders/model-ALS-ultra.vert + Shaders/shadows-include.vert Shaders/model-ALS-ultra.frag Shaders/cloud-shadowfunc.frag Shaders/hazes.frag Shaders/secondary_lights.frag Shaders/noise.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag @@ -1268,14 +1269,28 @@ please see Docs/README.model-combined.eff for documentation - - - rembrandt_enabled - int - - rembrandt - - + + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + @@ -1497,8 +1512,10 @@ please see Docs/README.model-combined.eff for documentation Shaders/ubershader.vert + Shaders/shadows-include.vert Shaders/include_fog.frag Shaders/ubershader.frag + Shaders/shadows-include.frag @@ -1848,13 +1865,27 @@ please see Docs/README.model-combined.eff for documentation - - rembrandt_enabled - int - - rembrandt - - + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Effects/model-default.eff b/Effects/model-default.eff index 1ad02e801..be34c6906 100644 --- a/Effects/model-default.eff +++ b/Effects/model-default.eff @@ -57,6 +57,14 @@ /sim/rendering/shaders/landmass /sim/rendering/shaders/transition + + + /sim/rendering/shadows/enabled + + + /sim/rendering/shadows/sun-atlas-size + + @@ -122,11 +130,13 @@ Shaders/generic-ALS-base.vert + Shaders/shadows-include.vert Shaders/model-ALS-base.frag Shaders/hazes.frag Shaders/secondary_lights.frag Shaders/noise.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag visibility @@ -353,81 +363,30 @@ int tquality_level + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + - - - - /sim/rendering/rembrandt/enabled - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - false - - material/ambient - material/diffuse - material/specular - material/emissive - material/shininess - ambient-and-diffuse - - false - true - smooth - cull-face - - 1 - RenderBin - - - 0 - texture[0]/type - texture[0]/image - texture[0]/filter - texture[0]/wrap-s - texture[0]/wrap-t - - texture[0]/internal-format - - - modulate - - - - vertex-program-two-side - - - Shaders/deferred-gbuffer.vert - Shaders/deferred-gbuffer.frag - Shaders/gbuffer-functions.frag - Shaders/gbuffer-encode.frag - - - texture - sampler-2d - 0 - - - - - @@ -525,8 +484,10 @@ Shaders/default.vert + Shaders/shadows-include.vert Shaders/include_fog.frag Shaders/default.frag + Shaders/shadows-include.frag @@ -584,6 +545,27 @@ material/color-mode-uniform + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Effects/model-wingflex.eff b/Effects/model-wingflex.eff index c6c3babb5..3e295696b 100644 --- a/Effects/model-wingflex.eff +++ b/Effects/model-wingflex.eff @@ -200,7 +200,6 @@ /local-weather/cloud-shadows/cloudpos-x[19] /local-weather/cloud-shadows/cloudpos-y[19] /local-weather/cloud-shadows/cloud-shadow-flag - /sim/rendering/rembrandt/enabled 0 @@ -450,12 +449,14 @@ Shaders/model-ALS-wingflex.vert - Shaders/model-ALS-ultra.frag + Shaders/shadows-include.vert + Shaders/model-ALS-ultra.frag Shaders/cloud-shadowfunc.frag Shaders/hazes.frag Shaders/secondary_lights.frag Shaders/noise.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag @@ -1303,14 +1304,28 @@ - - rembrandt_enabled - int - - rembrandt - - - + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + + @@ -1531,9 +1546,11 @@ Shaders/ubershader.vert - Shaders/include_fog.frag + Shaders/shadows-include.vert + Shaders/include_fog.frag Shaders/ubershader.frag - + Shaders/shadows-include.frag + BaseTex @@ -1882,13 +1899,27 @@ - - rembrandt_enabled - int - - rembrandt - - + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Compositor/Effects/projection-2d.eff b/Effects/projection-2d.eff similarity index 87% rename from Compositor/Effects/projection-2d.eff rename to Effects/projection-2d.eff index c65a85874..10f97bdf7 100644 --- a/Compositor/Effects/projection-2d.eff +++ b/Effects/projection-2d.eff @@ -1,6 +1,6 @@ - Effects/Compositor/projection-2d + Effects/projection-2d /sim/current-view/field-of-view @@ -13,7 +13,7 @@ - Compositor/Shaders/ALS/projection-2d.frag + Shaders/projection-2d.frag 2 diff --git a/Effects/road.eff b/Effects/road.eff index 42cae761e..dd3869ca8 100644 --- a/Effects/road.eff +++ b/Effects/road.eff @@ -307,12 +307,14 @@ Shaders/model-ALS-ultra.vert + Shaders/shadows-include.vert Shaders/road-ALS-ultra.frag Shaders/cloud-shadowfunc.frag Shaders/hazes.frag Shaders/secondary_lights.frag Shaders/noise.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag tangent 6 @@ -1070,7 +1072,27 @@ display_ysize - + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Effects/rock.eff b/Effects/rock.eff index b24f14a70..3d0bd0b74 100644 --- a/Effects/rock.eff +++ b/Effects/rock.eff @@ -89,12 +89,14 @@ Shaders/terrain-ALS-ultra.vert Shaders/filters-ALS.vert + Shaders/shadows-include.vert Shaders/rock-ALS.frag Shaders/cloud-shadowfunc.frag Shaders/noise.frag Shaders/hazes.frag Shaders/secondary_lights.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag intrinsic_wetness @@ -579,6 +581,27 @@ 2 + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + lequal diff --git a/Effects/runway.eff b/Effects/runway.eff index e7e2e4af2..60181bef2 100644 --- a/Effects/runway.eff +++ b/Effects/runway.eff @@ -204,13 +204,15 @@ Shaders/terrain-ALS-ultra.vert Shaders/filters-ALS.vert + Shaders/shadows-include.vert Shaders/runway-ALS.frag - Shaders/cloud-shadowfunc.frag - Shaders/noise.frag - Shaders/hazes.frag - Shaders/secondary_lights.frag - Shaders/filters-ALS.frag - Shaders/lightspot-ALS.frag + Shaders/cloud-shadowfunc.frag + Shaders/noise.frag + Shaders/hazes.frag + Shaders/secondary_lights.frag + Shaders/filters-ALS.frag + Shaders/lightspot-ALS.frag + Shaders/shadows-include.frag visibility @@ -852,6 +854,27 @@ 2 + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + - - - - - texture[5]/images - - - - - 6 - - texture[6]/type - - - texture[6]/image - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - - - 7 - - texture[7]/type - - - texture[7]/image - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - - - vertex-program-two-side - - false - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - back - - Shaders/runway-gbuffer.vert - Shaders/runway-gbuffer.frag - Shaders/gbuffer-functions.frag - Shaders/gbuffer-encode.frag - - tangent - 6 - - - binormal - 7 - - - - BaseTex - sampler-2d - 0 - - - - Map - sampler-2d - 1 - - - - Noise - sampler-3d - 2 - - - - NormalTex - sampler-2d - 4 - - - - Environment - sampler-cube - 5 - - - - Rainbow - sampler-2d - 6 - - - - Fresnel - sampler-2d - 7 - - - - - rainbowiness - float - - rainbowiness - - - - - - fresneliness - float - - fresneliness - - - - - - noisiness - float - - noisiness - - - - - - spec_adjust - float - - rnorm - - - - - - ambient_correction - float - - ambient_correction - - - - - - reflect_map - float - - reflect_map - - - - - - normalmap_dds - float - - normalmap_dds - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - @@ -1354,8 +1042,10 @@ Shaders/reflect-bump-spec.vert - Shaders/include_fog.frag + Shaders/shadows-include.vert + Shaders/include_fog.frag Shaders/runway.frag + Shaders/shadows-include.frag tangent 6 diff --git a/Effects/schemes.xml b/Effects/schemes.xml index 4f2de8bd5..aeb1e3feb 100644 --- a/Effects/schemes.xml +++ b/Effects/schemes.xml @@ -1,7 +1,7 @@ - als-shadow - Effects/ALS/shadow-pass + classic-shadow + Effects/Fallback/classic-shadow diff --git a/Effects/shadow-vol.eff b/Effects/shadow-vol.eff index fbf7dc5df..92ef4316c 100644 --- a/Effects/shadow-vol.eff +++ b/Effects/shadow-vol.eff @@ -1,357 +1,8 @@ + - Effects/shadow - - - - white - - false - - 1 - - - 0 - - /environment/ground-visibility-m - /environment/visibility-m - /environment/ground-haze-thickness-m - /rendering/scene/scattering - /environment/surface/scattering - /environment/terminator-relative-position-m - /environment/mean-terrain-elevation-m - /rendering/scene/overcast - /sim/rendering/eye-altitude-m - /environment/cloud-self-shading - /environment/moonlight - /position/altitude-agl-m - /orientation/model/pitch-deg - /orientation/model/roll-deg - 0.5 - - - - - - - /sim/rendering/shaders/skydome - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - - true - - material/active - material/ambient - material/diffuse - material/specular - material/emissive - material/shininess - material/color-mode - - - blend/active - blend/source - blend/destination - - shade-model - cull-face - - 10 - DepthSortedBin - - rendering-hint - - 0 - texture[0]/type - texture[0]/image - texture[0]/filter - texture[0]/wrap-s - texture[0]/wrap-t - - - Shaders/shadow-vol-ALS.vert - Shaders/shadow-ALS.frag - - - hazeLayerAltitude - float - lthickness - - - scattering - float - scattering - - - terminator - float - terminator - - - ground_scattering - float - ground_scattering - - - terrain_alt - float - terrain_alt - - - overcast - float - overcast - - - eye_alt - float - eye_alt - - - moonlight - float - moonlight - - - alt_agl - float - alt_agl - - - pitch - float - model-pitch - - - roll - float - model-roll - - - gear_clearance - float - gear_clearance - - - lequal - true - - 0 0 0 0 - - - - true - - material/active - material/ambient - material/diffuse - material/specular - material/emissive - material/shininess - material/color-mode - - - blend/active - blend/source - blend/destination - - shade-model - back - - 10 - DepthSortedBin - - rendering-hint - - 0 - texture[0]/type - texture[0]/image - texture[0]/filter - texture[0]/wrap-s - texture[0]/wrap-t - - - Shaders/shadow-vol-ALS.vert - Shaders/shadow-ALS.frag - - - visibility - float - visibility - - - avisibility - float - avisibility - - - hazeLayerAltitude - float - lthickness - - - scattering - float - scattering - - - terminator - float - terminator - - - ground_scattering - float - ground_scattering - - - terrain_alt - float - terrain_alt - - - overcast - float - overcast - - - eye_alt - float - eye_alt - - - cloud_self_shading - float - cloud_self_shading - - - moonlight - float - moonlight - - - alt_agl - float - alt_agl - - - pitch - float - model-pitch - - - roll - float - model-roll - - - gear_clearance - float - gear_clearance - - - lequal - true - - - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - - texture[0]/active - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - modulate - - - - - + Effects/shadow-vol diff --git a/Effects/shadow.eff b/Effects/shadow.eff index eefb4c90e..d5ce9e1fa 100644 --- a/Effects/shadow.eff +++ b/Effects/shadow.eff @@ -1,261 +1,8 @@ + Effects/shadow - - - - white - - false - - 1 - - - 0 - - /environment/ground-visibility-m - /environment/visibility-m - /environment/ground-haze-thickness-m - /rendering/scene/scattering - /environment/surface/scattering - /environment/terminator-relative-position-m - /environment/mean-terrain-elevation-m - /rendering/scene/overcast - /sim/rendering/eye-altitude-m - /environment/cloud-self-shading - /environment/moonlight - /position/gear-agl-m - 1.5 - - - - - - - /sim/rendering/shaders/skydome - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - true - - material/active - material/ambient - material/diffuse - material/specular - material/emissive - material/shininess - material/color-mode - - - blend/active - blend/source - blend/destination - - shade-model - cull-face - - 10 - DepthSortedBin - - rendering-hint - - - 0 - - texture[0]/type - texture[0]/image - texture[0]/filter - texture[0]/wrap-s - texture[0]/wrap-t - - - - vertex-program-two-side - - - Shaders/shadow-ALS.vert - Shaders/shadow-ALS.frag - - - visibility - float - visibility - - - avisibility - float - avisibility - - - hazeLayerAltitude - float - lthickness - - - scattering - float - scattering - - - terminator - float - terminator - - - ground_scattering - float - ground_scattering - - - terminator - float - terminator - - - terrain_alt - float - terrain_alt - - - overcast - float - overcast - - - eye_alt - float - eye_alt - - - cloud_self_shading - float - cloud_self_shading - - - moonlight - float - moonlight - - - alt_agl - float - alt_agl - - - gear_clearance - float - gear_clearance - - - greater - 0.01 - - - lequal - true - - - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - - texture[0]/active - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - modulate - - - - - diff --git a/Effects/ssao-blur-1.eff b/Effects/ssao-blur-1.eff deleted file mode 100644 index f5bae695f..000000000 --- a/Effects/ssao-blur-1.eff +++ /dev/null @@ -1,10 +0,0 @@ - - - Effects/ssao-blur-1 - Effects/blur - - 4.0 - 0.0 - ao-1 - - diff --git a/Effects/ssao-blur-2.eff b/Effects/ssao-blur-2.eff deleted file mode 100644 index c3b630c06..000000000 --- a/Effects/ssao-blur-2.eff +++ /dev/null @@ -1,10 +0,0 @@ - - - Effects/ssao-blur-2 - Effects/blur - - 0.0 - 4.0 - ao-2 - - diff --git a/Effects/ssao.eff b/Effects/ssao.eff deleted file mode 100644 index 31b36f44e..000000000 --- a/Effects/ssao.eff +++ /dev/null @@ -1,84 +0,0 @@ - - - Effects/ssao - - 1.0 - 0.0 - 7.0 - 0.03 - 800.0 - - - - - 0 - buffer - depth - - - 1 - buffer - normal - - - 2 - buffer - spec-emis - - - 3 - noise - - - Shaders/ssao.vert - Shaders/ssao.frag - Shaders/gbuffer-functions.frag - - - depth_tex - sampler-2d - 0 - - - normal_tex - sampler-2d - 1 - - - spec_emis_tex - sampler-2d - 2 - - - noise_tex - sampler-2d - 3 - - - g_scale - float - g_scale - - - g_bias - float - g_bias - - - g_intensity - float - g_intensity - - - g_sample_rad - float - g_sample_rad - - - random_size - float - random_size - - - - diff --git a/Effects/sunlight.eff b/Effects/sunlight.eff deleted file mode 100644 index 05c917ada..000000000 --- a/Effects/sunlight.eff +++ /dev/null @@ -1,272 +0,0 @@ - - - Effects/sunlight - - /sim/rendering/shadows/filtering - - - - - /sim/rendering/shadows/enabled - - 1.0 - /sim/rendering/shadows/filtering - - - - - false - - false - - - one - one - - - 1 - RenderBin - - - 0 - buffer - depth - - - 1 - buffer - normal - - - 2 - buffer - diffuse - - - 3 - buffer - spec-emis - - - 4 - buffer - shadow - - - Shaders/sunlight.vert - Shaders/sunlight.frag - Shaders/gbuffer-functions.frag - - - depth_tex - sampler-2d - 0 - - - normal_tex - sampler-2d - 1 - - - color_tex - sampler-2d - 2 - - - spec_emis_tex - sampler-2d - 3 - - - shadow_tex - sampler-2d - 4 - - - filtering - int - filtering - - - - - - - - /sim/rendering/shadows/enabled - - - - false - - false - - - one - one - - - 1 - RenderBin - - - 0 - buffer - depth - - - 1 - buffer - normal - - - 2 - buffer - diffuse - - - 3 - buffer - spec-emis - - - 4 - buffer - shadow - - - Shaders/sunlight.vert - Shaders/sunlight-nofiltering.frag - Shaders/gbuffer-functions.frag - - - depth_tex - sampler-2d - 0 - - - normal_tex - sampler-2d - 1 - - - color_tex - sampler-2d - 2 - - - spec_emis_tex - sampler-2d - 3 - - - shadow_tex - sampler-2d - 4 - - - - - - - false - - false - - - one - one - - - 1 - RenderBin - - - 0 - buffer - depth - - - 1 - buffer - normal - - - 2 - buffer - diffuse - - - 3 - buffer - spec-emis - - - Shaders/sunlight.vert - Shaders/sunlight-noshadow.frag - Shaders/gbuffer-functions.frag - - - depth_tex - sampler-2d - 0 - - - normal_tex - sampler-2d - 1 - - - color_tex - sampler-2d - 2 - - - spec_emis_tex - sampler-2d - 3 - - - - - - diff --git a/Effects/terrain-default.eff b/Effects/terrain-default.eff index d88718fb1..5a6c9073c 100644 --- a/Effects/terrain-default.eff +++ b/Effects/terrain-default.eff @@ -181,6 +181,14 @@ /local-weather/cloud-shadows/nearest-cloudpos-x /local-weather/cloud-shadows/nearest-cloudpos-y /local-weather/cloud-shadows/cloud-shadow-flag + + + /sim/rendering/shadows/enabled + + + /sim/rendering/shadows/sun-atlas-size + + @@ -314,12 +322,14 @@ Shaders/terrain-ALS-ultra.vert Shaders/filters-ALS.vert + Shaders/shadows-include.vert Shaders/terrain-ALS-ultra.frag Shaders/noise.frag Shaders/cloud-shadowfunc.frag Shaders/hazes.frag Shaders/secondary_lights.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag grain_strength @@ -825,6 +835,27 @@ 2 + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + lequal @@ -936,10 +967,12 @@ Shaders/terrain-ALS-detailed.vert Shaders/filters-ALS.vert + Shaders/shadows-include.vert Shaders/terrain-ALS-detailed.frag Shaders/noise.frag Shaders/hazes.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag visibility @@ -1128,6 +1161,27 @@ 2 + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + lequal false --> @@ -1222,10 +1276,12 @@ Shaders/generic-ALS-base.vert + Shaders/shadows-include.vert Shaders/terrain-ALS-base.frag Shaders/hazes.frag Shaders/noise.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag visibility @@ -1349,81 +1405,34 @@ 2 + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + lequal - - - - - - /sim/rendering/rembrandt/enabled - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - false - - material/ambient - material/diffuse - material/specular - material/emissive - material/shininess - ambient-and-diffuse - - false - true - smooth - back - - 1 - RenderBin - - - 0 - texture[0]/type - texture[0]/image - texture[0]/filter - texture[0]/wrap-s - texture[0]/wrap-t - texture[0]/internal-format - - modulate - - - - Shaders/deferred-gbuffer.vert - Shaders/deferred-gbuffer.frag - Shaders/gbuffer-functions.frag - Shaders/gbuffer-encode.frag - - - texture - sampler-2d - 0 - - - - - + @@ -1516,8 +1525,10 @@ Shaders/include_fog.vert Shaders/default.vert + Shaders/shadows-include.vert Shaders/default.frag Shaders/include_fog.frag + Shaders/shadows-include.frag visibility @@ -1560,6 +1571,27 @@ 2 + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + lequal diff --git a/Effects/terrain-overlay.eff b/Effects/terrain-overlay.eff index 9076213b6..97ea9067b 100644 --- a/Effects/terrain-overlay.eff +++ b/Effects/terrain-overlay.eff @@ -151,13 +151,15 @@ Shaders/terrain-ALS-ultra.vert - Shaders/filters-ALS.vert + Shaders/filters-ALS.vert + Shaders/shadows-include.vert Shaders/terrain-ALS-ultra.frag Shaders/noise.frag Shaders/cloud-shadowfunc.frag Shaders/hazes.frag Shaders/secondary_lights.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag grain_strength @@ -663,6 +665,27 @@ 2 + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + lequal @@ -720,6 +743,7 @@ Shaders/noise.frag Shaders/filters-ALS.frag Shaders/cloud-shadowfunc.frag + Shaders/shadows-include.frag 96 triangles triangle-strip @@ -905,7 +929,27 @@ int cloud_shadow_flag - + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + true diff --git a/Effects/test.eff b/Effects/test.eff deleted file mode 100644 index e153a2445..000000000 --- a/Effects/test.eff +++ /dev/null @@ -1,91 +0,0 @@ - - - Effects/test - - - - - - - - /sim/rendering/shaders/generic - - 1.0 - - - - - - - true - - 0.5 0.5 0.5 1.0 - 0.5 0.5 0.5 1.0 - off - - - greater - 0.01 - - smooth - - src-alpha - one-minus-src-alpha - - - false - - - 10 - DepthSortedBin - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - - - - Shaders/test.vert - Shaders/test.frag - - - - baseTexture - sampler-2d - 0 - - - shading - float - 0.5 - - true - - - diff --git a/Effects/transition.eff b/Effects/transition.eff index b0e1682cd..4349a9e68 100644 --- a/Effects/transition.eff +++ b/Effects/transition.eff @@ -92,323 +92,12 @@ parameters : 6 7 --> - - - - /sim/rendering/shaders/transition - /sim/rendering/rembrandt/enabled - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - true - - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - - - transparent - - - - transparent - - - smooth - back - - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 0 - - texture[0]/type - - - texture[0]/image - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - - 1 - - texture[2]/type - - - texture[2]/image - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - - 2 - - texture[3]/type - - - texture[3]/image - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - - 3 - - texture[4]/type - - - texture[4]/image - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - - 4 - noise - - - - - Shaders/transition-gbuffer.vert - Shaders/transition-gbuffer.frag - Shaders/gbuffer-functions.frag - Shaders/gbuffer-encode.frag - - - - BaseTex - sampler-2d - 0 - - - - SecondTex - sampler-2d - 1 - - - - ThirdTex - sampler-2d - 2 - - - - SnowTex - sampler-2d - 3 - - - - NoiseTex - sampler-3d - 4 - - - - RainNorm - float - - rain-norm - - - - - SnowLevel - float - - snow-level - - - - - Transitions - float - - transitions - - - - - InverseSlope - float - - inverse - - - - - CloudCover0 - float - - cloud-cover0 - - - - - CloudCover1 - float - - cloud-cover1 - - - - - CloudCover2 - float - - cloud-cover2 - - - - - CloudCover3 - float - - cloud-cover3 - - - - - CloudCover4 - float - - cloud-cover4 - - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - /sim/rendering/shaders/quality-level /sim/rendering/shaders/transition - - 0.0 - /sim/rendering/rembrandt/enabled - 2.0 @@ -558,8 +247,10 @@ parameters : Shaders/transition.vert + Shaders/shadows-include.vert Shaders/include_fog.frag Shaders/transition.frag + Shaders/shadows-include.frag @@ -708,6 +399,27 @@ parameters : + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Effects/tree.eff b/Effects/tree.eff index 2488ba9e6..9a8677db3 100644 --- a/Effects/tree.eff +++ b/Effects/tree.eff @@ -1591,52 +1591,6 @@ - - - - - /sim/rendering/rembrandt/enabled - /sim/rendering/random-vegetation - - - - true - - 1.0 1.0 1.0 1.0 - 1.0 1.0 1.0 1.0 - off - - - gequal - 0.1 - - - 0 - 2d - - texture[0]/image - - clamp - clamp - - - Shaders/deferred-tree.vert - Shaders/deferred-tree.frag - Shaders/gbuffer-functions.frag - Shaders/gbuffer-encode.frag - - - season - float - season - - - texture - sampler-2d - 0 - - - diff --git a/Effects/urban.eff b/Effects/urban.eff index c2552047a..a904e7f28 100644 --- a/Effects/urban.eff +++ b/Effects/urban.eff @@ -218,12 +218,14 @@ Shaders/urban-ALS.vert + Shaders/shadows-include.vert Shaders/urban-ALS.frag Shaders/cloud-shadowfunc.frag Shaders/noise.frag Shaders/hazes.frag Shaders/secondary_lights.frag Shaders/filters-ALS.frag + Shaders/shadows-include.frag tangent 6 @@ -747,7 +749,28 @@ - + + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + @@ -893,12 +916,14 @@ Shaders/urban-ALS.vert + Shaders/shadows-include.vert Shaders/urban-ALS.frag Shaders/cloud-shadowfunc.frag Shaders/noise.frag Shaders/hazes.frag Shaders/secondary_lights.frag - Shaders/filters-ALS.frag + Shaders/filters-ALS.frag + Shaders/shadows-include.frag tangent 6 @@ -1406,389 +1431,30 @@ osm-buildings + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + - - - - - - /sim/rendering/rembrandt/enabled - /sim/rendering/shaders/urban - - 4.0 - /sim/rendering/shaders/urban - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - GL_ATI_shader_texture_lod - GL_ARB_shader_texture_lod - GL_EXT_gpu_shader4 - - - - - false - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - false - false - smooth - back - - 0 - RenderBin - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 2 - noise - - - 3 - - texture[2]/image - - - texture[2]/type - - nearest-mipmap-nearest - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - average - average - average - min - - - - Shaders/urban-gbuffer.vert - Shaders/urban-gbuffer.frag - Shaders/gbuffer-functions.frag - Shaders/gbuffer-encode.frag - - tangent - 6 - - - binormal - 7 - - - - BaseTex - sampler-2d - 0 - - - NormalTex - sampler-2d - 1 - - - NoiseTex - sampler-3d - 2 - - - QDMTex - sampler-2d - 3 - - - depth_factor - float - - depth-factor - - - - tile_size - float - - xsize - - - - quality_level - float - - quality-level - - - - snowlevel - float - - snow-level - - - - max_lod_level - float - - max-lod-level - - - - random_buildings - bool - - random-buildings - - - - osm_buildings - bool - - osm-buildings - - - - - - - - /sim/rendering/rembrandt/enabled - /sim/rendering/shaders/urban - - 1.0 - /sim/rendering/shaders/urban - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - false - - - material/ambient - - - material/diffuse - - - material/specular - - ambient-and-diffuse - - false - false - smooth - back - - 0 - RenderBin - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 2 - noise - - - Shaders/urban-gbuffer.vert - Shaders/urban-gbuffer.frag - Shaders/gbuffer-functions.frag - Shaders/gbuffer-encode.frag - - tangent - 6 - - - binormal - 7 - - - - BaseTex - sampler-2d - 0 - - - NormalTex - sampler-2d - 1 - - - NoiseTex - sampler-3d - 2 - - - depth_factor - float - - depth-factor - - - - tile_size - float - - xsize - - - - night_color - float-vec3 - - night-color - - - - quality_level - float - - quality-level - - - - snowlevel - float - - snow-level - - - - random_buildings - bool - - random-buildings - - - - osm_buildings - bool - - osm-buildings - - - - @@ -1921,8 +1587,10 @@ Shaders/urban.vert + Shaders/shadows-include.vert Shaders/include_fog.frag Shaders/urban.frag + Shaders/shadows-include.frag tangent 6 @@ -2052,6 +1720,27 @@ + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + @@ -2157,8 +1846,10 @@ Shaders/urban.vert + Shaders/shadows-include.vert Shaders/include_fog.frag Shaders/urban.frag + Shaders/shadows-include.frag tangent 6 @@ -2262,6 +1953,27 @@ snow-level + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + diff --git a/Effects/water-inland.eff b/Effects/water-inland.eff index f484f6b1e..b7034eef9 100644 --- a/Effects/water-inland.eff +++ b/Effects/water-inland.eff @@ -1414,397 +1414,6 @@ - - - - - - /sim/rendering/shaders/water - /sim/rendering/rembrandt/enabled - - 2.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - Shaders/water-gbuffer.vert - Shaders/water-gbuffer.frag - Shaders/gbuffer-functions.frag - Shaders/gbuffer-encode.frag - - - water_reflection - sampler-2d - 0 - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - water_reflection_grey - sampler-2d - 4 - - - sea_foam - sampler-2d - 5 - - - perlin_normalmap - sampler-2d - 6 - - - - normalmap_dds - float - - normalmap_dds - - - - saturation - float - - saturation - - - - CloudCover0 - float - - cloud-cover[0] - - - - CloudCover1 - float - - cloud-cover[1] - - - - CloudCover2 - float - - cloud-cover[2] - - - - CloudCover3 - float - - cloud-cover[3] - - - - CloudCover4 - float - - cloud-cover[4] - - - - Status - int - - status - - - - Overcast - float - - overcast - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - WaveFreq - float - - WaveFreq - - - - WaveAmp - float - - WaveAmp - - - - WaveSharp - float - - WaveSharp - - - - WaveAngle - float - - WaveAngle - - - - WaveFactor - float - - WaveFactor - - - - WaveDAngle - float - - WaveDAngle - - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - - - diff --git a/Effects/water.eff b/Effects/water.eff index f3be756d2..8007c801a 100644 --- a/Effects/water.eff +++ b/Effects/water.eff @@ -1391,853 +1391,6 @@ - - - - /sim/rendering/shaders/water - /sim/rendering/rembrandt/enabled - - 4.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - false - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 1 - noise - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - 7 - - texture[7]/image - - - texture[7]/type - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - texture[7]/internal-format - - - - - Shaders/water-gbuffer.vert - Shaders/water_sine-gbuffer.frag - Shaders/gbuffer-functions.frag - Shaders/gbuffer-encode.frag - - tangent - 6 - - - binormal - 7 - - - - water_reflection - sampler-2d - 0 - - - Noise - sampler-3d - 1 - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - water_reflection_grey - sampler-2d - 4 - - - sea_foam - sampler-2d - 5 - - - perlin_normalmap - sampler-2d - 6 - - - topo_map - sampler-2d - 7 - - - - normalmap_dds - float - - normalmap_dds - - - - saturation - float - - - saturation - - - - CloudCover0 - float - - cloud-cover[0] - - - - CloudCover1 - float - - cloud-cover[1] - - - - CloudCover2 - float - - cloud-cover[2] - - - - CloudCover3 - float - - cloud-cover[3] - - - - CloudCover4 - float - - cloud-cover[4] - - - - Status - int - - status - - - - - Overcast - float - - overcast - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - WaveFreq - float - - WaveFreq - - - - WaveAmp - float - - WaveAmp - - - - WaveSharp - float - - WaveSharp - - - - WaveAngle - float - - WaveAngle - - - - WaveFactor - float - - WaveFactor - - - - WaveDAngle - float - - WaveDAngle - - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - rembrandt_enabled - int - - rembrandt - - - - - - - - - /sim/rendering/shaders/water - /sim/rendering/rembrandt/enabled - - 2.0 - /sim/rendering/shaders/water - - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - ambient-and-diffuse - - - transparent - - - transparent - - smooth - back - - - render-bin/bin-number - - - render-bin/bin-name - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - 5 - - texture[5]/image - - - texture[5]/type - - - texture[5]/filter - - - texture[5]/wrap-s - - - texture[5]/wrap-t - - - texture[5]/internal-format - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - - Shaders/water-gbuffer.vert - Shaders/water-gbuffer.frag - Shaders/gbuffer-functions.frag - Shaders/gbuffer-encode.frag - - - water_reflection - sampler-2d - 0 - - - water_normalmap - sampler-2d - 2 - - - water_dudvmap - sampler-2d - 3 - - - water_reflection_grey - sampler-2d - 4 - - - sea_foam - sampler-2d - 5 - - - perlin_normalmap - sampler-2d - 6 - - - - normalmap_dds - float - - normalmap_dds - - - - saturation - float - - - saturation - - - - CloudCover0 - float - - cloud-cover[0] - - - - CloudCover1 - float - - cloud-cover[1] - - - - CloudCover2 - float - - cloud-cover[2] - - - - CloudCover3 - float - - cloud-cover[3] - - - - CloudCover4 - float - - cloud-cover[4] - - - - Status - int - - status - - - - Overcast - float - - overcast - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - - WaveFreq - float - - WaveFreq - - - - WaveAmp - float - - WaveAmp - - - - WaveSharp - float - - WaveSharp - - - - WaveAngle - float - - WaveAngle - - - - WaveFactor - float - - WaveFactor - - - - WaveDAngle - float - - WaveDAngle - - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - fogType - int - - fogtype - - - - - rembrandt_enabled - int - - rembrandt - - - - - @@ -2670,13 +1823,6 @@ - - rembrandt_enabled - int - - rembrandt - - @@ -3068,13 +2214,6 @@ - - rembrandt_enabled - int - - rembrandt - - diff --git a/Compositor/Effects/agriculture.eff b/Effects/ws30.eff similarity index 51% rename from Compositor/Effects/agriculture.eff rename to Effects/ws30.eff index b07fddb72..13302464b 100644 --- a/Compositor/Effects/agriculture.eff +++ b/Effects/ws30.eff @@ -1,7 +1,8 @@ + - Effects/agriculture - Effects/crop + Effects/ws30 + @@ -18,8 +19,8 @@ 1.2 - - Textures/Terrain/unknown.png + + Textures/Terrain/cropgrass1.png 2d linear-mipmap-linear @@ -31,6 +32,53 @@ normalized + + Textures/Terrain/city1.png + 2d + linear-mipmap-linear + + repeat + repeat + + + normalized + + + Textures/Terrain/forest.png + 2d + linear-mipmap-linear + + repeat + repeat + + + normalized + + + Textures/Terrain/water.png + 2d + linear-mipmap-linear + + repeat + repeat + + + normalized + + + Textures/Terrain/snow3.png + 2d + linear-mipmap-linear + repeat + repeat + normalized + Textures/Terrain/void.png 2d @@ -39,7 +87,7 @@ repeat normalized - + Textures/Terrain/void.png 2d linear-mipmap-linear @@ -63,6 +111,14 @@ repeat normalized + + Textures/Terrain/void.png + 2d + linear-mipmap-linear + repeat + repeat + normalized + false 0 @@ -70,15 +126,13 @@ 0 0.5 - 0.5 - 1000.0 - 0 - 2000.0 - 0.3 - 0.0 - 0.0 0.0 + 0.5 + 0.0 + 1.0 + 1.0 1.0 + 0 false /environment/ground-visibility-m @@ -137,6 +191,12 @@ /environment/season + + /environment/air-pollution-norm + + + /environment/surface/delta-T-soil + /sim/rendering/shaders/wind-effects @@ -146,12 +206,66 @@ /environment/sea/surface/wind-from-north-fps + + /sim/startup/xsize + + + /sim/startup/ysize + + + /sim/current-view/pitch-offset-deg + + + /sim/current-view/heading-offset-deg + + + /sim/current-view/field-of-view + + + /sim/rendering/als-secondary-lights/use-searchlight + + + /sim/rendering/als-secondary-lights/use-landing-light + + + /sim/rendering/als-secondary-lights/use-alt-landing-light + + + /sim/rendering/als-secondary-lights/landing-light1-offset-deg + + + /sim/rendering/als-secondary-lights/landing-light2-offset-deg + + + /sim/rendering/als-secondary-lights/landing-light3-offset-deg + /sim/rendering/shaders/landmass /sim/rendering/shaders/transition + + /sim/rendering/als-filters/use-filtering + + + /sim/rendering/als-filters/gamma + + + /sim/rendering/als-filters/brightness + + + /sim/rendering/als-filters/grey-factor + + + /sim/rendering/als-filters/black-factor + + + /sim/rendering/als-filters/use-night-vision + + + /sim/rendering/als-filters/use-IR-vision + /local-weather/cloud-shadows/cloudpos-x[0] @@ -272,30 +386,30 @@ /local-weather/cloud-shadows/cloudpos-y[19] + + /local-weather/cloud-shadows/nearest-cloudpos-x + + + /local-weather/cloud-shadows/nearest-cloudpos-y + /local-weather/cloud-shadows/cloud-shadow-flag + + + /sim/rendering/als/shadows/enabled + + + /sim/rendering/als/shadows/sun-atlas-size + + - - als-lighting + - - - 6.0 - /sim/rendering/shaders/landmass - - - 6.0 - /sim/rendering/shaders/transition - - - 1.0 - /sim/rendering/shaders/crop - - + /sim/rendering/shaders/skydome 2.0 @@ -310,6 +424,46 @@ + true @@ -351,12 +505,8 @@ texture[0]/image - - texture[0]/type - - - texture[0]/filter - + nearest-mipmap-nearest + nearest-mipmap-nearest texture[0]/wrap-s @@ -366,145 +516,97 @@ texture[0]/internal-format + + max + max + max + + + + + 1 + + texture[1]/image + + + texture[1]/filter + + + texture[1]/wrap-s + + + texture[1]/wrap-t + + + texture[1]/internal-format + 2 - texture[13]/image + texture[2]/image - - texture[13]/type - - texture[13]/filter + texture[2]/filter - texture[13]/wrap-s + texture[2]/wrap-s - texture[13]/wrap-t + texture[2]/wrap-t - texture[13]/internal-format + texture[2]/internal-format + + + 3 + + texture[3]/image + + + texture[3]/filter + + + texture[3]/wrap-s + + + texture[3]/wrap-t + + + texture[3]/internal-format + + + 4 - - texture[14]/type - - texture[14]/image + texture[4]/image - texture[14]/filter + texture[4]/filter - texture[14]/wrap-s + texture[4]/wrap-s - texture[14]/wrap-t + texture[4]/wrap-t - texture[14]/internal-format - - - - 5 - - texture[16]/type - - - texture[16]/image - - - texture[16]/filter - - - texture[16]/wrap-s - - - texture[16]/wrap-t - - - texture[16]/internal-format + texture[4]/internal-format + - Shaders/ALS/terrain-ultra.vert - Shaders/ALS/filters.vert - Shaders/ALS/shadows-include.vert - Shaders/ALS/agriculture.frag - Shaders/ALS/cloud-shadowfunc.frag - Shaders/ALS/noise.frag - Shaders/ALS/hazes.frag - Shaders/ALS/secondary_lights.frag - Shaders/ALS/filters.frag - Shaders/ALS/shadows-include.frag + Shaders/generic-ALS-base.vert + Shaders/shadows-include.vert + Shaders/ws30.frag + Shaders/hazes.frag + Shaders/noise.frag + Shaders/filters-ALS.frag + Shaders/shadows-include.frag - - grain_strength - float - - grain_strength - - - - intrinsic_wetness - float - - intrinsic_wetness - - - - overlay_fraction - float - - overlay_fraction - - - - overlay_scale - float - - overlay_scale - - - - rotation_scale - float - - rotation_scale - - - - distortion_factor - float - - distortion_factor - - - - uv_xoffset - float - - uv_xoffset - - - - uv_yoffset - float - - uv_yoffset - - - - dust_resistance - float - - dust_resistance - - visibility float @@ -568,62 +670,6 @@ eye_alt - - eye_lat - float - - eye_lat - - - - eye_lon - float - - eye_lon - - - - snowlevel - float - - snow_level - - - - snow_thickness_factor - float - - snow_thickness_factor - - - - dust_cover_factor - float - - dust_cover_factor - - - - lichen_cover_factor - float - - lichen_cover_factor - - - - wetness - float - - wetness - - - - fogstructure - float - - fogstructure - - cloud_self_shading float @@ -638,13 +684,6 @@ moonlight - - season - float - - season - - air_pollution float @@ -652,48 +691,6 @@ air_pollution - - view_pitch_offset - float - - view_pitch_offset - - - - view_heading_offset - float - - view_heading_offset - - - - field_of_view - float - - view_fov - - - - landing_light1_offset - float - - landing_light1_offset - - - - landing_light2_offset - float - - landing_light2_offset - - - - landing_light3_offset - float - - landing_light3_offset - - gamma @@ -751,357 +748,6 @@ fact_black - - - cloudpos1_x - float - - cloudpos1_x - - - - cloudpos1_y - float - - cloudpos1_y - - - - cloudpos2_x - float - - cloudpos2_x - - - - cloudpos2_y - float - - cloudpos2_y - - - - cloudpos3_x - float - - cloudpos3_x - - - - cloudpos3_y - float - - cloudpos3_y - - - - cloudpos4_x - float - - cloudpos4_x - - - - cloudpos4_y - float - - cloudpos4_y - - - - cloudpos5_x - float - - cloudpos5_x - - - - cloudpos5_y - float - - cloudpos5_y - - - - cloudpos6_x - float - - cloudpos6_x - - - - cloudpos6_y - float - - cloudpos6_y - - - - cloudpos7_x - float - - cloudpos7_x - - - - cloudpos7_y - float - - cloudpos7_y - - - - cloudpos8_x - float - - cloudpos8_x - - - - cloudpos8_y - float - - cloudpos8_y - - - - cloudpos9_x - float - - cloudpos9_x - - - - cloudpos9_y - float - - cloudpos9_y - - - - cloudpos10_x - float - - cloudpos10_x - - - - cloudpos10_y - float - - cloudpos10_y - - - - cloudpos11_x - float - - cloudpos11_x - - - - cloudpos11_y - float - - cloudpos11_y - - - - cloudpos12_x - float - - cloudpos12_x - - - - cloudpos12_y - float - - cloudpos12_y - - - - cloudpos13_x - float - - cloudpos13_x - - - - cloudpos13_y - float - - cloudpos13_y - - - - cloudpos14_x - float - - cloudpos14_x - - - - cloudpos14_y - float - - cloudpos14_y - - - - cloudpos15_x - float - - cloudpos15_x - - - - cloudpos15_y - float - - cloudpos15_y - - - - cloudpos16_x - float - - cloudpos16_x - - - - cloudpos16_y - float - - cloudpos16_y - - - - cloudpos17_x - float - - cloudpos17_x - - - - cloudpos17_y - float - - cloudpos17_y - - - - cloudpos18_x - float - - cloudpos18_x - - - - cloudpos18_y - float - - cloudpos18_y - - - - cloudpos19_x - float - - cloudpos19_x - - - - cloudpos19_y - float - - cloudpos19_y - - - - cloudpos20_x - float - - cloudpos20_x - - - - cloudpos20_y - float - - cloudpos20_y - - - - WindE - float - - windE - - - - WindN - float - - windN - - - - quality_level - int - - quality_level - - - - tquality_level - int - - tquality_level - - - - wind_effects - int - - wind_effects - - - - cloud_shadow_flag - int - - cloud_shadow_flag - - - - rotation_flag - int - - rotation_flag - - - - use_searchlight - int - - use_searchlight - - - - use_landing_light - int - - use_landing_light - - - - use_alt_landing_light - int - - use_alt_landing_light - - display_xsize int @@ -1117,32 +763,30 @@ - raise_vertex - bool - - raise_vertex - - - - texture + landclass sampler-2d 0 - mix_texture + grass sampler-2d - 5 + 1 - grain_texture - sampler-2d - 4 - - - gradient_texture + city sampler-2d 2 + + forest + sampler-2d + 3 + + + water + sampler-2d + 4 + colorMode int @@ -1172,6 +816,7 @@ lequal + diff --git a/Environment/environment.xml b/Environment/environment.xml index c04b70eb5..a48fa2bba 100644 --- a/Environment/environment.xml +++ b/Environment/environment.xml @@ -283,6 +283,11 @@ + + false + false + + clear diff --git a/Geodata/README b/Geodata/README new file mode 100644 index 000000000..089e7be95 --- /dev/null +++ b/Geodata/README @@ -0,0 +1,40 @@ +Köppen_Geiger climate map of the world: +------------------------------------------------------------------------------ +Website: http://koeppen-geiger.vu-wien.ac.at/present.htm +Download: http://koeppen-geiger.vu-wien.ac.at/Rcode/Map_KG-Global.zip + +ASICII +CODE description +----------------------------------------------------- + 1 Af equatorial, fully humid + 2 Am equatorial, monsoonal + 3 As equatorial, summer dry + 4 Aw equatorial, winter dry + 5 BSh arid, steppe, hot arid + 6 BSk arid, steppe, cold arid + 7 BWh arid, desert, hot arid + 8 BWk arid, desert, cold arid + 9 Cfa warm temperature, fully humid hot summer +10 Cfb warm temperature, fully humid, warm summer +11 Cfc warm temperature, fully humid, cool summer +12 Csa warm temperature, summer dry, hot summer +13 Csb warm temperature, summer dry, warm summer +14 Csc warm temperature, summer dry, cool summer +15 Cwa warm temperature, winter dry, hot summer +16 Cwb warm temperature, winter dry, warm summer +17 Cwc warm temperature, winter dry, cool summer +18 Dfa snow, fully humid, hot summer +19 Dfb snow, fully humid, warm summer, warm summer +20 Dfc snow, fully humid, cool summer, cool summer +21 Dfd snow, fully humid, extremely continetal +22 Dsa snow, summer dry, hot summer +23 Dsb snow, summer dry, warm summer +24 Dsc snow, summer dry, cool summer +25 Dsd snow, summer dry, extremely continetal +26 Dwa snow, winter dry, hot summer +27 Dwb snow, winter dry, warm summer +28 Dwc snow, winter dry, cool summer +29 Dwd snow, winter dry, extremely continetal +30 EF polar frost +31 ET polar tundra +32 Ocean (converted to 0 in the image file) diff --git a/Geodata/koppen-geiger.png b/Geodata/koppen-geiger.png new file mode 100644 index 000000000..8f6c0945a Binary files /dev/null and b/Geodata/koppen-geiger.png differ diff --git a/Materials/base/materials-base.xml b/Materials/base/materials-base.xml index 4bdc77d43..cf1fe4cf4 100644 --- a/Materials/base/materials-base.xml +++ b/Materials/base/materials-base.xml @@ -11,6 +11,33 @@ + + ws30 + Effects/ws30 + 2000 + 2000 + 4000000.0 + + 0.93 + 0.95 + 0.93 + 1.0 + + + 0.1 + 0.12 + 0.1 + 1.0 + + 1.2 + 1 + 0.7 + 0.1 + 0.15 + 1e30 + + + diff --git a/Shaders/agriculture-ALS.frag b/Shaders/agriculture-ALS.frag index a1176d668..ad132b962 100644 --- a/Shaders/agriculture-ALS.frag +++ b/Shaders/agriculture-ALS.frag @@ -92,6 +92,8 @@ vec3 searchlight(); vec3 landing_light(in float offset, in float offsetv); vec3 filter_combined (in vec3 color) ; +float getShadowing(); + // a fade function for procedural scales which are smaller than a pixel @@ -417,13 +419,15 @@ if ((dist < 5000.0)&& (quality_level > 3) && (combined_wetness>0.0)) NdotL = NdotL + 0.05 * noisegrad_1m * detail_fade(1.0, view_angle,dist); if (NdotL > 0.0) { + float shadowmap = getShadowing(); if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 0.3 * noise_250m + 0.5 * noise_500m+0.2 * noise_1500m, dist);} - color += diffuse_term * NdotL; + color += diffuse_term * NdotL * shadowmap; NdotHV = max(dot(n, halfVector), 0.0); if (gl_FrontMaterial.shininess > 0.0) specular.rgb = ((gl_FrontMaterial.specular.rgb * 0.1 + (water_factor * vec3 (1.0, 1.0, 1.0))) * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor))); + * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor)) + * shadowmap); } color.a = 1.0;//diffuse_term.a; // This shouldn't be necessary, but our lighting becomes very diff --git a/Shaders/airfield-ALS.frag b/Shaders/airfield-ALS.frag index 12bdd2e23..753ed0555 100644 --- a/Shaders/airfield-ALS.frag +++ b/Shaders/airfield-ALS.frag @@ -78,6 +78,8 @@ vec3 searchlight(); vec3 landing_light(in float offset, in float offsetv); vec3 filter_combined (in vec3 color) ; +float getShadowing(); + float detail_fade (in float scale, in float angle, in float dist) { @@ -282,9 +284,10 @@ if (quality_level > 3) } if (NdotL > 0.0) { + float shadowmap = getShadowing(); if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, noise_1500m, dist);} - color += diffuse_term * NdotL; + color += diffuse_term * NdotL * shadowmap; @@ -294,7 +297,8 @@ if (quality_level > 3) if (gl_FrontMaterial.shininess > 0.0) specular.rgb = ((gl_FrontMaterial.specular.rgb + (water_factor * vec3 (1.0, 1.0, 1.0))) * light_specular.rgb - * pow(NdotHV, (gl_FrontMaterial.shininess + 20.0 * water_factor))); + * pow(NdotHV, (gl_FrontMaterial.shininess + 20.0 * water_factor)) + * shadowmap); } color.a = 1.0; // This shouldn't be necessary, but our lighting becomes very diff --git a/Shaders/ambient.frag b/Shaders/ambient.frag deleted file mode 100644 index d4e726e0a..000000000 --- a/Shaders/ambient.frag +++ /dev/null @@ -1,22 +0,0 @@ -#version 120 - -uniform sampler2D color_tex; -uniform sampler2D ao_tex; -uniform sampler2D normal_tex; -uniform sampler2D spec_emis_tex; -uniform vec4 fg_SunAmbientColor; -uniform bool ambientOcclusion; -uniform float ambientOcclusionStrength; - -void main() { - vec2 coords = gl_TexCoord[0].xy; - float initialized = texture2D( spec_emis_tex, coords ).a; - if ( initialized < 0.1 ) - discard; - vec3 tcolor = texture2D( color_tex, coords ).rgb; - float ao = 1.0; - if (ambientOcclusion) { - ao = 1.0 - ambientOcclusionStrength * (1.0 - texture2D( ao_tex, coords ).r); - } - gl_FragColor = vec4(tcolor * fg_SunAmbientColor.rgb * ao, 1.0); -} diff --git a/Shaders/bloom-combine.frag b/Shaders/bloom-combine.frag deleted file mode 100644 index 4452cab40..000000000 --- a/Shaders/bloom-combine.frag +++ /dev/null @@ -1,12 +0,0 @@ -#version 120 - -uniform sampler2D color_tex; -uniform sampler2D spec_emis_tex; -void main() { - vec2 coords = gl_TexCoord[0].xy; - vec4 spec_emis = texture2D( spec_emis_tex, coords ); - if ( spec_emis.a < 0.1 ) - spec_emis.z = 0.0; - vec3 tcolor = texture2D( color_tex, coords ).rgb; - gl_FragColor = vec4(tcolor * spec_emis.z, 1.0); -} diff --git a/Shaders/blur.frag b/Shaders/blur.frag deleted file mode 100644 index 9d7cdc830..000000000 --- a/Shaders/blur.frag +++ /dev/null @@ -1,18 +0,0 @@ -#version 120 - -uniform sampler2D input_tex; -uniform vec2 fg_BufferSize; -uniform float blurOffset_x; -uniform float blurOffset_y; -const float f[5] = float[](0.0, 1.0, 2.0, 3.0, 4.0); -const float w[5] = float[](0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162 ); -void main() { - vec2 blurOffset = vec2(blurOffset_x, blurOffset_y) / fg_BufferSize; - vec2 coords = gl_TexCoord[0].xy; - vec4 color = vec4( texture2D( input_tex, coords + f[0] * blurOffset ).rgb * w[0], 1.0 ); - for (int i=1; i<5; ++i ) { - color.rgb += texture2D( input_tex, coords - f[i] * blurOffset ).rgb * w[i]; - color.rgb += texture2D( input_tex, coords + f[i] * blurOffset ).rgb * w[i]; - } - gl_FragColor = color; -} diff --git a/Shaders/building-deferred-gbuffer.vert b/Shaders/building-deferred-gbuffer.vert deleted file mode 100644 index 907a799d7..000000000 --- a/Shaders/building-deferred-gbuffer.vert +++ /dev/null @@ -1,91 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Author: Frederic Bouvier. -// -#version 120 -#extension GL_EXT_draw_instanced : enable - -attribute vec3 instancePosition; // (x,y,z) -attribute vec3 instanceScaleRotate; // (width, depth, height) -attribute vec3 attrib1; // Generic packed attributes -attribute vec3 attrib2; - -varying vec3 ecNormal; -varying float alpha; - -const float c_precision = 128.0; -const float c_precisionp1 = c_precision + 1.0; - -vec3 float2vec(float value) { - vec3 val; - val.x = mod(value, c_precisionp1) / c_precision; - val.y = mod(floor(value / c_precisionp1), c_precisionp1) / c_precision; - val.z = floor(value / (c_precisionp1 * c_precisionp1)) / c_precision; - return val; -} - -void main() { - // Unpack generic attributes - vec3 attr1 = float2vec(attrib1.x); - vec3 attr2 = float2vec(attrib1.z); - vec3 attr3 = float2vec(attrib2.x); - - // Determine the rotation for the building. - float sr = sin(6.28 * attr1.x); - float cr = cos(6.28 * attr1.x); - - vec3 position = gl_Vertex.xyz; - // Adjust the very top of the roof to match the rooftop scaling. This shapes - // the rooftop - gambled, gabled etc. These vertices are identified by gl_Color.z - position.x = (1.0 - gl_Color.z) * position.x + gl_Color.z * ((position.x + 0.5) * attr3.z - 0.5); - position.y = (1.0 - gl_Color.z) * position.y + gl_Color.z * (position.y * attrib2.y ); - - // Adjust pitch of roof to the correct height. These vertices are identified by gl_Color.z - // Scale down by the building height (instanceScaleRotate.z) because - // immediately afterwards we will scale UP the vertex to the correct scale. - position.z = position.z + gl_Color.z * attrib1.y / instanceScale.z; - position = position * instanceScaleRotate.xyz; - - // Rotation of the building and movement into position - position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr))); - position = position + instancePosition.xyz; - - gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0); - - // Texture coordinates are stored as: - // - a separate offset (x0, y0) for the wall (wtex0x, wtex0y), and roof (rtex0x, rtex0y) - // - a semi-shared (x1, y1) so that the front and side of the building can have - // different texture mappings - // - // The vertex color value selects between them: - // gl_Color.x=1 indicates front/back walls - // gl_Color.y=1 indicates roof - // gl_Color.z=1 indicates top roof vertexs (used above) - // gl_Color.a=1 indicates sides - // Finally, the roof texture is on the right of the texture sheet - float wtex0x = attr1.y; // Front/Side texture X0 - float wtex0y = attr1.z; // Front/Side texture Y0 - float rtex0x = attr2.z; // Roof texture X0 - float rtex0y = attr3.x; // Roof texture Y0 - float wtex1x = attr2.x; // Front/Roof texture X1 - float stex1x = attr3.y; // Side texture X1 - float wtex1y = attr2.y; // Front/Roof/Side texture Y1 - vec2 tex0 = vec2(sign(gl_MultiTexCoord0.x) * (gl_Color.x*wtex0x + gl_Color.y*rtex0x + gl_Color.a*wtex0x), - gl_Color.x*wtex0y + gl_Color.y*rtex0y + gl_Color.a*wtex0y); - - vec2 tex1 = vec2(gl_Color.x*wtex1x + gl_Color.y*wtex1x + gl_Color.a*stex1x, - wtex1y); - - gl_TexCoord[0].x = tex0.x + gl_MultiTexCoord0.x * tex1.x; - gl_TexCoord[0].y = tex0.y + gl_MultiTexCoord0.y * tex1.y; - - // Rotate the normal. - ecNormal = gl_Normal; - ecNormal.xy = vec2(dot(ecNormal.xy, vec2(cr, sr)), dot(ecNormal.xy, vec2(-sr, cr))); - ecNormal = gl_NormalMatrix * ecNormal; - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_FrontColor = vec4(1.0, 1.0, 1.0, 1.0); - gl_BackColor = vec4(1.0, 1.0, 1.0, 1.0); - alpha = 1.0; -} diff --git a/Shaders/building-model-ALS-ultra.vert b/Shaders/building-model-ALS-ultra.vert index af1489c25..c88e04d5d 100644 --- a/Shaders/building-model-ALS-ultra.vert +++ b/Shaders/building-model-ALS-ultra.vert @@ -27,7 +27,6 @@ uniform float hdg; uniform int refl_dynamic; uniform int nmap_enabled; uniform int shader_qual; -uniform int rembrandt_enabled; uniform int color_is_position; //////Fog Include/////////// @@ -177,11 +176,8 @@ void main(void) reflVec = reflVec_stat; } - if(rembrandt_enabled < 1){ gl_FrontColor = gl_FrontMaterial.emission + vec4(1.0,1.0,1.0,1.0) * (gl_LightModel.ambient + gl_LightSource[0].ambient); - } else { - gl_FrontColor = vec4(1.0,1.0,1.0,1.0); - } + gl_Position = gl_ModelViewProjectionMatrix * vec4(rawpos,1.0); } diff --git a/Shaders/building-ubershader.vert b/Shaders/building-ubershader.vert index 6615dffef..758ae7850 100644 --- a/Shaders/building-ubershader.vert +++ b/Shaders/building-ubershader.vert @@ -15,7 +15,6 @@ varying vec3 normal; uniform int refl_dynamic; uniform int nmap_enabled; uniform int shader_qual; -uniform int rembrandt_enabled; attribute vec3 instancePosition; // (x,y,z) attribute vec3 instanceScale; // (width, depth, height) @@ -89,12 +88,9 @@ void main(void) // Force no alpha on random buildings diffuseColor = vec4(gl_FrontMaterial.diffuse.rgb,1.0); - if(rembrandt_enabled < 1){ gl_FrontColor = gl_FrontMaterial.emission + vec4(1.0) * (gl_LightModel.ambient + gl_LightSource[0].ambient); - } else { - gl_FrontColor = vec4(1.0); - } + gl_ClipVertex = ecPosition; // Texture coordinates are stored as: diff --git a/Shaders/chute-ALS.vert b/Shaders/chute-ALS.vert index a46a3087e..9c97fdc8b 100644 --- a/Shaders/chute-ALS.vert +++ b/Shaders/chute-ALS.vert @@ -41,6 +41,7 @@ uniform float chute_bend; uniform float chute_projection_z; uniform float osg_SimulationTime; +void setupShadows(vec4 eyeSpacePos); // This is the value used in the skydome scattering shader - use the same here for consistency? const float EarthRadius = 5800000.0; @@ -286,6 +287,7 @@ else // the faster, full-day version without lightfields gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; gl_Position = gl_ModelViewProjectionMatrix * vertex; + setupShadows(gl_ModelViewMatrix * vertex); } diff --git a/Shaders/cinema.frag b/Shaders/cinema.frag deleted file mode 100644 index 7dffdebc6..000000000 --- a/Shaders/cinema.frag +++ /dev/null @@ -1,96 +0,0 @@ -#version 120 - -uniform sampler2D lighting_tex; -uniform sampler2D bloom_tex; -uniform sampler2D film_tex; - -uniform bool colorShift; -uniform vec3 redShift; -uniform vec3 greenShift; -uniform vec3 blueShift; - -uniform bool vignette; -uniform float innerCircle; -uniform float outerCircle; - -uniform bool distortion; -uniform vec3 distortionFactor; - -uniform bool colorFringe; -uniform float colorFringeFactor; - -uniform bool filmWear; - -uniform vec2 fg_BufferSize; -uniform float osg_SimulationTime; -// uniform float shutterFreq; -// uniform float shutterDuration; - -uniform bool bloomEnabled; -uniform float bloomStrength; -uniform bool bloomBuffers; - -void main() { - vec2 c1 = gl_TexCoord[0].xy; - vec2 initialCoords = c1; - vec2 c2; - - if (distortion) { - c1 = 2.0 * initialCoords - vec2(1.,1.); - c1 *= vec2( 1.0, fg_BufferSize.y / fg_BufferSize.x ); - float r = length(c1); - - c1 += c1 * dot(distortionFactor.xy, vec2(r*r, r*r*r*r)); - c1 /= distortionFactor.z; - - c1 *= vec2( 1.0, fg_BufferSize.x / fg_BufferSize.y ); - c1 = c1 * .5 + .5; - - if (colorFringe) { - c2 = 2.0 * initialCoords - vec2(1.,1.); - c2 *= vec2( 1.0, fg_BufferSize.y / fg_BufferSize.x ); - r = length(c2); - - c2 += c2 * dot(distortionFactor.xy*colorFringeFactor, vec2(r*r, r*r*r*r)); - c2 /= distortionFactor.z; - - c2 *= vec2( 1.0, fg_BufferSize.x / fg_BufferSize.y ); - c2 = c2 * .5 + .5; - } - } - - vec3 dirt = vec3(1.0); - if (filmWear) { - dirt = texture2D(film_tex, initialCoords*vec2( 1.0, fg_BufferSize.y / fg_BufferSize.x ) + vec2(0.0, osg_SimulationTime * 7.7)).rgb; - } - - vec4 color = texture2D( lighting_tex, c1 ); - if (bloomEnabled && bloomBuffers) - color += bloomStrength * texture2D( bloom_tex, c1 ); - - if (distortion && colorFringe) { - color.g = texture2D( lighting_tex, c2 ).g; - if (bloomEnabled && bloomBuffers) - color.g += bloomStrength * texture2D( bloom_tex, c2 ).g; - } - - if (colorShift) { - vec3 col2; - col2.r = dot(color.rgb, redShift); - col2.g = dot(color.rgb, greenShift); - col2.b = dot(color.rgb, blueShift); - color.rgb = col2; - } - - if (vignette) { - vec2 c = 2.0 * initialCoords - vec2(1.,1.); - c = c * vec2( 1.0, fg_BufferSize.y / fg_BufferSize.x ); - float l = length(c); - float f = smoothstep( innerCircle, innerCircle * outerCircle, l ); - color.rgb = (1.0 - f) * color.rgb; - } - // if ((osg_FrameNumber % 6) == 0) - // f = 1.0; - - gl_FragColor = color * vec4(dirt, 1.0); -} diff --git a/Shaders/cliffs-ALS.frag b/Shaders/cliffs-ALS.frag index 956b93159..b96e7b7e5 100644 --- a/Shaders/cliffs-ALS.frag +++ b/Shaders/cliffs-ALS.frag @@ -83,6 +83,8 @@ vec3 searchlight(); vec3 landing_light(in float offset, in float offsetv); vec3 filter_combined (in vec3 color) ; +float getShadowing(); + float light_func (in float x, in float a, in float b, in float c, in float d, in float e) { x = x - 0.5; @@ -388,8 +390,9 @@ if ((dist < 5000.0) && (combined_wetness>0.0)) float fresnel; if (NdotL > 0.0) { + float shadowmap = getShadowing(); if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 0.3 * noise_250m + 0.5 * noise_500m+0.2 * noise_1500m, dist);} - color += diffuse_term * NdotL; + color += diffuse_term * NdotL * shadowmap; NdotHV = max(dot(n, halfVector), 0.0); fresnel = 1.0 + 5.0 * (1.0-smoothstep(0.0,0.2, dot(normalize(ecViewdir),n))); @@ -397,7 +400,8 @@ if ((dist < 5000.0) && (combined_wetness>0.0)) //if (gl_FrontMaterial.shininess > 0.0) specular.rgb = ((gl_FrontMaterial.specular.rgb * 0.1 + (water_factor * vec3 (1.0, 1.0, 1.0))) * light_specular.rgb - * pow(NdotHV, max(gl_FrontMaterial.shininess,4.0) + (20.0 * water_factor))); + * pow(NdotHV, max(gl_FrontMaterial.shininess,4.0) + (20.0 * water_factor)) + * shadowmap); } color.a = 1.0;//diffuse_term.a; // This shouldn't be necessary, but our lighting becomes very diff --git a/Shaders/clustered-include.frag b/Shaders/clustered-include.frag new file mode 100644 index 000000000..9b042033a --- /dev/null +++ b/Shaders/clustered-include.frag @@ -0,0 +1,243 @@ +#version 120 + +uniform sampler3D fg_Clusters; +uniform sampler2D fg_ClusteredPointLights; +uniform sampler2D fg_ClusteredSpotLights; + +uniform int fg_ClusteredTileSize; +uniform float fg_ClusteredSliceScale; +uniform float fg_ClusteredSliceBias; +uniform int fg_ClusteredHorizontalTiles; +uniform int fg_ClusteredVerticalTiles; + +const int MAX_POINTLIGHTS = 1024; +const int MAX_SPOTLIGHTS = 1024; +const int MAX_LIGHT_GROUPS_PER_CLUSTER = 255; + +struct PointLight { + vec4 position; + vec4 ambient; + vec4 diffuse; + vec4 specular; + vec4 attenuation; +}; + +struct SpotLight { + vec4 position; + vec4 direction; + vec4 ambient; + vec4 diffuse; + vec4 specular; + vec4 attenuation; + float cos_cutoff; + float exponent; +}; + + +PointLight unpackPointLight(int index) +{ + PointLight light; + float v = (float(index) + 0.5) / float(MAX_POINTLIGHTS); + light.position = texture2D(fg_ClusteredPointLights, vec2(0.1, v)); + light.ambient = texture2D(fg_ClusteredPointLights, vec2(0.3, v)); + light.diffuse = texture2D(fg_ClusteredPointLights, vec2(0.5, v)); + light.specular = texture2D(fg_ClusteredPointLights, vec2(0.7, v)); + light.attenuation = texture2D(fg_ClusteredPointLights, vec2(0.9, v)); + return light; +} + +SpotLight unpackSpotLight(int index) +{ + SpotLight light; + float v = (float(index) + 0.5) / float(MAX_SPOTLIGHTS); + light.position = texture2D(fg_ClusteredSpotLights, vec2(0.0714, v)); + light.direction = texture2D(fg_ClusteredSpotLights, vec2(0.2143, v)); + light.ambient = texture2D(fg_ClusteredSpotLights, vec2(0.3571, v)); + light.diffuse = texture2D(fg_ClusteredSpotLights, vec2(0.5, v)); + light.specular = texture2D(fg_ClusteredSpotLights, vec2(0.6429, v)); + light.attenuation = texture2D(fg_ClusteredSpotLights, vec2(0.7857, v)); + vec2 reminder = texture2D(fg_ClusteredSpotLights, vec2(0.9286, v)).xy; + light.cos_cutoff = reminder.x; + light.exponent = reminder.y; + return light; +} + +// @param p Fragment position in view space. +// @param n Fragment normal in view space. +vec3 getClusteredLightsContribution(vec3 p, vec3 n, vec3 texel) +{ + int zSlice = int(max(log2(-p.z) * fg_ClusteredSliceScale + + fg_ClusteredSliceBias, 0.0)); + int ySlice = int(gl_FragCoord.y) / fg_ClusteredTileSize * zSlice; + int xSlice = int(gl_FragCoord.x) / fg_ClusteredTileSize; + + vec2 clusterCoords = vec2( + (float(xSlice) + 0.5) / fg_ClusteredHorizontalTiles, + (float(ySlice) * float(zSlice) + 0.5) / fg_ClusteredVerticalTiles); + + int pointCount = int(texture3D(fg_Clusters, vec3(clusterCoords, 0.0)).r); + int spotCount = int(texture3D(fg_Clusters, vec3(clusterCoords, 0.0)).g); + + int lightGroupCount = int(ceil(float(pointCount + spotCount) / 4.0)); + + vec3 color = vec3(0.0); + + for (int i = 0; i < lightGroupCount; ++i) { + float r = (float(i + 1) + 0.5) / float(MAX_LIGHT_GROUPS_PER_CLUSTER + 1); + vec4 packedIndices = texture3D(fg_Clusters, vec3(clusterCoords, r)); + + for (int j = 0; j < 4; ++j) { + int index; + if (j == 0) index = int(packedIndices.x); + else if (j == 1) index = int(packedIndices.y); + else if (j == 2) index = int(packedIndices.z); + else if (j == 3) index = int(packedIndices.w); + else break; + + int currentLight = i * 4 + j; + if (currentLight < pointCount) { + // This is a point light + PointLight light = unpackPointLight(index); + + float range = light.attenuation.w; + vec3 toLight = light.position.xyz - p; + // Ignore fragments outside the light volume + if (dot(toLight, toLight) > (range * range)) + continue; + + float d = length(toLight); + float att = 1.0 / (light.attenuation.x // constant + + light.attenuation.y * d // linear + + light.attenuation.z * d * d); // quadratic + vec3 lightDir = normalize(toLight); + float NdotL = max(dot(n, lightDir), 0.0); + + vec3 Iamb = light.ambient.rgb; + vec3 Idiff = gl_FrontMaterial.diffuse.rgb * light.diffuse.rgb * NdotL; + vec3 Ispec = vec3(0.0); + + if (NdotL > 0.0) { + vec3 halfVector = normalize(lightDir + normalize(-p)); + float NdotHV = max(dot(n, halfVector), 0.0); + Ispec = gl_FrontMaterial.specular.rgb + * light.specular.rgb + * pow(NdotHV, gl_FrontMaterial.shininess); + } + + color += ((Iamb + Idiff) * texel + Ispec) * att; + } else if (currentLight < (pointCount + spotCount)) { + // This is a spot light + SpotLight light = unpackSpotLight(index); + + vec3 toLight = light.position.xyz - p; + + float d = length(toLight); + float att = 1.0 / (light.attenuation.x // constant + + light.attenuation.y * d // linear + + light.attenuation.z * d * d); // quadratic + + vec3 lightDir = normalize(toLight); + + float spotDot = dot(-lightDir, light.direction.xyz); + if (spotDot < light.cos_cutoff) + continue; + + att *= pow(spotDot, light.exponent); + + float NdotL = max(dot(n, lightDir), 0.0); + + vec3 Iamb = light.ambient.rgb; + vec3 Idiff = gl_FrontMaterial.diffuse.rgb * light.diffuse.rgb * NdotL; + vec3 Ispec = vec3(0.0); + + if (NdotL > 0.0) { + vec3 halfVector = normalize(lightDir + normalize(-p)); + float NdotHV = max(dot(n, halfVector), 0.0); + Ispec = gl_FrontMaterial.specular.rgb + * light.specular.rgb + * pow(NdotHV, gl_FrontMaterial.shininess); + } + + color += ((Iamb + Idiff) * texel + Ispec) * att; + } else { + break; + } + } + } + + return clamp(color, 0.0, 1.0); + + // for (int i = 0; i < pointCount; ++i) { + // vec3 lightCoords = clusterCoords; + + // int pointCount = int(texture2D(fg_Clusters, clusterCoords).r); + // PointLight light = pointLights[lightListIndex]; + + // float range = light.attenuation.w; + // vec3 toLight = light.position.xyz - p; + // // Ignore fragments outside the light volume + // if (dot(toLight, toLight) > (range * range)) + // continue; + + // //////////////////////////////////////////////////////////////////////// + // // Actual lighting + + // float d = length(toLight); + // float att = 1.0 / (light.attenuation.x // constant + // + light.attenuation.y * d // linear + // + light.attenuation.z * d * d); // quadratic + // vec3 lightDir = normalize(toLight); + // float NdotL = max(dot(n, lightDir), 0.0); + + // vec3 Iamb = light.ambient.rgb; + // vec3 Idiff = light.diffuse.rgb * NdotL; + // vec3 Ispec = vec3(0.0); + + // if (NdotL > 0.0) { + // vec3 halfVector = normalize(lightDir + normalize(-p)); + // float NdotHV = max(dot(n, halfVector), 0.0); + // Ispec = light.specular.rgb * att * pow(NdotHV, shininess); + // } + + // color += addColors(color, (Iamb + Idiff + Ispec) * att); + // } + + // for (uint i = uint(0); i < spotCount; ++i) { + // uint lightListIndex = texelFetch(fg_ClusteredLightIndices, + // int(startIndex + i)).r; + // SpotLight light = spotLights[lightListIndex]; + + // vec3 toLight = light.position.xyz - p; + + // //////////////////////////////////////////////////////////////////////// + // // Actual lighting + + // float d = length(toLight); + // float att = 1.0 / (light.attenuation.x // constant + // + light.attenuation.y * d // linear + // + light.attenuation.z * d * d); // quadratic + + // vec3 lightDir = normalize(toLight); + + // float spotDot = dot(-lightDir, light.direction.xyz); + // if (spotDot < light.cos_cutoff) + // continue; + + // att *= pow(spotDot, light.exponent); + + // float NdotL = max(dot(n, lightDir), 0.0); + + // vec3 Iamb = light.ambient.rgb; + // vec3 Idiff = light.diffuse.rgb * NdotL; + // vec3 Ispec = vec3(0.0); + + // if (NdotL > 0.0) { + // vec3 halfVector = normalize(lightDir + normalize(-p)); + // float NdotHV = max(dot(n, halfVector), 0.0); + // Ispec = light.specular.rgb * att * pow(NdotHV, shininess); + // } + + // color += (Iamb + Idiff + Ispec) * att; + // } + +} diff --git a/Shaders/crop.frag b/Shaders/crop.frag index fb7a69e3b..ed0349258 100644 --- a/Shaders/crop.frag +++ b/Shaders/crop.frag @@ -24,6 +24,8 @@ uniform int fogType; vec3 fog_Func(vec3 color, int type); ////////////////////// +float getShadowing(); + void main (void) { @@ -64,7 +66,7 @@ void main (void) //"snow" c1 = mix(c1, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0)); - vec3 diffuse = gl_Color.rgb * max(0.0, dot(VNormal, gl_LightSource[0].position.xyz)); + vec3 diffuse = gl_Color.rgb * max(0.0, dot(VNormal, gl_LightSource[0].position.xyz)) * getShadowing(); vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0); c1 *= ambient_light; diff --git a/Shaders/crop.vert b/Shaders/crop.vert index 9e70bfa6d..669e66225 100644 --- a/Shaders/crop.vert +++ b/Shaders/crop.vert @@ -6,6 +6,8 @@ varying vec3 VNormal; varying vec3 Normal; varying vec4 constantColor; +void setupShadows(vec4 eyeSpacePos); + void main(void) { gl_TexCoord[0] = gl_MultiTexCoord0; @@ -21,4 +23,6 @@ void main(void) + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); gl_Position = ftransform(); -} \ No newline at end of file + + setupShadows(ecPosition); +} diff --git a/Shaders/default.frag b/Shaders/default.frag index 1c3fbaf84..79989d1b7 100644 --- a/Shaders/default.frag +++ b/Shaders/default.frag @@ -14,6 +14,8 @@ uniform int fogType; vec3 fog_Func(vec3 color, int type); ////////////////////// +float getShadowing(); + float luminance(vec3 color) { return dot(vec3(0.212671, 0.715160, 0.072169), color); @@ -37,12 +39,14 @@ void main() NdotL = dot(n, lightDir); if (NdotL > 0.0) { - color += diffuse_term * NdotL; + float shadowmap = getShadowing(); + color += diffuse_term * NdotL * shadowmap; NdotHV = max(dot(n, halfVector), 0.0); if (gl_FrontMaterial.shininess > 0.0) specular.rgb = (gl_FrontMaterial.specular.rgb * gl_LightSource[0].specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess)); + * pow(NdotHV, gl_FrontMaterial.shininess) + * shadowmap); } color.a = diffuse_term.a; // This shouldn't be necessary, but our lighting becomes very @@ -54,4 +58,4 @@ void main() fragColor.rgb = fog_Func(fragColor.rgb, fogType); gl_FragColor = fragColor; -} \ No newline at end of file +} diff --git a/Shaders/default.vert b/Shaders/default.vert index 1bc240585..c58c56349 100644 --- a/Shaders/default.vert +++ b/Shaders/default.vert @@ -21,6 +21,8 @@ varying vec3 normal; uniform int colorMode; +void setupShadows(vec4 eyeSpacePos); + ////fog "include"//////// //uniform int fogType; // @@ -58,4 +60,5 @@ void main() gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; //fogCoord = abs(ecPosition.z / ecPosition.w); //fog_Func(fogType); + setupShadows(gl_ModelViewMatrix * gl_Vertex); } diff --git a/Shaders/deferred-gbuffer.frag b/Shaders/deferred-gbuffer.frag deleted file mode 100644 index 4c847305e..000000000 --- a/Shaders/deferred-gbuffer.frag +++ /dev/null @@ -1,25 +0,0 @@ -#version 120 -#extension GL_EXT_gpu_shader4 : enable -// -*- mode: C; -*- -// Licence: GPL v2 -// Author: Frederic Bouvier. -// - -varying vec3 ecNormal; -varying float alpha; -uniform int materialID; -uniform sampler2D texture; - -void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth); - -void main() { - vec4 texel = texture2D(texture, gl_TexCoord[0].st); - if (texel.a * alpha < 0.1) - discard; - float specular = dot( gl_FrontMaterial.specular.rgb, vec3( 0.3, 0.59, 0.11 ) ); - float shininess = gl_FrontMaterial.shininess; - float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb, vec3( 0.3, 0.59, 0.11 ) ); - - vec3 normal2 = normalize( (2.0 * gl_Color.a - 1.0) * ecNormal ); - encode_gbuffer(normal2, gl_Color.rgb * texel.rgb, materialID, specular, shininess, emission, gl_FragCoord.z); -} diff --git a/Shaders/deferred-gbuffer.vert b/Shaders/deferred-gbuffer.vert deleted file mode 100644 index 9654f1159..000000000 --- a/Shaders/deferred-gbuffer.vert +++ /dev/null @@ -1,16 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Author: Frederic Bouvier. -// -#version 120 - -varying vec3 ecNormal; -varying float alpha; -void main() { - ecNormal = gl_NormalMatrix * gl_Normal; - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_FrontColor.rgb = gl_Color.rgb; gl_FrontColor.a = 1.0; - gl_BackColor.rgb = gl_Color.rgb; gl_BackColor.a = 0.0; - alpha = gl_Color.a; -} diff --git a/Shaders/deferred-tree.frag b/Shaders/deferred-tree.frag deleted file mode 100644 index 9fcccb62d..000000000 --- a/Shaders/deferred-tree.frag +++ /dev/null @@ -1,21 +0,0 @@ -#version 120 -#extension GL_EXT_gpu_shader4 : enable -// -// attachment 0: normal.x | normal.x | normal.y | normal.y -// attachment 1: diffuse.r | diffuse.g | diffuse.b | material Id -// attachment 2: specular.l | shininess | emission.l | unused -// -uniform int materialID; -uniform sampler2D texture; -void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth); -void main() { - vec4 texel = texture2D(texture, gl_TexCoord[0].st); - if (texel.a < 0.1) - discard; - float specular = 0.0; - float shininess = 0.1; - float emission = 0.0; - - // Normal is straight towards the viewer. (FB: Are they really billboards ? ) - encode_gbuffer(vec3(0.5, 0.5, 0.0), gl_Color.rgb * texel.rgb, materialID, specular, shininess, emission, gl_FragCoord.z); -} diff --git a/Shaders/deferred-tree.vert b/Shaders/deferred-tree.vert deleted file mode 100644 index edc4d6b17..000000000 --- a/Shaders/deferred-tree.vert +++ /dev/null @@ -1,35 +0,0 @@ -// Tree instance scheme: -// vertex - local position of quad vertex. -// normal - x y scaling, z number of varieties -// fog coord - rotation -// color - xyz of tree quad origin, replicated 4 times. -#version 120 - -uniform float season; - -void main() { - - // Texture coordinates - float numVarieties = gl_Normal.z; - float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties; - texFract += floor(gl_MultiTexCoord0.x) / numVarieties; - gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0); - gl_TexCoord[0].y = gl_TexCoord[0].y + 0.5 * season; - - // Position and scaling - vec3 position = gl_Vertex.xyz * gl_Normal.xxy; - float sr = sin(gl_FogCoord + gl_Color.x); - float cr = cos(gl_FogCoord + gl_Color.x); - - // Rotation of the generic quad to specific one for the tree. - position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr))); - - // Move to correct location (stored in gl_Color) - position = position + gl_Color.xyz; - gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0); - - // Color - white. - gl_FrontColor = vec4(1.0, 1.0, 1.0,1.0); - gl_BackColor = vec4(1.0, 1.0, 1.0,1.0); -} - diff --git a/Shaders/display.frag b/Shaders/display.frag deleted file mode 100644 index df48e55cd..000000000 --- a/Shaders/display.frag +++ /dev/null @@ -1,45 +0,0 @@ -#version 120 - -uniform sampler2D lighting_tex; -uniform sampler2D bloom_tex; - -uniform sampler2D bufferNW_tex; -uniform sampler2D bufferNE_tex; -uniform sampler2D bufferSW_tex; -uniform sampler2D bufferSE_tex; - -uniform bool showBuffers; - -uniform bool bloomEnabled; -uniform float bloomStrength; -uniform bool bloomBuffers; - -uniform bool bufferNW_enabled; -uniform bool bufferNE_enabled; -uniform bool bufferSW_enabled; -uniform bool bufferSE_enabled; - -void main() { - vec2 coords = gl_TexCoord[0].xy; - vec4 color; - if (showBuffers) { - if (coords.x < 0.2 && coords.y < 0.2 && bufferSW_enabled) { - color = texture2D( bufferSW_tex, coords * 5.0 ); - } else if (coords.x >= 0.8 && coords.y >= 0.8 && bufferNE_enabled) { - color = texture2D( bufferNE_tex, (coords - vec2( 0.8, 0.8 )) * 5.0 ); - } else if (coords.x >= 0.8 && coords.y < 0.2 && bufferSE_enabled) { - color = texture2D( bufferSE_tex, (coords - vec2( 0.8, 0.0 )) * 5.0 ); - } else if (coords.x < 0.2 && coords.y >= 0.8 && bufferNW_enabled) { - color = texture2D( bufferNW_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 ); - } else { - color = texture2D( lighting_tex, coords ); - if (bloomEnabled && bloomBuffers) - color = color + bloomStrength * texture2D( bloom_tex, coords ); - } - } else { - color = texture2D( lighting_tex, coords ); - if (bloomEnabled && bloomBuffers) - color = color + bloomStrength * texture2D( bloom_tex, coords ); - } - gl_FragColor = color; -} diff --git a/Shaders/drunway-ALS.frag b/Shaders/drunway-ALS.frag index cc816c840..cccb77060 100644 --- a/Shaders/drunway-ALS.frag +++ b/Shaders/drunway-ALS.frag @@ -83,6 +83,7 @@ vec3 rayleigh_out_shift(in vec3 color, in float outscatter); vec3 get_hazeColor(in float light_arg); vec3 filter_combined (in vec3 color) ; +float getShadowing(); void main() @@ -284,14 +285,16 @@ if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0)) //NdotL = NdotL + 3.0 * N.r + 0.1 * (noise_01m-0.5) ; } if (NdotL > 0.0) { + float shadowmap = getShadowing(); if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 1.0, dist);} - color += diffuse_term * NdotL; + color += diffuse_term * NdotL * shadowmap; NdotHV = max(dot(n, halfVector), 0.0); //if (gl_FrontMaterial.shininess > 0.0) specular.rgb = ((gl_FrontMaterial.specular.rgb + (water_factor * vec3 (1.0, 1.0, 1.0))) * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor))); + * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor)) + * shadowmap); } color.a = 1.0;//diffuse_term.a; // This shouldn't be necessary, but our lighting becomes very diff --git a/Shaders/flutter-ALS.vert b/Shaders/flutter-ALS.vert index 500fcdcca..9c0f9c4ee 100644 --- a/Shaders/flutter-ALS.vert +++ b/Shaders/flutter-ALS.vert @@ -48,6 +48,8 @@ const float terminator_width = 200000.0; float earthShade; +void setupShadows(vec4 eyeSpacePos); + float light_func (in float x, in float a, in float b, in float c, in float d, in float e) { //x = x - 0.5; @@ -308,5 +310,5 @@ else // the faster, full-day version without lightfields // fogCoord = abs(ecPosition.z / ecPosition.w); //fog_Func(fogType); - + setupShadows(ecPosition); } diff --git a/Shaders/flutter.vert b/Shaders/flutter.vert index 0d07a042f..3de78d2a3 100644 --- a/Shaders/flutter.vert +++ b/Shaders/flutter.vert @@ -35,6 +35,8 @@ uniform sampler3D Noise; //void fog_Func(int type); ///////////////////////// +void setupShadows(vec4 eyeSpacePos); + /////// functions ///////// float normalize_range(float _val) @@ -139,5 +141,5 @@ void main() // fogCoord = abs(ecPosition.z / ecPosition.w); //fog_Func(fogType); - + setupShadows(ecPosition); } diff --git a/Shaders/fog.frag b/Shaders/fog.frag deleted file mode 100644 index c1c0b84ff..000000000 --- a/Shaders/fog.frag +++ /dev/null @@ -1,28 +0,0 @@ -#version 120 - -uniform sampler2D depth_tex; -uniform sampler2D normal_tex; -uniform sampler2D color_tex; -uniform sampler2D spec_emis_tex; -uniform vec4 fg_FogColor; -uniform float fg_FogDensity; -uniform vec3 fg_Planes; -varying vec3 ray; - -vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex ); - -void main() { - vec2 coords = gl_TexCoord[0].xy; - float initialized = texture2D( spec_emis_tex, coords ).a; - if ( initialized < 0.1 ) - discard; - vec3 normal; - vec3 pos = position( normalize(ray), coords, depth_tex ); - - float fogFactor = 0.0; - const float LOG2 = 1.442695; - fogFactor = exp2(-fg_FogDensity * fg_FogDensity * pos.z * pos.z * LOG2); - fogFactor = clamp(fogFactor, 0.0, 1.0); - - gl_FragColor = vec4(fg_FogColor.rgb, 1.0 - fogFactor); -} diff --git a/Shaders/fog.vert b/Shaders/fog.vert deleted file mode 100644 index f283ea7af..000000000 --- a/Shaders/fog.vert +++ /dev/null @@ -1,8 +0,0 @@ -#version 120 -uniform mat4 fg_ProjectionMatrixInverse; -varying vec3 ray; -void main() { - gl_Position = gl_Vertex; - gl_TexCoord[0] = gl_MultiTexCoord0; - ray = (fg_ProjectionMatrixInverse * gl_Vertex).xyz; -} diff --git a/Shaders/forest.frag b/Shaders/forest.frag index 4d8a7d349..084fded6e 100644 --- a/Shaders/forest.frag +++ b/Shaders/forest.frag @@ -28,6 +28,8 @@ uniform int fogType; vec3 fog_Func(vec3 color, int type); ////////////////////// +float getShadowing(); + float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds) { @@ -183,7 +185,7 @@ void main (void) diffuse = gl_Color.rgb * max(0.8, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz)); } - vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 0.0); + vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 0.0) * getShadowing(); c1 *= ambient_light; vec4 finalColor = c1; diff --git a/Shaders/forest.vert b/Shaders/forest.vert index 226ebb141..3b566c1b7 100644 --- a/Shaders/forest.vert +++ b/Shaders/forest.vert @@ -16,6 +16,8 @@ attribute vec3 binormal; // void fog_Func(int type); // ///////////////////////// +void setupShadows(vec4 eyeSpacePos); + void main(void) { rawpos = gl_Vertex; @@ -31,4 +33,5 @@ void main(void) gl_Position = ftransform(); gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; // fog_Func(fogType); + setupShadows(ecPosition); } diff --git a/Shaders/fullscreen.vert b/Shaders/fullscreen.vert deleted file mode 100644 index 014076a02..000000000 --- a/Shaders/fullscreen.vert +++ /dev/null @@ -1,5 +0,0 @@ -#version 120 -void main() { - gl_Position = gl_Vertex; - gl_TexCoord[0] = gl_MultiTexCoord0; -} diff --git a/Shaders/gbuffer-encode.frag b/Shaders/gbuffer-encode.frag deleted file mode 100644 index ac6bf1ad8..000000000 --- a/Shaders/gbuffer-encode.frag +++ /dev/null @@ -1,25 +0,0 @@ -// -*- mode: C; -*- -#version 120 -// Licence: GPL v2 -// Author: Frederic Bouvier. - -uniform bool fg_DepthInColor; - -vec2 normal_encode(vec3 n); -vec3 float_to_color(in float f); - -// attachment 0: normal.x | normal.y | 0.0 | 1.0 -// attachment 1: diffuse.r | diffuse.g | diffuse.b | material Id -// attachment 2: specular.l | shininess | emission.l | unused -// attachment 3: ---------- depth ------------ | unused (optional) -// -void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth) -{ - gl_FragData[0] = vec4( normal_encode(normal), 0.0, 1.0 ); - gl_FragData[1] = vec4( color, float( mId ) / 255.0 ); - gl_FragData[2] = vec4( specular, shininess / 128.0, emission, 1.0 ); - vec3 dcol = vec3(1.0, 1.0, 1.0); - if (fg_DepthInColor) - dcol = float_to_color(depth); - gl_FragData[3] = vec4(dcol, 1.0); -} diff --git a/Shaders/gbuffer-functions.frag b/Shaders/gbuffer-functions.frag deleted file mode 100644 index 5a92f68d1..000000000 --- a/Shaders/gbuffer-functions.frag +++ /dev/null @@ -1,70 +0,0 @@ -// -*- mode: C; -*- -#version 120 -// Licence: GPL v2 -// Author: Frederic Bouvier. - -uniform vec3 fg_Planes; -uniform bool fg_DepthInColor; - -// normal compression functions from -// http://aras-p.info/texts/CompactNormalStorage.html#method04spheremap -vec2 normal_encode(vec3 n) -{ - float p = sqrt(n.z * 8.0 + 8.0); - return n.xy / p + 0.5; -} - -vec3 normal_decode(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; -} - -// depth to color encoding and decoding functions from -// Deferred Shading Tutorial by Fabio Policarpo and Francisco Fonseca -// (corrected by Frederic Bouvier) -vec3 float_to_color(in float f) -{ - vec3 color; - f *= 255.0; - color.x = floor(f); - f = (f-color.x)*255.0; - color.y = floor(f); - color.z = f-color.y; - color.xy /= 255.0; - return color; -} - -float color_to_float(vec3 color) -{ - const vec3 byte_to_float = vec3(1.0, 1.0/255.0, 1.0/(255.0*255.0)); - return dot(color,byte_to_float); -} - -vec3 position( vec3 viewDir, float depth ) -{ - vec3 pos; - pos.z = - fg_Planes.y / (fg_Planes.x + depth * fg_Planes.z); - pos.xy = viewDir.xy / viewDir.z * pos.z; - return pos; -} - -vec3 position( vec3 viewDir, vec3 depthColor ) -{ - return position( viewDir, color_to_float(depthColor) ); -} - -vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex ) -{ - float depth; - if (fg_DepthInColor) - depth = color_to_float( texture2D( depth_tex, coords ).rgb ); - else - depth = texture2D( depth_tex, coords ).r; - return position( viewDir, depth ); -} diff --git a/Shaders/generic-ALS-base.vert b/Shaders/generic-ALS-base.vert index ecabf9e44..103c4a7ac 100644 --- a/Shaders/generic-ALS-base.vert +++ b/Shaders/generic-ALS-base.vert @@ -36,6 +36,7 @@ uniform float overcast; uniform float ground_scattering; uniform float moonlight; +void setupShadows(vec4 eyeSpacePos); // This is the value used in the skydome scattering shader - use the same here for consistency? const float EarthRadius = 5800000.0; @@ -239,6 +240,7 @@ else // the faster, full-day version without lightfields gl_FrontColor.rgb = constant_term.rgb; gl_FrontColor.a = 1.0; gl_BackColor.rgb = constant_term.rgb; gl_BackColor.a = 0.0; + setupShadows(gl_ModelViewMatrix * gl_Vertex); } diff --git a/Shaders/grass-ALS.frag b/Shaders/grass-ALS.frag index 34238f2b9..f797a37f9 100644 --- a/Shaders/grass-ALS.frag +++ b/Shaders/grass-ALS.frag @@ -2,7 +2,7 @@ #version 120 #define BLADE_FRACTION 0.1 -#define MAX_LAYERS 30 +#define MAX_LAYERS 20 #define MAX_DISTANCE 1000.0 uniform float visibility; @@ -37,6 +37,8 @@ float rand2D(in vec2 co); float Noise2D(in vec2 co, in float wavelength); vec3 filter_combined (in vec3 color) ; +float getShadowing(); + float map(float s, float a1, float a2, float b1, float b2) { @@ -153,7 +155,7 @@ void main() texel.r = min(1.0, (1.0 + 2.5 * 0.1 * season) * texel.r); texel.g = texel.g; texel.b = max(0.0, (1.0 - 4.0 * 0.1 * season) * texel.b); - float intensity = length(texel.rgb) * (1.0 - 0.5 * smoothstep(1.1,2.0,season)); + float intensity = length(texel.rgb) * (1.0 - 0.5 * smoothstep(1.1,2.0,season)) * mix(0.3, 1.0, getShadowing()); texel.rgb = intensity * normalize(mix(texel.rgb, vec3(0.23,0.17,0.08), smoothstep(1.1,2.0, season))); float base_alpha = clamp(0.4 * max_height/0.3, 0.4, 1.0); diff --git a/Shaders/grass-ALS.geom b/Shaders/grass-ALS.geom index f53049850..f96732528 100644 --- a/Shaders/grass-ALS.geom +++ b/Shaders/grass-ALS.geom @@ -2,9 +2,9 @@ #version 120 #extension GL_EXT_geometry_shader4 : enable -#define MAX_LAYERS 30 -#define MIN_LAYERS 8 -#define MAX_MINUS_MIN_LAYERS 22 +#define MAX_LAYERS 20 +#define MIN_LAYERS 2 +#define MAX_MINUS_MIN_LAYERS 18 uniform float max_height; @@ -14,7 +14,18 @@ varying out vec2 g_rawpos; varying out float g_distance_to_eye; varying out float g_layer; - +uniform mat4 fg_LightMatrix_csm0; +uniform mat4 fg_LightMatrix_csm1; +uniform mat4 fg_LightMatrix_csm2; +uniform mat4 fg_LightMatrix_csm3; +varying out vec4 lightSpacePos[4]; +void setupShadows(vec4 eyeSpacePos) +{ + lightSpacePos[0] = fg_LightMatrix_csm0 * eyeSpacePos; + lightSpacePos[1] = fg_LightMatrix_csm1 * eyeSpacePos; + lightSpacePos[2] = fg_LightMatrix_csm2 * eyeSpacePos; + lightSpacePos[3] = fg_LightMatrix_csm3 * eyeSpacePos; +} float min3(in float a, in float b, in float c) { @@ -45,6 +56,8 @@ void main() g_distance_to_eye = distances[i]; g_layer = currDeltaLayer; + setupShadows(gl_ModelViewMatrix * pos); + gl_Position = gl_ModelViewProjectionMatrix * pos; gl_TexCoord[0] = gl_TexCoordIn[i][0]; EmitVertex(); diff --git a/Shaders/light-point.frag b/Shaders/light-point.frag deleted file mode 100644 index c4b2c5dd7..000000000 --- a/Shaders/light-point.frag +++ /dev/null @@ -1,71 +0,0 @@ -#version 120 - -uniform vec2 fg_BufferSize; -uniform vec3 fg_Planes; - -uniform sampler2D depth_tex; -uniform sampler2D normal_tex; -uniform sampler2D color_tex; -uniform sampler2D spec_emis_tex; -uniform vec4 LightPosition; -uniform vec4 Ambient; -uniform vec4 Diffuse; -uniform vec4 Specular; -uniform vec3 Attenuation; -uniform float Near; -uniform float Far; - -varying vec4 ecPosition; - -vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex ); -vec3 normal_decode(vec2 enc); - -void main() { - vec3 ray = ecPosition.xyz / ecPosition.w; - vec3 ecPos3 = ray; - vec3 viewDir = normalize(ray); - vec2 coords = gl_FragCoord.xy / fg_BufferSize; - - vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg); - vec4 spec_emis = texture2D( spec_emis_tex, coords ); - - vec3 pos = position(viewDir, coords, depth_tex); - - if ( pos.z < ecPos3.z ) // Negative direction in z - discard; // Don't light surface outside the light volume - - vec3 VP = LightPosition.xyz - pos; - if ( dot( VP, VP ) > ( Far * Far ) ) - discard; // Don't light surface outside the light volume - - float d = length( VP ); - VP /= d; - - vec3 halfVector = normalize(VP - viewDir); - - float att = 1.0 / (Attenuation.x + Attenuation.y * d + Attenuation.z *d*d); - - float cosAngIncidence = clamp(dot(normal, VP), 0.0, 1.0); - - float nDotVP = max(0.0, dot(normal, VP)); - float nDotHV = max(0.0, dot(normal, halfVector)); - - vec4 color_material = texture2D( color_tex, coords ); - vec3 color = color_material.rgb; - vec3 Iamb = Ambient.rgb * color * att; - vec3 Idiff = Diffuse.rgb * color * att * nDotVP; - - float matID = color_material.a * 255.0; - float spec_intensity = spec_emis.x; - float spec_att = att; - if (matID == 254.0) { // 254: water, 255: Ubershader - spec_intensity = 1.0; // spec_color shouldn't depend on cloud cover when rendering spot light - spec_att = min(10.0 * att, 1.0); // specular attenuation reduced on water - } - - vec3 Ispec = vec3(0.0); - if (cosAngIncidence > 0.0) - Ispec = pow( nDotHV, spec_emis.y * 128.0 ) * spec_intensity * spec_att * Specular.rgb; - - gl_FragColor = vec4(Iamb + Idiff + Ispec, 1.0); -} diff --git a/Shaders/light-spot.frag b/Shaders/light-spot.frag deleted file mode 100644 index b92bc53a1..000000000 --- a/Shaders/light-spot.frag +++ /dev/null @@ -1,86 +0,0 @@ -#version 120 - -uniform vec2 fg_BufferSize; -uniform vec3 fg_Planes; - -uniform sampler2D depth_tex; -uniform sampler2D normal_tex; -uniform sampler2D color_tex; -uniform sampler2D spec_emis_tex; -uniform vec4 LightPosition; -uniform vec4 LightDirection; -uniform vec4 Ambient; -uniform vec4 Diffuse; -uniform vec4 Specular; -uniform vec3 Attenuation; -uniform float Exponent; -uniform float Cutoff; -uniform float CosCutoff; -uniform float Near; -uniform float Far; - -varying vec4 ecPosition; - -vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex ); -vec3 normal_decode(vec2 enc); - -void main() { - vec3 ray = ecPosition.xyz / ecPosition.w; - vec3 ecPos3 = ray; - vec3 viewDir = normalize(ray); - vec2 coords = gl_FragCoord.xy / fg_BufferSize; - - vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg); - vec4 spec_emis = texture2D( spec_emis_tex, coords ); - - vec3 pos = position(viewDir, coords, depth_tex); - - if ( pos.z < ecPos3.z ) // Negative direction in z - discard; // Don't light surface outside the light volume - - vec3 VP = LightPosition.xyz - pos; - if ( dot( VP, VP ) > ( Far * Far ) ) - discard; // Don't light surface outside the light volume - - float d = length( VP ); - VP /= d; - - vec3 halfVector = normalize(VP - viewDir); - - float att = 1.0 / (Attenuation.x + Attenuation.y * d + Attenuation.z *d*d); - float spotDot = dot(-VP, normalize(LightDirection.xyz)); - - float spotAttenuation = 0.0; - if (spotDot < CosCutoff) - spotAttenuation = 0.0; - else - spotAttenuation = pow(spotDot, Exponent); - att *= spotAttenuation; - - float cosAngIncidence = clamp(dot(normal, VP), 0.0, 1.0); - - float nDotVP = max(0.0, dot(normal, VP)); - float nDotHV = max(0.0, dot(normal, halfVector)); - - vec4 color_material = texture2D( color_tex, coords ); - vec3 color = color_material.rgb; - vec3 Iamb = Ambient.rgb * color * att; - vec3 Idiff = Diffuse.rgb * color * att * nDotVP; - - float matID = color_material.a * 255.0; - float spec_intensity = spec_emis.x; - float spec_att = att; - if (matID == 254.0) { // 254: water, 255: Ubershader - spec_intensity = 1.0; // spec_color shouldn't depend on cloud cover when rendering spot light - spec_att = min(10.0 * att, 1.0); // specular attenuation reduced on water - } - - vec3 Ispec = vec3(0.0); - if (cosAngIncidence > 0.0) - Ispec = pow( nDotHV, spec_emis.y * 128.0 ) * spec_intensity * spec_att * Specular.rgb; - - if (matID >= 254.0) - Idiff += Ispec * spec_emis.x; - - gl_FragColor = vec4(Iamb + Idiff + Ispec, 1.0); -} diff --git a/Shaders/light-spot.vert b/Shaders/light-spot.vert deleted file mode 100644 index 244db6b81..000000000 --- a/Shaders/light-spot.vert +++ /dev/null @@ -1,7 +0,0 @@ -#version 120 -varying vec4 ecPosition; - -void main() { - ecPosition = gl_ModelViewMatrix * gl_Vertex; - gl_Position = ftransform(); -} diff --git a/Shaders/model-ALS-base.frag b/Shaders/model-ALS-base.frag index 833bf3349..ecd756ff1 100644 --- a/Shaders/model-ALS-base.frag +++ b/Shaders/model-ALS-base.frag @@ -56,6 +56,8 @@ vec3 searchlight(); vec3 landing_light(in float offset, in float offsetv); vec3 filter_combined (in vec3 color) ; +float getShadowing(); + float luminance(vec3 color) { return dot(vec3(0.212671, 0.715160, 0.072169), color); @@ -107,12 +109,14 @@ void main() NdotL = dot(n, lightDir); if (NdotL > 0.0) { - color += diffuse_term * NdotL; + float shadowmap = getShadowing(); + color += diffuse_term * NdotL * shadowmap; NdotHV = max(dot(n, halfVector), 0.0); if (gl_FrontMaterial.shininess > 0.0) specular.rgb = (gl_FrontMaterial.specular.rgb * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess)); + * pow(NdotHV, gl_FrontMaterial.shininess) + * shadowmap); } color.a = diffuse_term.a; // This shouldn't be necessary, but our lighting becomes very diff --git a/Shaders/model-ALS-ultra.frag b/Shaders/model-ALS-ultra.frag index 0c61f7392..56bc9e3a5 100644 --- a/Shaders/model-ALS-ultra.frag +++ b/Shaders/model-ALS-ultra.frag @@ -119,6 +119,8 @@ vec3 filter_combined (in vec3 color) ; vec3 moonlight_perception (in vec3 light) ; vec3 addLights(in vec3 color1, in vec3 color2); +float getShadowing(); + float light_func (in float x, in float a, in float b, in float c, in float d, in float e) { @@ -339,7 +341,8 @@ void main (void) else {pf1 = pow(nDotHV1, 0.5*gl_FrontMaterial.shininess);} - + float shadowmap = getShadowing(); + light_diffuse *= shadowmap; if (cloud_shadow_flag == 1) { @@ -387,6 +390,7 @@ void main (void) Specular+= gl_FrontMaterial.specular * pow(max(0.0,-dot(N,normalize(vertVec))),gl_FrontMaterial.shininess) * vec4(secondary_light,1.0); Specular *= refl_d; + Specular *= shadowmap; vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse; color = clamp( color, 0.0, 1.0 ); diff --git a/Shaders/model-ALS-ultra.vert b/Shaders/model-ALS-ultra.vert index c60ba8da4..844aadf99 100644 --- a/Shaders/model-ALS-ultra.vert +++ b/Shaders/model-ALS-ultra.vert @@ -28,6 +28,8 @@ uniform int shader_qual; // void fog_Func(int type); //////////////////////////// +void setupShadows(vec4 eyeSpacePos); + void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat) { rotmat = mat4( cosRy , sinRx * sinRy , cosRx * sinRy, 0.0, @@ -112,4 +114,6 @@ void main(void) gl_Position = ftransform(); gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + + setupShadows(ecPosition); } diff --git a/Shaders/model-ALS-wingflex.vert b/Shaders/model-ALS-wingflex.vert index b23502f12..b9e58372c 100644 --- a/Shaders/model-ALS-wingflex.vert +++ b/Shaders/model-ALS-wingflex.vert @@ -39,13 +39,14 @@ uniform float rotation_rad; uniform int refl_dynamic; uniform int nmap_enabled; uniform int shader_qual; -uniform int rembrandt_enabled; //////Fog Include/////////// // uniform int fogType; // void fog_Func(int type); //////////////////////////// +void setupShadows(vec4 eyeSpacePos); + void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat) { rotmat = mat4( cosRy , sinRx * sinRy , cosRx * sinRy, 0.0, @@ -239,13 +240,12 @@ void main(void) reflVec = reflVec_stat; } - if(rembrandt_enabled < 1){ gl_FrontColor = gl_FrontMaterial.emission + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); - } else { - gl_FrontColor = gl_Color; - } + gl_Position = gl_ModelViewProjectionMatrix * vertex; //gl_Position = ftransform(); gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + + setupShadows(gl_ModelViewMatrix * vertex); } diff --git a/Compositor/Shaders/ALS/projection-2d.frag b/Shaders/projection-2d.frag similarity index 100% rename from Compositor/Shaders/ALS/projection-2d.frag rename to Shaders/projection-2d.frag diff --git a/Shaders/road-ALS-ultra.frag b/Shaders/road-ALS-ultra.frag index 615102498..89a21da9e 100644 --- a/Shaders/road-ALS-ultra.frag +++ b/Shaders/road-ALS-ultra.frag @@ -113,6 +113,8 @@ vec3 landing_light(in float offset, in float offsetv); vec3 filter_combined (in vec3 color) ; vec3 addLights(in vec3 color1, in vec3 color2); +float getShadowing(); + float light_func (in float x, in float a, in float b, in float c, in float d, in float e) { @@ -494,14 +496,14 @@ void main (void) secondary_light += landing_light(landing_light2_offset, landing_light3_offset); } - - vec4 Diffuse = light_diffuse * nDotVP; + float shadowmap = getShadowing(); + vec4 Diffuse = light_diffuse * nDotVP * shadowmap; Diffuse.rgb += secondary_light * light_distance_fading(dist); if (use_IR_vision) { Diffuse.rgb = max(Diffuse.rgb, vec3 (0.5, 0.5, 0.5)); } - vec4 Specular = gl_FrontMaterial.specular * light_diffuse * pf + gl_FrontMaterial.specular * light_ambient * pf1; + vec4 Specular = gl_FrontMaterial.specular * light_diffuse * pf + gl_FrontMaterial.specular * light_ambient * pf1 * shadowmap; Specular+= gl_FrontMaterial.specular * pow(max(0.0,-dot(N,nVertVec)),gl_FrontMaterial.shininess) * vec4(secondary_light,1.0); diff --git a/Shaders/rock-ALS.frag b/Shaders/rock-ALS.frag index 170e1bbb5..b764f7fb5 100644 --- a/Shaders/rock-ALS.frag +++ b/Shaders/rock-ALS.frag @@ -84,6 +84,8 @@ vec3 searchlight(); vec3 landing_light(in float offset, in float offsetv); vec3 filter_combined (in vec3 color) ; +float getShadowing(); + float light_func (in float x, in float a, in float b, in float c, in float d, in float e) { x = x - 0.5; @@ -446,8 +448,9 @@ if ((dist < 5000.0) && (combined_wetness>0.0)) float fresnel; if (NdotL > 0.0) { + float shadowmap = getShadowing(); if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 0.3 * noise_250m + 0.5 * noise_500m+0.2 * noise_1500m, dist);} - color += diffuse_term * NdotL; + color += diffuse_term * NdotL * shadowmap; NdotHV = max(dot(n, halfVector), 0.0); fresnel = 1.0 + 5.0 * (1.0-smoothstep(0.0,0.2, dot(normalize(ecViewdir),n))); @@ -456,7 +459,8 @@ if ((dist < 5000.0) && (combined_wetness>0.0)) //if (gl_FrontMaterial.shininess > 0.0) specular.rgb = ((gl_FrontMaterial.specular.rgb * 0.1 + snow_factor * vec3(1.0,1.0,1.0) + (water_factor * vec3 (1.0, 1.0, 1.0))) * light_specular.rgb - * pow(NdotHV, max(gl_FrontMaterial.shininess,4.0) + (20.0 * water_factor))); + * pow(NdotHV, max(gl_FrontMaterial.shininess,4.0) + (20.0 * water_factor)) + * shadowmap); } color.a = 1.0;//diffuse_term.a; // This shouldn't be necessary, but our lighting becomes very diff --git a/Shaders/runway-ALS.frag b/Shaders/runway-ALS.frag index 4fb90f0ff..fdacfc916 100644 --- a/Shaders/runway-ALS.frag +++ b/Shaders/runway-ALS.frag @@ -73,6 +73,8 @@ vec3 rayleigh_out_shift(in vec3 color, in float outscatter); vec3 get_hazeColor(in float light_arg); vec3 filter_combined (in vec3 color) ; +float getShadowing(); + void main() { @@ -286,14 +288,16 @@ if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0)) } if (NdotL > 0.0) { + float shadowmap = getShadowing(); if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 1.0, dist);} - color += diffuse_term * NdotL; + color += diffuse_term * NdotL * shadowmap; NdotHV = max(dot(n, halfVector), 0.0); fresnel = 1.0 + 5.0 * (1.0-smoothstep(0.0,0.2, dot(E,n))); specular.rgb = ((vec3 (0.2,0.2,0.2) * fresnel + (water_factor * vec3 (1.0, 1.0, 1.0))) * light_specular.rgb - * pow(NdotHV, max(4.0, (20.0 * water_factor)))); + * pow(NdotHV, max(4.0, (20.0 * water_factor))) + * shadowmap); } // raindrops diff --git a/Shaders/runway-gbuffer.frag b/Shaders/runway-gbuffer.frag deleted file mode 100644 index 2906ad3a0..000000000 --- a/Shaders/runway-gbuffer.frag +++ /dev/null @@ -1,112 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// © Emilian Huminiuc and Vivian Meazza 2011 - -#version 120 - -varying vec3 rawpos; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 vViewVec; -varying vec3 reflVec; - -varying vec4 Diffuse; -varying float alpha; -//varying float fogCoord; - -uniform samplerCube Environment; -uniform sampler2D Rainbow; -uniform sampler2D BaseTex; -uniform sampler2D Fresnel; -uniform sampler2D Map; -uniform sampler2D NormalTex; -uniform sampler3D Noise; - -uniform float spec_adjust; -uniform float rainbowiness; -uniform float fresneliness; -uniform float noisiness; -uniform float ambient_correction; -uniform float normalmap_dds; - -void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth); - -void main (void) -{ - - vec4 texel = texture2D(BaseTex, gl_TexCoord[0].st); - vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * 8.0); - vec4 map = texture2D(Map, gl_TexCoord[0].st * 8.0); - vec4 specNoise = texture3D(Noise, rawpos.xyz * 0.0045); - vec4 noisevec = texture3D(Noise, rawpos.xyz); - vec3 ambient = vec3(0.85,0.85,0.9);//placeholder for sun ambient - vec3 N; - float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb + gl_FrontMaterial.emission.rgb, - vec3( 0.3, 0.59, 0.11 ) ); - - N = nmap.rgb * 2.0 - 1.0; - N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); - if (normalmap_dds > 0) - N = -N; - - float nFactor = 1.0 - N.z; - float lightness = dot(texel.rgb, vec3( 0.3, 0.59, 0.11 )); - - // calculate the specular light - float refl_correction = spec_adjust * 2.5 - 1.0; - float shininess = max (0.35, refl_correction) * nmap.a * nFactor; - - - float specular = dot(vec3(1.0) * lightness , vec3( 0.3, 0.59, 0.11 )) * nFactor; - - vec4 color = vec4(1.0); - - color.a = texel.a * alpha; - color = clamp(color, 0.0, 1.0); - - vec3 viewVec = normalize(vViewVec); - - // Map a rainbowish color - float v = abs(dot(viewVec, normalize(VNormal))); - vec4 rainbow = texture2D(Rainbow, vec2(v, 0.0)); - - // Map a fresnel effect - vec4 fresnel = texture2D(Fresnel, vec2(v, 0.0)); - - // map the refection of the environment - vec4 reflection = textureCube(Environment, reflVec * dot(N,VNormal)); - - - // set the user shininess offset - float transparency_offset = clamp(refl_correction, -1.0, 1.0); - float reflFactor = 0.0; - - float MixFactor = specNoise.r * specNoise.g * specNoise.b * 350.0; - - MixFactor = 0.75 * smoothstep(0.0, 1.0, MixFactor); - - reflFactor = max(map.a * (texel.r + texel.g), 1.0 - MixFactor) * nFactor + transparency_offset ; - reflFactor =0.75 * smoothstep(0.05, 1.0, reflFactor); - - // set ambient adjustment to remove bluiness with user input - float ambient_offset = clamp(ambient_correction, -1.0, 1.0); - vec3 ambient_Correction = vec3(ambient.rg, ambient.b * 0.6) * ambient_offset; - ambient_Correction = clamp(ambient_Correction, -1.0, 1.0); - - // add fringing fresnel and rainbow effects and modulate by reflection - vec4 reflcolor = mix(reflection, rainbow, rainbowiness * v); - - vec4 reflfrescolor = mix(reflcolor, fresnel, fresneliness * v); - vec4 noisecolor = mix(reflfrescolor, noisevec, noisiness); - vec4 raincolor = vec4(noisecolor.rgb * reflFactor, 1.0) * nFactor; - vec4 mixedcolor = mix(texel, raincolor * (1.0 - refl_correction * (1.0 - lightness)), reflFactor); - - // the final reflection - vec4 fragColor = vec4(color.rgb * mixedcolor.rgb + ambient_Correction * nFactor, color.a); - float doWater = step(0.1, reflFactor); - int matIndex = int(doWater) * 253 + 1; - shininess += doWater * reflFactor * 240.0; - - encode_gbuffer(N, fragColor.rgb, matIndex, specular, shininess, emission, gl_FragCoord.z); -} diff --git a/Shaders/runway-gbuffer.vert b/Shaders/runway-gbuffer.vert deleted file mode 100644 index 4c9e7b346..000000000 --- a/Shaders/runway-gbuffer.vert +++ /dev/null @@ -1,71 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// © Emilian Huminiuc and Vivian Meazza 2011 -#version 120 - -varying vec3 rawpos; -varying float fogCoord; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 Normal; -varying vec3 vViewVec; -varying vec3 reflVec; - -varying vec4 Diffuse; -varying float alpha; - -uniform mat4 osg_ViewMatrixInverse; - -attribute vec3 tangent; -attribute vec3 binormal; - -////fog "include"//////// -// uniform int fogType; -// -// void fog_Func(int type); -///////////////////////// - -void main(void) -{ - rawpos = gl_Vertex.xyz / gl_Vertex.w; - vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; - ecPosition.xyz = ecPosition.xyz / ecPosition.w; - //fogCoord = ecPosition.z; - //fog_Func(fogType); - - vec3 n = normalize(gl_Normal); - vec3 t = cross(gl_Normal, vec3(1.0,0.0,0.0)); - vec3 b = cross(n,t); - - VNormal = gl_NormalMatrix * gl_Normal; - VTangent = normalize(gl_NormalMatrix * tangent); - VBinormal = normalize(gl_NormalMatrix * binormal); - Normal = normalize(gl_Normal); - - Diffuse = gl_Color * gl_LightSource[0].diffuse; - //Diffuse= gl_Color.rgb * max(0.0, dot(normalize(VNormal), gl_LightSource[0].position.xyz)); - - // Super hack: if diffuse material alpha is less than 1, assume a - // transparency animation is at work - if (gl_FrontMaterial.diffuse.a < 1.0) - alpha = gl_FrontMaterial.diffuse.a; - else - alpha = gl_Color.a; - - // Vertex in eye coordinates - vec3 vertVec = ecPosition.xyz; - - vViewVec.x = dot(t, vertVec); - vViewVec.y = dot(b, vertVec); - vViewVec.z = dot(n, vertVec); - - // calculate the reflection vector - vec4 reflect_eye = vec4(reflect(vertVec, VNormal), 0.0); - reflVec = normalize(gl_ModelViewMatrixInverse * reflect_eye).xyz; - - gl_FrontColor = gl_FrontMaterial.emission + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); - - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; -} diff --git a/Shaders/runway.frag b/Shaders/runway.frag index ca7b5ab00..7ed26f317 100644 --- a/Shaders/runway.frag +++ b/Shaders/runway.frag @@ -38,6 +38,8 @@ uniform int fogType; vec3 fog_Func(vec3 color, int type); ////////////////////// +float getShadowing(); + void main (void) { //vec3 halfV; @@ -71,9 +73,10 @@ void main (void) else pf = pow(nDotHV, /*gl_FrontMaterial.*/shininess); - vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP; + float shadowmap = getShadowing(); + vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP * shadowmap; //vec4 Specular = vec4(vec3(0.5*shininess), 1.0)* gl_LightSource[0].specular * pf; - vec4 Specular = vec4(1.0)* lightness * gl_LightSource[0].specular * pf; + vec4 Specular = vec4(1.0)* lightness * gl_LightSource[0].specular * pf * shadowmap; vec4 color = gl_Color + Diffuse * gl_FrontMaterial.diffuse; //color += Specular * vec4(vec3(0.5*shininess), 1.0) * nmap.a; @@ -129,4 +132,4 @@ void main (void) fragColor.rgb = fog_Func(fragColor.rgb, fogType); gl_FragColor = fragColor; -} \ No newline at end of file +} diff --git a/Shaders/shadow-ALS.frag b/Shaders/shadow-ALS.frag deleted file mode 100644 index ff9c2765b..000000000 --- a/Shaders/shadow-ALS.frag +++ /dev/null @@ -1,20 +0,0 @@ -#version 120 - -uniform sampler2D texture; -uniform float scattering; -varying float alpha_correction; - -void main() -{ - vec4 texel = texture2D(texture, gl_TexCoord[0].st); - texel.a = smoothstep(0.0,0.1, texel.a); - - float illumination = length(gl_Color.rgb); - texel = vec4 (0.1,0.1,0.1,texel.a); - texel.a *= illumination; - texel.a *=0.6 * smoothstep(0.5,0.8,scattering); - texel.a = min(0.8, texel.a); - - vec4 fragColor = texel; - gl_FragColor = fragColor * alpha_correction;; -} diff --git a/Shaders/shadow-ALS.vert b/Shaders/shadow-ALS.vert deleted file mode 100644 index 0786e659e..000000000 --- a/Shaders/shadow-ALS.vert +++ /dev/null @@ -1,77 +0,0 @@ -// -*-C++-*- - - -#version 120 - -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float avisibility; -uniform float visibility; -uniform float overcast; -uniform float ground_scattering; -uniform float eye_alt; -uniform float moonlight; -uniform float alt_agl; -uniform float gear_clearance; - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ - -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -varying float alpha_correction; - -void main() -{ - alpha_correction = 1.0; - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec3 relPos = gl_Vertex.xyz - ep.xyz; - - - // compute the strength of light - float vertex_alt = max(gl_Vertex.z,100.0); - float scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - float yprime = -dot(relPos, lightHorizon); - float yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - float earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - float lightArg = (terminator-yprime_alt)/100000.0; - vec4 light_diffuse; - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * scattering; - float shade_depth = 1.0 * smoothstep (0.6,0.95,ground_scattering) * (1.0-smoothstep(0.1,0.5,overcast)) * smoothstep(0.4,1.5,earthShade); - - light_diffuse.rgb = light_diffuse.rgb * (1.0 + 1.2 * shade_depth); - - - // project the shadow onto the ground - vec4 pos = gl_Vertex; - pos.z-=0.95 * alt_agl-0.1; - pos.xy -= lightFull.xy * 0.95* alt_agl/lightFull.z; - - // enlargen the shadow for low light - if (dot(pos.xy, lightHorizon.xy)<0.0) - { - pos.xy -= lightFull.xy * gear_clearance/lightFull.z; - } - - - gl_Position = gl_ModelViewProjectionMatrix * pos; - - gl_FrontColor = light_diffuse; - gl_BackColor = gl_FrontColor; -} diff --git a/Shaders/shadow-vol-ALS.vert b/Shaders/shadow-vol-ALS.vert deleted file mode 100644 index 5ecf7d256..000000000 --- a/Shaders/shadow-vol-ALS.vert +++ /dev/null @@ -1,161 +0,0 @@ -// -*-C++-*- - - -#version 120 - -uniform float hazeLayerAltitude; -uniform float terminator; -uniform float terrain_alt; -uniform float overcast; -uniform float ground_scattering; -uniform float eye_alt; -uniform float moonlight; -uniform float alt_agl; -uniform float pitch; -uniform float roll; -uniform float gear_clearance; - - - -const float EarthRadius = 5800000.0; -const float terminator_width = 200000.0; - -void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat) -{ - rotmat = mat4( cosRy , sinRx * sinRy , cosRx * sinRy, 0.0, - 0.0 , cosRx , -sinRx , 0.0, - -sinRy, sinRx * cosRy, cosRx * cosRy , 0.0, - 0.0 , 0.0 , 0.0 , 1.0 ); -} - -/* - -//Experimental - not used for now. Seems to work functionally the same as rotationMatrixPR -void rotationMatrixRP(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat) -{ - rotmat = mat4( cosRy , sinRx * sinRy , -cosRx * sinRy, 0.0, - 0.0 , cosRx , sinRx , 0.0, - sinRy, -sinRx * cosRy, cosRx * cosRy , 0.0, - 0.0 , 0.0 , 0.0 , 1.0 ); -} -*/ - -float light_func (in float x, in float a, in float b, in float c, in float d, in float e) -{ - -if (x < -15.0) {return 0.0;} - -return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d)); -} - -varying float alpha_correction; - -void main() -{ - float start_fade = 0; - float end_fade = 100; - float diff = end_fade - start_fade; - alpha_correction = 1.0 - smoothstep(start_fade, end_fade, alt_agl); - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - - vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0); - vec3 relPos = gl_Vertex.xyz - ep.xyz; - - - // compute the strength of light - float vertex_alt = max(gl_Vertex.z,100.0); - float scattering = ground_scattering + (1.0 - ground_scattering) * smoothstep(hazeLayerAltitude -100.0, hazeLayerAltitude + 100.0, vertex_alt); - vec3 lightFull = (gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz; - vec3 lightHorizon = normalize(vec3(lightFull.x,lightFull.y, 0.0)); - float yprime = -dot(relPos, lightHorizon); - float yprime_alt = yprime - sqrt(2.0 * EarthRadius * vertex_alt); - float earthShade = 0.6 * (1.0 - smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt)) + 0.4; - float lightArg = (terminator-yprime_alt)/100000.0; - vec4 light_diffuse; - light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0); - light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0); - light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0); - light_diffuse.a = 1.0; - light_diffuse = light_diffuse * scattering; - float shade_depth = 1.0 * smoothstep (0.6,0.95,ground_scattering) * (1.0-smoothstep(0.1,0.5,overcast)) * smoothstep(0.4,1.5,earthShade); - - light_diffuse.rgb = light_diffuse.rgb * (1.0 + 1.2 * shade_depth); - - //experiment - light_diffuse.b = 1.0; - light_diffuse.g = 1.0; - light_diffuse.r = 1.0; - light_diffuse.a = 1.0; - - //prepare rotation matrix - mat4 RotMatPR; - mat4 RotMatPR_tr; - - float _roll = roll; - - - //if (_roll>90.0 || _roll < -90.0) //making roll=-roll when >90 is no longer necessary thanks to fix with transpose of rotation matrix. - //{_roll = -_roll;} - float cosRx = cos(radians(-_roll)); - float sinRx = sin(radians(-_roll)); - float cosRy = cos(radians(pitch)); - float sinRy = sin(radians(pitch)); - - rotationMatrixPR(sinRx, cosRx, sinRy, cosRy, RotMatPR); - //rotationMatrixRP(sinRx, cosRx, sinRy, cosRy, RotMatPR); - - RotMatPR_tr=transpose(RotMatPR); //RotMatPR works fine if pitch =0 or roll=0 but if say pitch=35 and roll=60 the rotation is all wrong. transpose(RotMatPR) however works perfectly. - - - // project the shadow onto the ground - //vec4 vertex = RotMatPR * gl_Vertex; - vec4 vertex = RotMatPR_tr * gl_Vertex; - vec4 pos = vertex; - - vec2 deltaxy = lightFull.xy * 0.95* (alt_agl + vertex.z + gear_clearance)/lightFull.z; //This is the 'actual' location, taking into a account the full 3-D structure of the aircraft - - vec2 deltazeroxy = lightFull.xy * 0.95* (alt_agl + gear_clearance)/lightFull.z; //Instead of using the exact z value of this particularly point to determine the distance of the shadow & reposition & shrink it appropriately, we'll just use the origin (0,0,0) of the model instead. This avoids a problem below, where varying vertex.z in deltaxy and then using deltaxy to calculate dist caused the shadow to sort of slant upwards, thanks to the varying z values used - - float dist = sqrt(deltazeroxy.x * deltazeroxy.x + deltazeroxy.y * deltazeroxy.y + alt_agl * alt_agl); //could use function 'distance' instead, might be better? - - - if (dist < 75) - { - - pos.z = -0.9 * alt_agl + 0.05 * vertex.z; - //pos.z = 0.05 * (vertex.z + gear_clearance); - - pos.xy -= deltaxy; - - } - else - { - //The code below to shrink the shadow while keeping it 75 m. away has some issues that need to be fixed. Making the shadow shrink at x^2 rate partly to cover up this problem until it can be solved . . . - //The problem is that the aircraft isn't flat/parallel to the ground any more, but it appears to be at an angle to the ground. - //The various shrinkages perhaps mess with the angles somehow, meaning that when the animations apply the roll & pitch corrections they just don't quite work as they should - pos.z = (-0.9*75)*alt_agl/dist + 0.05 * vertex.z ; //if the shadow is more than about 75 meters from the aircraft it disappears so we are going to just keep it right at 75 m. & make it smaller to simulate greater distance. - //(-0.9*75) is the same factor for altitude we were using above when dist=75. *alt_agl/dist keeps it at the right height proportionally to simulate the location at a further distance, while actually just keeping it at 75 m. distance. - - //pos.z = 0.05 * vertex.z ; //if the shadow is more than about 75 meters from the aircraft it disappears so we are going to just keep it right at 75 m. & make it smaller to simulate greater distance. - - - - //shrink the size FIRST, THEN move where it needs to be. If you shrink later you're also shrinking the deltaxy distance moved, which doesn't work well - pos.xy = 75 / dist * pos.xy; //shrinking the size of the shadow to simulate further distance. Should be linear shrinkage but doing it ^2 for now to help ucover up the issues in code above. - - pos.xy -= 75 * deltaxy/dist; // Similarly to above, * deltaxy/dist; keeps it at the right XY position proportionally to simulate the location at a further distance, while actually just keeping it at 75 m. distance. - - } - - // pos.z = pos.z - offset; - - //if (dist>=75) pos = pos * 30/dist; //not sure why this doesn't work/ perhaps an overflow of some kind? - - gl_Position = gl_ModelViewProjectionMatrix * pos; - - gl_FrontColor = light_diffuse; - //light_diffuse.a=0; - gl_BackColor = gl_FrontColor; - //gl_BackColor = light_diffuse; -} diff --git a/Compositor/Shaders/ALS/shadows-include.frag b/Shaders/shadows-include.frag similarity index 87% rename from Compositor/Shaders/ALS/shadows-include.frag rename to Shaders/shadows-include.frag index 8361c6f61..9eb03856f 100644 --- a/Compositor/Shaders/ALS/shadows-include.frag +++ b/Shaders/shadows-include.frag @@ -7,7 +7,9 @@ uniform int sun_atlas_size; varying vec4 lightSpacePos[4]; -const float depth_bias = 0.0005; +const bool DEBUG_CASCADES = false; + +const float depth_bias = 2.0; // Ideally these should be passed as an uniform, but we don't support uniform // arrays yet @@ -17,6 +19,17 @@ const vec2 uv_shifts[4] = vec2[4]( const vec2 uv_factor = vec2(0.5, 0.5); +float debugCascade(int cascade) +{ + const mat2 bayer_matrix = mat2(0, 3, 2, 1); + const float scale = 1.0; + vec2 coords = mod(gl_FragCoord.xy * scale, 2.0); + int threshold = int(bayer_matrix[int(coords.y)][int(coords.x)]); + if (threshold <= cascade) + return 0.0; + return 1.0; +} + float checkWithinBounds(vec2 coords, vec2 bottomLeft, vec2 topRight) { vec2 r = step(bottomLeft, coords) - step(topRight, coords); @@ -28,7 +41,7 @@ float sampleOffset(vec4 pos, vec2 offset, vec2 invTexelSize) return shadow2DProj( shadow_tex, vec4( pos.xy + offset * invTexelSize * pos.w, - pos.z - depth_bias, + pos.z - depth_bias * invTexelSize.x, pos.w)).r; } @@ -105,6 +118,9 @@ float getShadowing() for (int i = 0; i < 4; ++i) { if (checkWithinBounds(lightSpacePos[i].xy, vec2(0.0), vec2(1.0)) > 0.0 && (lightSpacePos[i].z / lightSpacePos[i].w) <= 1.0) { + if (DEBUG_CASCADES) + return debugCascade(i); + if (checkWithinBounds(lightSpacePos[i].xy, bandBottomLeft, bandTopRight) < 1.0) { vec2 s = smoothstep(vec2(0.0), bandBottomLeft, lightSpacePos[i].xy) - diff --git a/Compositor/Shaders/ALS/shadows-include.vert b/Shaders/shadows-include.vert similarity index 59% rename from Compositor/Shaders/ALS/shadows-include.vert rename to Shaders/shadows-include.vert index bc6758ee9..afbffbbde 100644 --- a/Compositor/Shaders/ALS/shadows-include.vert +++ b/Shaders/shadows-include.vert @@ -9,20 +9,22 @@ uniform mat4 fg_LightMatrix_csm3; varying vec4 lightSpacePos[4]; +const float normal_offset_scale = 0.1; + void setupShadows(vec4 eyeSpacePos) { if (!shadows_enabled) return; - float normalOffset = 0.005; + vec3 normal = gl_NormalMatrix * gl_Normal; - float costheta = clamp(dot(gl_Normal, gl_LightSource[0].position.xyz), 0.0, 1.0); - float slopeScale = 1.0 - costheta; - normalOffset *= slopeScale; + vec3 toLight = normalize(gl_LightSource[0].position.xyz); + float costheta = dot(normal, toLight); + float slopeScale = clamp(1.0 - costheta, 0.0, 1.0); + float normalOffset = normal_offset_scale * slopeScale; - vec4 offsetPos = gl_ModelViewMatrix * - (gl_Vertex + vec4(gl_Normal, 0.0) * normalOffset); + vec4 offsetPos = eyeSpacePos + vec4(normal * normalOffset, 0.0); vec4 offsets[4]; offsets[0] = fg_LightMatrix_csm0 * offsetPos; @@ -36,8 +38,8 @@ void setupShadows(vec4 eyeSpacePos) lightSpacePos[3] = fg_LightMatrix_csm3 * eyeSpacePos; // Offset only in UV space - // lightSpacePos[0].xy = offsets[0].xy; - // lightSpacePos[1].xy = offsets[1].xy; - // lightSpacePos[2].xy = offsets[2].xy; - // lightSpacePos[3].xy = offsets[3].xy; + lightSpacePos[0].xy = offsets[0].xy; + lightSpacePos[1].xy = offsets[1].xy; + lightSpacePos[2].xy = offsets[2].xy; + lightSpacePos[3].xy = offsets[3].xy; } diff --git a/Shaders/ssao.frag b/Shaders/ssao.frag deleted file mode 100644 index de29876e0..000000000 --- a/Shaders/ssao.frag +++ /dev/null @@ -1,64 +0,0 @@ -#version 120 -#extension GL_EXT_gpu_shader4 : enable -uniform sampler2D normal_tex; -uniform sampler2D depth_tex; -uniform sampler2D spec_emis_tex; -uniform sampler3D noise_tex; -uniform vec2 fg_BufferSize; -uniform vec3 fg_Planes; -uniform vec4 fg_du; -uniform vec4 fg_dv; -uniform float g_scale; -uniform float g_bias; -uniform float g_intensity; -uniform float g_sample_rad; -uniform float random_size; -uniform float osg_SimulationTime; - -varying vec4 ray; - -const vec2 v[4] = vec2[](vec2(1.0,0.0),vec2(-1.0,0.0),vec2(0.0,1.0),vec2(0.0,-1.0)); - -vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex ); -vec3 normal_decode(vec2 enc); - -vec2 getRandom( in vec2 uv ) { - float level = osg_SimulationTime - float(int(osg_SimulationTime)); - return normalize( texture3D( noise_tex, vec3(uv*50.0, level) ).xy * 0.14 - 0.07 ); -} -vec3 getPosition(in vec2 uv, in vec2 uv0, in vec4 ray0) { - vec2 duv = uv - uv0; - vec4 ray = ray0 + fg_du * duv.x + fg_dv * duv.y; - vec3 viewDir = normalize( ray.xyz ); - return position(viewDir, uv, depth_tex); -} -float doAmbientOcclusion(in vec2 tcoord, in vec2 uv, in vec3 p, in vec3 cnorm, in vec4 ray) { - vec3 diff = getPosition(tcoord+uv,tcoord,ray)-p; - float d = length(diff); - vec3 v = diff / d; - d *= g_scale; - return max(0.0, dot( cnorm,v ) - g_bias) * (1.0/(1.0+d)) * g_intensity; -} -void main() { - vec2 coords = gl_TexCoord[0].xy; - float initialized = texture2D( spec_emis_tex, coords ).a; - if ( initialized < 0.1 ) - discard; - vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg); - vec3 viewDir = normalize(ray.xyz); - vec3 pos = position(viewDir, coords, depth_tex); - vec2 rand = getRandom(coords); - float ao = 0.0; - float rad = g_sample_rad; - int iterations = 4; - for (int j = 0; j < 1; ++j ) { - vec2 coord1 = reflect( v[j], rand ) * rad; - vec2 coord2 = vec2( coord1.x*0.707 - coord1.y*0.707, coord1.x*0.707 + coord1.y*0.707 ); - ao += doAmbientOcclusion(coords,coord1*0.25,pos,normal,ray); - ao += doAmbientOcclusion(coords,coord2*0.5,pos,normal,ray); - ao += doAmbientOcclusion(coords,coord1*0.75,pos,normal,ray); - ao += doAmbientOcclusion(coords,coord2,pos,normal,ray); - } - ao /= 16.0; - gl_FragColor = vec4( vec3(1.0 - ao), 1.0 ); -} diff --git a/Shaders/ssao.vert b/Shaders/ssao.vert deleted file mode 100644 index c1ef46dc6..000000000 --- a/Shaders/ssao.vert +++ /dev/null @@ -1,8 +0,0 @@ -#version 120 -uniform mat4 fg_ProjectionMatrixInverse; -varying vec4 ray; -void main() { - gl_Position = gl_Vertex; - gl_TexCoord[0] = gl_MultiTexCoord0; - ray = fg_ProjectionMatrixInverse * gl_Vertex; -} diff --git a/Shaders/sunlight-nofiltering.frag b/Shaders/sunlight-nofiltering.frag deleted file mode 100644 index 5c530c0e0..000000000 --- a/Shaders/sunlight-nofiltering.frag +++ /dev/null @@ -1,91 +0,0 @@ -#version 120 - -uniform mat4 fg_ViewMatrix; -uniform sampler2D depth_tex; -uniform sampler2D normal_tex; -uniform sampler2D color_tex; -uniform sampler2D spec_emis_tex; -uniform sampler2DShadow shadow_tex; -uniform vec4 fg_SunDiffuseColor; -uniform vec4 fg_SunSpecularColor; -uniform vec4 fg_SunAmbientColor; -uniform vec3 fg_SunDirection; -uniform vec3 fg_Planes; -uniform int fg_ShadowNumber; -uniform vec4 fg_ShadowDistances; - -uniform mat4 fg_ShadowMatrix_0; -uniform mat4 fg_ShadowMatrix_1; -uniform mat4 fg_ShadowMatrix_2; -uniform mat4 fg_ShadowMatrix_3; - -varying vec3 ray; - -vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex ); -vec3 normal_decode(vec2 enc); - -vec4 DynamicShadow( in vec4 ecPosition, out vec4 tint ) -{ - vec4 coords; - vec2 shift = vec2( 0.0 ); - int index = 4; - float factor = 0.5; - if (ecPosition.z > -fg_ShadowDistances.x) { - index = 1; - if (fg_ShadowNumber == 1) - factor = 1.0; - tint = vec4(0.0,1.0,0.0,1.0); - coords = fg_ShadowMatrix_0 * ecPosition; - } else if (ecPosition.z > -fg_ShadowDistances.y && fg_ShadowNumber > 1) { - index = 2; - shift = vec2( 0.0, 0.5 ); - tint = vec4(0.0,0.0,1.0,1.0); - coords = fg_ShadowMatrix_1 * ecPosition; - } else if (ecPosition.z > -fg_ShadowDistances.z && fg_ShadowNumber > 2) { - index = 3; - shift = vec2( 0.5, 0.0 ); - tint = vec4(1.0,1.0,0.0,1.0); - coords = fg_ShadowMatrix_2 * ecPosition; - } else if (ecPosition.z > -fg_ShadowDistances.w && fg_ShadowNumber > 3) { - shift = vec2( 0.5, 0.5 ); - tint = vec4(1.0,0.0,0.0,1.0); - coords = fg_ShadowMatrix_3 * ecPosition; - } else { - return vec4(1.1,1.1,0.0,1.0); // outside, clamp to border - } - coords.st *= factor; - coords.st += shift; - return coords; -} -void main() { - vec2 coords = gl_TexCoord[0].xy; - vec4 spec_emis = texture2D( spec_emis_tex, coords ); - if ( spec_emis.a < 0.1 ) - discard; - vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg); - vec3 viewDir = normalize(ray); - vec3 pos = position( viewDir, coords, depth_tex ); - - vec4 tint; - float shadow = shadow2DProj( shadow_tex, DynamicShadow( vec4( pos, 1.0 ), tint ) ).r; - vec3 lightDir = (fg_ViewMatrix * vec4( fg_SunDirection, 0.0 )).xyz; - lightDir = normalize( lightDir ); - vec3 color = texture2D( color_tex, coords ).rgb; - vec3 Idiff = clamp( dot( lightDir, normal ), 0.0, 1.0 ) * color * fg_SunDiffuseColor.rgb; - vec3 halfDir = normalize( lightDir - viewDir ); - vec3 Ispec = vec3(0.0); - vec3 Iemis = spec_emis.z * color; - - float cosAngIncidence = clamp(dot(normal, lightDir), 0.0, 1.0); - float blinnTerm = clamp( dot( halfDir, normal ), 0.0, 1.0 ); - - if (cosAngIncidence > 0.0) - Ispec = pow( blinnTerm, spec_emis.y * 128.0 ) * spec_emis.x * fg_SunSpecularColor.rgb; - - float matID = texture2D( color_tex, coords ).a * 255.0; - if (matID >= 254.0) - Idiff += Ispec * spec_emis.x; - - gl_FragColor = vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0); -// gl_FragColor = mix(tint, vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0), 0.92); -} diff --git a/Shaders/sunlight-noshadow.frag b/Shaders/sunlight-noshadow.frag deleted file mode 100644 index d43be1ba8..000000000 --- a/Shaders/sunlight-noshadow.frag +++ /dev/null @@ -1,43 +0,0 @@ -#version 120 - -uniform mat4 fg_ViewMatrix; -uniform sampler2D depth_tex; -uniform sampler2D normal_tex; -uniform sampler2D color_tex; -uniform sampler2D spec_emis_tex; -uniform vec4 fg_SunDiffuseColor; -uniform vec4 fg_SunSpecularColor; -uniform vec3 fg_SunDirection; -uniform vec3 fg_Planes; -varying vec3 ray; - -vec3 normal_decode(vec2 enc); - -void main() { - vec2 coords = gl_TexCoord[0].xy; - vec4 spec_emis = texture2D( spec_emis_tex, coords ); - if ( spec_emis.a < 0.1 ) - discard; - vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg); - vec3 viewDir = normalize(ray); - - vec3 lightDir = (fg_ViewMatrix * vec4( fg_SunDirection, 0.0 )).xyz; - lightDir = normalize( lightDir ); - vec3 color = texture2D( color_tex, coords ).rgb; - vec3 Idiff = clamp( dot( lightDir, normal ), 0.0, 1.0 ) * color * fg_SunDiffuseColor.rgb; - vec3 halfDir = normalize( lightDir - viewDir ); - vec3 Ispec = vec3(0.0); - vec3 Iemis = spec_emis.z * color; - - float cosAngIncidence = clamp(dot(normal, lightDir), 0.0, 1.0); - float blinnTerm = clamp( dot( halfDir, normal ), 0.0, 1.0 ); - - if (cosAngIncidence > 0.0) - Ispec = pow( blinnTerm, spec_emis.y * 128.0 ) * spec_emis.x * fg_SunSpecularColor.rgb; - - float matID = texture2D( color_tex, coords ).a * 255.0; - if (matID >= 254.0) - Idiff += Ispec * spec_emis.x; - - gl_FragColor = vec4(Idiff + Ispec + Iemis, 1.0); -} diff --git a/Shaders/sunlight.frag b/Shaders/sunlight.frag deleted file mode 100644 index 918dbf003..000000000 --- a/Shaders/sunlight.frag +++ /dev/null @@ -1,107 +0,0 @@ -#version 120 -uniform mat4 fg_ViewMatrix; -uniform sampler2D depth_tex; -uniform sampler2D normal_tex; -uniform sampler2D color_tex; -uniform sampler2D spec_emis_tex; -uniform sampler2DShadow shadow_tex; -uniform vec4 fg_SunDiffuseColor; -uniform vec4 fg_SunSpecularColor; -uniform vec3 fg_SunDirection; -uniform vec3 fg_Planes; -uniform int fg_ShadowNumber; -uniform vec4 fg_ShadowDistances; - -uniform mat4 fg_ShadowMatrix_0; -uniform mat4 fg_ShadowMatrix_1; -uniform mat4 fg_ShadowMatrix_2; -uniform mat4 fg_ShadowMatrix_3; - -uniform int filtering; -varying vec3 ray; - -vec3 position( vec3 viewDir, vec2 coords, sampler2D depth_tex ); -vec3 normal_decode(vec2 enc); - -vec4 DynamicShadow( in vec4 ecPosition, out vec4 tint ) -{ - vec4 coords; - vec2 shift = vec2( 0.0 ); - int index = 4; - float factor = 0.5; - if (ecPosition.z > -fg_ShadowDistances.x) { - index = 1; - if (fg_ShadowNumber == 1) - factor = 1.0; - tint = vec4(0.0,1.0,0.0,1.0); - coords = fg_ShadowMatrix_0 * ecPosition; - } else if (ecPosition.z > -fg_ShadowDistances.y && fg_ShadowNumber > 1) { - index = 2; - shift = vec2( 0.0, 0.5 ); - tint = vec4(0.0,0.0,1.0,1.0); - coords = fg_ShadowMatrix_1 * ecPosition; - } else if (ecPosition.z > -fg_ShadowDistances.z && fg_ShadowNumber > 2) { - index = 3; - shift = vec2( 0.5, 0.0 ); - tint = vec4(1.0,1.0,0.0,1.0); - coords = fg_ShadowMatrix_2 * ecPosition; - } else if (ecPosition.z > -fg_ShadowDistances.w && fg_ShadowNumber > 3) { - shift = vec2( 0.5, 0.5 ); - tint = vec4(1.0,0.0,0.0,1.0); - coords = fg_ShadowMatrix_3 * ecPosition; - } else { - return vec4(1.1,1.1,0.0,1.0); // outside, clamp to border - } - coords.st *= factor; - coords.st += shift; - return coords; -} -void main() { - vec2 coords = gl_TexCoord[0].xy; - vec4 spec_emis = texture2D( spec_emis_tex, coords ); - if ( spec_emis.a < 0.1 ) - discard; - vec3 normal = normal_decode(texture2D( normal_tex, coords ).rg); - vec3 viewDir = normalize(ray); - vec3 pos = position( viewDir, coords, depth_tex ); - - vec4 tint; - float shadow = 0.0; - if (filtering == 1) { - shadow = shadow2DProj( shadow_tex, DynamicShadow( vec4( pos, 1.0 ), tint ) ).r; - } else if (filtering == 2) { - shadow += 0.333 * shadow2DProj( shadow_tex, DynamicShadow( vec4(pos, 1.0), tint ) ).r; - shadow += 0.166 * shadow2DProj( shadow_tex, DynamicShadow( vec4(pos + vec3(-0.003 * pos.z, -0.002 * pos.z, 0), 1.0), tint ) ).r; - shadow += 0.166 * shadow2DProj( shadow_tex, DynamicShadow( vec4(pos + vec3( 0.003 * pos.z, 0.002 * pos.z, 0), 1.0), tint ) ).r; - shadow += 0.166 * shadow2DProj( shadow_tex, DynamicShadow( vec4(pos + vec3(-0.003 * pos.z, 0.002 * pos.z, 0), 1.0), tint ) ).r; - shadow += 0.166 * shadow2DProj( shadow_tex, DynamicShadow( vec4(pos + vec3( 0.003 * pos.z, -0.002 * pos.z, 0), 1.0), tint ) ).r; - } else { - float kernel[9] = float[9]( 36/256.0, 24/256.0, 6/256.0, - 24/256.0, 16/256.0, 4/256.0, - 6/256.0, 4/256.0, 1/256.0 ); - for( int x = -2; x <= 2; ++x ) - for( int y = -2; y <= 2; ++y ) - shadow += kernel[int(abs(float(x))*3 + abs(float(y)))] * shadow2DProj( shadow_tex, DynamicShadow( vec4(pos + vec3(-0.0025 * x * pos.z, -0.0025 * y * pos.z, 0), 1.0), tint ) ).r; - } - vec3 lightDir = (fg_ViewMatrix * vec4( fg_SunDirection, 0.0 )).xyz; - lightDir = normalize( lightDir ); - vec4 color_material = texture2D( color_tex, coords ); - vec3 color = color_material.rgb; - vec3 Idiff = clamp( dot( lightDir, normal ), 0.0, 1.0 ) * color * fg_SunDiffuseColor.rgb; - vec3 halfDir = normalize( lightDir - viewDir ); - vec3 Ispec = vec3(0.0); - vec3 Iemis = spec_emis.z * color; - - float cosAngIncidence = clamp(dot(normal, lightDir), 0.0, 1.0); - float blinnTerm = clamp( dot( halfDir, normal ), 0.0, 1.0 ); - - if (cosAngIncidence > 0.0) - Ispec = pow( blinnTerm, spec_emis.y * 128.0 ) * spec_emis.x * fg_SunSpecularColor.rgb; - - float matID = color_material.a * 255.0; - if (matID >= 254.0) // 254: Water, 255: Ubershader - Idiff += Ispec * spec_emis.x; - - gl_FragColor = vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0); -// gl_FragColor = mix(tint, vec4(mix(vec3(0.0), Idiff + Ispec, shadow) + Iemis, 1.0), 0.92); -} diff --git a/Shaders/sunlight.vert b/Shaders/sunlight.vert deleted file mode 100644 index 6d7c623bf..000000000 --- a/Shaders/sunlight.vert +++ /dev/null @@ -1,10 +0,0 @@ -#version 120 -//uniform mat4 fg_ViewMatrixInverse; -uniform mat4 fg_ProjectionMatrixInverse; -varying vec3 ray; -void main() { - gl_Position = gl_Vertex; - gl_TexCoord[0] = gl_MultiTexCoord0; -// ray = (fg_ViewMatrixInverse * vec4((fg_ProjectionMatrixInverse * gl_Vertex).xyz, 0.0)).xyz; - ray = (fg_ProjectionMatrixInverse * gl_Vertex).xyz; -} diff --git a/Shaders/terrain-ALS-base.frag b/Shaders/terrain-ALS-base.frag index 04eb1e660..5e7bc20e7 100644 --- a/Shaders/terrain-ALS-base.frag +++ b/Shaders/terrain-ALS-base.frag @@ -33,7 +33,9 @@ float eShade; float fog_func (in float targ, in float alt); vec3 get_hazeColor(in float light_arg); -vec3 filter_combined (in vec3 color) ; +vec3 filter_combined (in vec3 color); + +float getShadowing(); float luminance(vec3 color) { @@ -69,12 +71,14 @@ void main() NdotL = dot(n, lightDir); if (NdotL > 0.0) { - color += diffuse_term * NdotL; + float shadowmap = getShadowing(); + color += diffuse_term * NdotL * shadowmap; NdotHV = max(dot(n, halfVector), 0.0); if (gl_FrontMaterial.shininess > 0.0) specular.rgb = (gl_FrontMaterial.specular.rgb * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess)); + * pow(NdotHV, gl_FrontMaterial.shininess) + * shadowmap); } color.a = diffuse_term.a; // This shouldn't be necessary, but our lighting becomes very diff --git a/Shaders/terrain-ALS-detailed.frag b/Shaders/terrain-ALS-detailed.frag index e79306ad0..21fbc77d9 100644 --- a/Shaders/terrain-ALS-detailed.frag +++ b/Shaders/terrain-ALS-detailed.frag @@ -56,7 +56,7 @@ float fog_func (in float targ, in float alt); vec3 get_hazeColor(in float light_arg); vec3 filter_combined (in vec3 color) ; - +float getShadowing(); void main() @@ -305,12 +305,14 @@ if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0)) NdotL = NdotL + 1.0 * (noisegrad_10m + 0.5* noisegrad_5m) * mix_factor/0.8 * (1.0 - smoothstep(1000.0, 2000.0, dist)); } if (NdotL > 0.0) { - color += diffuse_term * NdotL; + float shadowmap = getShadowing(); + color += diffuse_term * NdotL * shadowmap; NdotHV = max(dot(n, halfVector), 0.0); if (gl_FrontMaterial.shininess > 0.0) specular.rgb = ((gl_FrontMaterial.specular.rgb * 0.1 + (water_factor * vec3 (1.0, 1.0, 1.0))) * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor))); + * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor)) + * shadowmap); } color.a = 1.0;//diffuse_term.a; // This shouldn't be necessary, but our lighting becomes very diff --git a/Shaders/terrain-ALS-detailed.vert b/Shaders/terrain-ALS-detailed.vert index 660919b35..5bdaa4470 100644 --- a/Shaders/terrain-ALS-detailed.vert +++ b/Shaders/terrain-ALS-detailed.vert @@ -55,6 +55,7 @@ const float EarthRadius = 5800000.0; const float terminator_width = 200000.0; vec3 moonlight_perception (in vec3 light); +void setupShadows(vec4 eyeSpacePos); float light_func (in float x, in float a, in float b, in float c, in float d, in float e) { @@ -84,7 +85,8 @@ void main() float scattering; rawPos = gl_Vertex.xy; - worldPos = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex).xyz; + vec4 eyePos = gl_ModelViewMatrix * gl_Vertex; + worldPos = (osg_ViewMatrixInverse * eyePos).xyz; steepness = dot(normalize(gl_Normal), vec3 (0.0, 0.0, 1.0)); @@ -298,7 +300,8 @@ if (use_IR_vision) gl_FrontColor.a = mie_angle; gl_BackColor.a = mie_angle; } - + +setupShadows(eyePos); } diff --git a/Shaders/terrain-ALS-ultra.frag b/Shaders/terrain-ALS-ultra.frag index 65a52e2bc..a72393771 100644 --- a/Shaders/terrain-ALS-ultra.frag +++ b/Shaders/terrain-ALS-ultra.frag @@ -88,6 +88,7 @@ vec3 searchlight(); vec3 landing_light(in float offset, in float offsetv); vec3 filter_combined (in vec3 color) ; +float getShadowing(); // a fade function for procedural scales which are smaller than a pixel @@ -442,13 +443,15 @@ if ((dist < 5000.0) && (combined_wetness>0.0)) NdotL = NdotL + (1.0-snow_mix_factor) * 0.3* dot_texel.a * (0.5* dotnoisegrad_10m * detail_fade(1.0 * dot_size, view_angle, dist) +0.5 * dotnoisegrad_10m * noise_01m * detail_fade(0.1, view_angle, dist)) ; if (NdotL > 0.0) { + float shadowmap = getShadowing(); if (cloud_shadow_flag == 1) {NdotL = NdotL * shadow_func(relPos.x, relPos.y, 0.3 * noise_250m + 0.5 * noise_500m+0.2 * noise_1500m, dist);} - color += diffuse_term * NdotL; + color += diffuse_term * NdotL * shadowmap; NdotHV = max(dot(n, halfVector), 0.0); if (gl_FrontMaterial.shininess > 0.0) specular.rgb = ((gl_FrontMaterial.specular.rgb * 0.1 + (water_factor * vec3 (1.0, 1.0, 1.0))) * light_specular.rgb - * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor))); + * pow(NdotHV, gl_FrontMaterial.shininess + (20.0 * water_factor)) + * shadowmap); } color.a = 1.0;//diffuse_term.a; // This shouldn't be necessary, but our lighting becomes very diff --git a/Shaders/terrain-ALS-ultra.vert b/Shaders/terrain-ALS-ultra.vert index c3dcf9f28..ebe1b95a9 100644 --- a/Shaders/terrain-ALS-ultra.vert +++ b/Shaders/terrain-ALS-ultra.vert @@ -53,6 +53,8 @@ float yprime_alt; vec3 moonlight_perception (in vec3 light); +void setupShadows(vec4 eyeSpacePos); + // This is the value used in the skydome scattering shader - use the same here for consistency? const float EarthRadius = 5800000.0; const float terminator_width = 200000.0; @@ -290,7 +292,7 @@ if (use_IR_vision) gl_FrontColor.a = mie_angle; gl_BackColor.a = mie_angle; - + setupShadows(gl_ModelViewMatrix * gl_Vertex); } diff --git a/Shaders/terrain-overlay-ALS.frag b/Shaders/terrain-overlay-ALS.frag index 9a87f2002..54396928a 100644 --- a/Shaders/terrain-overlay-ALS.frag +++ b/Shaders/terrain-overlay-ALS.frag @@ -46,6 +46,8 @@ vec3 filter_combined (in vec3 color) ; float shadow_func_nearest (in float x, in float y, in float noise, in float dist); +float getShadowing(); + void main() { @@ -157,7 +159,7 @@ void main() // lighting is very simple, the ground underneath should do most of it vec3 N = normalize (gl_NormalMatrix * g_normal); - float NdotL = 0.5 + 1.0 * clamp(dot (N, gl_LightSource[0].position.xyz), 0.0, 1.0) * cloud_shade; + float NdotL = 0.5 + 1.0 * clamp(dot (N, gl_LightSource[0].position.xyz), 0.0, 1.0) * cloud_shade * getShadowing(); texel *= length(gl_LightSource[0].diffuse.rgb)/1.73 * scattering * NdotL; texel = clamp(texel, 0.0, 1.0); diff --git a/Shaders/terrain-overlay-ALS.geom b/Shaders/terrain-overlay-ALS.geom index 2e412b74e..2a9af20fd 100644 --- a/Shaders/terrain-overlay-ALS.geom +++ b/Shaders/terrain-overlay-ALS.geom @@ -16,7 +16,18 @@ varying out vec3 g_normal; varying out float g_altitude; varying out float g_layer; - +uniform mat4 fg_LightMatrix_csm0; +uniform mat4 fg_LightMatrix_csm1; +uniform mat4 fg_LightMatrix_csm2; +uniform mat4 fg_LightMatrix_csm3; +varying out vec4 lightSpacePos[4]; +void setupShadows(vec4 eyeSpacePos) +{ + lightSpacePos[0] = fg_LightMatrix_csm0 * eyeSpacePos; + lightSpacePos[1] = fg_LightMatrix_csm1 * eyeSpacePos; + lightSpacePos[2] = fg_LightMatrix_csm2 * eyeSpacePos; + lightSpacePos[3] = fg_LightMatrix_csm3 * eyeSpacePos; +} float min3(in float a, in float b, in float c) { @@ -49,6 +60,8 @@ void main() g_normal = v_normal[i]; g_altitude = gl_PositionIn[i].z; + setupShadows(gl_ModelViewMatrix * pos); + gl_Position = gl_ModelViewProjectionMatrix * pos; gl_TexCoord[0] = gl_TexCoordIn[i][0]; EmitVertex(); diff --git a/Shaders/transition-gbuffer.frag b/Shaders/transition-gbuffer.frag deleted file mode 100644 index 5efe56f07..000000000 --- a/Shaders/transition-gbuffer.frag +++ /dev/null @@ -1,163 +0,0 @@ -// -*-C++-*- -// Texture switching based on face slope and snow level -// based on earlier work by Frederic Bouvier, Tim Moore, and Yves Sablonier. -// � Emilian Huminiuc 2011 -#version 120 - -varying float RawPosZ; -varying vec3 WorldPos; -varying vec3 normal; -varying vec3 Vnormal; - -uniform float SnowLevel; -uniform float Transitions; -uniform float InverseSlope; -uniform float RainNorm; - -uniform float CloudCover0; -uniform float CloudCover1; -uniform float CloudCover2; -uniform float CloudCover3; -uniform float CloudCover4; - -uniform sampler2D BaseTex; -uniform sampler2D SecondTex; -uniform sampler2D ThirdTex; -uniform sampler2D SnowTex; - -uniform sampler3D NoiseTex; - -// gbuffer function -void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth); -/////////////////// - -void main() - { - float NdotL; - float NdotHV; - float fogFactor; - float cover; - float slope; - float L1; - float L2; - float wetness; - float pf; - - vec3 n; - vec3 lightDir; - vec3 halfVector; - - vec4 texel; - vec4 fragColor; - vec4 color; - - cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4); - - vec4 Noise = texture3D(NoiseTex, WorldPos.xyz*0.0011); - vec4 Noise2 = texture3D(NoiseTex, WorldPos.xyz * 0.00008); - float MixFactor = Noise.r * Noise.g * Noise.b; //Mixing Factor to create a more organic looking boundary - float MixFactor2 = Noise2.r * Noise2.g * Noise2.b; - MixFactor *= 300.0; - MixFactor2 *= 300.0; - MixFactor = clamp(MixFactor, 0.0, 1.0); - MixFactor2 = clamp(MixFactor2, 0.0, 1.0); - L1 = 0.90 - 0.02 * MixFactor; //first transition slope - L2 = 0.78 + 0.04 * MixFactor; //Second transition slope - - // If gl_Color.a == 0, this is a back-facing polygon and the - // Vnormal should be reversed. - n = (2.0 * gl_Color.a - 1.0) * Vnormal; - n = normalize(n); - - color = vec4(1.0); - - //Select texture based on slope - slope = normalize(normal).z; - - //pull the texture fetch outside flow control to fix aliasing artefacts :( - vec4 baseTexel = texture2D(BaseTex, gl_TexCoord[0].st); - vec4 secondTexel = texture2D(SecondTex, gl_TexCoord[0].st); - vec4 thirdTexel = texture2D(ThirdTex, gl_TexCoord[0].st); - vec4 snowTexel = texture2D(SnowTex, gl_TexCoord[0].st); - - //Normal transition. For more abrupt faces apply another texture (or 2). - if (InverseSlope == 0.0) { - //Do we do an intermediate transition - if (Transitions >= 1.5) { - if (slope >= L1) { - texel = baseTexel; - } - if (slope >= L2 && slope < L1){ - texel = mix(secondTexel, baseTexel, smoothstep(L2, L1 - 0.06 * MixFactor, slope)); - } - if (slope < L2){ - texel = mix(thirdTexel, secondTexel, smoothstep(L2 - 0.13 * MixFactor, L2, slope)); - } - // Just one transition - } else if (Transitions < 1.5) { - if (slope >= L1) { - texel = baseTexel; - } - if (slope < L1) { - texel = mix(thirdTexel, baseTexel, smoothstep(L2 - 0.13 * MixFactor, L1, slope)); - } - } - - //Invert the transition: keep original texture on abrupt slopes and switch to another on flatter terrain - } else if (InverseSlope > 0.0) { - //Interemdiate transition ? - if (Transitions >= 1.5) { - if (slope >= L1 + 0.1) { - texel = thirdTexel; - } - if (slope >= L2 && slope < L1 + 0.1){ - texel = mix(secondTexel, thirdTexel, smoothstep(L2 + 0.06 * MixFactor, L1 + 0.1, slope)); - } - if (slope <= L2){ - texel = mix(baseTexel, secondTexel, smoothstep(L2 - 0.06 * MixFactor, L2, slope)); - } - //just one - } else if (Transitions < 1.5) { - if (slope > L1 + 0.1) { - texel = thirdTexel; - } - if (slope <= L1 + 0.1){ - texel = mix(baseTexel, thirdTexel, smoothstep(L2 - 0.06 * MixFactor, L1 + 0.1, slope)); - } - } - } - - //darken textures with wetness - wetness = 1.0 - 0.3 * RainNorm; - texel.rgb = texel.rgb * wetness; - - float altitude = RawPosZ; - //Snow texture for areas higher than SnowLevel - if (altitude >= SnowLevel - (1000.0 * slope + 300.0 * MixFactor) && slope > L2 - 0.12) { - texel = mix( texel, - mix( texel, snowTexel, smoothstep(L2 - 0.09 * MixFactor, L2, slope) ), - smoothstep(SnowLevel - (1000.0 * slope + 300.0 * MixFactor), - SnowLevel - (1000.0 * slope - 150.0 * MixFactor), - altitude) - ); - } - - fragColor = color * texel; - - if(cover >= 2.5){ - fragColor.rgb = fragColor.rgb * 1.2; - } else { - fragColor.rg = fragColor.rg * (0.6 + 0.2 * cover); - fragColor.b = fragColor.b * (0.5 + 0.25 * cover); - } - - - fragColor.rgb *= 1.2 - 0.6 * MixFactor * MixFactor2; - - float specular = dot( gl_FrontMaterial.specular.rgb, vec3( 0.3, 0.59, 0.11 ) ); - float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb + gl_FrontMaterial.emission.rgb, - vec3( 0.3, 0.59, 0.11 ) - ); - - encode_gbuffer( n, fragColor.rgb, 1, specular, gl_FrontMaterial.shininess, emission, gl_FragCoord.z ); - } diff --git a/Shaders/transition-gbuffer.vert b/Shaders/transition-gbuffer.vert deleted file mode 100644 index dec1e334b..000000000 --- a/Shaders/transition-gbuffer.vert +++ /dev/null @@ -1,21 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Authors: Frederic Bouvier, Emilian Huminiuc -// -#version 120 - -varying float RawPosZ; -varying vec3 WorldPos; -varying vec3 normal; -varying vec3 Vnormal; - -uniform mat4 osg_ViewMatrixInverse; - -void main() { - RawPosZ = gl_Vertex.z; - WorldPos = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex).xyz; - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - normal = normalize(gl_Normal); - Vnormal = gl_NormalMatrix * gl_Normal; -} diff --git a/Shaders/transition.frag b/Shaders/transition.frag index 521755f1f..29f09c201 100644 --- a/Shaders/transition.frag +++ b/Shaders/transition.frag @@ -34,6 +34,8 @@ uniform int fogType; vec3 fog_Func(vec3 color, int type); ////////////////////// +float getShadowing(); + void main() { float pf = 0.0; @@ -64,7 +66,7 @@ void main() float nDotVP = max(0.0, dot(n, normalize(gl_LightSource[0].position.xyz))); float nDotHV = max(0.0, dot(n, normalize(gl_LightSource[0].halfVector.xyz))); - vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP; + vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP * getShadowing(); if (nDotVP > 0.0) pf = pow(nDotHV, gl_FrontMaterial.shininess); diff --git a/Shaders/transition.vert b/Shaders/transition.vert index fdfade826..06a9f8fb1 100644 --- a/Shaders/transition.vert +++ b/Shaders/transition.vert @@ -14,12 +14,16 @@ varying vec3 Vnormal; uniform mat4 osg_ViewMatrixInverse; +void setupShadows(vec4 eyeSpacePos); + void main() { RawPosZ = gl_Vertex.z; - WorldPos = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex).xyz; + vec4 eyePos = gl_ModelViewMatrix * gl_Vertex; + WorldPos = (osg_ViewMatrixInverse * eyePos).xyz; gl_Position = ftransform(); gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; normal = normalize(gl_Normal); Vnormal = normalize(gl_NormalMatrix * gl_Normal); + setupShadows(eyePos); } diff --git a/Shaders/ubershader-gbuffer.frag b/Shaders/ubershader-gbuffer.frag deleted file mode 100644 index 6df4e754a..000000000 --- a/Shaders/ubershader-gbuffer.frag +++ /dev/null @@ -1,246 +0,0 @@ -// -*- mode: C; -*- -// UBERSHADER - Rembrandt version - fragment shader -// Licence: GPL v2 -// Authors: Frederic Bouvier and Gijs de Rooy -// with major additions and revisions by -// Emilian Huminiuc and Vivian Meazza 2011 -#version 120 - -varying vec4 diffuseColor; -varying vec3 VBinormal; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 rawpos; -varying vec3 eyeVec; - -uniform samplerCube Environment; -uniform sampler2D BaseTex; -uniform sampler2D NormalTex; -uniform sampler2D LightMapTex; -uniform sampler2D ReflMapTex; -uniform sampler2D ReflGradientsTex; -uniform sampler3D ReflNoiseTex; - -uniform int dirt_enabled; -uniform int dirt_multi; -uniform int lightmap_enabled; -uniform int lightmap_multi; -uniform int nmap_dds; -uniform int nmap_enabled; -uniform int refl_enabled; -uniform int refl_dynamic; -uniform int refl_map; - -uniform float lightmap_r_factor; -uniform float lightmap_g_factor; -uniform float lightmap_b_factor; -uniform float lightmap_a_factor; -uniform float nmap_tile; -uniform float refl_correction; -uniform float refl_fresnel; -uniform float refl_rainbow; -uniform float refl_noise; -uniform float amb_correction; -uniform float dirt_r_factor; -uniform float dirt_g_factor; -uniform float dirt_b_factor; - -uniform vec3 lightmap_r_color; -uniform vec3 lightmap_g_color; -uniform vec3 lightmap_b_color; -uniform vec3 lightmap_a_color; - -uniform vec3 dirt_r_color; -uniform vec3 dirt_g_color; -uniform vec3 dirt_b_color; - -void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth); - -uniform mat4 osg_ViewMatrixInverse; -uniform float latDeg; -uniform float lonDeg; - -//////rotation matrices///////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -mat3 rotX(in float angle) -{ - mat3 rotmat = mat3( - 1.0, 0.0, 0.0, - 0.0, cos(angle), -sin(angle), - 0.0, sin(angle), cos(angle) - ); - return rotmat; -} - -mat3 rotY(in float angle) -{ - mat3 rotmat = mat3( - cos(angle), 0.0, sin(angle), - 0.0, 1.0, 0.0, - -sin(angle), 0.0, cos(angle) - ); - return rotmat; -} - -mat3 rotZ(in float angle) -{ - mat3 rotmat = mat3( - cos(angle), -sin(angle), 0.0, - sin(angle), cos(angle), 0.0, - 0.0, 0.0, 1.0 - ); - return rotmat; -} - -//////////////////////////////////////////////////////////////////////////////// - - - -void main (void) -{ - vec4 texel = texture2D(BaseTex, gl_TexCoord[0].st); - vec4 nmap = texture2D(NormalTex, gl_TexCoord[0].st * nmap_tile); - vec4 reflmap = texture2D(ReflMapTex, gl_TexCoord[0].st); - vec4 noisevec = texture3D(ReflNoiseTex, rawpos.xyz); - vec4 lightmapTexel = texture2D(LightMapTex, gl_TexCoord[0].st); - - vec3 mixedcolor; - vec3 ambient = vec3(0.85,0.85,0.9);//placeholder for sun ambient - //vec3 ambient = fg_SunAmbientColor.rgb; - vec3 N; - vec3 dotN; - float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb, - vec3( 0.3, 0.59, 0.11 ) ); - float pf; - - ///BEGIN bump - if (nmap_enabled > 0){ - N = nmap.rgb * 2.0 - 1.0; - N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal); - if (nmap_dds > 0) - N = -N; - } else { - N = normalize(VNormal); - } - ///END bump //////////////////////////////////////////////////////////////////// - vec3 viewN = normalize((gl_ModelViewMatrixTranspose * vec4(N,0.0)).xyz); - vec3 viewVec = normalize(eyeVec); - float v = abs(dot(viewVec, viewN));// Map a rainbowish color - vec4 fresnel = texture2D(ReflGradientsTex, vec2(v, 0.75)); - vec4 rainbow = texture2D(ReflGradientsTex, vec2(v, 0.25)); - - mat4 reflMatrix = gl_ModelViewMatrixInverse; - vec3 wRefVec = reflect(viewVec,N); - - ////dynamic reflection ///////////////////////////// - if (refl_dynamic > 0 && refl_enabled > 0){ - reflMatrix = osg_ViewMatrixInverse; - - vec3 wVertVec = (reflMatrix * vec4(eyeVec,0.0)).xyz; - vec3 wNormal = (reflMatrix * vec4(N,0.0)).xyz; - - float latRad = radians(90. - latDeg); - float lonRad = radians(lonDeg); - - mat3 rotCorrY = rotY(latRad); - mat3 rotCorrZ = rotZ(lonRad); - mat3 reflCorr = rotCorrY * rotCorrZ; - wRefVec = reflect(wVertVec,wNormal); - wRefVec = normalize(reflCorr * wRefVec); - } else { ///static reflection - wRefVec = normalize(reflMatrix * vec4(wRefVec,0.0)).xyz; - } - - vec3 reflection = textureCube(Environment, wRefVec).xyz; - - - vec4 color = gl_Color + gl_FrontLightModelProduct.sceneColor; - float specular = dot((gl_FrontMaterial.specular * nmap.a).rgb, vec3( 0.3, 0.59, 0.11 )); - - //////////////////////////////////////////////////////////////////////////////// - //BEGIN reflect - //////////////////////////////////////////////////////////////////////////////// - if (refl_enabled > 0){ - float reflFactor; - float transparency_offset = clamp(refl_correction, -1.0, 1.0);// set the user shininess offset - if(refl_map > 0){ - // map the shininess of the object with user input - reflFactor = reflmap.a + transparency_offset; - } else if (nmap_enabled > 0) { - // set the reflectivity proportional to shininess with user input - reflFactor = gl_FrontMaterial.shininess * 0.0078125 * nmap.a + transparency_offset; - } else { - reflFactor = gl_FrontMaterial.shininess * 0.0078125 + transparency_offset; - } - reflFactor = clamp(reflFactor, 0.0, 1.0); - - // add fringing fresnel and rainbow effects and modulate by reflection - vec3 reflcolor = mix(reflection, rainbow.rgb, refl_rainbow * v); - vec3 reflfrescolor = mix(reflcolor, fresnel.rgb, refl_fresnel * v); - vec3 noisecolor = mix(reflfrescolor, noisevec.rgb, refl_noise); - vec3 raincolor = noisecolor.rgb * reflFactor; - mixedcolor = mix(texel.rgb, raincolor, reflFactor); - } else { - mixedcolor = texel.rgb; - } - //////////////////////////////////////////////////////////////////////////// - //END reflect - //////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////// - //begin DIRT - //////////////////////////////////////////////////////////////////////////// - if (dirt_enabled >= 1){ - vec3 dirtFactorIn = vec3 (dirt_r_factor, dirt_g_factor, dirt_b_factor); - vec3 dirtFactor = reflmap.rgb * dirtFactorIn.rgb; - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_r_color, smoothstep(0.0, 1.0, dirtFactor.r)); - if (dirt_multi > 0) { - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_g_color, smoothstep(0.0, 1.0, dirtFactor.g)); - mixedcolor.rgb = mix(mixedcolor.rgb, dirt_b_color, smoothstep(0.0, 1.0, dirtFactor.b)); - } - } - //////////////////////////////////////////////////////////////////////////// - //END Dirt - //////////////////////////////////////////////////////////////////////////// - - - // set ambient adjustment to remove bluiness with user input - float ambient_offset = clamp(amb_correction, -1.0, 1.0); - vec3 ambient_Correction = vec3(ambient.rg, ambient.b * 0.6) * ambient_offset; - ambient_Correction = clamp(ambient_Correction, -1.0, 1.0); - - //specifically disallow alpha - color.a = 1.0; //texel.a * alpha; - color.rgb *= mixedcolor.rgb; - color.rgb += ambient_Correction.rgb; - vec4 fragColor = color; - - //////////////////////////////////////////////////////////////////////////////// - // BEGIN lightmap - //////////////////////////////////////////////////////////////////////////////// - if ( lightmap_enabled >= 1 ) { - vec3 lightmapcolor; - vec4 lightmapFactor = vec4(lightmap_r_factor, lightmap_g_factor, lightmap_b_factor, lightmap_a_factor); - lightmapFactor = lightmapFactor * lightmapTexel; - if (lightmap_multi > 0 ){ - lightmapcolor = lightmap_r_color * lightmapFactor.r + - lightmap_g_color * lightmapFactor.g + - lightmap_b_color * lightmapFactor.b + - lightmap_a_color * lightmapFactor.a ; - emission = max(max(lightmapFactor.r * lightmapTexel.r, lightmapFactor.g * lightmapTexel.g), - max( lightmapFactor.b * lightmapTexel.b, lightmapFactor.a * lightmapTexel.a)); - } else { - lightmapcolor = lightmapTexel.rgb * lightmap_r_color * lightmapFactor.r; - emission = lightmapTexel.r * lightmapFactor.r; - } - //fragColor.rgb = max(fragColor.rgb, lightmapcolor * gl_FrontMaterial.diffuse.rgb * mixedcolor); - emission = length(lightmapcolor); - fragColor.rgb = max(fragColor.rgb * (1.0 - emission), - lightmapcolor * gl_FrontMaterial.diffuse.rgb * mixedcolor); - } - //////////////////////////////////////////////////////////////////////////////// - // END lightmap - //////////////////////////////////////////////////////////////////////////////// - - encode_gbuffer(N, fragColor.rgb, 255, specular, gl_FrontMaterial.shininess, emission, gl_FragCoord.z); -} \ No newline at end of file diff --git a/Shaders/ubershader.frag b/Shaders/ubershader.frag index 1a8507ee4..d8a2f7b77 100644 --- a/Shaders/ubershader.frag +++ b/Shaders/ubershader.frag @@ -65,6 +65,8 @@ uniform int fogType; vec3 fog_Func(vec3 color, int type); //////////////////////////////////// +float getShadowing(); + //////rotation matrices///////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -179,8 +181,9 @@ void main (void) else pf = pow(nDotHV, gl_FrontMaterial.shininess); - vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP; - vec4 Specular = gl_FrontMaterial.specular * gl_LightSource[0].diffuse * pf; + float shadowmap = getShadowing(); + vec4 Diffuse = gl_LightSource[0].diffuse * nDotVP * shadowmap; + vec4 Specular = gl_FrontMaterial.specular * gl_LightSource[0].diffuse * pf * shadowmap; vec4 color = gl_Color + Diffuse*diffuseColor; color = clamp( color, 0.0, 1.0 ); diff --git a/Shaders/ubershader.vert b/Shaders/ubershader.vert index 5379107a0..b447e0260 100644 --- a/Shaders/ubershader.vert +++ b/Shaders/ubershader.vert @@ -16,7 +16,8 @@ attribute vec3 tangent; attribute vec3 binormal; uniform int nmap_enabled; -uniform int rembrandt_enabled; + +void setupShadows(vec4 eyeSpacePos); void main(void) { @@ -54,14 +55,12 @@ void main(void) if (gl_FrontMaterial.diffuse.a < 1.0) diffuseColor.a = gl_FrontMaterial.diffuse.a; - if(rembrandt_enabled < 1){ gl_FrontColor = gl_FrontMaterial.emission + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); - } else { - gl_FrontColor = gl_Color; - } - + gl_Position = ftransform(); gl_ClipVertex = ecPosition; gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + + setupShadows(ecPosition); } diff --git a/Shaders/urban-ALS.frag b/Shaders/urban-ALS.frag index f74cc9e9e..ccb8bce49 100644 --- a/Shaders/urban-ALS.frag +++ b/Shaders/urban-ALS.frag @@ -99,6 +99,8 @@ vec3 searchlight(); vec3 landing_light(in float offset, in float offsetv); vec3 filter_combined (in vec3 color) ; +float getShadowing(); + void QDM(inout vec3 p, inout vec3 v) { const int MAX_LEVEL = TEXTURE_MIP_LEVELS; @@ -279,7 +281,7 @@ void main (void) if (cloud_shadow_flag == 1) {diffuse = diffuse * shadow_func(relPos.x, relPos.y, 1.0, dist);} - + diffuse *= getShadowing(); float shadow_factor = 1.0; diff --git a/Shaders/urban-ALS.vert b/Shaders/urban-ALS.vert index 0eb8546f1..eb8af1433 100644 --- a/Shaders/urban-ALS.vert +++ b/Shaders/urban-ALS.vert @@ -51,6 +51,8 @@ uniform mat4 osg_ViewMatrixInverse; attribute vec3 tangent;//, binormal; +void setupShadows(vec4 eyeSpacePos); + float earthShade; @@ -282,6 +284,6 @@ if (use_IR_vision) constantColor = gl_FrontMaterial.emission + gl_Color * (gl_LightModel.ambient + light_ambient); - +setupShadows(ecPosition); } diff --git a/Shaders/urban-gbuffer.frag b/Shaders/urban-gbuffer.frag deleted file mode 100644 index 61c0a9083..000000000 --- a/Shaders/urban-gbuffer.frag +++ /dev/null @@ -1,227 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Author: Frederic Bouvier. -// Adapted from the paper by F. Policarpo et al. : Real-time Relief Mapping on Arbitrary Polygonal Surfaces -// Adapted from the paper and sources by M. Drobot in GPU Pro : Quadtree Displacement Mapping with Height Blending - -#version 120 - -#extension GL_ATI_shader_texture_lod : enable -#extension GL_ARB_shader_texture_lod : enable - -#define TEXTURE_MIP_LEVELS 10 -#define TEXTURE_PIX_COUNT 1024 //pow(2,TEXTURE_MIP_LEVELS) -#define BINARY_SEARCH_COUNT 10 -#define BILINEAR_SMOOTH_FACTOR 2.0 - -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec3 Normal; -varying vec4 constantColor; -varying vec4 specular; - -uniform sampler3D NoiseTex; -uniform sampler2D BaseTex; -uniform sampler2D NormalTex; -uniform sampler2D QDMTex; -uniform float depth_factor; -uniform float tile_size; -uniform float quality_level; -uniform float snowlevel; -uniform bool random_buildings; - -const float scale = 1.0; -int linear_search_steps = 10; -int GlobalIterationCount = 0; -int gIterationCap = 64; - -void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth); - -void QDM(inout vec3 p, inout vec3 v) -{ - const int MAX_LEVEL = TEXTURE_MIP_LEVELS; - const float NODE_COUNT = TEXTURE_PIX_COUNT; - const float TEXEL_SPAN_HALF = 1.0 / NODE_COUNT / 2.0; - - float fDeltaNC = TEXEL_SPAN_HALF * depth_factor; - - vec3 p2 = p; - float level = MAX_LEVEL; - vec2 dirSign = (sign(v.xy) + 1.0) * 0.5; - GlobalIterationCount = 0; - float d = 0.0; - - while (level >= 0.0 && GlobalIterationCount < gIterationCap) - { - vec4 uv = vec4(p2.xyz, level); - d = texture2DLod(QDMTex, uv.xy, uv.w).w; - - if (d > p2.z) - { - //predictive point of ray traversal - vec3 tmpP2 = p + v * d; - - //current node count - float nodeCount = pow(2.0, (MAX_LEVEL - level)); - //current and predictive node ID - vec4 nodeID = floor(vec4(p2.xy, tmpP2.xy)*nodeCount); - - //check if we are crossing the current cell - if (nodeID.x != nodeID.z || nodeID.y != nodeID.w) - { - //calculate distance to nearest bound - vec2 a = p2.xy - p.xy; - vec2 p3 = (nodeID.xy + dirSign) / nodeCount; - vec2 b = p3.xy - p.xy; - - vec2 dNC = (b.xy * p2.z) / a.xy; - //take the nearest cell - d = min(d,min(dNC.x, dNC.y))+fDeltaNC; - - level++; - - } - p2 = p + v * d; - } - level--; - GlobalIterationCount++; - } - - // - // Manual Bilinear filtering - // - float rayLength = length(p2.xy - p.xy) + fDeltaNC; - - float dA = p2.z * (rayLength - BILINEAR_SMOOTH_FACTOR * TEXEL_SPAN_HALF) / rayLength; - float dB = p2.z * (rayLength + BILINEAR_SMOOTH_FACTOR * TEXEL_SPAN_HALF) / rayLength; - - vec4 p2a = vec4(p + v * dA, 0.0); - vec4 p2b = vec4(p + v * dB, 0.0); - dA = texture2DLod(NormalTex, p2a.xy, p2a.w).w; - dB = texture2DLod(NormalTex, p2b.xy, p2b.w).w; - - dA = abs(p2a.z - dA); - dB = abs(p2b.z - dB); - - p2 = mix(p2a.xyz, p2b.xyz, dA / (dA + dB)); - - p = p2; -} - -float ray_intersect_QDM(vec2 dp, vec2 ds) -{ - vec3 p = vec3( dp, 0.0 ); - vec3 v = vec3( ds, 1.0 ); - QDM( p, v ); - return p.z; -} - -float ray_intersect_relief(vec2 dp, vec2 ds) -{ - float size = 1.0 / float(linear_search_steps); - float depth = 0.0; - float best_depth = 1.0; - - for(int i = 0; i < linear_search_steps - 1; ++i) - { - depth += size; - float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a); - if(best_depth > 0.996) - if(depth >= t) - best_depth = depth; - } - depth = best_depth; - - const int binary_search_steps = 5; - - for(int i = 0; i < binary_search_steps; ++i) - { - size *= 0.5; - float t = step(0.95, texture2D(NormalTex, dp + ds * depth).a); - if(depth >= t) - { - best_depth = depth; - depth -= 2.0 * size; - } - depth += size; - } - - return(best_depth); -} - -float ray_intersect(vec2 dp, vec2 ds) -{ - if ( random_buildings ) - return 0.0; - else if ( quality_level >= 4.0 ) - return ray_intersect_QDM( dp, ds ); - else - return ray_intersect_relief( dp, ds ); -} - -void main (void) -{ - if ( quality_level >= 3.0 ) { - linear_search_steps = 20; - } - - float depthfactor = depth_factor; - if ( random_buildings ) - depthfactor = 0.0; - - vec3 normal = normalize(VNormal); - vec3 tangent = normalize(VTangent); - vec3 binormal = normalize(VBinormal); - vec3 ecPos3 = ecPosition.xyz / ecPosition.w; - vec3 V = normalize(ecPos3); - vec3 s = vec3(dot(V, tangent), dot(V, binormal), dot(normal, -V)); - vec2 ds = s.xy * depthfactor / s.z; - vec2 dp = gl_TexCoord[0].st - ds; - float d = ray_intersect(dp, ds); - - vec2 uv = dp + ds * d; - vec3 N = texture2D(NormalTex, uv).xyz; - float emis = N.z; - N = N * 2.0 - 1.0; - - - N.z = sqrt(1.0 - min(1.0,dot(N.xy, N.xy))); - float Nz = N.z; - N = normalize(N.x * tangent + N.y * binormal + N.z * normal); - - vec4 ambient_light = constantColor + vec4(gl_Color.rgb, 1.0); - - // vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale); - // vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale); - - // float n=0.06; - // n += nvL[0]*0.4; - // n += nvL[1]*0.6; - // n += nvL[2]*2.0; - // n += nvL[3]*4.0; - // n += noisevec[0]*0.1; - // n += noisevec[1]*0.4; - - // n += noisevec[2]*0.8; - // n += noisevec[3]*2.1; - // n = mix(0.6, n, length(ecPosition.xyz) ); - - vec4 finalColor = texture2D(BaseTex, uv); - // finalColor = mix(finalColor, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), - // step(0.8,Nz)*(1.0-emis)*smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0)); - // finalColor *= ambient_light; - - vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depthfactor / s.z, 1.0 ); - - if (dot(normal,-V) > 0.1) { - vec4 iproj = gl_ProjectionMatrix * p; - iproj /= iproj.w; - gl_FragDepth = (iproj.z+1.0)/2.0; - } else { - gl_FragDepth = gl_FragCoord.z; - } - encode_gbuffer(N, finalColor.rgb, 1, dot(specular.xyz,vec3(0.3, 0.59, 0.11 )), specular.w, 0.0, gl_FragDepth); -} diff --git a/Shaders/urban-gbuffer.vert b/Shaders/urban-gbuffer.vert deleted file mode 100644 index 96a304ca5..000000000 --- a/Shaders/urban-gbuffer.vert +++ /dev/null @@ -1,31 +0,0 @@ -// -*- mode: C; -*- -// Licence: GPL v2 -// Author: Frederic Bouvier -#version 120 - -varying vec4 rawpos; -varying vec4 ecPosition; -varying vec3 VNormal; -varying vec3 Normal; -varying vec3 VTangent; -varying vec3 VBinormal; -varying vec4 constantColor; -varying vec4 specular; - -attribute vec3 tangent, binormal; - -void main(void) -{ - rawpos = gl_Vertex; - ecPosition = gl_ModelViewMatrix * gl_Vertex; - VNormal = normalize(gl_NormalMatrix * gl_Normal); - Normal = normalize(gl_Normal); - VTangent = gl_NormalMatrix * tangent; - VBinormal = gl_NormalMatrix * binormal; - gl_FrontColor = gl_Color; - constantColor = gl_FrontMaterial.emission - + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - specular = vec4( gl_FrontMaterial.specular.rgb, gl_FrontMaterial.shininess ); -} diff --git a/Shaders/urban.frag b/Shaders/urban.frag index 057a8b92a..c4666d53a 100644 --- a/Shaders/urban.frag +++ b/Shaders/urban.frag @@ -45,6 +45,8 @@ uniform int fogType; vec3 fog_Func(vec3 color, int type); ////////////////////// +float getShadowing(); + void QDM(inout vec3 p, inout vec3 v) { const int MAX_LEVEL = TEXTURE_MIP_LEVELS; @@ -197,6 +199,7 @@ void main (void) vec3 l = gl_LightSource[0].position.xyz; vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l)); + diffuse *= getShadowing(); float shadow_factor = 1.0; // Shadow diff --git a/Shaders/urban.vert b/Shaders/urban.vert index c065bc59e..52cb1068d 100644 --- a/Shaders/urban.vert +++ b/Shaders/urban.vert @@ -19,6 +19,8 @@ attribute vec3 tangent, binormal; // void fog_Func(int type); ///////////////////////// +void setupShadows(vec4 eyeSpacePos); + void main(void) { rawpos = gl_Vertex; @@ -33,4 +35,5 @@ void main(void) gl_Position = ftransform(); gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; // fog_Func(fogType); + setupShadows(ecPosition); } diff --git a/Shaders/water-gbuffer.frag b/Shaders/water-gbuffer.frag deleted file mode 100644 index 4b607ddd0..000000000 --- a/Shaders/water-gbuffer.frag +++ /dev/null @@ -1,212 +0,0 @@ -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// © Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// © Emilian Huminiuc and Vivian Meazza -// Optimisation - 2012-5-05 -// Based on ideas by Thorsten Renk -// © Emilian Huminiuc and Vivian Meazza - -#version 120 - -uniform sampler2D water_normalmap; -uniform sampler2D water_reflection; -uniform sampler2D water_dudvmap; -uniform sampler2D water_reflection_grey; -uniform sampler2D sea_foam; -uniform sampler2D perlin_normalmap; - -uniform float CloudCover0; -uniform float CloudCover1; -uniform float CloudCover2; -uniform float CloudCover3; -uniform float CloudCover4; -uniform float Overcast; -uniform float WaveAmp; -uniform float WaveFreq; -uniform float WaveSharp; -uniform float WindE; -uniform float WindN; -uniform float normalmap_dds; -uniform float osg_SimulationTime; -uniform float saturation; - -uniform int Status; - -varying vec4 waterTex1; //moving texcoords -varying vec4 waterTex2; //moving texcoords -varying vec3 viewerdir; -varying vec3 normal; -varying vec3 rawNormal; -varying vec3 VTangent; -varying vec3 VBinormal; - - -/////// functions ///////// -void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth); - -void rotationmatrix(in float angle, out mat4 rotmat) - { - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); - } - -void main(void) - { - const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005); - const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02); - const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25); - - mat4 RotationMatrix; - // compute direction to viewer - vec3 E = normalize(viewerdir); - - vec3 Normal = normalize(normal); - vec3 vNormal = normalize(rawNormal); - - const float water_shininess = 240.0; - - // approximate cloud cover - float cover = 0.0; - //bool Status = true; - - - float windEffect = sqrt( WindE*WindE + WindN*WindN ) * 0.6; //wind speed in kt - float windScale = 15.0/(3.0 + windEffect); //wave scale - float windEffect_low = 0.3 + 0.7 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter - float waveRoughness = 0.05 + smoothstep(0.0, 20.0, windEffect); //wave roughness filter - - float mixFactor = 0.75 - 0.15 * smoothstep(0.0, 40.0, windEffect); - mixFactor = clamp(mixFactor, 0.3, 0.8); - - if (Status == 1){ - cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4); - } else { - // hack to allow for Overcast not to be set by Local Weather - if (Overcast == 0.0){ - cover = 5.0; - } else { - cover = Overcast * 5.0; - } - } - - vec4 viewt = vec4(-E, 0.0) * 0.6; - - vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale) * 2.0 - 1.0; - - vec4 dist = texture2D(water_dudvmap, vec2(waterTex1 + disdis*sca2)* windScale) * 2.0 - 1.0; - dist *= (0.6 + 0.5 * smoothstep(0.0, 15.0, windEffect)); - vec4 fdist = normalize(dist); - if (normalmap_dds > 0) - fdist = -fdist; //dds fix - fdist *= sca; - - //normalmaps - rotationmatrix(radians(3.0 * windScale + 0.6 * sin(waterTex1.s * 0.2)), RotationMatrix); - vec4 nmap = texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0; - vec4 nmap1 = texture2D(perlin_normalmap, vec2(waterTex1/** RotationMatrix*/ + disdis * sca2) * windScale) * 2.0 - 1.0; - - rotationmatrix(radians(-2.0 * windScale -0.4 * sin(waterTex1.s * 0.32)), RotationMatrix); - nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 1.5) * 2.0 - 1.0; - //nmap1 += texture2D(perlin_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0; - rotationmatrix(radians(1.5 * windScale + 0.3 * sin(waterTex1.s * 0.16)), RotationMatrix); - nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 2.1) * 2.0 - 1.0; - rotationmatrix(radians(-0.5 * windScale - 0.45 * sin(waterTex1.s * 0.28)), RotationMatrix); - nmap += texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 0.8) * 2.0 - 1.0; - - rotationmatrix(radians(-1.2 * windScale - 0.35 * sin(waterTex1.s * 0.28)), RotationMatrix); - nmap += texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix* tscale) * windScale * 1.7) * 2.0 - 1.0; - nmap1 += texture2D(perlin_normalmap, vec2(waterTex2/** RotationMatrix*/ * tscale) * windScale) * 2.0 - 1.0; - - nmap *= windEffect_low; - nmap1 *= windEffect_low; - // mix water and noise, modulated by factor - vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness); - if (normalmap_dds > 0) - vNorm = -vNorm; //dds fix - - //load reflection - //vec4 tmp = vec4(lightdir, 0.0); - vec4 tmp = vec4(0.0); - vec4 refTex = texture2D(water_reflection, vec2(tmp + waterTex1) * 32.0) ; - vec4 refTexGrey = texture2D(water_reflection_grey, vec2(tmp + waterTex1) * 32.0) ; - vec4 refl ; - - // cover = 0; - - if(cover >= 1.5){ - refl = normalize(refTex); - refl.a = 1.0; - } - else - { - refl = normalize(refTexGrey); - refl.r *= (0.75 + 0.15 * cover); - refl.g *= (0.80 + 0.15 * cover); - refl.b *= (0.875 + 0.125 * cover); - refl.a = 1.0; - } - - rotationmatrix(radians(2.1* windScale + 0.25 * sin(waterTex1.s *0.14)), RotationMatrix); - vec3 N0 = vec3(texture2D(water_normalmap, vec2(waterTex1* RotationMatrix + disdis * sca2) * windScale * 1.15) * 2.0 - 1.0); - vec3 N1 = vec3(texture2D(perlin_normalmap, vec2(waterTex1/** RotationMatrix*/ + disdis * sca) * windScale) * 2.0 - 1.0); - - rotationmatrix(radians(-1.5 * windScale -0.32 * sin(waterTex1.s *0.24)), RotationMatrix); - N0 += vec3(texture2D(water_normalmap, vec2(waterTex2* RotationMatrix * tscale) * windScale * 1.8) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2/** RotationMatrix*/ * tscale) * windScale) * 2.0 - 1.0); - - rotationmatrix(radians(3.8 * windScale + 0.45 * sin(waterTex1.s *0.32)), RotationMatrix); - N0 += vec3(texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * (tscale + sca2)) * windScale * 0.85) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex2/** RotationMatrix*/ * (tscale + sca2)) * windScale) * 2.0 - 1.0); - - rotationmatrix(radians(-2.8 * windScale - 0.38 * sin(waterTex1.s * 0.26)), RotationMatrix); - N0 += vec3(texture2D(water_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca2) * windScale * 2.1) * 2.0 - 1.0); - N1 += vec3(texture2D(perlin_normalmap, vec2(waterTex1 /** RotationMatrix*/ + disdis * sca) * windScale) * 2.0 - 1.0); - - N0 *= windEffect_low; - N1 *= windEffect_low; - - vec3 N2 = normalize(mix(N0, N1, mixFactor) * waveRoughness); - Normal = normalize(N2.x * VTangent + N2.y * VBinormal + N2.z * Normal); - //vNormal = normalize(mix(vNormal + N0, vNormal + N1, mixFactor) * waveRoughness); - vNormal = normalize(N2.x * vec3(1.,0.,0.) + N2.y * vec3(0.,1.,0.) + N2.z * vNormal); - - if (normalmap_dds > 0){ - Normal = -Normal; //dds fix - vNormal = -vNormal; - } - // specular - //vec3 specular_color = vec3(gl_LightSource[0].diffuse) - // * pow(max(0.0, dot(N, H)), water_shininess) * 6.0; - //vec4 specular = vec4(specular_color, 0.5); - - //specular = specular * saturation * 0.3 ; - //float specular = saturation * 0.3; - - //calculate fresnel - vec4 invfres = vec4( dot(vNorm, viewt) ); - vec4 fres = vec4(1.0) + invfres; - refl *= fres; - - //calculate final colour - //vec4 ambient_light = gl_LightSource[0].diffuse; - vec4 finalColor = refl; - - float foamSlope = 0.10 + 0.1 * windScale; - vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 25.0); - float waveSlope = vNormal.g; - - if (windEffect >= 8.0) - if (waveSlope >= foamSlope){ - finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), smoothstep(0.01, 0.50, vNormal.g)); - } - - float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb + gl_FrontMaterial.emission.rgb, - vec3( 0.3, 0.59, 0.11 ) - ); - float specular = smoothstep(0.0, 3.5, cover); - encode_gbuffer(Normal, finalColor.rgb, 254, specular, 128.0, emission, gl_FragCoord.z); - } diff --git a/Shaders/water-gbuffer.vert b/Shaders/water-gbuffer.vert deleted file mode 100644 index bfe91e6ee..000000000 --- a/Shaders/water-gbuffer.vert +++ /dev/null @@ -1,123 +0,0 @@ -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// © Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// © Emilian Huminiuc and Vivian Meazza - -#version 120 - -varying vec4 waterTex1; -varying vec4 waterTex2; - -varying vec3 viewerdir; -varying vec3 lightdir; -varying vec3 normal; -varying vec3 rawNormal; - -varying vec3 VTangent; -varying vec3 VBinormal; - -varying vec3 WorldPos; -varying vec2 TopoUV; - - -uniform float WindE, WindN; -uniform int rembrandt_enabled; - -uniform float osg_SimulationTime; -uniform mat4 osg_ViewMatrixInverse; - -attribute vec3 tangent; -attribute vec3 binormal; - -// constants for the cartezian to geodetic conversion. - -const float a = 6378137.0; //float a = equRad; -const float squash = 0.9966471893352525192801545; -const float latAdjust = 0.9999074159800018; //geotiff source for the depth map -const float lonAdjust = 0.9999537058469516; //actual extents: +-180.008333333333326/+-90.008333333333340 - - -/////// functions ///////// - -void rotationmatrix(in float angle, out mat4 rotmat) - { - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); - } - -void main(void) - { - mat4 RotationMatrix; - rawNormal= gl_Normal; - normal = gl_NormalMatrix * gl_Normal; - VTangent = normalize(gl_NormalMatrix * tangent); - VBinormal = normalize(gl_NormalMatrix * binormal); - - viewerdir = vec3(gl_ModelViewMatrixInverse[3]) - vec3(gl_Vertex); - - vec4 t1 = vec4(0.0, osg_SimulationTime * 0.005217, 0.0, 0.0); - vec4 t2 = vec4(0.0, osg_SimulationTime * -0.0012, 0.0, 0.0); - - float Angle; - - float windFactor = sqrt(WindE * WindE + WindN * WindN) * 0.05; - - if (WindN == 0.0 && WindE == 0.0) { - Angle = 0.0; - }else{ - Angle = atan(-WindN, WindE) - atan(1.0); - } - - rotationmatrix(Angle, RotationMatrix); - waterTex1 = gl_MultiTexCoord0 * RotationMatrix - t1 * windFactor; - - rotationmatrix(Angle, RotationMatrix); - waterTex2 = gl_MultiTexCoord0 * RotationMatrix - t2 * windFactor; - - WorldPos = (osg_ViewMatrixInverse *gl_ModelViewMatrix * gl_Vertex).xyz; - - ///FIXME: convert cartezian coordinates to geodetic, this - ///FIXME: duplicates parts of code in SGGeodesy.cxx - //////////////////////////////////////////////////////////////////////////// - float e2 = abs(1.0 - squash * squash); - float ra2 = 1.0/(a * a); - float e4 = e2 * e2; - float XXpYY = WorldPos.x * WorldPos.x + WorldPos.y * WorldPos.y; - float Z = WorldPos.z; - float sqrtXXpYY = sqrt(XXpYY); - float p = XXpYY * ra2; - float q = Z*Z*(1.0-e2)*ra2; - float r = 1.0/6.0*(p + q - e4); - float s = e4 * p * q/(4.0*r*r*r); - if ( s >= 2.0 && s <= 0.0) - s = 0.0; - float t = pow(1.0+s+sqrt(s*2.0+s*s), 1.0/3.0); - float u = r + r*t + r/t; - float v = sqrt(u*u + e4*q); - float w = (e2*u+ e2*v-e2*q)/(2.0*v); - float k = sqrt(u+v+w*w)-w; - float D = k*sqrtXXpYY/(k+e2); - - vec2 NormPosXY = normalize(WorldPos.xy); - vec2 NormPosXZ = normalize(vec2(D, WorldPos.z)); - float signS = sign(WorldPos.y); - if (-0.00015 <= WorldPos.y && WorldPos.y<=.00015) - signS = 1.0; - float signT = sign(WorldPos.z); - if (-0.0002 <= WorldPos.z && WorldPos.z<=.0002) - signT = 1.0; - float cosLon = dot(NormPosXY, vec2(1.0,0.0)); - float cosLat = dot(abs(NormPosXZ), vec2(1.0,0.0)); - TopoUV.s = signS * lonAdjust * degrees(acos(cosLon))/180.; - TopoUV.t = signT * latAdjust * degrees(acos(cosLat))/90.; - TopoUV.s = TopoUV.s * 0.5 + 0.5; - TopoUV.t = TopoUV.t * 0.5 + 0.5; - - //FIXME end///////////////////////////////////////////////////////////////// - - gl_Position = ftransform(); - } \ No newline at end of file diff --git a/Shaders/water_sine-gbuffer.frag b/Shaders/water_sine-gbuffer.frag deleted file mode 100644 index 957539b88..000000000 --- a/Shaders/water_sine-gbuffer.frag +++ /dev/null @@ -1,394 +0,0 @@ -// FRAGMENT SHADER -// This shader is mostly an adaptation of the shader found at -// http://www.bonzaisoftware.com/water_tut.html and its glsl conversion -// available at http://forum.bonzaisoftware.com/viewthread.php?tid=10 -// ©Michael Horsch - 2005 -// Major update and revisions - 2011-10-07 -// ©Emilian Huminiuc and Vivian Meazza -// Optimisation - 2012-5-05 -// Based on ideas by Thorsten Renk -// ©Emilian Huminiuc and Vivian Meazza - -#version 120 - -uniform sampler2D water_normalmap ; -uniform sampler2D water_reflection ; -uniform sampler2D water_dudvmap ; -uniform sampler2D water_reflection_grey ; -uniform sampler2D sea_foam ; -uniform sampler2D perlin_normalmap ; - -uniform sampler2D topo_map; - -uniform sampler3D Noise ; - - -uniform float saturation ; -uniform float Overcast ; -uniform float WindE ; -uniform float WindN ; -uniform float CloudCover0 ; -uniform float CloudCover1 ; -uniform float CloudCover2 ; -uniform float CloudCover3 ; -uniform float CloudCover4 ; -uniform float osg_SimulationTime ; -uniform float WaveFreq ; -uniform float WaveAmp ; -uniform float WaveSharp ; -uniform float WaveAngle ; -uniform float WaveFactor ; -uniform float WaveDAngle ; -uniform float normalmap_dds ; -uniform int Status ; - - -varying vec4 waterTex1 ; //moving texcoords -varying vec4 waterTex2 ; //moving texcoords - -varying vec3 WorldPos ; -varying vec2 TopoUV ; - -varying vec3 viewerdir ; -varying vec3 lightdir ; -varying vec3 normal ; -varying vec3 rawNormal ; -varying vec3 VTangent ; -varying vec3 VBinormal ; - -const vec4 AllOnes = vec4(1.0); -const vec4 sca = vec4(0.005, 0.005, 0.005, 0.005) ; -const vec4 sca2 = vec4(0.02, 0.02, 0.02, 0.02) ; -const vec4 tscale = vec4(0.25, 0.25, 0.25, 0.25) ; -const float water_shininess = 240.0 ; - -/////// functions ///////// -void encode_gbuffer(vec3 normal, vec3 color, int mId, float specular, float shininess, float emission, float depth); - - -void rotationmatrix(in float angle, out mat4 rotmat) - { - rotmat = mat4( cos( angle ), -sin( angle ), 0.0, 0.0, - sin( angle ), cos( angle ), 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); - } - -// wave functions /////////////////////// - -struct Wave { - float freq ; // 2*PI / wavelength - float amp ; // amplitude - float phase ; // speed * 2*PI / wavelength - vec2 dir ; - }; - -Wave wave0 = Wave(1.0, 1.0, 0.5, vec2(0.97, 0.25)) ; -Wave wave1 = Wave(2.0, 0.5, 1.3, vec2(0.97, -0.25)) ; -Wave wave2 = Wave(1.0, 1.0, 0.6, vec2(0.95, -0.3)) ; -Wave wave3 = Wave(2.0, 0.5, 1.4, vec2(0.99, 0.1)) ; - -float evaluateWave(in Wave w, vec2 pos, float t) - { - return w.amp * sin( dot(w.dir, pos) * w.freq + t * w.phase) ; - } - -// derivative of wave function -float evaluateWaveDeriv(Wave w, vec2 pos, float t) - { - return w.freq * w.amp * cos( dot(w.dir, pos)*w.freq + t*w.phase) ; - } - -// sharp wave functions -float evaluateWaveSharp(Wave w, vec2 pos, float t, float k) - { - return w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k) ; - } - -float evaluateWaveDerivSharp(Wave w, vec2 pos, float t, float k) - { - return k*w.freq*w.amp * pow(sin( dot(w.dir, pos)*w.freq + t*w.phase)* 0.5 + 0.5 , k - 1.0) * cos( dot(w.dir, pos)*w.freq + t*w.phase) ; - } - -void sumWaves(float angle, float dangle, float windScale, float factor, out float ddx, out float ddy) - { - mat4 RotationMatrix ; - float deriv ; - vec4 P = waterTex1 * 1024.0 ; - - rotationmatrix(radians(angle + dangle * windScale + 0.6 * sin(P.x * factor)), RotationMatrix) ; - P *= RotationMatrix ; - - P.y += evaluateWave(wave0, P.xz, osg_SimulationTime) ; - deriv = evaluateWaveDeriv(wave0, P.xz, osg_SimulationTime ) ; - ddx = deriv * wave0.dir.x ; - ddy = deriv * wave0.dir.y ; - - P.y += evaluateWave(wave1, P.xz, osg_SimulationTime) ; - deriv = evaluateWaveDeriv(wave1, P.xz, osg_SimulationTime) ; - ddx += deriv * wave1.dir.x ; - ddy += deriv * wave1.dir.y ; - - P.y += evaluateWaveSharp(wave2, P.xz, osg_SimulationTime, WaveSharp) ; - deriv = evaluateWaveDerivSharp(wave2, P.xz, osg_SimulationTime, WaveSharp) ; - ddx += deriv * wave2.dir.x ; - ddy += deriv * wave2.dir.y ; - - P.y += evaluateWaveSharp(wave3, P.xz, osg_SimulationTime, WaveSharp) ; - deriv = evaluateWaveDerivSharp(wave3, P.xz, osg_SimulationTime, WaveSharp) ; - ddx += deriv * wave3.dir.x ; - ddy += deriv * wave3.dir.y ; - } - -void main(void) - { - - mat4 RotationMatrix ; - - // compute direction to viewer - vec3 E = normalize(viewerdir) ; - - // compute direction to light source - //vec3 L = normalize(lightdir); - // half vector - //vec3 H = normalize(L + E); - - vec3 Normal = normalize(normal) ; - vec3 vNormal = normalize(rawNormal) ; - - - // approximate cloud cover - float cover = 0.0 ; - //bool Status = true; - - // Global bathymetry texture - vec4 topoTexel = texture2D(topo_map, TopoUV); - vec4 mixNoise = texture3D(Noise, WorldPos.xyz * 0.00005); - vec4 mixNoise1 = texture3D(Noise, WorldPos.xyz * 0.00008); - float mixNoiseFactor = mixNoise.r * mixNoise.g * mixNoise.b; - float mixNoise1Factor = mixNoise1.r * mixNoise1.g * mixNoise1.b; - mixNoiseFactor *= 300.0; - mixNoise1Factor *= 300.0; - mixNoiseFactor = 0.8 + 0.2 * smoothstep(0.0,1.0, mixNoiseFactor)* smoothstep(0.0,1.0, mixNoise1Factor); - float floorMixFactor = smoothstep(0.3, 0.985, topoTexel.a * mixNoiseFactor); - vec3 floorColour = mix(topoTexel.rgb, mixNoise.rgb * mixNoise1.rgb, 0.3); - - float windFloorFactor = 1.0 + 0.5 * smoothstep(0.8, 0.985, topoTexel.a); - float windEffect = sqrt( WindE*WindE + WindN*WindN ) * 0.6; //wind speed in kt - float windFloorEffect = windEffect * windFloorFactor; - float windScale = 15.0/(3.0 + windEffect); //wave scale - float windEffect_low = 0.3 + 0.7 * smoothstep(0.0, 5.0, windEffect); //low windspeed wave filter - float waveRoughness = 0.01 + smoothstep(0.0, 40.0, windEffect); //wave roughness filter - - float mixFactor = 0.2 + 0.02 * smoothstep(0.0, 50.0, windFloorEffect); - mixFactor = clamp(mixFactor, 0.3, 0.95); - // sine waves - - // Test data - //float WaveFreq =1.0; - //float WaveAmp = 1000.0; - //float WaveSharp = 10.0; - - vec4 ddxVec = vec4(0.0) ; - vec4 ddyVec = vec4(0.0) ; - - float ddx = 0.0, ddy = 0.0 ; - float ddx1 = 0.0, ddy1 = 0.0 ; - float ddx2 = 0.0, ddy2 = 0.0 ; - float ddx3 = 0.0, ddy3 = 0.0 ; - float waveamp ; - - float angle = 0.0 ; - float WaveAmpFromDepth = WaveAmp * (1.0 + 0.5 * smoothstep(0.8, 0.9, topoTexel.a)); - float phaseFloorFactor = 1.0 - 0.2 * smoothstep(0.8, 0.9, topoTexel.a); - wave0.freq = WaveFreq ; - wave0.amp = WaveAmpFromDepth ; - wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))) ; - wave0.phase *= phaseFloorFactor; - - angle -= 45.0 ; - wave1.freq = WaveFreq * 2.0 ; - wave1.amp = WaveAmpFromDepth * 1.25 ; - wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))) ; - wave1.phase *= phaseFloorFactor; - - angle += 30.0; - wave2.freq = WaveFreq * 3.5 ; - wave2.amp = WaveAmpFromDepth * 0.75 ; - wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))) ; - wave2.phase *= phaseFloorFactor; - - angle -= 50.0 ; - wave3.freq = WaveFreq * 3.0 ; - wave3.amp = WaveAmpFromDepth * 0.75 ; - wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))) ; - wave3.phase *= phaseFloorFactor; - - // sum waves - - ddx = 0.0, ddy = 0.0 ; - sumWaves(WaveAngle, -1.5, windScale, WaveFactor, ddx, ddy) ; - - ddx1 = 0.0, ddy1 = 0.0 ; - sumWaves(WaveAngle, 1.5, windScale, WaveFactor, ddx1, ddy1) ; - - //reset the waves - angle = 0.0 ; - waveamp = WaveAmpFromDepth * 0.75 ; - - wave0.freq = WaveFreq ; - wave0.amp = waveamp ; - wave0.dir = vec2(cos(radians(angle)), sin(radians(angle))) ; - - angle -= 20.0 ; - wave1.freq = WaveFreq * 2.0 ; - wave1.amp = waveamp * 1.25 ; - wave1.dir = vec2(cos(radians(angle)), sin(radians(angle))) ; - - angle += 35.0 ; - wave2.freq = WaveFreq * 3.5 ; - wave2.amp = waveamp * 0.75 ; - wave2.dir = vec2(cos(radians(angle)), sin(radians(angle))) ; - - angle -= 45.0 ; - wave3.freq = WaveFreq * 3.0 ; - wave3.amp = waveamp * 0.75 ; - wave3.dir = vec2(cos(radians(angle)), sin(radians(angle))) ; - - // sum waves - ddx2 = 0.0, ddy2 = 0.0 ; - sumWaves(WaveAngle + WaveDAngle, -1.5, windScale, WaveFactor, ddx2, ddy2) ; - - ddx3 = 0.0, ddy3 = 0.0 ; - sumWaves(WaveAngle + WaveDAngle, 1.5, windScale, WaveFactor, ddx3, ddy3) ; - - ddxVec = vec4(ddx, ddx1, ddx2, ddx3) ; - ddyVec = vec4(ddy, ddy1, ddy2, ddy3) ; - - float ddxSum = dot(ddxVec, AllOnes) ; - float ddySum = dot(ddyVec, AllOnes) ; - - if (Status == 1){ - cover = min(min(min(min(CloudCover0, CloudCover1),CloudCover2),CloudCover3),CloudCover4) ; - } else { - // hack to allow for Overcast not to be set by Local Weather - if (Overcast == 0.0){ - cover = 5.0; - } else { - cover = Overcast * 5.0; - } - } - - vec4 viewt = vec4(-E, 0.0) * 0.6 ; - - vec4 disdis = texture2D(water_dudvmap, vec2(waterTex2 * tscale)* windScale) * 2.0 - 1.0 ; - - vec2 uvAnimSca2 = (waterTex1 + disdis * sca2).st * windScale; - //normalmaps - vec4 nmap = texture2D(water_normalmap, uvAnimSca2) * 2.0 - 1.0; - vec4 nmap1 = texture2D(perlin_normalmap, uvAnimSca2) * 2.0 - 1.0; - - rotationmatrix(radians(3.0 * sin(osg_SimulationTime * 0.0075)), RotationMatrix); - vec2 uvAnimTscale = (waterTex2 * RotationMatrix * tscale).st * windScale; - - nmap += texture2D(water_normalmap, uvAnimTscale) * 2.0 - 1.0; - nmap1 += texture2D(perlin_normalmap, uvAnimTscale) * 2.0 - 1.0; - - // mix water and noise, modulated by factor - vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness) ; - vNorm.r += ddxSum ; - vNorm.y += ddySum ; - - if (normalmap_dds > 0)//dds fix - vNorm = -vNorm ; - - //load reflection - //vec4 tmp = vec4(lightdir, 0.0); - //vec4 tmp = vec4(0.0); - vec2 refTexUV = waterTex1.st * 32.0; - vec4 refTex = texture2D(water_reflection, refTexUV) ; - vec4 refTexGrey = texture2D(water_reflection_grey, refTexUV) ; - vec4 refl = vec4(0.0,0.0,0.0,1.0) ; - - // Test data - // cover = 0; - - if(cover >= 1.5){ - refl.rgb = normalize(refTex).rgb; - } - else - { - refl.rgb = normalize(refTexGrey).rgb; - refl.r *= (0.75 + 0.15 * cover); - refl.g *= (0.80 + 0.15 * cover); - refl.b *= (0.875 + 0.125 * cover); - } - - vec4 N0 = texture2D(water_normalmap, uvAnimSca2) * 2.0 - 1.0; - vec4 N1 = texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca) * windScale) * 2.0 - 1.0; - - N0 += texture2D(water_normalmap, vec2(waterTex1 * tscale) * windScale) * 2.0 - 1.0; - N1 += texture2D(perlin_normalmap, vec2(waterTex2 * tscale) * windScale) * 2.0 - 1.0; - - - rotationmatrix(radians(2.0 * sin(osg_SimulationTime * 0.005)), RotationMatrix); - vec2 uvAnimTscaleSca2 = (waterTex2 * RotationMatrix * (tscale + sca2)).st * windScale; - N0 += texture2D(water_normalmap, uvAnimTscaleSca2) * 2.0 - 1.0; - N1 += texture2D(perlin_normalmap, uvAnimTscaleSca2) * 2.0 - 1.0; - - rotationmatrix(radians(-4.0 * sin(osg_SimulationTime * 0.003)), RotationMatrix); - N0 += texture2D(water_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca2) * windScale) * 2.0 - 1.0; - N1 += texture2D(perlin_normalmap, vec2(waterTex1 * RotationMatrix + disdis * sca) * windScale) * 2.0 - 1.0; - - N0 *= windEffect_low; - N1 *= windEffect_low; - - N0.r += ddxSum; - N0.g += ddySum; - vec3 N2 = normalize(mix(N0.rgb, N1.rgb, mixFactor) * waveRoughness); - Normal = normalize(N2.x * VTangent + N2.y * VBinormal + N2.z * Normal); - //vNormal = normalize(mix(vNormal + N0, vNormal + N1, mixFactor) * waveRoughness); - vNormal = normalize(N2.x * vec3(1.0, 0.0, 0.0) + N2.y * vec3(0.0, 1., 0.0) + N2.z * vNormal); - if (normalmap_dds > 0){ //dds fix - Normal = -Normal; - vNormal = -vNormal; - } - - - // specular -// vec3 specular_color = vec3(1.0) * pow(max(0.0, dot(Normal, H)), water_shininess) * 6.0; -// vec4 specular = vec4(specular_color, 0.5); -// specular_color *= saturation * 0.3 ; -// float specular = saturation * 0.3; - - //calculate fresnel - float vNormDotViewT = dot(vNorm, viewt); - vec4 invfres = vec4( vNormDotViewT ); - vec4 fres = vec4(1.0) + invfres; - refl *= fres; - - refl.rgb = mix(refl.rgb, floorColour, floorMixFactor); - //calculate final colour - vec4 finalColor = refl; - - -//add foam - vec4 foam_texel = texture2D(sea_foam, (waterTex2 * tscale).st * 50.0); - float foamSlope = 0.1 + 0.1 * windScale; - - float waveSlope1 = vNormal.g * windFloorFactor * 0.96 ; //0.6; Normals values seem to be .25 of those in the classic pipeline - float waveSlope2 = vNorm.r * windFloorFactor * 0.4; //0.25; - float waveSlope = waveSlope1 + waveSlope2 ; - - finalColor = mix(finalColor, max(finalColor, finalColor + foam_texel), - smoothstep(7.0, 8.0, windFloorEffect) - * step(foamSlope, waveSlope) - * smoothstep(0.01, 0.50, waveSlope)); - - float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb + gl_FrontMaterial.emission.rgb, - vec3( 0.3, 0.59, 0.11 ) - ); - float specular = smoothstep(0.0, 3.5, cover); - - encode_gbuffer(Normal, finalColor.rgb, 254, specular, water_shininess, emission, gl_FragCoord.z); - } diff --git a/Compositor/Shaders/ALS/terrain-base.frag b/Shaders/ws30.frag similarity index 90% rename from Compositor/Shaders/ALS/terrain-base.frag rename to Shaders/ws30.frag index 6e84cdd19..f8fa8fb68 100644 --- a/Compositor/Shaders/ALS/terrain-base.frag +++ b/Shaders/ws30.frag @@ -1,3 +1,5 @@ +// WS30 FRAGMENT SHADER + // -*-C++-*- #version 120 @@ -8,16 +10,16 @@ varying vec3 normal; varying vec3 relPos; -uniform float fg_Fcoef; - -uniform sampler2D texture; +uniform sampler2D landclass; +uniform sampler2D grass; +uniform sampler2D city; +uniform sampler2D forest; +uniform sampler2D water; varying float yprime_alt; varying float mie_angle; -varying float flogz; - uniform float visibility; uniform float avisibility; @@ -29,6 +31,11 @@ uniform float overcast; uniform float eye_alt; uniform float cloud_self_shading; +// Passed from VPBTechnique, not the Effect +uniform int tile_level; +uniform float tile_width; +uniform float tile_height; + const float EarthRadius = 5800000.0; const float terminator_width = 200000.0; @@ -89,11 +96,25 @@ void main() // saturated. Clamping the color before modulating by the texture // is closer to what the OpenGL fixed function pipeline does. color = clamp(color, 0.0, 1.0); - texel = texture2D(texture, gl_TexCoord[0].st); + + int lc = int(texture2D(landclass, gl_TexCoord[0].st).r * 256.0 + 0.5); + + if ((lc == 1) || (lc == 2) || (lc == 4) || (lc == 5)) + { + texel = texture2D(city, gl_TexCoord[0].st); + } else if ((lc > 21) && (lc < 25)) + { + texel = texture2D(forest, gl_TexCoord[0].st); + } else if (lc > 38) + { + texel = texture2D(water, gl_TexCoord[0].st); + } else { + texel = texture2D(grass, gl_TexCoord[0].st); + } + + //texel = texture2D(texture, gl_TexCoord[0].st); fragColor = color * texel + specular; - - // here comes the terrain haze model @@ -249,7 +270,4 @@ fragColor.rgb = mix(hazeColor, fragColor.rgb,transmission); fragColor.rgb = filter_combined(fragColor.rgb); gl_FragColor = fragColor; -// logarithmic depth -gl_FragDepth = log2(flogz) * fg_Fcoef * 0.5; } - diff --git a/defaults.xml b/defaults.xml index 245769350..acdfcdeff 100644 --- a/defaults.xml +++ b/defaults.xml @@ -54,84 +54,10 @@ Started September 2000 by David Megginson, david@megginson.com false Materials/regions/materials.xml - - - false - 1024 - - - - false - default-pipeline - false - false - 0.6 - true - true - 0.6 - true - false - - false - 0.8 - 1.3 - false - - .393 - .769 - .189 - - - .349 - .686 - .168 - - - .272 - .534 - .131 - - false - - 0.0 - 0.0 - 1.0 - - false - 1.0 - false - - 1.0 - false - false - - false - - - - true - spec-emis - - - true - normal - - - true - diffuse - - - - true - true - true - true - true - false - false - - - + + false + 2048 + false 5 8 @@ -148,7 +74,7 @@ Started September 2000 by David Megginson, david@megginson.com 1.0 1.0 0.0 - 0.0 + 0.0 0.0 1.0 1.0 @@ -244,22 +170,6 @@ Started September 2000 by David Megginson, david@megginson.com true true - false - false - false - false - false - - true - false - 2048 - 4 - 2.0 - 8.0 - 32.0 - 128.0 - 1 - false true false diff --git a/gui/dialogs/environment-settings.xml b/gui/dialogs/environment-settings.xml index 5bb373790..e4d41a913 100644 --- a/gui/dialogs/environment-settings.xml +++ b/gui/dialogs/environment-settings.xml @@ -88,15 +88,45 @@ - hbox + vbox left left + + hbox + + + + climate-update + /environment/climate/weather-update + true + + dialog-apply + + + property-toggle + + + + + + climate-update + /environment/climate/environment-update + true + + dialog-apply + + + property-toggle + + + + - + metar-snow /environment/params/metar-updates-snow-level