Skip to content

Texture Set list and Texture Set Settings: the missing settings and controls - #876

Draft
Rebornim wants to merge 7 commits into
storytold:mainfrom
Rebornim:feat/texture-sets-pass
Draft

Rebornim wants to merge 7 commits into
storytold:mainfrom
Rebornim:feat/texture-sets-pass

Conversation

@Rebornim

@Rebornim Rebornim commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Draft: work in progress. One commit lands per item of #861; the unticked items below are still to build. The panel layout itself comes last, after the engine items.

Texture Set list and Texture Set Settings: the missing settings and controls, built to work the same from the panels and from automation

Closes #861.

What the user saw

The Texture Set list showed a row per set with an eye and a size, and the Texture Set Settings panel had a square size, a fixed "Main shader" text, a plain channel list and a mesh map list. Several settings the project file already stored (normal mixing, ambient occlusion mixing) could not be changed, and the viewport ignored them.

Checklist

One commit per item.

  • Normal mixing (Combine / Replace) is a setting (textureSet.settings normalMixing), reported by textureSet.inspect; Replace keeps the height slope out of the viewport normal, the normal view and both path tracers (export already did this). Height still displaces.
  • Ambient occlusion mixing (Multiply / None) is a setting (textureSet.settings aoMixing), reported by textureSet.inspect; the viewport used to multiply the baked map in whatever the setting said (export already followed it). Changing it, or undoing that, resends the set's textures.
  • Height to normal method (Sharp / Smooth (Sobel)) is a setting (textureSet.settings heightToNormal), reported by textureSet.inspect. Export always used Sobel and the viewport and path tracers always used the plain neighbour difference; all four now follow the set's method. Projects without the field stay Smooth, so exports are unchanged and the viewport normal now matches them (a slight softening of single-texel height detail in the viewport of old projects).
  • UV padding (3D Space Neighbor / 2D Space Neighbor) is a setting (textureSet.settings uvPadding 3d|2d), reported by textureSet.inspect, followed by the viewport and export. 3D continues the surface across UV seams; tangent-space normals always pad in 2D. New sets use 3D (the reference default); projects without the field keep 2D, the padding they were made with, so they open and export as before.
  • Non-square texture sets: textureSet.resolution takes an optional height (default: square), textureSet.inspect reports height, export.plan reports height and sourceHeight. Paint resamples to the new shape; the viewport, padding, Mirror and Transform filters, mask export and file export follow both sides (the export size option sets the width, the height keeps the set's shape). A set whose UV tiles have their own sizes stays square (per-tile sizes are square, as in the reference), and the command says so. Projects without the field open square, as before. The width / lock / height controls come with the settings layout; until then picking a size in the panel keeps the set's shape.
  • A channel's storage format (Texture Set Settings: change a channel's storage format #652): textureSet.channel.format {channel, format} (sRGB8, L8, RGB8, L16, RGB16, L16F, RGB16F, L32F, RGB32F, one undo step), reported by textureSet.inspect. 8-bit formats keep 256 steps of the channel's composite (sRGB8 spaced for gamma, so darks keep more), L formats keep one grey value; 16-bit and float formats keep the 16 bits every channel had. The float formats are no wider than that yet, and values stay in the channel's range: they are offered so a set can name the format it exports for, and the command result does not pretend otherwise. Layer data keeps its precision, so going back to a wider format brings back what was painted. Until a format is set, every channel keeps the 16 bits TextureCraft always stored, shown as RGB16 / L16, in new and saved projects alike, so nothing renders differently until someone picks a format; setting one channel's format keeps the others at 16 bits. (The reference starts Base color at sRGB8 and scalars at L8; starting new sets there would quietly drop precision everyone has today, so 8 bits is a choice here, not the default.) The format picker comes with the settings layout.
  • More channels (the reference's full list, unused ones marked)
  • Manage channels window
  • Texture Set list rows: visibility menu, solo, size and shader per row, right-click menu, rename, UV tile rows
  • Texture Set Settings layout, description, shader dropdown, mesh map slots

What changed

TextureSet::height_in_normal is the one rule for normal mixing; export, the raster shader (disp.w, previously unused) and the path tracers (TraceSet::height_in_normal) read it. compose::display::tile_bytes takes the set's AoMixing; Session::invalidate_changed resends a set whose AO mixing an undo or redo changed. Both fields already had serde defaults (Combine, Multiply), so old projects open and render as before. HeightToNormalMethod::slope is the one height slope filter; mesh.wgsl (uv_rotation.w, previously unused) and trace.wgsl (bit 8 of a set's placeholder mask word) mirror it. geom::UvSeam::of_material finds a material's UV seams (edges two triangles share in 3D but not in UV space); compose::PaddingMaps holds a set's padding map plus a 2D one for tangent-space normals, used by pad_tiles (viewport, rebuilt by sync_caches when the mode changes) and export (ExportInput::seams). TextureSet::formats() gives each channel's stored format (format_precision, false until a format is set, maps 8-bit labels to 16-bit); compose::channel_store::stored applies it where composite_block encodes a texel, and SetCache::formats recomposites a set whose formats change (also on undo). TextureSet::resolution_height (None = square) with height(), set_size() and block_size(); size() follows block_size(). Export's sampler, padding and diffusion take the block's two sides; the height slope scales each axis by its own side, which is the old value on square sets.

Tests

  • set_cmds::tests::channel_format_changes_what_the_viewport_holds_and_undoes
  • channel_store::tests (8-bit steps, sRGB8 darks, grey formats, signed channels)
  • project::tests::sets_keep_16_bits_until_a_format_is_set_also_in_older_files
  • set_cmds::tests::normal_mixing_replace_keeps_height_out_of_the_normal_and_undoes
  • set_cmds::tests::ao_mixing_resends_the_set_to_the_viewport_and_undoes
  • it::bake_resolution (the viewport's occlusion texture with mixing None vs Multiply)
  • set_cmds::tests::height_to_normal_method_is_set_by_command_and_undoes
  • export::tests::height_to_normal_method_smooth_reaches_the_diagonal_neighbours
  • set_cmds::tests::uv_padding_rebuilds_the_viewport_padding_and_undoes
  • seam_padding::tests::padding_past_a_seam_continues_from_its_other_side_and_normals_stay_flat
  • export::tests::padding_past_a_seam_takes_the_far_island_except_for_normals
  • uv_seam::tests::a_closed_mesh_has_seams_and_a_single_island_has_none
  • project::tests::non_square_sets_are_wider_than_tall_per_block_and_stay_square_with_tile_sizes
  • uv_tile_cmds::tests::non_square_sets_keep_their_paint_export_wide_tiles_and_refuse_tile_sizes
  • eval::tests::a_mirror_on_a_wide_set_reflects_across_its_own_height

What ran

  • cargo check --workspace --tests (local, Rust 1.95.0).
  • On GitHub ubuntu-24.04 (Rust 1.96.0): cargo test -p texturecraft-engine --lib set_cmds, -p texturecraft-engine --test it bake_resolution, -p texturecraft-compose --lib display: passed (runs 45901291322, 45901294088, 45901297355 on Rebornim/texturecraft-builds).
  • On GitHub for the height to normal commit: cargo test -p texturecraft-engine --lib set_cmds, -p texturecraft-formats --lib export, and -p texturecraft-render --lib on a software GPU (the mesh and trace shaders compile there): passed (runs 45902594791, 45902598062, 45902675420).
  • cargo fmt --all --check and cargo clippy --all-targets -D warnings on core, render, formats, engine, automation, ui-egui (Rust 1.96.0, run 45903224104): fmt clean; clippy's only finding is nonminimal_bool at crates/ui-egui/src/settings_window.rs:159, which is on main too (not this PR), so ui-egui's test targets were not linted in that run.
  • On GitHub for the UV padding commit: cargo test -p texturecraft-geom -p texturecraft-compose --lib, -p texturecraft-formats --lib, -p texturecraft-engine (whole crate, including panic_hunt): passed (runs 45904820040, 45904822799, 45904826852); cargo fmt --all --check and cargo clippy --all-targets -D warnings on geom, compose, core, formats, engine: clean (run 45904909453).
  • On GitHub for the non-square commit: cargo test -p texturecraft-core -p texturecraft-compose -p texturecraft-formats --lib and -p texturecraft-engine (whole crate, including panic_hunt): passed (runs 45906991594, 45906995061); cargo fmt --all --check clean; cargo clippy --all-targets -D warnings stopped at settings_window.rs:159 (nonminimal_bool), which is on main already (fd39434) and not part of this PR, so clippy on ui-egui did not finish, and no other crate reported anything (run 45906998608); cargo xtask layers: passed (run 45907495768).
  • On GitHub for the channel format commit: cargo test -p texturecraft-core -p texturecraft-compose -p texturecraft-formats --lib and -p texturecraft-engine (whole crate, including panic_hunt): passed (runs 45909563553, 45909574976); cargo clippy -p texturecraft-core -p texturecraft-compose -p texturecraft-engine --all-targets -D warnings: clean (run 45908719661, whose one fmt finding, module order in compose's lib.rs, is fixed in the commit).
  • Not yet: full CI, wasm, layers.

…t out of the viewport normal

textureSet.settings takes normalMixing (combine or replace) as one undo step and
textureSet.inspect reports it. Replace already left the height slope out of exported
normals; the viewport, the normal view and both path tracers now follow it too, while
height still displaces. Projects without the field stay Combine.
…ps the baked map out of the viewport

textureSet.settings takes aoMixing (multiply or none) and textureSet.inspect reports it.
The viewport's occlusion texture multiplied the baked ambient occlusion in whatever the
setting said, while export already followed it; display tiles now take the set's mixing,
and changing it (or undoing the change) resends that set's textures.
@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

…command and followed by export, viewport and path tracers

textureSet.settings takes heightToNormal (sharp or smooth) as one undo step and
textureSet.inspect reports it. Smooth is the 3x3 Sobel filter export already used;
Sharp takes the two neighbours across, which the viewport and both path tracers
used until now. All four now read the set's method from one rule
(HeightToNormalMethod::slope, mirrored in mesh.wgsl and trace.wgsl). Projects
without the field stay Smooth, so their exports are unchanged; their viewport
normal now matches the export.
…y command and followed by the viewport and export

textureSet.settings takes uvPadding (3d or 2d) as one undo step and textureSet.inspect
reports it. 2D Space Neighbor is the padding we always had: each texel outside the UV
islands repeats the nearest covered texel. 3D Space Neighbor continues the surface across
UV seams: a texel just outside a seam takes the texel as far inside the seam's other
island (UvSeam finds the edges two triangles share in 3D but not in UV space), up to 32
texels out, and falls back to the nearest covered texel elsewhere. Tangent-space normals
always pad in 2D, since they turn with their island. New texture sets use 3D Space
Neighbor; projects without the field keep 2D, so they open and export as before.
…y command and followed by the viewport, filters and export

textureSet.resolution takes an optional height (default: square). Old projects open
square as before; sets whose UV tiles have their own sizes stay square.
@Rebornim
Rebornim force-pushed the feat/texture-sets-pass branch 3 times, most recently from 99dbd21 to 358ae7c Compare November 26, 2026 23:12
…ange what the composite holds

textureSet.channel.format {channel, format} stores a channel in sRGB8, L8, RGB8, L16, RGB16, L16F,
RGB16F, L32F or RGB32F, as one undo step. The composite keeps 256 steps for 8-bit formats (sRGB8
spaced for gamma) and one grey value for L formats; 16-bit and float formats keep the tiles' 16 bits,
and the command says so for floats. Layer data keeps its precision, so a wider format brings back
what was painted.

Until a format is set, every channel keeps the 16 bits TextureCraft always stored (shown as RGB16 /
L16), so new and saved projects render as before; setting one channel's format keeps the others at
16 bits.
@Rebornim
Rebornim force-pushed the feat/texture-sets-pass branch from 358ae7c to 8a33d75 Compare November 26, 2026 23:12
…xported, with inspect marking the ones the shader ignores
@Rebornim
Rebornim force-pushed the feat/texture-sets-pass branch from 801d829 to 81dc529 Compare November 26, 2026 23:42

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Texture Set list + Texture Set Settings parity

1 participant