From 1bc79c5badfa9c469164a98303e99b915e0aa85e Mon Sep 17 00:00:00 2001 From: luboslenco Date: Sat, 18 Apr 2026 21:02:33 +0200 Subject: [PATCH] paint: fix displacement strength option --- paint/sources/make_depth.c | 2 +- paint/sources/make_material.c | 2 +- paint/sources/make_mesh.c | 2 +- paint/sources/parser_material.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/paint/sources/make_depth.c b/paint/sources/make_depth.c index 17ae60f8..a5a3084c 100644 --- a/paint/sources/make_depth.c +++ b/paint/sources/make_depth.c @@ -54,7 +54,7 @@ node_shader_context_t *make_depth_run(material_t *data, material_context_t *matc // } // } // } - // node_shader_write_vert(kong, string("output.wposition += wnormal * float3(height, height, height) * float3(%s, %s, %s);", + // node_shader_write_vert(kong, string("output.wposition += vert_wnormal * float3(height, height, height) * float3(%s, %s, %s);", // f32_to_string(displace_strength), f32_to_string(displace_strength), f32_to_string(displace_strength))); // } diff --git a/paint/sources/make_material.c b/paint/sources/make_material.c index b54263a4..3e2c0789 100644 --- a/paint/sources/make_material.c +++ b/paint/sources/make_material.c @@ -515,7 +515,7 @@ char *make_material_blend_mode_mask(node_shader_t *kong, i32 blending, char *col f32 make_material_get_displace_strength() { vec4_t sc = context_main_object()->base->transform->scale; - return g_config->displace_strength * 0.02 * sc.x; + return g_config->displace_strength * 0.1 * sc.x; } void make_material_parse_depth_material() { diff --git a/paint/sources/make_mesh.c b/paint/sources/make_mesh.c index f1351c5f..a12f3d96 100644 --- a/paint/sources/make_mesh.c +++ b/paint/sources/make_mesh.c @@ -144,7 +144,7 @@ node_shader_context_t *make_mesh_run(material_t *data, i32 layer_pass) { } } } - node_shader_write_vert(kong, string("output.wposition += wnormal * float3(height, height, height) * float3(%s, %s, %s);", + node_shader_write_vert(kong, string("output.wposition += vert_wnormal * float3(height, height, height) * float3(%s, %s, %s);", f32_to_string(displace_strength), f32_to_string(displace_strength), f32_to_string(displace_strength))); } diff --git a/paint/sources/parser_material.c b/paint/sources/parser_material.c index 841f5913..b91aafb8 100644 --- a/paint/sources/parser_material.c +++ b/paint/sources/parser_material.c @@ -289,9 +289,9 @@ void parser_material_finalize(node_shader_context_t *con) { node_shader_write_attrib_vert(kong, "output.wnormal = constants.N * float3(input.nor.xy, input.pos.w);"); node_shader_write_attrib_frag(kong, "var n: float3 = normalize(input.wnormal);"); } - else if (kong->vert_n) { + if (kong->vert_n) { node_shader_add_constant(kong, "N: float3x3", "_normal_matrix"); - node_shader_write_attrib_vert(kong, "var wnormal: float3 = normalize(constants.N * float3(input.nor.xy, input.pos.w));"); + node_shader_write_attrib_vert(kong, "var vert_wnormal: float3 = normalize(constants.N * float3(input.nor.xy, input.pos.w));"); } if (kong->frag_nattr) { node_shader_add_out(kong, "nattr: float3");