Skip to content

Instantly share code, notes, and snippets.

@sarahzrf
Created May 10, 2018 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sarahzrf/c9909aee70e3656895820f20ac395956 to your computer and use it in GitHub Desktop.
Save sarahzrf/c9909aee70e3656895820f20ac395956 to your computer and use it in GitHub Desktop.
//!HOOK MAINPRESUB
//!BIND HOOKED
const float videoNonLinStretchRatio = 1;
vec2 stretch(vec2 pos, float par) {
float m_stretch = pow(par, videoNonLinStretchRatio);
float x = pos.x - 0.5;
return vec2(mix(x * abs(x) * 2.0, x, m_stretch) + 0.5, pos.y);
}
vec4 hook() {
float dar = target_size.x / target_size.y,
sar = HOOKED_size.x / HOOKED_size.y,
par = dar / sar;
return HOOKED_tex(stretch(HOOKED_pos, par));
}
@aeneas01
Copy link

aeneas01 commented Nov 20, 2019

using this code, what would be the best way to increase the center width a bit more while decreasing the edge stretch amount? can this be accomplished by editing some of the numbers? for example changing the "const float videoNonLinStretchRatio = 1" to something other than 1 and/or changing any of the numbers that appear in this section: float x = pos.x - 0.5; return vec2(mix(x * abs(x) * 2.0, x, m_stretch) + 0.5, pos.y);.... ?

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment