LYGIA Shader Library

unratio (lygia/v1.1.6/space/unratio)

unFix the aspect ratio

Use:

ratio(vec2 st, vec2 st_size)

Check it on Github


#ifndef FNC_UNRATIO
#define FNC_UNRATIO
vec2 unratio (in vec2 st, in vec2 s) { return vec2(st.x, st.y*(s.x/s.y)+(s.y*.5-s.x*.5)/s.y); }
#endif

Use:

ratio(float2 st, float2 st_size)

Check it on Github


#ifndef FNC_UNRATIO
#define FNC_UNRATIO
float2 unratio (in float2 st, in float2 size) {
    return float2(st.x, st.y*(size.x/size.y)+(size.y*.5-size.x*.5)/size.y);
}
#endif

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository