Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Playing Thrive 0.5.8.1
- Thrive is running. Log output:
- Process Started
- Godot Engine v3.4.4.stable.mono..3089e490a - https://godotengine.org
- OpenGL ES 3.0 Renderer: ATI Mobility Radeon HD 4200 Series
- OpenGL ES Batching: ON
- Mono: Log file is: 'C:/Users/Profile1/AppData/Roaming/Thrive/mono/mono_logs/2022-05-20_18.34.26_6820.log'
- This is Thrive version: 0.5.8.1
- Startup C# locale is: ru-RU Godot locale is: ru_RU
- user:// directory is: C:/Users/Profile1/AppData/Roaming/Thrive
- Game logs are written to: C:/Users/Profile1/AppData/Roaming/Thrive\logs latest log is 'log.txt'
- Doing delayed apply for some settings
- Set audio output device to: Default
- Set C# locale to: en Godot locale is: en
- No SteamClient class found, not initializing Steam
- Loaded registry for Compound with 11 items
- Loaded registry for MembraneType with 6 items
- Loaded registry for Background with 11 items
- Loaded registry for Biome with 11 items
- Loaded registry for BioProcess with 13 items
- Loaded registry for OrganelleDefinition with 23 items
- Loaded registry for MusicCategory with 6 items
- Loaded registry for HelpTexts with 5 items
- Loaded registry for NamedInputGroup with 6 items
- Loaded registry for Gallery with 3 items
- SimulationParameters loading ended
- SimulationParameters are good
- Loading mod Nodes into the scene tree
- Jukebox now playing from: Menu
- Jukebox: starting track: res://assets/sounds/main-menu-theme-1.ogg position: 0
- TaskExecutor started with parallel job count: 2
- Previous patch doesn't exist, despawning all entities.
- Applying patch (Tazermichen Volcanic Vent) settings
- Number of clouds in this patch = 8
- Registering new spawner: Name: ammonia density: 4E-05
- Registering new spawner: Name: glucose density: 2E-05
- Registering new spawner: Name: phosphates density: 4E-05
- Registering new spawner: Name: hydrogensulfide density: 4E-05
- oxygen spawn density is 0. It won't spawn
- carbondioxide spawn density is 0. It won't spawn
- nitrogen spawn density is 0. It won't spawn
- sunlight spawn density is 0. It won't spawn
- Number of chunks in this patch = 4
- Registering new spawner: Name: FLOATING_HAZARD density: 0.0001
- Registering new spawner: Name: SMALL_IRON_CHUNK density: 3E-05
- MARINE_SNOW spawn density is 0. It won't spawn
- Registering new spawner: Name: BIG_IRON_CHUNK density: 8E-05
- Number of species in this patch = 1
- Registering new spawner: Name: 1 density: 1.438849E-05
- Player Microbe spawned
- Jukebox now playing from: MicrobeStage
- 1 | #version 330
- 2 | #define GLES_OVER_GL
- 3 | #define MAX_LIGHT_DATA_STRUCTS 409
- 4 |
- 5 | #define MAX_FORWARD_LIGHTS 32
- 6 |
- 7 | #define MAX_REFLECTION_DATA_STRUCTS 455
- 8 |
- 9 | #define MAX_SKELETON_BONES 1365
- 10 |
- 11 | #define ENABLE_OCTAHEDRAL_COMPRESSION
- 12 | #define USE_LIGHT_DIRECTIONAL
- 13 | #define USE_FORWARD_LIGHTING
- 14 | #define USE_RADIANCE_MAP
- 15 | #define USE_RADIANCE_MAP_ARRAY
- 16 | #define SHADOW_MODE_PCF_5
- 17 | #define USE_SHADOW
- 18 | #define USE_LIGHTMAP_FILTER_BICUBIC
- 19 | #define LIGHT_DIRECTIONAL_SHADOW
- 20 | #define LIGHT_USE_PSSM4
- 21 | #define USE_MATERIAL
- 22 | #define ENABLE_UV_INTERP
- 23 | precision highp float;
- 24 | precision highp int;
- 25 |
- 26 |
- 27 | /* texture unit usage, N is max_texture_unity-N
- 28 |
- 29 | 1-skeleton
- 30 | 2-radiance
- 31 | 3-reflection_atlas
- 32 | 4-directional_shadow
- 33 | 5-shadow_atlas
- 34 | 6-decal_atlas
- 35 | 7-screen
- 36 | 8-depth
- 37 | 9-probe1
- 38 | 10-probe2
- 39 |
- 40 | */
- 41 |
- 42 | uniform highp mat4 world_transform;
- 43 | /* clang-format on */
- 44 |
- 45 | #define M_PI 3.14159265359
- 46 | #define SHADER_IS_SRGB false
- 47 |
- 48 | /* Varyings */
- 49 |
- 50 | #if defined(ENABLE_COLOR_INTERP)
- Output is too long, it was truncated! See the log file for full output.
- 873 |
- 874 | splane.xy /= splane.z;
- 875 | splane.xy = splane.xy * 0.5 + 0.5;
- 876 |
- 877 | splane.xy = splane.xy * clamp_rect.zw + clamp_rect.xy;
- 878 | splane.xy = clamp(splane.xy, clamp_rect.xy, clamp_rect.xy + clamp_rect.zw);
- 879 |
- 880 | highp vec4 ambient_out;
- 881 | ambient_out.a = blend;
- 882 | ambient_out.rgb = textureLod(reflection_atlas, splane.xy, 5.0).rgb;
- 883 | ambient_out.rgb = mix(reflections[idx].ambient.rgb, ambient_out.rgb, reflections[idx].ambient.a);
- 884 | if (reflections[idx].params.z < 0.5) {
- 885 | ambient_out.rgb = mix(ambient, ambient_out.rgb, blend);
- 886 | }
- 887 |
- 888 | ambient_out.rgb *= ambient_out.a;
- 889 | ambient_accum += ambient_out;
- 890 | } else {
- 891 | highp vec4 ambient_out;
- 892 | ambient_out.a = blend;
- 893 | ambient_out.rgb = reflections[idx].ambient.rgb;
- 894 | if (reflections[idx].params.z < 0.5) {
- 895 | ambient_out.rgb = mix(ambient, ambient_out.rgb, blend);
- 896 | }
- 897 | ambient_out.rgb *= ambient_out.a;
- 898 | ambient_accum += ambient_out;
- 899 | }
- 900 | #endif
- 901 | }
- 902 |
- 903 | #ifdef USE_LIGHTMAP
- 904 | #ifdef USE_LIGHTMAP_LAYERED
- 905 | uniform mediump sampler2DArray lightmap; //texunit:-9
- 906 | uniform int lightmap_layer;
- 907 | #else
- 908 | uniform mediump sampler2D lightmap; //texunit:-9
- 909 | #endif
- 910 |
- 911 | uniform mediump float lightmap_energy;
- 912 |
- 913 | #ifdef USE_LIGHTMAP_FILTER_BICUBIC
- 914 | uniform vec2 lightmap_texture_size;
- 915 |
- 916 | // w0, w1, w2, and w3 are the four cubic B-spline basis functions
- 917 | float w0(float a) {
- 918 | return (1.0 / 6.0) * (a * (a * (-a + 3.0) - 3.0) + 1.0);
- 919 | }
- 920 |
- 921 | float w1(float a) {
- 922 | return (1.0 / 6.0) * (a * a * (3.0 * a - 6.0) + 4.0);
- 923 | }
- 924 |
- 925 | float w2(float a) {
- 926 | return (1.0 / 6.0) * (a * (a * (-3.0 * a + 3.0) + 3.0) + 1.0);
- 927 | }
- 928 |
- 929 | float w3(float a) {
- 930 | return (1.0 / 6.0) * (a * a * a);
- 931 | }
- 932 |
- 933 | // g0 and g1 are the two amplitude functions
- 934 | float g0(float a) {
- 935 | return w0(a) + w1(a);
- 936 | }
- 937 |
- 938 | float g1(float a) {
- 939 | return w2(a) + w3(a);
- 940 | }
- 941 |
- 942 | // h0 and h1 are the two offset functions
- 943 | float h0(float a) {
- 944 | return -1.0 + w1(a) / (w0(a) + w1(a));
- 945 | }
- 946 |
- 947 | float h1(float a) {
- 948 | return 1.0 + w3(a) / (w2(a) + w3(a));
- 949 | }
- 950 |
- 951 | vec4 texture_bicubic(sampler2D tex, vec2 uv) {
- 952 | vec2 texel_size = vec2(1.0) / lightmap_texture_size;
- 953 |
- 954 | uv = uv * lightmap_texture_size + vec2(0.5);
- 955 |
- 956 | vec2 iuv = floor(uv);
- 957 | vec2 fuv = fract(uv);
- 958 |
- 959 | float g0x = g0(fuv.x);
- 960 | float g1x = g1(fuv.x);
- 961 | float h0x = h0(fuv.x);
- 962 | float h1x = h1(fuv.x);
- 963 | float h0y = h0(fuv.y);
- 964 | float h1y = h1(fuv.y);
- 965 |
- 966 | vec2 p0 = (vec2(iuv.x + h0x, iuv.y + h0y) - vec2(0.5)) * texel_size;
- 967 | vec2 p1 = (vec2(iuv.x + h1x, iuv.y + h0y) - vec2(0.5)) * texel_size;
- 968 | vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - vec2(0.5)) * texel_size;
- 969 | vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - vec2(0.5)) * texel_size;
- 970 |
- 971 | return (g0(fuv.y) * (g0x * texture(tex, p0) + g1x * texture(tex, p1))) +
- 972 | (g1(fuv.y) * (g0x * texture(tex, p2) + g1x * texture(tex, p3)));
- 973 | }
- 974 |
- 975 | vec4 textureArray_bicubic(sampler2DArray tex, vec3 uv) {
- 976 | vec2 texel_size = vec2(1.0) / lightmap_texture_size;
- 977 |
- 978 | uv.xy = uv.xy * lightmap_texture_size + vec2(0.5);
- 979 |
- 980 | vec2 iuv = floor(uv.xy);
- 981 | vec2 fuv = fract(uv.xy);
- 982 |
- 983 | float g0x = g0(fuv.x);
- 984 | float g1x = g1(fuv.x);
- 985 | float h0x = h0(fuv.x);
- 986 | float h1x = h1(fuv.x);
- 987 | float h0y = h0(fuv.y);
- 988 | float h1y = h1(fuv.y);
- 989 |
- 990 | vec2 p0 = (vec2(iuv.x + h0x, iuv.y + h0y) - vec2(0.5)) * texel_size;
- 991 | vec2 p1 = (vec2(iuv.x + h1x, iuv.y + h0y) - vec2(0.5)) * texel_size;
- 992 | vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - vec2(0.5)) * texel_size;
- 993 | vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - vec2(0.5)) * texel_size;
- 994 |
- 995 | return (g0(fuv.y) * (g0x * texture(tex, vec3(p0, uv.z)) + g1x * texture(tex, vec3(p1, uv.z)))) +
- 996 | (g1(fuv.y) * (g0x * texture(tex, vec3(p2, uv.z)) + g1x * texture(tex, vec3(p3, uv.z))));
- 997 | }
- 998 |
- 999 | #define LIGHTMAP_TEXTURE_SAMPLE(m_tex, m_uv) texture_bicubic(m_tex, m_uv)
- 1000 | #define LIGHTMAP_TEXTURE_LAYERED_SAMPLE(m_tex, m_uv) textureArray_bicubic(m_tex, m_uv)
- 1001 |
- 1002 | #else //!USE_LIGHTMAP_FILTER_BICUBIC
- 1003 | #define LIGHTMAP_TEXTURE_SAMPLE(m_tex, m_uv) texture(m_tex, m_uv)
- 1004 | #define LIGHTMAP_TEXTURE_LAYERED_SAMPLE(m_tex, m_uv) texture(m_tex, m_uv)
- 1005 |
- 1006 | #endif //USE_LIGHTMAP_FILTER_BICUBIC
- 1007 | #endif
- 1008 |
- 1009 | #ifdef USE_LIGHTMAP_CAPTURE
- 1010 | uniform mediump vec4[12] lightmap_captures;
- 1011 | #endif
- 1012 |
- 1013 | #ifdef USE_GI_PROBES
- 1014 |
- 1015 | uniform mediump sampler3D gi_probe1; //texunit:-9
- 1016 | uniform highp mat4 gi_probe_xform1;
- 1017 | uniform highp vec3 gi_probe_bounds1;
- 1018 | uniform highp vec3 gi_probe_cell_size1;
- 1019 | uniform highp float gi_probe_multiplier1;
- 1020 | uniform highp float gi_probe_bias1;
- 1021 | uniform highp float gi_probe_normal_bias1;
- 1022 | uniform bool gi_probe_blend_ambient1;
- 1023 |
- 1024 | uniform mediump sampler3D gi_probe2; //texunit:-10
- 1025 | uniform highp mat4 gi_probe_xform2;
- 1026 | uniform highp vec3 gi_probe_bounds2;
- 1027 | uniform highp vec3 gi_probe_cell_size2;
- 1028 | uniform highp float gi_probe_multiplier2;
- 1029 | uniform highp float gi_probe_bias2;
- 1030 | uniform highp float gi_probe_normal_bias2;
- 1031 | uniform bool gi_probe2_enabled;
- 1032 | uniform bool gi_probe_blend_ambient2;
- 1033 |
- 1034 | vec3 voxel_cone_trace(mediump sampler3D probe, vec3 cell_size, vec3 pos, vec3 ambient, bool blend_ambient, vec3 direction, float tan_half_angle, float max_distance, float p_bias) {
- 1035 | float dist = p_bias; //1.0; //dot(direction,mix(vec3(-1.0),vec3(1.0),greaterThan(direction,vec3(0.0))))*2.0;
- 1036 | float alpha = 0.0;
- 1037 | vec3 color = vec3(0.0);
- 1038 |
- 1039 | while (dist < max_distance && alpha < 0.95) {
- 1040 | float diameter = max(1.0, 2.0 * tan_half_angle * dist);
- 1041 | vec4 scolor = textureLod(probe, (pos + dist * direction) * cell_size, log2(diameter));
- 1042 | float a = (1.0 - alpha);
- 1043 | color += scolor.rgb * a;
- 1044 | alpha += a * scolor.a;
- 1045 | dist += diameter * 0.5;
- 1046 | }
- 1047 |
- 1048 | if (blend_ambient) {
- 1049 | color.rgb = mix(ambient, color.rgb, min(1.0, alpha / 0.95));
- 1050 | }
- 1051 |
- 1052 | return color;
- 1053 | }
- 1054 |
- 1055 | void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds, vec3 cell_size, vec3 pos, vec3 ambient, vec3 environment, bool blend_ambient, float multiplier, mat3 normal_mtx, vec3 ref_vec, float roughness, float p_bias, float p_normal_bias, inout vec4 out_spec, inout vec4 out_diff) {
- 1056 | vec3 probe_pos = (probe_xform * vec4(pos, 1.0)).xyz;
- 1057 | vec3 ref_pos = (probe_xform * vec4(pos + ref_vec, 1.0)).xyz;
- 1058 | ref_vec = normalize(ref_pos - probe_pos);
- 1059 |
- 1060 | probe_pos += (probe_xform * vec4(normal_mtx[2], 0.0)).xyz * p_normal_bias;
- 1061 |
- 1062 | /* out_diff.rgb = voxel_cone_trace(probe,cell_size,probe_pos,normalize((probe_xform * vec4(ref_vec,0.0)).xyz),0.0 ,100.0);
- 1063 | out_diff.a = 1.0;
- 1064 | return;*/
- 1065 | //out_diff = vec4(textureLod(probe,probe_pos*cell_size,3.0).rgb,1.0);
- 1066 | //return;
- 1067 |
- 1068 | //this causes corrupted pixels, i have no idea why..
- 1069 | if (any(bvec2(any(lessThan(probe_pos, vec3(0.0))), any(greaterThan(probe_pos, bounds))))) {
- 1070 | return;
- 1071 | }
- 1072 |
- 1073 | vec3 blendv = abs(probe_pos / bounds * 2.0 - 1.0);
- 1074 | float blend = clamp(1.0 - max(blendv.x, max(blendv.y, blendv.z)), 0.0, 1.0);
- 1075 | //float blend=1.0;
- 1076 |
- 1077 | float max_distance = length(bounds);
- 1078 |
- 1079 | //radiance
- 1080 | #ifdef VCT_QUALITY_HIGH
- 1081 |
- 1082 | #define MAX_CONE_DIRS 6
- 1083 | vec3 cone_dirs[MAX_CONE_DIRS] = vec3[](
- 1084 | vec3(0.0, 0.0, 1.0),
- 1085 | vec3(0.866025, 0.0, 0.5),
- 1086 | vec3(0.267617, 0.823639, 0.5),
- 1087 | vec3(-0.700629, 0.509037, 0.5),
- 1088 | vec3(-0.700629, -0.509037, 0.5),
- 1089 | vec3(0.267617, -0.823639, 0.5));
- 1090 |
- 1091 | float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.15, 0.15, 0.15, 0.15, 0.15);
- 1092 | float cone_angle_tan = 0.577;
- 1093 | float min_ref_tan = 0.0;
- 1094 | #else
- 1095 |
- 1096 | #define MAX_CONE_DIRS 4
- 1097 |
- 1098 | vec3 cone_dirs[MAX_CONE_DIRS] = vec3[](
- 1099 | vec3(0.707107, 0.0, 0.707107),
- 1100 | vec3(0.0, 0.707107, 0.707107),
- 1101 | vec3(-0.707107, 0.0, 0.707107),
- 1102 | vec3(0.0, -0.707107, 0.707107));
- 1103 |
- 1104 | float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.25, 0.25, 0.25);
- 1105 | float cone_angle_tan = 0.98269;
- 1106 | max_distance *= 0.5;
- 1107 | float min_ref_tan = 0.2;
- 1108 |
- 1109 | #endif
- 1110 | vec3 light = vec3(0.0);
- 1111 | for (int i = 0; i < MAX_CONE_DIRS; i++) {
- 1112 | vec3 dir = normalize((probe_xform * vec4(pos + normal_mtx * cone_dirs[i], 1.0)).xyz - probe_pos);
- 1113 | light += cone_weights[i] * voxel_cone_trace(probe, cell_size, probe_pos, ambient, blend_ambient, dir, cone_angle_tan, max_distance, p_bias);
- 1114 | }
- 1115 |
- 1116 | light *= multiplier;
- 1117 |
- 1118 | out_diff += vec4(light * blend, blend);
- 1119 |
- 1120 | //irradiance
- 1121 |
- 1122 | vec3 irr_light = voxel_cone_trace(probe, cell_size, probe_pos, environment, blend_ambient, ref_vec, max(min_ref_tan, tan(roughness * 0.5 * M_PI * 0.99)), max_distance, p_bias);
- 1123 |
- 1124 | irr_light *= multiplier;
- 1125 | //irr_light=vec3(0.0);
- 1126 |
- 1127 | out_spec += vec4(irr_light * blend, blend);
- 1128 | }
- 1129 |
- 1130 | void gi_probes_compute(vec3 pos, vec3 normal, float roughness, inout vec3 out_specular, inout vec3 out_ambient) {
- 1131 | roughness = roughness * roughness;
- 1132 |
- 1133 | vec3 ref_vec = normalize(reflect(normalize(pos), normal));
- 1134 |
- 1135 | //find arbitrary tangent and bitangent, then build a matrix
- 1136 | vec3 v0 = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(0.0, 1.0, 0.0);
- 1137 | vec3 tangent = normalize(cross(v0, normal));
- 1138 | vec3 bitangent = normalize(cross(tangent, normal));
- 1139 | mat3 normal_mat = mat3(tangent, bitangent, normal);
- 1140 |
- 1141 | vec4 diff_accum = vec4(0.0);
- 1142 | vec4 spec_accum = vec4(0.0);
- 1143 |
- 1144 | vec3 ambient = out_ambient;
- 1145 | out_ambient = vec3(0.0);
- 1146 |
- 1147 | vec3 environment = out_specular;
- 1148 |
- 1149 | out_specular = vec3(0.0);
- 1150 |
- 1151 | gi_probe_compute(gi_probe1, gi_probe_xform1, gi_probe_bounds1, gi_probe_cell_size1, pos, ambient, environment, gi_probe_blend_ambient1, gi_probe_multiplier1, normal_mat, ref_vec, roughness, gi_probe_bias1, gi_probe_normal_bias1, spec_accum, diff_accum);
- 1152 |
- 1153 | if (gi_probe2_enabled) {
- 1154 | gi_probe_compute(gi_probe2, gi_probe_xform2, gi_probe_bounds2, gi_probe_cell_size2, pos, ambient, environment, gi_probe_blend_ambient2, gi_probe_multiplier2, normal_mat, ref_vec, roughness, gi_probe_bias2, gi_probe_normal_bias2, spec_accum, diff_accum);
- 1155 | }
- 1156 |
- 1157 | if (diff_accum.a > 0.0) {
- 1158 | diff_accum.rgb /= diff_accum.a;
- 1159 | }
- 1160 |
- 1161 | if (spec_accum.a > 0.0) {
- 1162 | spec_accum.rgb /= spec_accum.a;
- 1163 | }
- 1164 |
- 1165 | out_specular += spec_accum.rgb;
- 1166 | out_ambient += diff_accum.rgb;
- 1167 | }
- 1168 |
- 1169 | #endif
- 1170 |
- 1171 | void main() {
- 1172 | #ifdef RENDER_DEPTH_DUAL_PARABOLOID
- 1173 |
- 1174 | if (dp_clip > 0.0)
- 1175 | discard;
- 1176 | #endif
- 1177 |
- 1178 | //lay out everything, whathever is unused is optimized away anyway
- 1179 | highp vec3 vertex = vertex_interp;
- 1180 | vec3 view = -normalize(vertex_interp);
- 1181 | vec3 albedo = vec3(1.0);
- 1182 | vec3 transmission = vec3(0.0);
- 1183 | float metallic = 0.0;
- 1184 | float specular = 0.5;
- 1185 | vec3 emission = vec3(0.0);
- 1186 | float roughness = 1.0;
- 1187 | float rim = 0.0;
- 1188 | float rim_tint = 0.0;
- 1189 | float clearcoat = 0.0;
- 1190 | float clearcoat_gloss = 0.0;
- 1191 | float anisotropy = 0.0;
- 1192 | vec2 anisotropy_flow = vec2(1.0, 0.0);
- 1193 |
- 1194 | #if defined(ENABLE_AO)
- 1195 | float ao = 1.0;
- 1196 | float ao_light_affect = 0.0;
- 1197 | #endif
- 1198 |
- 1199 | float alpha = 1.0;
- 1200 |
- 1201 | #if defined(ALPHA_SCISSOR_USED)
- 1202 | float alpha_scissor = 0.5;
- 1203 | #endif
- 1204 |
- 1205 | #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
- 1206 | vec3 binormal = normalize(binormal_interp);
- 1207 | vec3 tangent = normalize(tangent_interp);
- 1208 | #else
- 1209 | vec3 binormal = vec3(0.0);
- 1210 | vec3 tangent = vec3(0.0);
- 1211 | #endif
- 1212 | vec3 normal = normalize(normal_interp);
- 1213 |
- 1214 | #if defined(DO_SIDE_CHECK)
- 1215 | if (!gl_FrontFacing) {
- 1216 | normal = -normal;
- 1217 | }
- 1218 | #endif
- 1219 |
- 1220 | #if defined(ENABLE_UV_INTERP)
- 1221 | vec2 uv = uv_interp;
- 1222 | #endif
- 1223 |
- 1224 | #if defined(ENABLE_UV2_INTERP) || defined(USE_LIGHTMAP)
- 1225 | vec2 uv2 = uv2_interp;
- 1226 | #endif
- 1227 |
- 1228 | #if defined(ENABLE_COLOR_INTERP)
- 1229 | vec4 color = color_interp;
- 1230 | #endif
- 1231 |
- 1232 | #if defined(ENABLE_NORMALMAP)
- 1233 |
- 1234 | vec3 normalmap = vec3(0.5);
- 1235 | #endif
- 1236 |
- 1237 | float normaldepth = 1.0;
- 1238 |
- 1239 | #if defined(SCREEN_UV_USED)
- 1240 | vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
- 1241 | #endif
- 1242 |
- 1243 | #if defined(ENABLE_SSS)
- 1244 | float sss_strength = 0.0;
- 1245 | #endif
- 1246 |
- 1247 | {
- 1248 | /* clang-format off */
- 1249 | {
- 1250 | vec4 m_albedo=texture(m_albedoTexture, uv_interp);
- 1251 | vec4 m_normalmap=texture(m_normalTexture, uv_interp);
- 1252 | vec3 m_normals=vec3(((m_normalmap.r*2.0)-1.0), ((m_normalmap.g*2.0)-1.0), ((m_normalmap.b*2.0)-1.0));
- 1253 | float m_y=m_normals.y;
- 1254 | m_normals.y=-m_normals.z;
- 1255 | m_normals.z=m_y;
- 1256 | vec4 m_damaged=texture(m_damagedTexture, uv_interp);
- 1257 | vec4 m_final=(((m_albedo*m_healthFraction)+(m_damaged*(1.0-m_healthFraction)))*m_tint);
- 1258 | vec4 m_dissolveTex=texture(m_dissolveTexture, uv_interp);
- 1259 | float m_cutoff=(dot(m_dissolveTex.rgb, vec3(0.3,0.3,0.3))-float((-0.8+clamp(m_dissolveValue, 0.0, 1.0))));
- 1260 | albedo=m_final.rgb;
- 1261 | normal=(camera_matrix*(world_transform*vec4(m_normals, 0.0))).xyz;
- 1262 | alpha=(round(m_cutoff)*m_final.a);
- 1263 | }
- 1264 |
- 1265 |
- 1266 | /* clang-format on */
- 1267 | }
- 1268 |
- 1269 | #if !defined(USE_SHADOW_TO_OPACITY)
- 1270 |
- 1271 | #if defined(ALPHA_SCISSOR_USED)
- 1272 | if (alpha < alpha_scissor) {
- 1273 | discard;
- 1274 | }
- 1275 | #endif // ALPHA_SCISSOR_USED
- 1276 |
- 1277 | #ifdef USE_OPAQUE_PREPASS
- 1278 |
- 1279 | if (alpha < opaque_prepass_threshold) {
- 1280 | discard;
- 1281 | }
- 1282 |
- 1283 | #endif // USE_OPAQUE_PREPASS
- 1284 |
- 1285 | #endif // !USE_SHADOW_TO_OPACITY
- 1286 |
- 1287 | #if defined(ENABLE_NORMALMAP)
- 1288 |
- 1289 | normalmap.xy = normalmap.xy * 2.0 - 1.0;
- 1290 | normalmap.z = sqrt(max(0.0, 1.0 - dot(normalmap.xy, normalmap.xy))); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
- 1291 |
- 1292 | normal = normalize(mix(normal, tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z, normaldepth));
- 1293 |
- 1294 | #endif
- 1295 |
- 1296 | #if defined(LIGHT_USE_ANISOTROPY)
- 1297 |
- 1298 | if (anisotropy > 0.01) {
- 1299 | //rotation matrix
- 1300 | mat3 rot = mat3(tangent, binormal, normal);
- 1301 | //make local to space
- 1302 | tangent = normalize(rot * vec3(anisotropy_flow.x, anisotropy_flow.y, 0.0));
- 1303 | binormal = normalize(rot * vec3(-anisotropy_flow.y, anisotropy_flow.x, 0.0));
- 1304 | }
- 1305 |
- 1306 | #endif
- 1307 |
- 1308 | #ifdef ENABLE_CLIP_ALPHA
- 1309 | if (albedo.a < 0.99) {
- 1310 | //used for doublepass and shadowmapping
- 1311 | discard;
- 1312 | }
- 1313 | #endif
- 1314 |
- 1315 | /////////////////////// LIGHTING //////////////////////////////
- 1316 |
- 1317 | //apply energy conservation
- 1318 |
- 1319 | #ifdef USE_VERTEX_LIGHTING
- 1320 |
- 1321 | vec3 specular_light = specular_light_interp.rgb;
- 1322 | vec3 diffuse_light = diffuse_light_interp.rgb;
- 1323 | #else
- 1324 |
- 1325 | vec3 specular_light = vec3(0.0, 0.0, 0.0);
- 1326 | vec3 diffuse_light = vec3(0.0, 0.0, 0.0);
- 1327 |
- 1328 | #endif
- 1329 |
- 1330 | vec3 ambient_light;
- 1331 | vec3 env_reflection_light = vec3(0.0, 0.0, 0.0);
- 1332 |
- 1333 | vec3 eye_vec = view;
- 1334 |
- 1335 | // IBL precalculations
- 1336 | float ndotv = clamp(dot(normal, eye_vec), 0.0, 1.0);
- 1337 | vec3 f0 = F0(metallic, specular, albedo);
- 1338 | vec3 F = f0 + (max(vec3(1.0 - roughness), f0) - f0) * pow(1.0 - ndotv, 5.0);
- 1339 |
- 1340 | #ifdef USE_RADIANCE_MAP
- 1341 |
- 1342 | #ifdef AMBIENT_LIGHT_DISABLED
- 1343 | ambient_light = vec3(0.0, 0.0, 0.0);
- 1344 | #else
- 1345 | {
- 1346 | { //read radiance from dual paraboloid
- 1347 |
- 1348 | vec3 ref_vec = reflect(-eye_vec, normal);
- 1349 | float horizon = min(1.0 + dot(ref_vec, normal), 1.0);
- 1350 | ref_vec = normalize((radiance_inverse_xform * vec4(ref_vec, 0.0)).xyz);
- 1351 | vec3 radiance = textureDualParaboloid(radiance_map, ref_vec, roughness) * bg_energy;
- 1352 | env_reflection_light = radiance;
- 1353 | env_reflection_light *= horizon * horizon;
- 1354 | }
- 1355 | }
- 1356 | #ifndef USE_LIGHTMAP
- 1357 | {
- 1358 | vec3 norm = normal;
- 1359 | norm = normalize((radiance_inverse_xform * vec4(norm, 0.0)).xyz);
- 1360 | norm.xy /= 1.0 + abs(norm.z);
- 1361 | norm.xy = norm.xy * vec2(0.5, 0.25) + vec2(0.5, 0.25);
- 1362 | if (norm.z > 0.0001) {
- 1363 | norm.y = 0.5 - norm.y + 0.5;
- 1364 | }
- 1365 |
- 1366 | vec3 env_ambient = texture(irradiance_map, norm.xy).rgb * bg_energy;
- 1367 | env_ambient *= 1.0 - F;
- 1368 |
- 1369 | ambient_light = mix(ambient_light_color.rgb, env_ambient, radiance_ambient_contribution);
- 1370 | }
- 1371 | #endif
- 1372 | #endif //AMBIENT_LIGHT_DISABLED
- 1373 |
- 1374 | #else
- 1375 |
- 1376 | #ifdef AMBIENT_LIGHT_DISABLED
- 1377 | ambient_light = vec3(0.0, 0.0, 0.0);
- 1378 | #else
- 1379 | ambient_light = ambient_light_color.rgb;
- 1380 | env_reflection_light = bg_color.rgb * bg_energy;
- 1381 | #endif //AMBIENT_LIGHT_DISABLED
- 1382 |
- 1383 | #endif
- 1384 |
- 1385 | ambient_light *= ambient_energy;
- 1386 |
- 1387 | float specular_blob_intensity = 1.0;
- 1388 |
- 1389 | #if defined(SPECULAR_TOON)
- 1390 | specular_blob_intensity *= specular * 2.0;
- 1391 | #endif
- 1392 |
- 1393 | #ifdef USE_GI_PROBES
- 1394 | gi_probes_compute(vertex, normal, roughness, env_reflection_light, ambient_light);
- 1395 |
- 1396 | #endif
- 1397 |
- 1398 | #ifdef USE_LIGHTMAP
- 1399 | #ifdef USE_LIGHTMAP_LAYERED
- 1400 | ambient_light = LIGHTMAP_TEXTURE_LAYERED_SAMPLE(lightmap, vec3(uv2, float(lightmap_layer))).rgb * lightmap_energy;
- 1401 | #else
- 1402 | ambient_light = LIGHTMAP_TEXTURE_SAMPLE(lightmap, uv2).rgb * lightmap_energy;
- 1403 | #endif
- 1404 | #endif
- 1405 |
- 1406 | #ifdef USE_LIGHTMAP_CAPTURE
- 1407 | {
- 1408 | vec3 cone_dirs[12] = vec3[](
- 1409 | vec3(0.0, 0.0, 1.0),
- 1410 | vec3(0.866025, 0.0, 0.5),
- 1411 | vec3(0.267617, 0.823639, 0.5),
- 1412 | vec3(-0.700629, 0.509037, 0.5),
- 1413 | vec3(-0.700629, -0.509037, 0.5),
- 1414 | vec3(0.267617, -0.823639, 0.5),
- 1415 | vec3(0.0, 0.0, -1.0),
- 1416 | vec3(0.866025, 0.0, -0.5),
- 1417 | vec3(0.267617, 0.823639, -0.5),
- 1418 | vec3(-0.700629, 0.509037, -0.5),
- 1419 | vec3(-0.700629, -0.509037, -0.5),
- 1420 | vec3(0.267617, -0.823639, -0.5));
- 1421 |
- 1422 | vec3 local_normal = normalize(camera_matrix * vec4(normal, 0.0)).xyz;
- 1423 | vec4 captured = vec4(0.0);
- 1424 | float sum = 0.0;
- 1425 | for (int i = 0; i < 12; i++) {
- 1426 | float amount = max(0.0, dot(local_normal, cone_dirs[i])); //not correct, but creates a nice wrap around effect
- 1427 | captured += lightmap_captures[i] * amount;
- 1428 | sum += amount;
- 1429 | }
- 1430 |
- 1431 | captured /= sum;
- 1432 |
- 1433 | // Alpha channel is used to indicate if dynamic objects keep the environment lighting
- 1434 | if (lightmap_captures[0].a > 0.5) {
- 1435 | ambient_light += captured.rgb;
- 1436 | } else {
- 1437 | ambient_light = captured.rgb;
- 1438 | }
- 1439 | }
- 1440 | #endif
- 1441 |
- 1442 | #ifdef USE_FORWARD_LIGHTING
- 1443 |
- 1444 | highp vec4 reflection_accum = vec4(0.0, 0.0, 0.0, 0.0);
- 1445 | highp vec4 ambient_accum = vec4(0.0, 0.0, 0.0, 0.0);
- 1446 | for (int i = 0; i < reflection_count; i++) {
- 1447 | reflection_process(reflection_indices[i], vertex, normal, binormal, tangent, roughness, anisotropy, ambient_light, env_reflection_light, reflection_accum, ambient_accum);
- 1448 | }
- 1449 |
- 1450 | if (reflection_accum.a > 0.0) {
- 1451 | specular_light += reflection_accum.rgb / reflection_accum.a;
- 1452 | } else {
- 1453 | specular_light += env_reflection_light;
- 1454 | }
- 1455 | #if !defined(USE_LIGHTMAP) && !defined(USE_LIGHTMAP_CAPTURE)
- 1456 | if (ambient_accum.a > 0.0) {
- 1457 | ambient_light = ambient_accum.rgb / ambient_accum.a;
- 1458 | }
- 1459 | #endif
- 1460 | #endif
- 1461 |
- 1462 | {
- 1463 | #if defined(DIFFUSE_TOON)
- 1464 | //simplify for toon, as
- 1465 | specular_light *= specular * metallic * albedo * 2.0;
- 1466 | #else
- 1467 |
- 1468 | // scales the specular reflections, needs to be be computed before lighting happens,
- 1469 | // but after environment, GI, and reflection probes are added
- 1470 | // Environment brdf approximation (Lazarov 2013)
- 1471 | // see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile
- 1472 | const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
- 1473 | const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
- 1474 | vec4 r = roughness * c0 + c1;
- 1475 | float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
- 1476 | vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;
- 1477 | specular_light *= env.x * F + env.y;
- 1478 | #endif
- 1479 | }
- 1480 |
- 1481 | #if defined(USE_LIGHT_DIRECTIONAL)
- 1482 |
- 1483 | vec3 light_attenuation = vec3(1.0);
- 1484 |
- 1485 | float depth_z = -vertex.z;
- 1486 | #ifdef LIGHT_DIRECTIONAL_SHADOW
- 1487 | #if !defined(SHADOWS_DISABLED)
- 1488 |
- 1489 | #ifdef LIGHT_USE_PSSM4
- 1490 | if (depth_z < shadow_split_offsets.w) {
- 1491 | #elif defined(LIGHT_USE_PSSM2)
- 1492 | if (depth_z < shadow_split_offsets.y) {
- 1493 | #else
- 1494 | if (depth_z < shadow_split_offsets.x) {
- 1495 | #endif //LIGHT_USE_PSSM4
- 1496 |
- 1497 | vec3 pssm_coord;
- 1498 | float pssm_fade = 0.0;
- 1499 |
- 1500 | #ifdef LIGHT_USE_PSSM_BLEND
- 1501 | float pssm_blend;
- 1502 | vec3 pssm_coord2;
- 1503 | bool use_blend = true;
- 1504 | #endif
- 1505 |
- 1506 | #ifdef LIGHT_USE_PSSM4
- 1507 |
- 1508 | if (depth_z < shadow_split_offsets.y) {
- 1509 | if (depth_z < shadow_split_offsets.x) {
- 1510 | highp vec4 splane = (shadow_matrix1 * vec4(vertex, 1.0));
- 1511 | pssm_coord = splane.xyz / splane.w;
- 1512 |
- 1513 | #if defined(LIGHT_USE_PSSM_BLEND)
- 1514 |
- 1515 | splane = (shadow_matrix2 * vec4(vertex, 1.0));
- 1516 | pssm_coord2 = splane.xyz / splane.w;
- 1517 | pssm_blend = smoothstep(0.0, shadow_split_offsets.x, depth_z);
- 1518 | #endif
- 1519 |
- 1520 | } else {
- 1521 | highp vec4 splane = (shadow_matrix2 * vec4(vertex, 1.0));
- 1522 | pssm_coord = splane.xyz / splane.w;
- 1523 |
- 1524 | #if defined(LIGHT_USE_PSSM_BLEND)
- 1525 | splane = (shadow_matrix3 * vec4(vertex, 1.0));
- 1526 | pssm_coord2 = splane.xyz / splane.w;
- 1527 | pssm_blend = smoothstep(shadow_split_offsets.x, shadow_split_offsets.y, depth_z);
- 1528 | #endif
- 1529 | }
- 1530 | } else {
- 1531 | if (depth_z < shadow_split_offsets.z) {
- 1532 | highp vec4 splane = (shadow_matrix3 * vec4(vertex, 1.0));
- 1533 | pssm_coord = splane.xyz / splane.w;
- 1534 |
- 1535 | #if defined(LIGHT_USE_PSSM_BLEND)
- 1536 | splane = (shadow_matrix4 * vec4(vertex, 1.0));
- 1537 | pssm_coord2 = splane.xyz / splane.w;
- 1538 | pssm_blend = smoothstep(shadow_split_offsets.y, shadow_split_offsets.z, depth_z);
- 1539 | #endif
- 1540 |
- 1541 | } else {
- 1542 | highp vec4 splane = (shadow_matrix4 * vec4(vertex, 1.0));
- 1543 | pssm_coord = splane.xyz / splane.w;
- 1544 | pssm_fade = smoothstep(shadow_split_offsets.z, shadow_split_offsets.w, depth_z);
- 1545 |
- 1546 | #if defined(LIGHT_USE_PSSM_BLEND)
- 1547 | use_blend = false;
- 1548 |
- 1549 | #endif
- 1550 | }
- 1551 | }
- 1552 |
- 1553 | #endif //LIGHT_USE_PSSM4
- 1554 |
- 1555 | #ifdef LIGHT_USE_PSSM2
- 1556 |
- 1557 | if (depth_z < shadow_split_offsets.x) {
- 1558 | highp vec4 splane = (shadow_matrix1 * vec4(vertex, 1.0));
- 1559 | pssm_coord = splane.xyz / splane.w;
- 1560 |
- 1561 | #if defined(LIGHT_USE_PSSM_BLEND)
- 1562 |
- 1563 | splane = (shadow_matrix2 * vec4(vertex, 1.0));
- 1564 | pssm_coord2 = splane.xyz / splane.w;
- 1565 | pssm_blend = smoothstep(0.0, shadow_split_offsets.x, depth_z);
- 1566 | #endif
- 1567 |
- 1568 | } else {
- 1569 | highp vec4 splane = (shadow_matrix2 * vec4(vertex, 1.0));
- 1570 | pssm_coord = splane.xyz / splane.w;
- 1571 | pssm_fade = smoothstep(shadow_split_offsets.x, shadow_split_offsets.y, depth_z);
- 1572 | #if defined(LIGHT_USE_PSSM_BLEND)
- 1573 | use_blend = false;
- 1574 |
- 1575 | #endif
- 1576 | }
- 1577 |
- 1578 | #endif //LIGHT_USE_PSSM2
- 1579 |
- 1580 | #if !defined(LIGHT_USE_PSSM4) && !defined(LIGHT_USE_PSSM2)
- 1581 | { //regular orthogonal
- 1582 | highp vec4 splane = (shadow_matrix1 * vec4(vertex, 1.0));
- 1583 | pssm_coord = splane.xyz / splane.w;
- 1584 | }
- 1585 | #endif
- 1586 |
- 1587 | //one one sample
- 1588 |
- 1589 | float shadow = sample_shadow(directional_shadow, directional_shadow_pixel_size, pssm_coord.xy, pssm_coord.z, light_clamp);
- 1590 |
- 1591 | #if defined(LIGHT_USE_PSSM_BLEND)
- 1592 |
- 1593 | if (use_blend) {
- 1594 | shadow = mix(shadow, sample_shadow(directional_shadow, directional_shadow_pixel_size, pssm_coord2.xy, pssm_coord2.z, light_clamp), pssm_blend);
- 1595 | }
- 1596 | #endif
- 1597 |
- 1598 | #ifdef USE_CONTACT_SHADOWS
- 1599 | if (shadow > 0.01 && shadow_color_contact.a > 0.0) {
- 1600 | float contact_shadow = contact_shadow_compute(vertex, -light_direction_attenuation.xyz, shadow_color_contact.a);
- 1601 | shadow = min(shadow, contact_shadow);
- 1602 | }
- 1603 | #endif
- 1604 | light_attenuation = mix(mix(shadow_color_contact.rgb, vec3(1.0), shadow), vec3(1.0), pssm_fade);
- 1605 | }
- 1606 |
- 1607 | #endif // !defined(SHADOWS_DISABLED)
- 1608 | #endif //LIGHT_DIRECTIONAL_SHADOW
- 1609 |
- 1610 | #ifdef USE_VERTEX_LIGHTING
- 1611 | diffuse_light *= mix(vec3(1.0), light_attenuation, diffuse_light_interp.a);
- 1612 | specular_light *= mix(vec3(1.0), light_attenuation, specular_light_interp.a);
- 1613 |
- 1614 | #else
- 1615 | light_compute(normal, -light_direction_attenuation.xyz, eye_vec, binormal, tangent, light_color_energy.rgb, light_attenuation, albedo, transmission, light_params.z * specular_blob_intensity, roughness, metallic, specular, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light, alpha);
- 1616 | #endif
- 1617 |
- 1618 | #endif //#USE_LIGHT_DIRECTIONAL
- 1619 |
- 1620 | #ifdef USE_VERTEX_LIGHTING
- 1621 | diffuse_light *= albedo;
- 1622 | #endif
- 1623 |
- 1624 | #ifdef USE_FORWARD_LIGHTING
- 1625 |
- 1626 | #ifndef USE_VERTEX_LIGHTING
- 1627 |
- 1628 | for (int i = 0; i < omni_light_count; i++) {
- 1629 | light_process_omni(omni_light_indices[i], vertex, eye_vec, normal, binormal, tangent, albedo, transmission, roughness, metallic, specular, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, specular_blob_intensity, diffuse_light, specular_light, alpha);
- 1630 | }
- 1631 |
- 1632 | for (int i = 0; i < spot_light_count; i++) {
- 1633 | light_process_spot(spot_light_indices[i], vertex, eye_vec, normal, binormal, tangent, albedo, transmission, roughness, metallic, specular, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, specular_blob_intensity, diffuse_light, specular_light, alpha);
- 1634 | }
- 1635 |
- 1636 | #endif //USE_VERTEX_LIGHTING
- 1637 |
- 1638 | #endif
- 1639 |
- 1640 | #ifdef USE_SHADOW_TO_OPACITY
- 1641 | alpha = min(alpha, clamp(length(ambient_light), 0.0, 1.0));
- 1642 |
- 1643 | #if defined(ALPHA_SCISSOR_USED)
- 1644 | if (alpha < alpha_scissor) {
- 1645 | discard;
- 1646 | }
- 1647 | #endif // ALPHA_SCISSOR_USED
- 1648 |
- 1649 | #ifdef USE_OPAQUE_PREPASS
- 1650 |
- 1651 | if (alpha < opaque_prepass_threshold) {
- 1652 | discard;
- 1653 | }
- 1654 |
- 1655 | #endif // USE_OPAQUE_PREPASS
- 1656 |
- 1657 | #endif // USE_SHADOW_TO_OPACITY
- 1658 |
- 1659 | #ifdef RENDER_DEPTH
- 1660 | //nothing happens, so a tree-ssa optimizer will result in no fragment shader :)
- 1661 | #else
- 1662 |
- 1663 | specular_light *= reflection_multiplier;
- 1664 | ambient_light *= albedo; //ambient must be multiplied by albedo at the end
- 1665 |
- 1666 | #if defined(ENABLE_AO)
- 1667 | ambient_light *= ao;
- 1668 | ao_light_affect = mix(1.0, ao, ao_light_affect);
- 1669 | specular_light *= ao_light_affect;
- 1670 | diffuse_light *= ao_light_affect;
- 1
- 671 | #endif
- 1672 |
- 1673 | // base color remapping
- 1674 | diffuse_light *= 1.0 - metallic; // TODO: avoid all diffuse and ambient light calculations when metallic == 1 up to this point
- 1675 | ambient_light *= 1.0 - metallic;
- 1676 |
- 1677 | if (fog_color_enabled.a > 0.5) {
- 1678 | float fog_amount = 0.0;
- 1679 |
- 1680 | #ifdef USE_LIGHT_DIRECTIONAL
- 1681 |
- 1682 | vec3 fog_color = mix(fog_color_enabled.rgb, fog_sun_color_amount.rgb, fog_sun_color_amount.a * pow(max(dot(normalize(vertex), -light_direction_attenuation.xyz), 0.0), 8.0));
- 1683 | #else
- 1684 |
- 1685 | vec3 fog_color = fog_color_enabled.rgb;
- 1686 | #endif
- 1687 |
- 1688 | //apply fog
- 1689 |
- 1690 | if (fog_depth_enabled) {
- 1691 | float fog_far = fog_depth_end > 0.0 ? fog_depth_end : z_far;
- 1692 |
- 1693 | float fog_z = smoothstep(fog_depth_begin, fog_far, length(vertex));
- 1694 |
- 1695 | fog_amount = pow(fog_z, fog_depth_curve) * fog_density;
- 1696 | if (fog_transmit_enabled) {
- 1697 | vec3 total_light = emission + ambient_light + specular_light + diffuse_light;
- 1698 | float transmit = pow(fog_z, fog_transmit_curve);
- 1699 | fog_color = mix(max(total_light, fog_color), fog_color, transmit);
- 1700 | }
- 1701 | }
- 1702 |
- 1703 | if (fog_height_enabled) {
- 1704 | float y = (camera_matrix * vec4(vertex, 1.0)).y;
- 1705 | fog_amount = max(fog_amount, pow(smoothstep(fog_height_min, fog_height_max, y), fog_height_curve));
- 1706 | }
- 1707 |
- 1708 | float rev_amount = 1.0 - fog_amount;
- 1709 |
- 1710 | emission = emission * rev_amount + fog_color * fog_amount;
- 1711 | ambient_light *= rev_amount;
- 1712 | specular_light *= rev_amount;
- 1713 | diffuse_light *= rev_amount;
- 1714 | }
- 1715 |
- 1716 | #ifdef USE_MULTIPLE_RENDER_TARGETS
- 1717 |
- 1718 | #ifdef SHADELESS
- 1719 | diffuse_buffer = vec4(albedo.rgb, 0.0);
- 1720 | specular_buffer = vec4(0.0);
- 1721 |
- 1722 | #else
- 1723 |
- 1724 | //approximate ambient scale for SSAO, since we will lack full ambient
- 1725 | float max_emission = max(emission.r, max(emission.g, emission.b));
- 1726 | float max_ambient = max(ambient_light.r, max(ambient_light.g, ambient_light.b));
- 1727 | float max_diffuse = max(diffuse_light.r, max(diffuse_light.g, diffuse_light.b));
- 1728 | float total_ambient = max_ambient + max_diffuse;
- 1729 | #ifdef USE_FORWARD_LIGHTING
- 1730 | total_ambient += max_emission;
- 1731 | #endif
- 1732 | float ambient_scale = (total_ambient > 0.0) ? (max_ambient + ambient_occlusion_affect_light * max_diffuse) / total_ambient : 0.0;
- 1733 |
- 1734 | #if defined(ENABLE_AO)
- 1735 | ambient_scale = mix(0.0, ambient_scale, ambient_occlusion_affect_ao_channel);
- 1736 | #endif
- 1737 | diffuse_buffer = vec4(diffuse_light + ambient_light, ambient_scale);
- 1738 | specular_buffer = vec4(specular_light, metallic);
- 1739 |
- 1740 | #ifdef USE_FORWARD_LIGHTING
- 1741 | diffuse_buffer.rgb += emission;
- 1742 | #endif
- 1743 | #endif //SHADELESS
- 1744 |
- 1745 | normal_mr_buffer = vec4(normalize(normal) * 0.5 + 0.5, roughness);
- 1746 |
- 1747 | #if defined(ENABLE_SSS)
- 1748 | sss_buffer = sss_strength;
- 1749 | #endif
- 1750 |
- 1751 | #else //USE_MULTIPLE_RENDER_TARGETS
- 1752 |
- 1753 | #ifdef SHADELESS
- 1754 | frag_color = vec4(albedo, alpha);
- 1755 | #else
- 1756 | frag_color = vec4(ambient_light + diffuse_light + specular_light, alpha);
- 1757 | #ifdef USE_FORWARD_LIGHTING
- 1758 | frag_color.rgb += emission;
- 1759 | #endif
- 1760 | #endif //SHADELESS
- 1761 |
- 1762 | #endif //USE_MULTIPLE_RENDER_TARGETS
- 1763 |
- 1764 | #endif //RENDER_DEPTH
- 1765 | }
- 1766 |
- Jukebox: starting track: res://assets/sounds/microbe-theme-6.ogg position: 0
- Jukebox: starting track: res://assets/sounds/soundeffects/microbe-ambience2.ogg position: 0
- 3.cpp:156) ERROR: SceneShaderGLES3: Program LINK FAILED: Fragment shader(s) failed to link, Vertex shader(s) linked. Fragment Shader not supported by HWWARNING: warning(#276) Symbol 'position_interp' usage doesn't match between two stages at: get_current_version (drivers/gles3/shader_gles3.cpp:478) ERROR: Method failed. Returning: nullptr at: get_current_version (drivers/gles3/shader_gles3.cpp:485) ERROR: Condition "!version" is true. Returned: false at: bind (drivers/gles3/shader_gles3.cpp:118) ERROR: Condition "!version" is true. Returned: -1 at: _get_uniform (drivers/gles3/shader_gles3.h:362) ERROR: Condition "!version" is true. Returned: -1 at: _get_uniform (drivers/gles3/shader_gles3.h:362) ERROR: Condition "!version" is true. Returned: -1 at: _get_uniform (drivers/gles3/shader_gles3.h:362) ERROR: Condition "!version" is true. Returned: -1 at: _get_uniform (drivers/gles3/shader_gles3.h:362)
- child process exited with code 0
- Thrive has exited normally (exit code 0).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement