Skip to content

Commit

Permalink
Fix bake export
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Jan 16, 2025
1 parent 4380cfe commit 1a0143b
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions armorpaint/sources/render_path_paint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,20 @@ function render_path_paint_is_rt_bake(): bool {
}
///end

function render_path_paint_update_bake_layer(bits: texture_bits_t) {
// 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
if (base_bits_handle.position != texture_bits_t.BITS32) {
base_bits_handle.position = bits;
slot_layer_resize_and_set_bits(context_raw.layer);
for (let i: i32 = 0; i < history_undo_layers.length; ++i) {
let l: slot_layer_t = history_undo_layers[i];
slot_layer_resize_and_set_bits(l);
}
base_bits_handle.position = texture_bits_t.BITS8;
}
}

function render_path_paint_draw() {
if (!render_path_paint_paint_enabled()) {
return;
Expand All @@ -693,10 +707,7 @@ function render_path_paint_draw() {
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_update_bake_layer(texture_bits_t.BITS32);

render_path_paint_baking = true;
_render_path_paint_bake_type = context_raw.bake_type;
Expand Down

0 comments on commit 1a0143b

Please sign in to comment.