From 1a312cc4ea11d3404f584008869a668ea331e9a6 Mon Sep 17 00:00:00 2001 From: Cory Petkovsek <632766+TokisanGames@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:42:36 +0700 Subject: [PATCH] Fix #416 fireflies in terrain --- src/shaders/main.glsl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shaders/main.glsl b/src/shaders/main.glsl index 91c0917b2..888833f2c 100644 --- a/src/shaders/main.glsl +++ b/src/shaders/main.glsl @@ -1,7 +1,7 @@ // Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors. R"(shader_type spatial; -render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx; +render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx,skip_vertex_transform; /* This shader is generated based upon the debug views you have selected. * The terrain function depends on this shader. So don't change: @@ -158,6 +158,10 @@ void vertex() { UV -= v_uv_offset; v_uv2_offset = v_uv_offset * _region_texel_size; UV2 -= v_uv2_offset; + + // Convert model space to view space w/ skip_vertex_transform render mode + VERTEX = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz; + VERTEX = (VIEW_MATRIX * vec4(VERTEX, 1.0)).xyz; } ////////////////////////