diff --git a/data/pipelines/atmo.shd b/data/pipelines/atmo.shd index 533ed4810..ccabbf2cb 100644 --- a/data/pipelines/atmo.shd +++ b/data/pipelines/atmo.shd @@ -53,7 +53,7 @@ fragment_shader [[ float a = 3.0*(1.0-g*g); float b = 2.0*(2.0+g*g); float c = 1.0+alpha*alpha; - float d = pow(1.0+g*g-2.0*g*alpha, 1.5); + float d = pow(abs(1.0+g*g-2.0*g*alpha), 1.5); return (a/b)*(c/d); } diff --git a/data/pipelines/common.glsl b/data/pipelines/common.glsl index 489ed958f..e04b66827 100644 --- a/data/pipelines/common.glsl +++ b/data/pipelines/common.glsl @@ -178,7 +178,7 @@ vec4 fullscreenQuad(int vertexID, out vec2 uv) { float packEmission(float emission) { - return log2(1 + emission / 64); + return log2(1 + emission / 64.0); } @@ -207,10 +207,10 @@ float toLinearDepth(mat4 inv_proj, float ndc_depth) fragcoord.y = Global.framebuffer_size.y - fragcoord.y - 1; #endif - cluster = ivec3(fragcoord.xy / 64, 0); + cluster = ivec3(fragcoord.xy / 64.0, 0); float linear_depth = toLinearDepth(Global.inv_projection, ndc_depth); cluster.z = int(log(linear_depth) * 16 / (log(10000 / 0.1)) - 16 * log(0.1) / log(10000 / 0.1)); - ivec2 tiles = (Global.framebuffer_size + 63) / 64; + ivec2 tiles = ivec2((Global.framebuffer_size + 63) / 64.0); cluster.y = tiles.y - 1 - cluster.y; return b_clusters[cluster.x + cluster.y * tiles.x + cluster.z * tiles.x * tiles.y]; } @@ -223,9 +223,9 @@ float toLinearDepth(mat4 inv_proj, float ndc_depth) fragcoord.y = Global.framebuffer_size.y - fragcoord.y - 1; #endif - cluster = ivec3(fragcoord.xy / 64, 0); + cluster = ivec3(fragcoord.xy / 64.0, 0); cluster.z = int(log(linear_depth) * 16 / (log(10000 / 0.1)) - 16 * log(0.1) / log(10000 / 0.1)); - ivec2 tiles = (Global.framebuffer_size + 63) / 64; + ivec2 tiles = ivec2((Global.framebuffer_size + 63) / 64.0); cluster.y = tiles.y - 1 - cluster.y; return b_clusters[cluster.x + cluster.y * tiles.x + cluster.z * tiles.x * tiles.y]; } @@ -331,7 +331,7 @@ float getShadow(sampler2D shadowmap, vec3 wpos, vec3 N) float occluder = textureLod(shadowmap, uv, 0).r; shadow += receiver > occluder - length(pcf_offset) * bias * 3 ? 1 : 0; } - return shadow / 16; + return shadow / 16.0; } } #endif @@ -538,7 +538,7 @@ vec3 pointLightsLighting(Cluster cluster, Surface surface, sampler2D shadow_atla float occluder = textureLod(shadow_atlas, uv, 0).r; shadow += receiver * 1.02 > occluder ? 1 : 0; } - attn *= shadow / 16; + attn *= shadow / 16.0; } float fov = b_lights[light_idx].fov; diff --git a/data/pipelines/debug_shape.shd b/data/pipelines/debug_shape.shd index 87e1de524..97ee0b738 100644 --- a/data/pipelines/debug_shape.shd +++ b/data/pipelines/debug_shape.shd @@ -10,7 +10,7 @@ vertex_shader [[ layout (location = 0) out vec4 v_color; void main() { - v_color = vec4(pow(a_color.rgb, vec3(2.2)), a_color.a); + v_color = vec4(pow(abs(a_color.rgb), vec3(2.2)), a_color.a); gl_Position = Pass.view_projection * u_model * vec4(a_position, 1); } ]] diff --git a/data/pipelines/ibl_filter.shd b/data/pipelines/ibl_filter.shd index 042b3a111..8cc989740 100644 --- a/data/pipelines/ibl_filter.shd +++ b/data/pipelines/ibl_filter.shd @@ -83,7 +83,7 @@ fragment_shader [[ { vec2 uv = v_uv * 2 - 1; uv.y *= -1; - vec3 N; + vec3 N = vec3(0); switch(u_face) { case 0: N = vec3(1, -uv.y, -uv.x); break; diff --git a/data/pipelines/standard.shd b/data/pipelines/standard.shd index 0ad58203e..3000b8f47 100644 --- a/data/pipelines/standard.shd +++ b/data/pipelines/standard.shd @@ -102,7 +102,7 @@ vertex_shader [[ v_lod = i_lod; #endif #if defined GRASS && defined VEGETATION - p = vegetationAnim(i_pos_scale.xyz, p, 1.0 / (1.0 + u_stiffness)); + p = vegetationAnim(i_pos_scale.xyz, p, 1 / (1.0 + u_stiffness)); v_darken = a_position.y > 0.1 ? 1 : 0.0; #elif defined VEGETATION #ifdef DEPTH