View Single Post
Old 7th June 2022, 00:00   #7  |  Link
RGMOfficial
Registered User
 
RGMOfficial's Avatar
 
Join Date: May 2022
Location: Brazil
Posts: 38
Quote:
Originally Posted by SaurusX View Post
Another thing to consider regarding rainbows is that they generally live only on DIAGONAL edges. Would it be preferable to alter the mask to only affect diagonal edges? It would add another layer of realism to the effect.
Can you provide an example script?

Here's the mask script:
Code:
function dpc_uumidpass(
\   clip C, int "tlo", int "thi", bool "setupmode")
{
    tlo    = Default(tlo, 128)
    thi    = Default(thi, 148)
    setupmode = Default(setupmode, false)

    CG = C.Grayscale()
    Last = CG
    Blur(1, 1)
    FFT3DFilter(bt=1, bw=64, bh=64, ow=32, oh=32,
    \  sigma=0, sigma2=0, sigma3=500, sigma4=100000)
    Subtract(UUGaussianBlurY(rad=1))
    mt_expand()
    Grayscale()
    return (setupmode) 
    \ ? dpc_histostretch(50.0, 0.01, 1.8, true)
    \ : Levels(tlo, 1.8, thi, 0, 255, coring=false)
}

function UUGaussianBlurY(clip C, float "var", float "rad")
{
    var = Max(0.0, Float(Default(var, 1.0)))
    rad = Max(1.0, Float(Default(rad, Pow(var, 0.5))))
    var = Pow(Min(Max(0.0, rad), 60.0), 2.0)
    
    w0 = C.Width
    h0 = C.Height
    w1 = Round(w0/rad)
    h1 = Round(h0/rad) /* formerly "w0/rad" ?? */

    B = C.BilinearResize(
    \         Min(Max(12, w1 + (w1 % 2)), w0), 
    \         Min(Max(12, h1 + (h1 % 2)), h0))

    B = B.Blur(1.0).Blur(1.0)
    
    return (var<0.01) ? C 
    \    : (var<1.5)  ? C.Blur(0.85 * var)
    \    : (B.Width>8 && B.Height>8) ? B.GaussResize(w0, h0)
    \    : B.BilinearResize(w0, h0)
}
Also, sorry for the late reply.

Last edited by RGMOfficial; 7th June 2022 at 00:36.
RGMOfficial is offline   Reply With Quote