View Single Post
Old 18th April 2018, 04:51   #120  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Quote:
Originally Posted by lansing View Post
The vertical and gird shader looks like the answer here, as they both added fake details to "smooth" out the diagonal lines and added fake "textures" into the color blocks.
Very clear description of why the shader effect looks good!

Which gives me an idea! Suppose we emulate the shader by
  1. smoothly sizing to 1/4 or 1/2 of the final size, then pixel sizing the rest of the way (to retain some jagginess);
  2. de-registering the RGB colors slightly (to imitate the phosphor arrangement); and
  3. superimposing a black grid pattern?
I already have a grid pattern generator function, made years ago (part of an attempt to recreate NTSC dot crawl artifacts). The grids are not exactly like the shader grids, but they might be close "enough."





Code:
LoadPlugin("<path>\PointSize_x64.dll")

## (source RGB32)

xBRZ(2) 
Org = Last

Org
GaussResize(1408, 1080, p=70)
ConvertToYV24
gridmask_square(2)
ConvertToRGB32
Trim(0, length=1)
Loop(Org.FrameCount)
Dots = Last

Org
GaussResize(1408/4, 1080/4, p=70)
PointResize(1408, 1080)
ShiftRedBlue(rx = -2, bx = +2)
Overlay(Dots, mode="darken", opacity=0.25)
Levels(0, 1.0, 255-64, 0, 255, coring=false)

ConvertToYV12(matrix="Rec709")
return Last

# https://forum.doom9.org/showthread.php?p=1803247#post1803247
##################################
### shift and/or resize Red and Blue relative to Green
##
## @ rx, ry, bx, by     - "shift" red & blue position
## @ rxd, ryd, bxd, byd - "delta" width & height
##
function ShiftRedBlue(clip C, 
\           float "rx", float "ry", 
\           float "bx", float "by",
\           float "rxd", float "ryd", 
\           float "bxd", float "byd")
{
    Assert(C.IsRGB, 
    \   "ShiftRedBlue: source must be RGB")
    rx  = Float(Default(rx,  0))
    ry  = Float(Default(ry,  0))
    bx  = Float(Default(bx,  0))
    by  = Float(Default(by,  0))
    rxd = Float(Default(rxd, 0))
    ryd = Float(Default(ryd, 0))
    bxd = Float(Default(bxd, 0))
    byd = Float(Default(byd, 0))
    C
    return (C.IsRGB24)
    \ ? MergeRGB(
    \     ShowRed.Spline64Resize(Width, Height, -rx, -ry, Width-rxd, Height-ryd)
    \   , ShowGreen
    \   , ShowBlue.Spline64Resize(Width, Height, -bx, -by, Width-bxd, Height-byd)
    \   )
    \ : MergeARGB(
    \     ShowAlpha
    \   , ShowRed.Spline64Resize(Width, Height, -rx, -ry, Width-rxd, Height-ryd)
    \   , ShowGreen
    \   , ShowBlue.Spline64Resize(Width, Height, -bx, -by, Width-bxd, Height-byd)
    \   )
}

## http://forum.doom9.org/showthread.php?t=170433
#######################################
### create a fixed pattern of dots.
function gridmask_square(clip C, int size)
{
    C
    return mt_logic(
    \   mt_lutspa(mode="absolute", chroma="-128",
    \             expr="x "+String(size)+" / pi * cos 108 * 126 + "),
    \   mt_lutspa(mode="absolute", chroma="-128",
    \             expr="y "+String(size)+" / pi * cos 108 * 126 + "),
    \  "andn")
}

Last edited by raffriff42; 18th April 2018 at 11:56. Reason: image
raffriff42 is offline   Reply With Quote