Skip to content

Add Symmetry (X/Y/Z) and X-Ray support to the Fill tool - #2106

Open
Epersonf wants to merge 12 commits into
armory3d:mainfrom
Epersonf:issue-1861-implementation
Open

Epersonf wants to merge 12 commits into
armory3d:mainfrom
Epersonf:issue-1861-implementation

Conversation

@Epersonf

@Epersonf Epersonf commented Aug 1, 2026

Copy link
Copy Markdown

Closes Issue #1861

This PR adds the two capabilities requested in #1861 to the Fill tool (Face, Angle, and UV Island modes):

  • Symmetry (X/Y/Z): mirrors the picked point across the object's own local axis (position and rotation aware) and finds the closest matching point on the mesh's actual surface. This is a geometric query against the mesh's raw triangles rather than a re-render/re-pick, so it works even when the mirrored side isn't currently visible from the camera (e.g. mirroring top→bottom while looking down at the object).
  • X-Ray: casts a ray through the cursor against the mesh's raw triangles and keeps the second-closest hit — the surface directly behind the visible front one — so a single click can paint through to the far/inner side of thin geometry.

Both options reuse the existing X-Ray/Symmetry checkboxes already shown for Brush and other tools; they were previously hidden for Fill and are now exposed there too. Both candidates are combined with the primary pick via an OR condition in the discard shader (Face) or the angle-match test (Angle), and as extra flood-fill seeds (UV Island). Picks are recomputed every frame while painting (not just on the initial click), so dragging across multiple faces mirrors/x-rays correctly, without recompiling the shader unless a candidate's validity actually changes.

Implementation notes

  • paint/sources/util/util_render.c: new util_render_closest_point_on_mesh (closest-point-on-triangle query) backing symmetry, and util_render_pick_fill_xray (ray-cast, keeps 2nd hit) backing X-Ray.
  • paint/sources/render/make_discard.c, paint/sources/render/make_paint.c: OR the mirrored/x-ray candidates into the existing Face/Angle match tests.
  • paint/sources/util/util_uv.c: seeds the UV Island flood fill with the mirrored/x-ray UV coordinates too; also fixes a missing cache-valid guard so the island map isn't recomputed more than necessary.
  • paint/sources/util/util_brush.c: recomputes symmetry/x-ray candidates every frame while painting so they track the cursor during a drag.
  • paint/sources/uniforms.c, paint/sources/types.h, paint/sources/context.c, paint/sources/functions.h: plumbing for the new picked-candidate state and shader constants.
  • paint/sources/ui/ui_header.c: shows the X-Ray/Symmetry checkboxes for the Fill tool.

Fixes alignment/wrapping in the mirror/x-ray fill code to match the
project's enforced clang-format style (AlignConsecutiveAssignments).
@Epersonf
Epersonf force-pushed the issue-1861-implementation branch from 9cff617 to a316b16 Compare September 16, 2026 23:47
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.

1 participant