Skip to content

Instantly share code, notes, and snippets.

Avatar

butterw butterw

  • France
View GitHub Profile
@butterw
butterw / bSide.hlsl
Last active Jun 20, 2020
hlsl pixel shader tested in mpc-hc video player. Apply effects to an xy-zone of the video (half the screen, or a box). Use: Side by side effect comparisons. Pixelate zone, Mask logo. Horizontal/Vertical Line.
View bSide.hlsl
sampler s0: register(s0);
float4 p1: register(c1);
#define px p1.x //: one_over_width: 1/W
#define py p1.y //: one_over_height: 1/H
/* bSide.hlsl by butterw v1.0 (ZoneShader_mpc)
- this directX pixel shader shows how to apply effects to an xy-zone of the video (half the screen, or a box)
applications:
- half the screen: Side by side effect comparisons.
@butterw
butterw / bTimeEffect_DePixelate.hlsl
Last active Jun 19, 2020
depixelate effect/glitch, strobe. Shows how to control an effect vs time (start, duration, repetition).
View bTimeEffect_DePixelate.hlsl
/*
bTimeEffect_DePixelate (square pixels)
by butterw
control a video pixel shader effect vs time.
tested in mpc-hc v1.9.3:
- Opening the player by double clicking a video starts the clock
- Short effect/glitch repeats every 10 seconds by default (T).
- Note that Loading another video or Pause/Stop does not reset the clock !
@butterw
butterw / bar_Mask.hlsl
Last active Jul 7, 2020
Image Masking/Shift methods (based on custom border widths, Aspect Ratio, with Offset, BoxMask) for realtime video playback in mpc-hc. Uses: Logo masking, offset 9/16 or 1/1 view, 21/9 view
View bar_Mask.hlsl
updated version in https://github.com/butterw/bShaders
View SweetFx.FilmGrain.hlsl
Moved to FilmGrain/Noise shader dir: https://github.com/butterw/bShaders/tree/master/FilmGrain_Noise
@butterw
butterw / NoChroma.hook
Created Oct 8, 2020
mpv glsl hook to remove source chroma (UV)
View NoChroma.hook
//!HOOK CHROMA
//!BIND HOOKED
//!DESC ChromaOff
/* glsl-shader for mpv video player, removes yuv source chroma (keep luma)*/
vec4 hook(){
return vec4(0.5);
}
@butterw
butterw / edge_freichen.hook
Last active Oct 8, 2020
Frei-Chen edge detection in luma (mpv .hook shader)
View edge_freichen.hook
//!HOOK LUMA
//!BIND HOOKED
//!DESC Frei-Chen Edge Detection
/*
Frei-Chen Edge Detection (in Luma)
original source code (freichen.frag): http://rastergrid.com/blog/2011/01/frei-chen-edge-detector/
glsl-shader adapted to mpv .hook by butterw
best results as a LUMA hook but can also work on MAIN or OUTPUT, can be combined with NoChroma.hook.
@butterw
butterw / Edge_Sharpen.hlsl
Created Oct 8, 2020
mpc-hc Edge Sharpen mod and optimization
View Edge_Sharpen.hlsl
#define Show_Edge 20
//[0, 1, 2, 20] default 0: edge sharpen, 1: show edges in Red, 2: show luma edges, 20 luma edges on dark background
#define Show_SplitScreen 1 //[0, 1, 2] default 0: no splitscreen, 1: horizontal split, 2 vertical split
/*
Edge detection and Edge sharpening, using Four 3x3 Prewitt operators.
Software Licence: GPL v3
the original Edge Sharpen is distributed with MPC-HC: https://www.videohelp.com/software/Media-Player-Classic-Home-Cinema
2020: - modification and optimization by butterw (9 texture, 47 arithmetic) >> (9 texture, 34 arithmetic)
@butterw
butterw / resizer_lanczos3_x.hlsl
Last active Oct 13, 2020
compensated Lanczos3 pass X (from mpc-be, adapted for mpc-hc user shader)
View resizer_lanczos3_x.hlsl
// compensated Lanczos3, pass X
// originally from mpc-be: https://sourceforge.net/p/mpcbe/code/HEAD/tree/trunk/src/Shaders/Resizers/resizer_lanczos3_x.hlsl
// adapted for use in mpc-hc (as zoomX=2) by butterw (license: GPL v3)
// use as a pre-resize shader, input resolution should match the screen resolution (no player resize involved)
// pass X perf: (6 texture, 79 arithmetic)
// A catmull-rom resizer (true separable kernel) is also available: resizer_catmull4_x.hlsl. Catmull-Rom spline4, pass X: (4 texture, 22 arithmetic)
sampler s0: register(s0);
float2 p0: register(c0); // W, H
float2 p1: register(c1); //px, py
@butterw
butterw / Sobel.hook
Created Oct 10, 2020
Sobel Edge detection for mpv
View Sobel.hook
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC Sobel Edge
/*
Sobel Edge Detection (RGB >> grayscale output)
original source code (sobel.frag): http://rastergrid.com/blog/2011/01/frei-chen-edge-detector/
glsl-shader adapted to mpv .hook by butterw:
MAIN: pre-resize (RGB)
You can’t perform that action at this time.