Skip to content

Instantly share code, notes, and snippets.


butterw butterw

  • France
View GitHub Profile
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:
// 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 / 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:
2020: - modification and optimization by butterw (9 texture, 47 arithmetic) >> (9 texture, 34 arithmetic)
butterw / edge_freichen.hook
Last active Oct 8, 2020
Frei-Chen edge detection in luma (mpv .hook shader)
View edge_freichen.hook
//!DESC Frei-Chen Edge Detection
Frei-Chen Edge Detection (in Luma)
original source code (freichen.frag):
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 / NoChroma.hook
Created Oct 8, 2020
mpv glsl hook to remove source chroma (UV)
View NoChroma.hook
//!DESC ChromaOff
/* glsl-shader for mpv video player, removes yuv source chroma (keep luma)*/
vec4 hook(){
return vec4(0.5);
View SweetFx.FilmGrain.hlsl
Moved to FilmGrain/Noise shader dir:
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
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 / 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)
- half the screen: Side by side effect comparisons.