CTS_PBR Studio Pro — 1.0.0
CAD Tools Studio

FINAL MATERIAL-PREVIEW PERFORMANCE BUILD
Material / Renderer selector and Apply button sit beside the map thumbnails. Targets: SketchUp diffuse, SketchUp PBR (2025+), V-Ray apply and Enscape apply. Enscape application works through renderer-native material metadata on SketchUp 2021-2026 and does not depend on SketchUp's 2025+ PBR API. D5 remains export-only. V-Ray geometry displacement is not included.
V-Ray apply builds a renderer-native .vrmat from the supplied V-Ray 7.4 template. Diffuse maps to Diffuse, roughness maps to Reflection Roughness, optional specular maps to Reflection Color, the original unmodified normal/bump image maps to Bump, and opacity maps to Opacity when available. Enscape apply no longer creates or opens a .matpkg. It builds a temporary native SketchUp SKM from the Enscape-saved NORMAL, BUMP and DISPLACEMENT metadata structure and loads it internally, which makes Enscape register its renderer-only slots. Diffuse maps to Albedo, roughness maps to Reflections, and the selected Normal, Bump or Displacement image maps to Enscape Height. For Bump and Displacement, SketchUp's native Normal slot is explicitly disabled so it cannot override the chosen Enscape Height type. Displacement application strips any embedded alpha from Albedo and disables opacity automatically because Enscape does not allow displacement on transparent materials. The original map files and one common physical width/height are used for every Enscape slot. Compatible opacity maps are assigned to Mask/Transparency for Normal and Bump. AO remains an exported reference map. Metalness defaults to zero. V-Ray geometry displacement remains excluded for stability.

DIRECT IMPORT
Import PBR folder and Import PBR ZIP are always visible directly below Load diffuse image. Supported inputs: PNG/JPG maps with channel suffixes such as _diff, _normal, _rough, _disp, _ao, _mask. Multiple detected sets appear in the Texture set selector.

SIMPLE ALPHA
Open Alpha / mask / cutout and enable simple alpha. Choose a background colour (or pick from the diffuse preview), bright background, dark background, or existing transparency. Adjust tolerance, brightness threshold, soft edge, opacity and invert. White keeps the surface; black removes it. View/export the grayscale mask and transparent PNG. Similar foreground colours can also be removed: this is colour/brightness selection, not object recognition. A simple polygon outline is available for multicolour backgrounds. Click points around the object in Diffuse / Map view, then Finish outline. Undo removes the last point; New outline starts again. The selected polygon is kept; Invert keeps the exterior. This is manual selection, not automatic edge snapping or AI segmentation. No advanced brush editor is included. Existing PNG alpha and imported opacity multiply once. Original source pixels remain unchanged. Alpha outputs are capped at 2K.

LIVE PERFORMANCE
Generated PBR sliders use a small background-worker preview while dragging, with only the latest pending update retained. Full-resolution generation follows a short pause or slider release. Simple alpha reuses a persistent worker and caches input pixels on both sides. Opacity changes reuse the computed selection. Preview updates are coalesced to animation frames; thumbnails refresh after completion instead of on every drag event. Full-resolution finishing starts after a short pause. The selected preview canvas is cached to avoid repeatedly converting the same source pixels. Imported-map sliders preview at reduced size and finish on release. Apply, Copy and Export wait for finished maps. Full-resolution generation is not instantaneous and depends on image size/settings/hardware.
Colour variation (hue/saturation/value/RGB), seamless controls, tiles and grooves remain available. Use 1K for faster final output. Live preview updates the tool; renderer/model application is explicit via Apply, avoiding repeated native material uploads during a drag.

APPLY
Repeated material/map preparation is cached. Apply stays disabled until SketchUp acknowledges completion, preventing overlapping requests. New V-Ray materials can still take time to upload; first-Apply latency is not guaranteed. Default renderer metalness remains zero. All applied map channels share material width/height.

ASPECT RATIO
Original image ratio, 1:1, 1:2, 2:1, 2:3, 3:2, 1:3 and 3:1. The padlock links physical width and height in millimetres. Unlock for independent sizes. Ratios change material mapping dimensions, not exported pixel cropping.

ERROR RECOVERY
Generation failures are shown in the status bar. Use Regenerate after a failed PBR job. If alpha fails, switch Enable simple alpha off/on to retry. Refresh clears maps and cancels pending jobs. Export/apply are blocked while results are incomplete or alpha has failed.

EXAMPLE ALPHA SETTINGS
Black-background character: click Black background. Colour #000000, tolerance 0.025, soft edge 0.015, edge-connected background only ON, opacity 1, invert OFF. Increase tolerance cautiously if a dark fringe remains. Interior dark details disconnected from the image border are preserved.
Multicolour-background character: click Multicolour background. Outline the silhouette closely, Finish outline, edge softness 1 pixel, opacity 1, invert OFF. Zoom and add points at fingers, feet and other bends. Colour key alone cannot reliably isolate this character because subject and background share colours. A single outline supports one contour; holes or separate contours require an externally created mask imported through Optional opacity import.

INSTALL
Install the RBZ through SketchUp Extension Manager and fully restart SketchUp. Version remains 1.0.0. Keep a backup of your model when testing an updated extension.

VALIDATION AND LIMITS
Additional tests cover direct ZIP/folder selection, both attached source images, black-background removal, polygon rasterization/export, saved outline settings and repeated unchanged alpha events. Automated browser tests exercise live generation, ratio locking, alpha composition/non-mutation, full-size mask/cutout export, continuous alpha sliders, renderer target payloads, worker failure/recovery and refresh cancellation. Ruby/JavaScript syntax checks are included in build validation. Browser bridge tests do not constitute native SketchUp, V-Ray or Enscape runtime validation. No promise of zero bugs, universal renderer support or exact geometry recovery from diffuse colour is made.

IMPLEMENTATION REFERENCES
SketchUp API guidance: model APIs stay on the main thread; image workers never call them. Model edits use undo operations and callbacks report failures.
https://ruby.sketchup.com/file.overview.html
https://ruby.sketchup.com/UI/HtmlDialog.html
https://ruby.sketchup.com/Sketchup/Model.html
Worker transferables avoid cloning large output buffers; UI events are coalesced and preview results are disposable.
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Optimizing_canvas

ALPHA PERFORMANCE CHECK
A headless Chromium benchmark using a 2048 x 1024 image and eight opacity-slider changes measured median preview response of 113 ms for the preceding build and 18 ms for this build. These are browser measurements, not SketchUp-native timings. Full-resolution finishing and complex selections take longer. 0.01-second response is not guaranteed.

MATERIAL CONTROL PERFORMANCE UPDATE (19 OCT 2026)
All material sliders share reusable background workers with cached source pixels, animation-frame input coalescing, and only the latest pending preview. Imported-map preview resizes are cached. Shared floating-point height/filter calculations are cached when their dependencies are unchanged. Changing source images or relevant geometry parameters invalidates the cache. No output resolution, final filters, bit depth or map formulas were reduced. Live previews retain the preceding build's 512-pixel working size; Apply/Export wait for full-quality final maps.

A regression sequence covering all 64 material control definitions matched the preceding build's output hashes for all generated channels, including 16-bit relief arrays, after each change. The sequence used one generation worker instead of 65. Browser tests also covered rapid changes, refresh cancellation, failed-worker recovery and source replacement. Native SketchUp/V-Ray/Enscape were not available for testing.

On a 1024 x 512 synthetic input, ten alternating normal/height slider changes measured median live-preview latency of 81 ms before and 53 ms after this update, including the first worker start. Values vary with the image, control, machine and renderer. Some first/complex updates were slower; under 0.01 seconds for every control is not guaranteed. Full-resolution output processing can take longer.

DROPDOWN / SECTION PREVIEW FIX
Category, surface finish, relief method, output size and controls inside Seamless, Tile grid/grooves and Surface preparation now request a live preview before full-resolution finishing. Previously, their change events could bypass the live path. Final generation waits for the preview to finish instead of interrupting a slow first preview. Repeated controls still coalesce to the latest selection.
PNG preparation for renderer application waits 1.2 seconds before starting and cancels when settings change. Small thumbnails are sampled directly from map arrays instead of expanding every full-resolution map on the UI thread. These changes do not alter final map pixels or export resolution. Apply/Export stay disabled until full-resolution processing finishes.
