LYGIA Shader Library

edge (lygia/filter/edge)

Wrapper around three different edge detection algorithms Sobel, Prewitt, and directional Sobel

Dependencies:

Use:

edge(<SAMPLER_TYPE> texture, <vec2> st, <vec2> pixels_scale)

Check it on Github



#ifndef EDGE_FNC
#define EDGE_FNC edgeSobel
#endif

#ifndef EDGE_TYPE
#define EDGE_TYPE float
#endif

#ifndef EDGE_SAMPLER_FNC
#define EDGE_SAMPLER_FNC(TEX, UV) sampleClamp2edge(TEX, UV).r
#endif


#ifndef FNC_EDGE
#define FNC_EDGE
EDGE_TYPE edge(in SAMPLER_TYPE tex, in vec2 st, in vec2 offset) {
    return EDGE_FNC(tex, st, offset);
}
#endif

Dependencies:

Use:

edge(<SAMPLER_TYPE> texture, <float2> st, <float2> pixels_scale)

Check it on Github



#ifndef EDGE_FNC
#define EDGE_FNC edgeSobel
#endif

#ifndef EDGE_TYPE
#define EDGE_TYPE float
#endif

#ifndef EDGE_SAMPLER_FNC
#define EDGE_SAMPLER_FNC(TEX, UV) SAMPLER_FNC(TEX, UV).r
#endif


#ifndef FNC_EDGE
#define FNC_EDGE
EDGE_TYPE edge(in SAMPLER_TYPE tex, in float2 st, in float2 offset) {
    return EDGE_FNC(tex, st, offset);
}
#endif

Examples

Licenses

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