Skip to content

feat: nodes material system and bug fix#266

Merged
wass08 merged 9 commits intopascalorg:mainfrom
sudhir9297:feat/nodes-material-system
Apr 20, 2026
Merged

feat: nodes material system and bug fix#266
wass08 merged 9 commits intopascalorg:mainfrom
sudhir9297:feat/nodes-material-system

Conversation

@sudhir9297
Copy link
Copy Markdown
Contributor

What does this PR do?

This PR upgrades the material system and interaction model across walls, stairs, roofs, and slabs by introducing multi-surface material support, click-targeted editing, and improved rendering stability.

It enables:

  • Independent material control for different surfaces (walls, stairs, roofs)
  • Direct click-based material editing in 3D instead of panel-only workflows
  • Backward compatibility with existing single-material objects
  • Improved UV handling and rendering consistency across all geometry types
  • Better selection, highlighting, and editing UX aligned with multi-surface materials

All updates are integrated into the existing architecture without introducing new state systems.


Walls

  • Added first-class two-sided wall material support for interior and exterior faces.
  • Kept wall top, bottom, end caps, and opening reveals on the base structural material.
  • Added backward-compatible migration from legacy single-material walls.
  • Updated wall merge logic so only walls with matching side-specific materials can merge.
  • Switched wall rendering to grouped/material-array rendering.
  • Updated wall cutaway and highlight behavior to support material arrays.
  • Restored wall panel to a single Material control instead of separate side pickers.
  • Added click-targeted wall-face editing in 3D (interior vs exterior).
  • Standardized wall panel actions (Move, Curve) into the shared Actions section.

Stairs

  • Added multi-surface stair material support for straight stairs:
    • Railing
    • Tread
    • Side / underside
  • Added backward-compatible migration from legacy single-material stairs.
  • Grouped stair geometry into tread vs side/underside regions.
  • Updated stair rendering so railing and stair body materials resolve independently.
  • Replaced separate stair material sections with click-targeted editing flow.
  • Added click-targeted material selection for:
    • Railing
    • Tread
    • Side / underside
  • Extended click-targeted editing to curved and spiral stairs.
  • Made curved/spiral center pillar selectable and mapped to side/underside material.
  • Fixed BVH/material crashes caused by mismatched placeholder geometry.
  • Replaced problematic placeholders with grouped empty geometries where required.
  • Fixed UV generation for straight stairs.
  • Fixed UV generation for curved and spiral stairs.
  • Added uv2 support for materials requiring secondary UVs.

Roofs

  • Added three logical roof material targets:
    • Top
    • Edge
    • Wall
  • Mapped inner wall-length faces to the wall material target.
  • Added backward-compatible migration from legacy single-material roofs.
  • Updated roof rendering to use grouped material arrays.
  • Added click-targeted roof material editing for:
    • Top faces
    • Edge faces
    • Inner wall-length faces
  • Kept roof panel as a single Material section (no duplication).
  • Fixed roof selection so merged roofs remain visually consistent.
  • Limited segment visualization to actual selected segments.
  • Fixed "Add Segment" UI to match shared action layout.

Roof Materials

  • Added new materials: wood1, wood2, wood3 to roof material picker.
  • Fixed roof UV generation.
  • Ensured UVs persist through geometry/CSG operations.
  • Added uv2 support for final roof geometry and segments.

Site / Ground Visuals

  • Investigated ghost/inverted footprint visible on ground grid.
  • Identified it as site ground masking behavior (not real geometry).
  • Removed the visual artifact so slabs no longer show ghost shapes.

Fence UVs

  • Fixed fence UV stretching issue.
  • Replaced single normalized projection with per-part UV mapping.
  • Applied unit-based mapping so rails/posts scale correctly.

Selection / Material Infrastructure

  • Extended shared selection system to support click-targeted material workflows.
  • Updated highlight and selection behavior to align with multi-surface materials across walls, stairs, and roofs.

Slab Material Fix & Stability

  • Investigated slab material loss after refresh.
  • Identified issue: material cloning before texture load caused fallback color rendering.
  • Fixed by applying preset materials directly to slab-owned material instances.
  • Ensured textures load correctly and persist visually after refresh.

Slider & Interaction Improvements

  • Updated wall Curve slider default step from 0.01m to 0.1m.
  • Standardized slider modifier behavior:
    • Cmd/Ctrl0.01
    • Shift1
    • Default → base step
  • Applied consistent modifier behavior across:
    • Drag
    • Mouse wheel
    • Arrow keys
    • Inline numeric input

Copy link
Copy Markdown
Collaborator

@wass08 wass08 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Need some changes before being merge-ready.
Also wasn't sure if having the material assignation in the renderer is better than in the system to prevent re-renders but we can keep it for now

localPosition: [localPoint.x, localPoint.y, localPoint.z],
normal: e.face ? [e.face.normal.x, e.face.normal.y, e.face.normal.z] : undefined,
faceIndex: e.faceIndex ?? undefined,
materialIndex: getIntersectionMaterialIndex(e.object, e.faceIndex ?? undefined),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass the object in the event, and let the events needing this extra computation do it only when needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update.

setMovingWallEndpoint: (value: MovingWallEndpoint | null) => void
curvingWall: WallNode | null
setCurvingWall: (wall: WallNode | null) => void
selectedWallMaterialTarget: SelectedWallMaterialTarget | null
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be replaced by selectedMaterialTarget with a generic type (and as we know the selected object we can deduct what type of node we're on) use AnyNodeId instead of roofNode['id'], wallNode['id']

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made the necessary changes.

@sudhir9297 sudhir9297 requested a review from wass08 April 20, 2026 19:07
Copy link
Copy Markdown
Collaborator

@wass08 wass08 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go!

@wass08 wass08 merged commit 86a4a82 into pascalorg:main Apr 20, 2026
@open-pascal open-pascal mentioned this pull request Apr 21, 2026
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.

2 participants