Commit Graph
3 Commits
Author SHA1 Message Date
AEmotionStudio cb391fa5d9 fix: Consistent shader registration and tensor-aware interpolation
- shader_noise_ksampler.py: register_shader_generator now registers to both
  the legacy SHADER_GENERATORS dict and the new centralized registry,
  matching the behavior in __init__.py for backward compatibility

- core/transforms.py: resize_noise_spatial now considers INPUT tensor
  dimensionality when selecting interpolation mode, not just target_size.
  For 5D video tensors with 2D target_size (H, W), uses frame-by-frame
  bilinear interpolation via new _resize_5d_tensor_spatial helper.
  Previously would incorrectly select bilinear mode for 5D tensors.
2026-01-27 00:32:53 -08:00
AEmotionStudioandClaude Opus 4.5 3f92bcaad9 fix: Add video format detection to match_noise_shape
- Add _detect_video_channel_dim helper using the same heuristics as
  blending.py and sampler.py for consistent format detection
- Add optional channel_dim parameter to match_noise_shape for explicit
  format specification when known
- Auto-detect B,C,F,H,W vs B,F,C,H,W format for video tensors when
  channel_dim is not provided

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 22:52:27 -08:00
AEmotionStudio e79e49506d refactor: Major codebase restructuring for separation of concerns
## New Directory Structure
- utils/: Shared utilities (color_utils, shape_masks, noise_utils)
- core/: Central logic (params, constants, blending, transforms, model_compat, sampler, debug, logging)
- shaders/: Shader generators with BaseNoiseGenerator ABC and plugin registry
- nodes/: ComfyUI node class definitions

## Key Changes
- Centralized color interpolation logic eliminating duplication across shader files
- Unified shape mask generation with 20+ shape types
- Consolidated simplex/FBM/perlin noise implementations
- Created ShaderParams class for parameter normalization and validation
- Implemented ShaderRegistry for plugin-based shader registration
- Extracted blending operations and noise transforms to dedicated modules
- Added model compatibility layer for channel detection
- Moved stub visualizer/debugger to core/debug.py
- Added centralized logging configuration

## Refactored Shaders
- domain_warp.py: Now uses shared utilities and BaseNoiseGenerator
- tensor_field.py: Now uses shared utilities and BaseNoiseGenerator
- curl_noise.py: Now uses shared utilities and BaseNoiseGenerator
- temporal_coherent_noise.py: Now uses shared utilities and BaseNoiseGenerator

## Cleanup
- Removed duplicate SHADER_GENERATORS registry
- Added comprehensive type hints to all new modules
- Maintained backward compatibility with legacy API
2026-01-26 19:48:23 -08:00