Skip to content

bratgot/SpectralLensPro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

SpectralLensPro — Nuke NDK Plugin

A compiled C++ replacement for the Spectral_Aberration_Pro_V2 Nuke Group.
Collapses 7 × GodRays + 7 × Grade + Merge + post-processing into a single multi-threaded operator for significantly faster rendering.


Features

Feature Group (before) NDK Plugin (after)
Band processing 7 separate GodRays + Grades Single fused loop
Thread model Serial node-graph traversal Nuke engine() multi-threading
Memory traffic 7 intermediate images One cached intermediate
Knob interface Matches original V2 Identical parameters

Supported modes: Zoom/Radial · Spin/Circular · Linear


Prerequisites

Requirement Version
Nuke 17.0 (with NDK headers — included in all non-NC installs)
Visual Studio 2022 (v143 toolset) recommended; 2019 also works
CMake 3.20 or newer
OS Windows 11 (x64)

Tip: Make sure cmake is on your PATH, or use the VS Developer Command Prompt.


Build Instructions

1. Clone / copy the project

SpectralLensPro/
├── CMakeLists.txt
├── README.md
└── src/
    └── SpectralLensPro.cpp

2. Configure with CMake

Open a Developer Command Prompt for VS 2022 (or PowerShell with VS env):

cd SpectralLensPro
mkdir build && cd build

cmake .. -G "Visual Studio 17 2022" -A x64 ^
      -DNUKE_INSTALL_PATH="C:\Program Files\Nuke17.0v1"

Adjust the Nuke path to match your installation (e.g. Nuke17.0v2).
The generator name may differ: use "Visual Studio 16 2019" for VS 2019.

3. Build

cmake --build . --config Release

The compiled plugin will be at:

build\plugin\Release\SpectralLensPro.dll

4. Install

Copy SpectralLensPro.dll to one of Nuke's plugin search paths:

Location Notes
%USERPROFILE%\.nuke\ Per-user (recommended for testing)
%NUKE_PATH%\plugins\ Studio-wide
Any path in NUKE_PATH Custom location

Or use the CMake install target:

cmake --install . --config Release
# → copies to %USERPROFILE%\.nuke\

5. Verify in Nuke

Launch Nuke 17 and press Tab in the Node Graph → type SpectralLensPro.
The node appears under Filter > SpectralLensPro.


Knob Reference

Knob Type Range Description
Blur Type Enum Zoom / Spin / Linear Dispersion geometry
Optical Center XY Radial/spin origin (disabled for Linear)
Angle Float 0–360 Linear mode direction (disabled for Zoom/Spin)
Dispersion Float 0–0.1 Chromatic separation magnitude
Focus Wavelength Float −2 to +2 Which wavelength stays sharp (−1=Violet, 0=Green, +1=Red)
Intensity Float 0–2 Global brightness multiplier
Crop to Format Bool Clip output to format + overscan
Overscan Int px Padding beyond format edge
Samples Int 2–64 Per-band volumetric samples (quality vs speed)
Gap Smoothing Float 0–2 Secondary blur bridging band gaps

Architecture Notes

Processing pipeline

Input Image
     │
     ▼
┌─────────────────────────────────────┐
│  Band Accumulation (cached)         │
│  For each of 7 spectral bands:      │
│    • GodRays-style multi-step       │
│      sampling at transformed coords │
│    • Apply spectral tint            │
│  Sum all bands (plus merge)         │
│  Apply white balance normalization  │
└─────────────────────────────────────┘
     │
     ▼
┌─────────────────────────────────────┐
│  Smoothing Pass (in engine)         │
│  GodRays-style resampling of the    │
│  cached intermediate at 2× quality  │
└─────────────────────────────────────┘
     │
     ▼
  Alpha fix (÷7) → Intensity → Crop
     │
     ▼
   Output

Spectral bands

Band W(λ) Tint RGB
Red +1.00 (1.0, 0.0, 0.0)
Orange +0.66 (1.0, 0.5, 0.0)
Yellow +0.33 (1.0, 1.0, 0.0)
Green 0.00 (0.0, 1.0, 0.0)
Cyan −0.33 (0.0, 0.5, 1.0)
Blue −0.66 (0.0, 0.0, 1.0)
Violet −1.00 (0.2, 0.0, 0.5)

Math model

For each band with wavelength index W:

S(λ) = 1.0 + (W − Focus) × Dispersion
  • Zoom mode: pixel scaled by S from optical center
  • Spin mode: pixel rotated by (W − F) × D × 50°
  • Linear mode: pixel translated by (1 + (W − F) × D × 100) along angle

Troubleshooting

"Cannot find Nuke NDK headers" — Set -DNUKE_INSTALL_PATH to the folder containing include/DDImage/Iop.h.

Plugin not found in Nuke — Verify the .dll is in a directory listed in nuke.pluginPath() (run in Nuke's Script Editor).

Crash on load — Ensure you built with the same MSVC version Nuke 17 was compiled with (typically VS 2022 / v143). Mixing toolsets can cause ABI issues.

Different results from the Group — The C++ bilinear filter may differ slightly from Nuke's internal GodRays filter. For pixel-exact matching, increase Samples to 32+.


License

Same terms as the original Spectral_Aberration_Pro_V2 by Marten Blumen.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors