From 7344cd40623dc18b19080112b5b956e186137f5a Mon Sep 17 00:00:00 2001 From: luboslenco Date: Thu, 16 Jan 2025 20:28:53 +0100 Subject: [PATCH] Improve bake quality --- armorpaint/sources/render_path_paint.ts | 7 +++++++ base/sources/history.ts | 1 - base/sources/slot_layer.ts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/armorpaint/sources/render_path_paint.ts b/armorpaint/sources/render_path_paint.ts index e7017c50f..dd6ef58b3 100644 --- a/armorpaint/sources/render_path_paint.ts +++ b/armorpaint/sources/render_path_paint.ts @@ -689,8 +689,15 @@ function render_path_paint_draw() { } if (context_raw.tool == workspace_tool_t.BAKE) { + if (context_raw.bake_type == bake_type_t.NORMAL || context_raw.bake_type == bake_type_t.HEIGHT || context_raw.bake_type == bake_type_t.DERIVATIVE) { if (!render_path_paint_baking && context_raw.pdirty > 0) { + + // Use RGBA128 texture format for high poly to low poly baking to prevent artifacts + // Existing undo layers are used during the baking process for now + base_bits_handle.position = texture_bits_t.BITS32; + layers_set_bits(); + render_path_paint_baking = true; _render_path_paint_bake_type = context_raw.bake_type; context_raw.bake_type = context_raw.bake_type == bake_type_t.NORMAL ? bake_type_t.NORMAL_OBJECT : bake_type_t.POSITION; // Bake high poly data diff --git a/base/sources/history.ts b/base/sources/history.ts index 9ec36ad1e..d830c02f9 100644 --- a/base/sources/history.ts +++ b/base/sources/history.ts @@ -522,7 +522,6 @@ function history_apply_mask() { history_push(tr("Apply Mask")); } - function history_invert_mask() { history_push(tr("Invert Mask")); } diff --git a/base/sources/slot_layer.ts b/base/sources/slot_layer.ts index 28a902e2a..b9122dd9d 100644 --- a/base/sources/slot_layer.ts +++ b/base/sources/slot_layer.ts @@ -377,7 +377,7 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { let format: tex_format_t = base_bits_handle.position == texture_bits_t.BITS8 ? tex_format_t.RGBA32 : base_bits_handle.position == texture_bits_t.BITS16 ? tex_format_t.RGBA64 : - tex_format_t.RGBA128; + tex_format_t.RGBA128; ///if is_sculpt format = tex_format_t.RGBA128;