├── .gitignore ├── .idea └── .idea.LygiaProject │ └── .idea │ ├── .gitignore │ ├── .name │ ├── encodings.xml │ ├── indexLayout.xml │ └── vcs.xml ├── Config ├── DefaultEditor.ini ├── DefaultEngine.ini └── DefaultGame.ini ├── LICENSE.md ├── LygiaProject.uproject ├── Platforms ├── Android │ └── Config │ │ └── AndroidEngine.ini ├── IOS │ └── Config │ │ └── IOSEngine.ini ├── Linux │ └── Config │ │ └── LinuxEngine.ini ├── Mac │ └── Config │ │ └── MacEngine.ini ├── PS4 │ └── Config │ │ └── PS4Engine.ini ├── PS5 │ └── Config │ │ └── PS5Engine.ini ├── Switch │ └── Config │ │ └── SwitchEngine.ini ├── Windows │ └── Config │ │ └── WindowsEngine.ini ├── XSX │ └── Config │ │ └── XSXEngine.ini └── XboxOne │ └── Config │ └── XboxOneEngine.ini ├── Plugins └── LygiaShader │ ├── Config │ └── FilterPlugin.ini │ ├── Content │ ├── Images │ │ ├── blue_noise.uasset │ │ ├── danny.uasset │ │ ├── grid_00.uasset │ │ ├── mixbox_lut.uasset │ │ ├── row_05.uasset │ │ ├── sprite_megaman.uasset │ │ ├── square_00.uasset │ │ ├── square_01.uasset │ │ └── square_02.uasset │ ├── Maps │ │ └── Demo.umap │ ├── Materials │ │ ├── animations │ │ │ ├── MF_AnimEase.uasset │ │ │ ├── MF_AnimationSprite.uasset │ │ │ ├── M_animation_easing.uasset │ │ │ └── M_animation_sprite.uasset │ │ ├── color │ │ │ ├── MF_color_LUT.uasset │ │ │ ├── MF_color_brightness_contrast.uasset │ │ │ ├── MF_color_brightness_saturation.uasset │ │ │ ├── MF_color_daltonize.uasset │ │ │ ├── MF_color_dither.uasset │ │ │ ├── MF_color_luma_luminance.uasset │ │ │ ├── MF_color_mix.uasset │ │ │ ├── MF_color_palettes.uasset │ │ │ ├── MF_color_vibrance.uasset │ │ │ ├── M_color_LUT.uasset │ │ │ ├── M_color_brightness_contrast.uasset │ │ │ ├── M_color_brightness_contrast_Inst.uasset │ │ │ ├── M_color_brightness_saturation.uasset │ │ │ ├── M_color_daltonize.uasset │ │ │ ├── M_color_dither.uasset │ │ │ ├── M_color_luma_luminance.uasset │ │ │ ├── M_color_mix.uasset │ │ │ ├── M_color_palettes.uasset │ │ │ └── M_color_vibrance.uasset │ │ ├── distort │ │ │ ├── M_distort_barrel.uasset │ │ │ ├── M_distort_chromaAB.uasset │ │ │ └── M_distort_grain.uasset │ │ ├── filter │ │ │ ├── M_filter_bilateralBlur2D.uasset │ │ │ ├── M_filter_boxBlur2D.uasset │ │ │ ├── M_filter_edge2D.uasset │ │ │ ├── M_filter_gaussinaBlur2D.uasset │ │ │ ├── M_filter_kawahara2D.uasset │ │ │ ├── M_filter_laplaacian.uasset │ │ │ ├── M_filter_mean2D.uasset │ │ │ ├── M_filter_median2D.uasset │ │ │ ├── M_filter_noiseBlur2D.uasset │ │ │ ├── M_filter_radialBlur2D.uasset │ │ │ └── M_filter_sharpen2D.uasset │ │ └── generative │ │ │ ├── M_generative_cnoise.uasset │ │ │ ├── M_generative_curl.uasset │ │ │ ├── M_generative_fbm.uasset │ │ │ ├── M_generative_noised.uasset │ │ │ ├── M_generative_pnoise.uasset │ │ │ ├── M_generative_random.uasset │ │ │ ├── M_generative_snoise.uasset │ │ │ ├── M_generative_voronoi.uasset │ │ │ └── M_generative_worley.uasset │ └── Widget │ │ ├── AddWidget.uasset │ │ ├── Item.uasset │ │ └── ShowExample.uasset │ ├── LygiaShader.uplugin │ ├── Resources │ └── Icon128.png │ ├── Shaders │ ├── animation_easing.usf │ ├── animation_easing_inl.usf │ ├── animation_sprite.usf │ ├── animation_sprite_inl.usf │ ├── color_LUT.usf │ ├── color_brightness_contrast.usf │ ├── color_brightness_contrast_inl.usf │ ├── color_brightness_saturation.usf │ ├── color_brightness_saturation_inl.usf │ ├── color_daltonize.usf │ ├── color_dither.usf │ ├── color_luma_luminance.usf │ ├── color_luma_luminance_inl.usf │ ├── color_mix.usf │ ├── color_mix_inl.usf │ ├── color_palettes.usf │ ├── color_palettes_inl.usf │ ├── color_vibrance.usf │ ├── distort_barrel.usf │ ├── distort_barrel_inl.usf │ ├── distort_chromaAB.usf │ ├── distort_chromaAB_inl.usf │ ├── distort_grain.usf │ ├── distort_grain_inl.usf │ ├── exampleDigit.usf │ ├── filter_bilateralBlur2D.usf │ ├── filter_bilateralBlur2D_inl.usf │ ├── filter_boxBlur2D.usf │ ├── filter_boxBlur2D_inl.usf │ ├── filter_edge2D.usf │ ├── filter_edge2D_inl.usf │ ├── filter_gaussinaBlur2D.usf │ ├── filter_gaussinaBlur2D_inl.usf │ ├── filter_kawahara2D.usf │ ├── filter_kawahara2D_inl.usf │ ├── filter_laplacian.usf │ ├── filter_laplacian_inl.usf │ ├── filter_mean2D.usf │ ├── filter_mean2D_inl.usf │ ├── filter_median2D.usf │ ├── filter_median2D_inl.usf │ ├── filter_noiseBlur2D.usf │ ├── filter_noiseBlur2D_inl.usf │ ├── filter_radialBlur2D.usf │ ├── filter_radialBlur2D_inl.usf │ ├── filter_sharpen2D.usf │ ├── filter_sharpen2D_inl.usf │ ├── generative_cnoise.usf │ ├── generative_curl.usf │ ├── generative_fbm.usf │ ├── generative_noised.usf │ ├── generative_pnoise.usf │ ├── generative_random.usf │ ├── generative_snoise.usf │ ├── generative_voronoi.usf │ ├── generative_worley.usf │ └── lygia │ │ ├── animation │ │ ├── easing.usf │ │ ├── easing │ │ │ ├── back.usf │ │ │ ├── bounce.usf │ │ │ ├── circular.usf │ │ │ ├── cubic.usf │ │ │ ├── elastic.usf │ │ │ ├── exponential.usf │ │ │ ├── linear.usf │ │ │ ├── quadratic.usf │ │ │ ├── quartic.usf │ │ │ ├── quintic.usf │ │ │ └── sine.usf │ │ └── spriteLoop.usf │ │ ├── color │ │ ├── blend.usf │ │ ├── blend │ │ │ ├── add.usf │ │ │ ├── average.usf │ │ │ ├── colorBurn.usf │ │ │ ├── colorDodge.usf │ │ │ ├── darken.usf │ │ │ ├── difference.usf │ │ │ ├── exclusion.usf │ │ │ ├── glow.usf │ │ │ ├── hardLight.usf │ │ │ ├── hardMix.usf │ │ │ ├── lighten.usf │ │ │ ├── linearBurn.usf │ │ │ ├── linearDodge.usf │ │ │ ├── multiply.usf │ │ │ ├── negation.usf │ │ │ ├── overlay.usf │ │ │ ├── phoenix.usf │ │ │ ├── pinLight.usf │ │ │ ├── reflect.usf │ │ │ ├── screen.usf │ │ │ ├── softLight.usf │ │ │ ├── subtract.usf │ │ │ └── vividLight.usf │ │ ├── brightnessContrast.usf │ │ ├── brightnessMatrix.usf │ │ ├── contrast.usf │ │ ├── contrastMatrix.usf │ │ ├── daltonize.usf │ │ ├── desaturate.usf │ │ ├── distance.usf │ │ ├── dither.usf │ │ ├── dither │ │ │ ├── blueNoise.usf │ │ │ ├── interleavedGradientNoise.usf │ │ │ ├── shift.usf │ │ │ ├── triangleNoise.usf │ │ │ └── vlachos.usf │ │ ├── exposure.usf │ │ ├── hueShift.usf │ │ ├── hueShiftRYB.usf │ │ ├── levels.usf │ │ ├── levels │ │ │ ├── gamma.usf │ │ │ ├── inputRange.usf │ │ │ └── outputRange.usf │ │ ├── luma.usf │ │ ├── luminance.usf │ │ ├── lut.usf │ │ ├── mixOklab.usf │ │ ├── mixRYB.usf │ │ ├── mixSpectral.usf │ │ ├── palette.usf │ │ ├── palette │ │ │ ├── fire.usf │ │ │ ├── heatmap.usf │ │ │ ├── hue.usf │ │ │ ├── macbeth.usf │ │ │ ├── pigments.usf │ │ │ ├── pigments │ │ │ │ ├── gamblin_oil.usf │ │ │ │ ├── golden_acrylic.usf │ │ │ │ ├── liquitex_acrylic.usf │ │ │ │ ├── rembrandt_oil.usf │ │ │ │ ├── winsor_acrylic.usf │ │ │ │ ├── winsor_gouache.usf │ │ │ │ └── winsor_oil.usf │ │ │ ├── ridgway.usf │ │ │ ├── spectral.usf │ │ │ ├── spectral │ │ │ │ ├── gems.usf │ │ │ │ ├── geoffrey.usf │ │ │ │ ├── soft.usf │ │ │ │ ├── zucconi.usf │ │ │ │ └── zucconi6.usf │ │ │ ├── spyder.usf │ │ │ ├── wada.usf │ │ │ ├── wada │ │ │ │ ├── dyad.usf │ │ │ │ ├── tetrad.usf │ │ │ │ ├── triad.usf │ │ │ │ └── value.usf │ │ │ └── water.usf │ │ ├── saturationMatrix.usf │ │ ├── space.usf │ │ ├── space │ │ │ ├── YCbCr2rgb.usf │ │ │ ├── YPbPr2rgb.usf │ │ │ ├── cmyk2rgb.usf │ │ │ ├── gamma2linear.usf │ │ │ ├── hcy2rgb.usf │ │ │ ├── hsl2rgb.usf │ │ │ ├── hsv2rgb.usf │ │ │ ├── hsv2ryb.usf │ │ │ ├── hue2rgb.usf │ │ │ ├── k2rgb.usf │ │ │ ├── lab2lch.usf │ │ │ ├── lab2rgb.usf │ │ │ ├── lab2srgb.usf │ │ │ ├── lab2xyz.usf │ │ │ ├── lch2lab.usf │ │ │ ├── lch2rgb.usf │ │ │ ├── linear2gamma.usf │ │ │ ├── lms2rgb.usf │ │ │ ├── oklab2rgb.usf │ │ │ ├── oklab2srgb.usf │ │ │ ├── rgb2YCbCr.usf │ │ │ ├── rgb2YPbPr.usf │ │ │ ├── rgb2cmyk.usf │ │ │ ├── rgb2hcv.usf │ │ │ ├── rgb2hcy.usf │ │ │ ├── rgb2heat.usf │ │ │ ├── rgb2hsl.usf │ │ │ ├── rgb2hsv.usf │ │ │ ├── rgb2hue.usf │ │ │ ├── rgb2lab.usf │ │ │ ├── rgb2lch.usf │ │ │ ├── rgb2lms.usf │ │ │ ├── rgb2luma.usf │ │ │ ├── rgb2oklab.usf │ │ │ ├── rgb2ryb.usf │ │ │ ├── rgb2srgb.usf │ │ │ ├── rgb2xyY.usf │ │ │ ├── rgb2xyz.usf │ │ │ ├── rgb2yiq.usf │ │ │ ├── rgb2yuv.usf │ │ │ ├── ryb2rgb.usf │ │ │ ├── srgb2lab.usf │ │ │ ├── srgb2lch.usf │ │ │ ├── srgb2luma.usf │ │ │ ├── srgb2oklab.usf │ │ │ ├── srgb2rgb.usf │ │ │ ├── srgb2xyz.usf │ │ │ ├── w2rgb.usf │ │ │ ├── xyY2rgb.usf │ │ │ ├── xyY2srgb.usf │ │ │ ├── xyY2xyz.usf │ │ │ ├── xyz2lab.usf │ │ │ ├── xyz2rgb.usf │ │ │ ├── xyz2srgb.usf │ │ │ ├── xyz2xyY.usf │ │ │ ├── yiq2rgb.usf │ │ │ └── yuv2rgb.usf │ │ ├── tonemap.usf │ │ ├── tonemap │ │ │ ├── aces.usf │ │ │ ├── debug.usf │ │ │ ├── filmic.usf │ │ │ ├── linear.usf │ │ │ ├── reinhard.usf │ │ │ ├── reinhardJodie.usf │ │ │ ├── uncharted.usf │ │ │ ├── uncharted2.usf │ │ │ └── unreal.usf │ │ ├── vibrance.usf │ │ └── whiteBalance.usf │ │ ├── distort │ │ ├── barrel.usf │ │ ├── chromaAB.usf │ │ ├── grain.usf │ │ └── stretch.usf │ │ ├── draw │ │ ├── bridge.usf │ │ ├── circle.usf │ │ ├── digits.usf │ │ ├── fill.usf │ │ ├── flip.usf │ │ ├── hex.usf │ │ ├── rect.usf │ │ ├── stroke.usf │ │ └── tri.usf │ │ ├── filter │ │ ├── bilateral.usf │ │ ├── boxBlur.usf │ │ ├── boxBlur │ │ │ ├── 1D.usf │ │ │ ├── 2D.usf │ │ │ └── 2D_fast9.usf │ │ ├── edge.usf │ │ ├── edge │ │ │ ├── prewitt.usf │ │ │ ├── sobel.usf │ │ │ └── sobelDirectional.usf │ │ ├── gaussianBlur.usf │ │ ├── gaussianBlur │ │ │ ├── 1D.usf │ │ │ ├── 1D_fast13.usf │ │ │ ├── 1D_fast5.usf │ │ │ ├── 1D_fast9.usf │ │ │ └── 2D.usf │ │ ├── kuwahara.usf │ │ ├── laplacian.usf │ │ ├── mean.usf │ │ ├── median.usf │ │ ├── median │ │ │ ├── 2D_fast3.usf │ │ │ └── 2D_fast5.usf │ │ ├── noiseBlur.usf │ │ ├── radialBlur.usf │ │ ├── sharpen.usf │ │ └── sharpen │ │ │ ├── adaptive.usf │ │ │ ├── contrastAdaptive.usf │ │ │ └── fast.usf │ │ ├── generative │ │ ├── cnoise.usf │ │ ├── curl.usf │ │ ├── fbm.usf │ │ ├── gerstnerWave.usf │ │ ├── noised.usf │ │ ├── pnoise.usf │ │ ├── psrdnoise.usf │ │ ├── random.usf │ │ ├── snoise.usf │ │ ├── srandom.usf │ │ ├── voronoi.usf │ │ ├── voronoise.usf │ │ └── worley.usf │ │ ├── geometry │ │ ├── aabb.usf │ │ ├── aabb │ │ │ ├── aabb.usf │ │ │ ├── centroid.usf │ │ │ ├── contain.usf │ │ │ ├── diagonal.usf │ │ │ ├── expand.usf │ │ │ ├── intersect.usf │ │ │ └── square.usf │ │ ├── triangle.usf │ │ └── triangle │ │ │ ├── area.usf │ │ │ ├── barycentric.usf │ │ │ ├── centroid.usf │ │ │ ├── closestPoint.usf │ │ │ ├── contain.usf │ │ │ ├── distanceSq.usf │ │ │ ├── intersect.usf │ │ │ ├── normal.usf │ │ │ ├── signedDistance.usf │ │ │ └── triangle.usf │ │ ├── lighting │ │ ├── atmosphere.usf │ │ ├── common │ │ │ ├── ashikhmin.usf │ │ │ ├── beckmann.usf │ │ │ ├── charlie.usf │ │ │ ├── clampNoV.usf │ │ │ ├── envBRDFApprox.usf │ │ │ ├── ggx.usf │ │ │ ├── gtaoMultiBounce.usf │ │ │ ├── henyeyGreenstein.usf │ │ │ ├── kelemen.usf │ │ │ ├── rayleigh.usf │ │ │ ├── schlick.usf │ │ │ ├── smithGGXCorrelated.usf │ │ │ └── specularAO.usf │ │ ├── debugCube.usf │ │ ├── diffuse.usf │ │ ├── diffuse │ │ │ ├── burley.usf │ │ │ ├── lambert.usf │ │ │ └── orenNayar.usf │ │ ├── envMap.usf │ │ ├── fakeCube.usf │ │ ├── fresnel.usf │ │ ├── fresnelReflection.usf │ │ ├── gooch.usf │ │ ├── ior.usf │ │ ├── ior │ │ │ ├── 2eta.usf │ │ │ └── 2f0.usf │ │ ├── iridescence.usf │ │ ├── light │ │ │ ├── directional.usf │ │ │ ├── falloff.usf │ │ │ ├── point.usf │ │ │ └── spot.usf │ │ ├── material.usf │ │ ├── material │ │ │ ├── albedo.usf │ │ │ ├── emissive.usf │ │ │ ├── metallic.usf │ │ │ ├── new.usf │ │ │ ├── normal.usf │ │ │ ├── occlusion.usf │ │ │ ├── roughness.usf │ │ │ ├── shininess.usf │ │ │ └── specular.usf │ │ ├── pbr.usf │ │ ├── pbrClearCoat.usf │ │ ├── pbrGlass.usf │ │ ├── pbrLittle.usf │ │ ├── ray.usf │ │ ├── raymarch.usf │ │ ├── raymarch │ │ │ ├── ao.usf │ │ │ ├── camera.usf │ │ │ ├── cast.usf │ │ │ ├── glass.usf │ │ │ ├── map.usf │ │ │ ├── material.usf │ │ │ ├── normal.usf │ │ │ ├── render.usf │ │ │ ├── softShadow.usf │ │ │ └── volume.usf │ │ ├── reflection.usf │ │ ├── shadow.usf │ │ ├── specular.usf │ │ ├── specular │ │ │ ├── beckmann.usf │ │ │ ├── blinnPhong.usf │ │ │ ├── cookTorrance.usf │ │ │ ├── gaussian.usf │ │ │ ├── ggx.usf │ │ │ ├── phong.usf │ │ │ └── ward.usf │ │ ├── sphereMap.usf │ │ ├── sphericalHarmonics.usf │ │ ├── toMaterialMetallic.usf │ │ └── toShininess.usf │ │ ├── math.usf │ │ ├── math │ │ ├── aafloor.usf │ │ ├── aafract.usf │ │ ├── aastep.usf │ │ ├── adaptiveThreshold.usf │ │ ├── bump.usf │ │ ├── const.usf │ │ ├── cubic.usf │ │ ├── cubicMix.usf │ │ ├── decimate.usf │ │ ├── fract.usf │ │ ├── gain.usf │ │ ├── gaussian.usf │ │ ├── grad4.usf │ │ ├── greaterThan.usf │ │ ├── highPass.usf │ │ ├── inside.usf │ │ ├── invCubic.usf │ │ ├── invQuartic.usf │ │ ├── lengthSq.usf │ │ ├── map.usf │ │ ├── mirror.usf │ │ ├── mix.usf │ │ ├── mmax.usf │ │ ├── mmin.usf │ │ ├── mod.usf │ │ ├── mod289.usf │ │ ├── pack.usf │ │ ├── parabola.usf │ │ ├── permute.usf │ │ ├── pow2.usf │ │ ├── pow3.usf │ │ ├── pow5.usf │ │ ├── pow7.usf │ │ ├── powFast.usf │ │ ├── quartic.usf │ │ ├── quat.usf │ │ ├── quat │ │ │ ├── 2mat3.usf │ │ │ ├── 2mat4.usf │ │ │ ├── add.usf │ │ │ ├── conj.usf │ │ │ ├── div.usf │ │ │ ├── identity.usf │ │ │ ├── inverse.usf │ │ │ ├── length.usf │ │ │ ├── lengthSq.usf │ │ │ ├── lerp.usf │ │ │ ├── mul.usf │ │ │ ├── neg.usf │ │ │ ├── norm.usf │ │ │ ├── sub.usf │ │ │ └── type.usf │ │ ├── quintic.usf │ │ ├── rotate2d.usf │ │ ├── rotate3d.usf │ │ ├── rotate3dX.usf │ │ ├── rotate3dY.usf │ │ ├── rotate3dZ.usf │ │ ├── rotate4d.usf │ │ ├── rotate4dX.usf │ │ ├── rotate4dY.usf │ │ ├── rotate4dZ.usf │ │ ├── saturateMediump.usf │ │ ├── scale2d.usf │ │ ├── scale3d.usf │ │ ├── scale4d.usf │ │ ├── select.usf │ │ ├── smootherstep.usf │ │ ├── sum.usf │ │ ├── taylorInvSqrt.usf │ │ ├── toMat4.usf │ │ ├── translate4d.usf │ │ ├── unpack.usf │ │ └── within.usf │ │ ├── morphological │ │ ├── alphaFill.usf │ │ ├── dilation.usf │ │ └── erosion.usf │ │ ├── sample.usf │ │ ├── sample │ │ ├── 2DCube.usf │ │ ├── 3DSdf.usf │ │ ├── bicubic.usf │ │ ├── bracketing.usf │ │ ├── bumpMap.usf │ │ ├── clamp2edge.usf │ │ ├── derivative.usf │ │ ├── dof.usf │ │ ├── equirect.usf │ │ ├── flow.usf │ │ ├── fxaa.usf │ │ ├── heatmap.usf │ │ ├── hue.usf │ │ ├── mirror.usf │ │ ├── nearest.usf │ │ ├── normalMap.usf │ │ ├── opticalFlow.usf │ │ ├── quilt.usf │ │ ├── repeat.usf │ │ ├── shadow.usf │ │ ├── shadowLerp.usf │ │ ├── shadowPCF.usf │ │ ├── smooth.usf │ │ ├── sprite.usf │ │ ├── triplanar.usf │ │ ├── untile.usf │ │ ├── viewPosition.usf │ │ ├── yuv.usf │ │ └── zero.usf │ │ ├── sampler.usf │ │ ├── sdf.usf │ │ ├── sdf │ │ ├── boxFrameSDF.usf │ │ ├── boxSDF.usf │ │ ├── capsuleSDF.usf │ │ ├── circleSDF.usf │ │ ├── coneSDF.usf │ │ ├── crossSDF.usf │ │ ├── cubeSDF.usf │ │ ├── cylinderSDF.usf │ │ ├── dodecahedronSDF.usf │ │ ├── ellipsoidSDF.usf │ │ ├── flowerSDF.usf │ │ ├── gearSDF.usf │ │ ├── heartSDF.usf │ │ ├── hexPrismSDF.usf │ │ ├── hexSDF.usf │ │ ├── icosahedronSDF.usf │ │ ├── juliaSDF.usf │ │ ├── kochSDF.usf │ │ ├── lineSDF.usf │ │ ├── linkSDF.usf │ │ ├── mandelbulbSDF.usf │ │ ├── octahedronSDF.usf │ │ ├── octogonPrismSDF.usf │ │ ├── opElongate.usf │ │ ├── opExtrude.usf │ │ ├── opIntersection.usf │ │ ├── opOnion.usf │ │ ├── opRepeat.usf │ │ ├── opRevolve.usf │ │ ├── opRound.usf │ │ ├── opSubtraction.usf │ │ ├── opUnion.usf │ │ ├── planeSDF.usf │ │ ├── polySDF.usf │ │ ├── pyramidSDF.usf │ │ ├── raysSDF.usf │ │ ├── rectSDF.usf │ │ ├── rhombSDF.usf │ │ ├── sphereSDF.usf │ │ ├── spiralSDF.usf │ │ ├── starSDF.usf │ │ ├── superShapeSDF.usf │ │ ├── tetrahedronSDF.usf │ │ ├── torusSDF.usf │ │ ├── triPrismSDF.usf │ │ ├── triSDF.usf │ │ └── vesicaSDF.usf │ │ ├── space │ │ ├── aspect.usf │ │ ├── bracketing.usf │ │ ├── brickTile.usf │ │ ├── cart2polar.usf │ │ ├── center.usf │ │ ├── checkerTile.usf │ │ ├── depth2viewZ.usf │ │ ├── displace.usf │ │ ├── equirect2xyz.usf │ │ ├── fisheye2xyz.usf │ │ ├── flipY.usf │ │ ├── hexTile.usf │ │ ├── kaleidoscope.usf │ │ ├── linearizeDepth.usf │ │ ├── lookAt.usf │ │ ├── mirrorTile.usf │ │ ├── nearest.usf │ │ ├── parallaxMapping.usf │ │ ├── polar2cart.usf │ │ ├── ratio.usf │ │ ├── rotate.usf │ │ ├── rotateX.usf │ │ ├── rotateY.usf │ │ ├── rotateZ.usf │ │ ├── scale.usf │ │ ├── screen2viewPosition.usf │ │ ├── sprite.usf │ │ ├── sqTile.usf │ │ ├── triTile.usf │ │ ├── uncenter.usf │ │ ├── unratio.usf │ │ ├── view2screenPosition.usf │ │ ├── viewZ2depth.usf │ │ ├── windmillTile.usf │ │ └── xyz2equirect.usf │ │ └── version.usf │ └── Source │ └── LygiaShader │ ├── LygiaShader.Build.cs │ ├── Private │ ├── LygiaShader.cpp │ └── ShaderFileBlueprintLib.cpp │ └── Public │ ├── LygiaShader.h │ └── ShaderFileBlueprintLib.h ├── README.md └── Source ├── LygiaProject.Target.cs ├── LygiaProject ├── LygiaProject.Build.cs ├── LygiaProject.cpp ├── LygiaProject.h ├── Private │ └── FileBlueprintLib.cpp └── Public │ └── FileBlueprintLib.h └── LygiaProjectEditor.Target.cs /.idea/.idea.LygiaProject/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Rider ignored files 5 | /projectSettingsUpdater.xml 6 | /.idea.LygiaProject.iml 7 | /modules.xml 8 | /contentModel.xml 9 | # Editor-based HTTP Client requests 10 | /httpRequests/ 11 | # Datasource local storage ignored files 12 | /dataSources/ 13 | /dataSources.local.xml 14 | -------------------------------------------------------------------------------- /.idea/.idea.LygiaProject/.idea/.name: -------------------------------------------------------------------------------- 1 | LygiaProject -------------------------------------------------------------------------------- /.idea/.idea.LygiaProject/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/.idea.LygiaProject/.idea/indexLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/.idea.LygiaProject/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Config/DefaultEditor.ini: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Config/DefaultGame.ini: -------------------------------------------------------------------------------- 1 | [/Script/EngineSettings.GeneralProjectSettings] 2 | ProjectID=7EE0B1CE4526CBBCFE465FBCA44B5907 3 | -------------------------------------------------------------------------------- /LygiaProject.uproject: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion": 3, 3 | "EngineAssociation": "4.26", 4 | "Category": "", 5 | "Description": "", 6 | "Modules": [ 7 | { 8 | "Name": "LygiaProject", 9 | "Type": "Runtime", 10 | "LoadingPhase": "Default", 11 | "AdditionalDependencies": [ 12 | "Engine" 13 | ] 14 | } 15 | ], 16 | "TargetPlatforms": [ 17 | "Android", 18 | "IOS", 19 | "Linux", 20 | "Mac", 21 | "Windows" 22 | ] 23 | } -------------------------------------------------------------------------------- /Platforms/Android/Config/AndroidEngine.ini: -------------------------------------------------------------------------------- 1 | [/Script/AndroidRuntimeSettings.AndroidRuntimeSettings] 2 | ;AudioSampleRate=48000 3 | AudioMaxChannels=12 4 | ;AudioCallbackBufferFrameSize=1024 5 | ;AudioNumBuffersToEnqueue=2 6 | ;AudioNumSourceWorkers=0 7 | 8 | ; Audio Plugins (must be enabled in .uproject 9 | ; ReverbPlugin= 10 | ; OcclusionPlugin= 11 | ; SpatializationPlugin= 12 | -------------------------------------------------------------------------------- /Platforms/IOS/Config/IOSEngine.ini: -------------------------------------------------------------------------------- 1 | [/Script/IOSRuntimeSettings.IOSRuntimeSettings] 2 | ;AudioSampleRate=48000 3 | AudioMaxChannels=16 4 | ;AudioCallbackBufferFrameSize=1024 5 | ;AudioNumBuffersToEnqueue=2 6 | ;AudioNumSourceWorkers=0 7 | 8 | ; Audio Plugins (must be enabled in .uproject 9 | ; ReverbPlugin= 10 | ; OcclusionPlugin= 11 | ; SpatializationPlugin= 12 | -------------------------------------------------------------------------------- /Platforms/Linux/Config/LinuxEngine.ini: -------------------------------------------------------------------------------- 1 | [/Script/LinuxTargetPlatform.LinuxTargetSettings] 2 | ;AudioSampleRate=48000 3 | AudioMaxChannels=16 4 | ;AudioCallbackBufferFrameSize=1024 5 | ;AudioNumBuffersToEnqueue=2 6 | ;AudioNumSourceWorkers=0 7 | 8 | ; Audio Plugins (must be enabled in .uproject 9 | ; ReverbPlugin= 10 | ; OcclusionPlugin= 11 | ; SpatializationPlugin= 12 | -------------------------------------------------------------------------------- /Platforms/Mac/Config/MacEngine.ini: -------------------------------------------------------------------------------- 1 | [/Script/MacTargetPlatform.MacTargetSettings] 2 | ;AudioSampleRate=48000 3 | ;AudioMaxChannels=32 4 | ;AudioCallbackBufferFrameSize=1024 5 | ;AudioNumBuffersToEnqueue=2 6 | ;AudioNumSourceWorkers=0 7 | 8 | ; Audio Plugins (must be enabled in .uproject 9 | ; ReverbPlugin= 10 | ; OcclusionPlugin= 11 | ; SpatializationPlugin= 12 | -------------------------------------------------------------------------------- /Platforms/PS4/Config/PS4Engine.ini: -------------------------------------------------------------------------------- 1 | [/Script/PS4PlatformEditor.PS4TargetSettings] 2 | ;AudioSampleRate=48000 3 | ;AudioMaxChannels=32 4 | AudioCallbackBufferFrameSize=256 5 | AudioNumBuffersToEnqueue=7 6 | AudioNumSourceWorkers=4 7 | 8 | ; Audio Plugins (must be enabled in .uproject 9 | ; ReverbPlugin= 10 | ; OcclusionPlugin= 11 | ; SpatializationPlugin=Audio3D 12 | -------------------------------------------------------------------------------- /Platforms/PS5/Config/PS5Engine.ini: -------------------------------------------------------------------------------- 1 | [/Script/PS5PlatformEditor.PS5TargetSettings] 2 | ;AudioSampleRate=48000 3 | ;AudioMaxChannels=32 4 | AudioCallbackBufferFrameSize=256 5 | AudioNumBuffersToEnqueue=7 6 | AudioNumSourceWorkers=4 7 | 8 | ; Audio Plugins (must be enabled in .uproject 9 | ; ReverbPlugin= 10 | ; OcclusionPlugin= 11 | ; SpatializationPlugin=Audio3D 12 | -------------------------------------------------------------------------------- /Platforms/Switch/Config/SwitchEngine.ini: -------------------------------------------------------------------------------- 1 | [/Script/SwitchRuntimeSettings.SwitchRuntimeSettings] 2 | ;AudioSampleRate=48000 3 | AudioMaxChannels=16 4 | ;AudioCallbackBufferFrameSize=1024 5 | ;AudioNumBuffersToEnqueue=2 6 | ;AudioNumSourceWorkers=0 7 | 8 | ; Audio Plugins (must be enabled in .uproject 9 | ; ReverbPlugin= 10 | ; OcclusionPlugin= 11 | ; SpatializationPlugin= 12 | -------------------------------------------------------------------------------- /Platforms/Windows/Config/WindowsEngine.ini: -------------------------------------------------------------------------------- 1 | [/Script/WindowsTargetPlatform.WindowsTargetSettings] 2 | ;AudioSampleRate=48000 3 | ;AudioMaxChannels=32 4 | AudioCallbackBufferFrameSize=256 5 | AudioNumBuffersToEnqueue=7 6 | ;AudioNumSourceWorkers=0 7 | 8 | ; Audio Plugins (must be enabled in .uproject 9 | ; ReverbPlugin= 10 | ; OcclusionPlugin= 11 | ; SpatializationPlugin= 12 | -------------------------------------------------------------------------------- /Platforms/XSX/Config/XSXEngine.ini: -------------------------------------------------------------------------------- 1 | [/Script/XSXPlatformEditor.XSXTargetSettings] 2 | ;AudioSampleRate=48000 3 | ;AudioMaxChannels=32 4 | AudioCallbackBufferFrameSize=256 5 | AudioNumBuffersToEnqueue=7 6 | ;AudioNumSourceWorkers=0 7 | 8 | ; Audio Plugins (must be enabled in .uproject 9 | ; ReverbPlugin= 10 | ; OcclusionPlugin= 11 | ; SpatializationPlugin= 12 | -------------------------------------------------------------------------------- /Platforms/XboxOne/Config/XboxOneEngine.ini: -------------------------------------------------------------------------------- 1 | [/Script/XboxOnePlatformEditor.XboxOneTargetSettings] 2 | ;AudioSampleRate=48000 3 | ;AudioMaxChannels=32 4 | AudioCallbackBufferFrameSize=256 5 | AudioNumBuffersToEnqueue=7 6 | ;AudioNumSourceWorkers=0 7 | 8 | ; Audio Plugins (must be enabled in .uproject 9 | ; ReverbPlugin= 10 | ; OcclusionPlugin= 11 | ; SpatializationPlugin= 12 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Config/FilterPlugin.ini: -------------------------------------------------------------------------------- 1 | [FilterPlugin] 2 | ; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and 3 | ; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively. 4 | ; 5 | ; Examples: 6 | ; /README.txt 7 | ; /Extras/... 8 | ; /Binaries/ThirdParty/*.dll 9 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Images/blue_noise.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Images/blue_noise.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Images/danny.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Images/danny.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Images/grid_00.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Images/grid_00.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Images/mixbox_lut.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Images/mixbox_lut.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Images/row_05.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Images/row_05.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Images/sprite_megaman.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Images/sprite_megaman.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Images/square_00.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Images/square_00.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Images/square_01.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Images/square_01.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Images/square_02.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Images/square_02.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Maps/Demo.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Maps/Demo.umap -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/animations/MF_AnimEase.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/animations/MF_AnimEase.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/animations/MF_AnimationSprite.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/animations/MF_AnimationSprite.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/animations/M_animation_easing.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/animations/M_animation_easing.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/animations/M_animation_sprite.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/animations/M_animation_sprite.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/MF_color_LUT.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/MF_color_LUT.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/MF_color_brightness_contrast.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/MF_color_brightness_contrast.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/MF_color_brightness_saturation.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/MF_color_brightness_saturation.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/MF_color_daltonize.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/MF_color_daltonize.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/MF_color_dither.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/MF_color_dither.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/MF_color_luma_luminance.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/MF_color_luma_luminance.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/MF_color_mix.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/MF_color_mix.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/MF_color_palettes.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/MF_color_palettes.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/MF_color_vibrance.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/MF_color_vibrance.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/M_color_LUT.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/M_color_LUT.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/M_color_brightness_contrast.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/M_color_brightness_contrast.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/M_color_brightness_contrast_Inst.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/M_color_brightness_contrast_Inst.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/M_color_brightness_saturation.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/M_color_brightness_saturation.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/M_color_daltonize.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/M_color_daltonize.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/M_color_dither.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/M_color_dither.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/M_color_luma_luminance.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/M_color_luma_luminance.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/M_color_mix.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/M_color_mix.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/M_color_palettes.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/M_color_palettes.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/color/M_color_vibrance.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/color/M_color_vibrance.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/distort/M_distort_barrel.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/distort/M_distort_barrel.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/distort/M_distort_chromaAB.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/distort/M_distort_chromaAB.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/distort/M_distort_grain.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/distort/M_distort_grain.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/filter/M_filter_bilateralBlur2D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/filter/M_filter_bilateralBlur2D.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/filter/M_filter_boxBlur2D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/filter/M_filter_boxBlur2D.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/filter/M_filter_edge2D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/filter/M_filter_edge2D.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/filter/M_filter_gaussinaBlur2D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/filter/M_filter_gaussinaBlur2D.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/filter/M_filter_kawahara2D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/filter/M_filter_kawahara2D.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/filter/M_filter_laplaacian.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/filter/M_filter_laplaacian.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/filter/M_filter_mean2D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/filter/M_filter_mean2D.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/filter/M_filter_median2D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/filter/M_filter_median2D.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/filter/M_filter_noiseBlur2D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/filter/M_filter_noiseBlur2D.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/filter/M_filter_radialBlur2D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/filter/M_filter_radialBlur2D.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/filter/M_filter_sharpen2D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/filter/M_filter_sharpen2D.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/generative/M_generative_cnoise.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/generative/M_generative_cnoise.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/generative/M_generative_curl.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/generative/M_generative_curl.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/generative/M_generative_fbm.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/generative/M_generative_fbm.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/generative/M_generative_noised.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/generative/M_generative_noised.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/generative/M_generative_pnoise.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/generative/M_generative_pnoise.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/generative/M_generative_random.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/generative/M_generative_random.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/generative/M_generative_snoise.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/generative/M_generative_snoise.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/generative/M_generative_voronoi.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/generative/M_generative_voronoi.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Materials/generative/M_generative_worley.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Materials/generative/M_generative_worley.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Widget/AddWidget.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Widget/AddWidget.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Widget/Item.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Widget/Item.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/Content/Widget/ShowExample.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Content/Widget/ShowExample.uasset -------------------------------------------------------------------------------- /Plugins/LygiaShader/LygiaShader.uplugin: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion": 3, 3 | "Version": 1, 4 | "VersionName": "1.0", 5 | "FriendlyName": "LygiaShader", 6 | "Description": "LYGIA Shader Library Example usage for unreal engine", 7 | "Category": "CrazeGame", 8 | "CreatedBy": "Frank lzt", 9 | "CreatedByURL": "https://github.com/franklzt/lygia_unreal_engine_examples", 10 | "DocsURL": "", 11 | "MarketplaceURL": "", 12 | "SupportURL": "", 13 | "CanContainContent": true, 14 | "IsBetaVersion": false, 15 | "IsExperimentalVersion": false, 16 | "Installed": false, 17 | "Modules": [ 18 | { 19 | "Name": "LygiaShader", 20 | "Type": "Runtime", 21 | "LoadingPhase": "Default" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /Plugins/LygiaShader/Resources/Icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Resources/Icon128.png -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/animation_easing_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/draw/circle.usf" 3 | #include "/LygiaShader/lygia/space/ratio.usf" 4 | #include "/LygiaShader/lygia/space/scale.usf" 5 | #include "/LygiaShader/lygia/animation/easing.usf" 6 | 7 | 8 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/animation_sprite_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/space/scale.usf" 3 | #include "/LygiaShader/lygia/sample/sprite.usf" 4 | #include "/LygiaShader/lygia/animation/spriteLoop.usf" -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/color_LUT.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/color/lut.usf" 3 | Texture2D Tex; 4 | Texture2D LutTex; 5 | float2 st; 6 | #define LUT_SQUARE 1 7 | struct __Colorlut 8 | { 9 | 10 | float4 drawShader(Texture2D Tex,float2 st) 11 | { 12 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 13 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 14 | color = Tex.SampleGrad(TexSampler,st,ddx(st),ddy(st)); 15 | color = lut(LutTex,LutTexSampler, color,0); 16 | return color; 17 | } 18 | }; 19 | __Colorlut _edgeFilter; 20 | return _edgeFilter.drawShader(Tex,st); -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/color_brightness_contrast_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/color/brightnessContrast.usf" 3 | #include "/LygiaShader/lygia/color/brightnessMatrix.usf" 4 | #include "/LygiaShader/lygia/color/contrast.usf" 5 | #include "/LygiaShader/lygia/color/contrastMatrix.usf" 6 | 7 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/color_brightness_saturation.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/color/desaturate.usf" 3 | #include "/LygiaShader/lygia/color/saturationMatrix.usf" 4 | Texture2D Tex; 5 | float2 st; 6 | float Saturation; 7 | struct __ColorsaturationMatrix 8 | { 9 | float4 drawShader(Texture2D Tex,float2 st) 10 | { 11 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 12 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 13 | 14 | 15 | color = Tex.SampleGrad(TexSampler,st,ddx(st),ddy(st)); 16 | 17 | if (st.y < 0.5) 18 | color = desaturate(color, 1.0-Saturation); 19 | else 20 | color = mul(saturationMatrix(Saturation), color); 21 | 22 | return color; 23 | } 24 | }; 25 | __ColorsaturationMatrix _edgeFilter; 26 | return _edgeFilter.drawShader(Tex,st); 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/color_brightness_saturation_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/color/desaturate.usf" 3 | #include "/LygiaShader/lygia/color/saturationMatrix.usf" 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/color_luma_luminance_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/color/luma.usf" 3 | #include "/LygiaShader/lygia/color/luminance.usf" 4 | #include "/Shaders/lygia/color/space.usf" 5 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/color_mix.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/color/mixOklab.usf" 3 | #include "/LygiaShader/lygia/math/mix.usf" 4 | #include "/LygiaShader/lygia/color/mixSpectral.usf" 5 | float2 st; 6 | float3 A; 7 | float3 B; 8 | struct __ColorMix 9 | { 10 | float4 drawShader(float2 st) 11 | { 12 | 13 | float4 color = float4(0.0,0.0,0.0,1.0); 14 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 15 | 16 | //float3 A = float3(0.9333, 0.9451, 0.0588); 17 | //float3 B = float3(0.0824, 0.1686, 0.5529); 18 | float pct = st.x; 19 | 20 | if (st.y < 0.33) 21 | color.rgb = mix(A, B, pct) ; 22 | else if (st.y < 0.66) 23 | color.rgb = mixOklab(A, B, pct); 24 | else 25 | color.rgb = mixSpectral(A, B, pct); 26 | 27 | return color; 28 | } 29 | }; 30 | __ColorMix _edgeFilter; 31 | return _edgeFilter.drawShader(st); -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/color_mix_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/color/mixOklab.usf" 3 | #include "/LygiaShader/lygia/math/mix.usf" 4 | #include "/LygiaShader/lygia/color/mixSpectral.usf" -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/color_palettes.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/color/palette/spectral.usf" 3 | #include "/LygiaShader/lygia/color/palette/fire.usf" 4 | #include "/LygiaShader/lygia/color/palette/heatmap.usf" 5 | #include "/LygiaShader/lygia/color/palette/hue.usf" 6 | Texture2D Tex; 7 | float2 st; 8 | struct __ColorpaletteShader 9 | { 10 | float4 drawShader(Texture2D Tex,float2 st) 11 | { 12 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 13 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 14 | 15 | float pct = st.x; 16 | 17 | if (st.y < 0.25) 18 | color.rgb = hue(pct,st.y); 19 | else if (st.y < 0.5) 20 | color.rgb = spectral(pct); 21 | else if (st.y < 0.75) 22 | color.rgb = heatmap(pct); 23 | else 24 | color.rgb = fire(pct); 25 | 26 | return color; 27 | } 28 | }; 29 | __ColorpaletteShader _edgeFilter; 30 | return _edgeFilter.drawShader(Tex,st); -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/color_palettes_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/color/palette/spectral.usf" 3 | #include "/LygiaShader/lygia/color/palette/fire.usf" 4 | #include "/Shaders/lygia/color/palette/heatmap.usf" 5 | #include "/Shaders/lygia/color/palette/hue.usf" -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/color_vibrance.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/color/vibrance.usf" 3 | Texture2D Tex; 4 | float2 st; 5 | float Vibrance; 6 | struct __Colorvibrance 7 | { 8 | float4 drawShader(Texture2D Tex,float2 st) 9 | { 10 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 11 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 12 | 13 | 14 | color = Tex.SampleGrad(TexSampler,st,ddx(st),ddy(st)); 15 | 16 | color = vibrance(color, Vibrance); 17 | 18 | return color; 19 | } 20 | }; 21 | __Colorvibrance _edgeFilter; 22 | return _edgeFilter.drawShader(Tex,st); 23 | 24 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/distort_barrel.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/distort/barrel.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" 4 | Texture2D Tex; 5 | float2 st; 6 | struct __Distortbarrel 7 | { 8 | float4 drawShader(Texture2D Tex,float2 st) 9 | { 10 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 11 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 12 | float ix = floor(st.x * 5.0); 13 | float strenght = max(0.0, ix * 10.0); 14 | color += barrel(Tex,TexSampler, st, pixel * strenght); 15 | color += digits(st - float2(ix/5.0 + 0.01, 0.01), strenght); 16 | color -= step(.98, frac(st.x * 5.0)); 17 | return color; 18 | } 19 | }; 20 | __Distortbarrel _edgeFilter; 21 | return _edgeFilter.drawShader(Tex,st); 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/distort_barrel_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/distort/barrel.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" 4 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/distort_chromaAB.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/distort/chromaAB.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" 4 | Texture2D Tex; 5 | float2 st; 6 | struct __DistortchromaAB 7 | { 8 | float4 drawShader(Texture2D Tex,float2 st) 9 | { 10 | float4 color = float4(0.0, 0.0, 0.0,1.0) ; 11 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 12 | 13 | 14 | float ix = floor(st.x * 5.0); 15 | float strenght = max(0.0, ix * 100.0); 16 | 17 | color.rgb += chromaAB(Tex,TexSampler, st, pixel * strenght, 1.0); 18 | 19 | color += digits(st - float2(ix/5.0 + 0.01, 0.01), strenght); 20 | color -= step(.98, frac(st.x * 5.0)); 21 | return color; 22 | } 23 | }; 24 | __DistortchromaAB _edgeFilter; 25 | return _edgeFilter.drawShader(Tex,st); 26 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/distort_chromaAB_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/distort/chromaAB.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/distort_grain.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/distort/grain.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" 4 | Texture2D Tex; 5 | float2 st; 6 | struct __DistortGrain 7 | { 8 | float4 drawShader(Texture2D Tex,float2 st) 9 | { 10 | 11 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 12 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 13 | 14 | 15 | color.rgb = grain(Tex,TexSampler, st, View.ViewSizeAndInvSize.xy, View.GameTime, 1.0); 16 | 17 | return color; 18 | } 19 | }; 20 | __DistortGrain _edgeFilter; 21 | return _edgeFilter.drawShader(Tex,st); 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/distort_grain_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/distort/grain.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" 4 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/exampleDigit.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/draw/digits.usf" 3 | float4 drawWidgetDigit(float4 inColor,float ix,float2 st,float radius) 4 | { 5 | inColor -= step(1.-st.y, 0.05) * 0.5; 6 | inColor = clamp(inColor, float4(0., 0., 0., 1.), float4(1., 1., 1., 1.)); 7 | inColor += digits(st - float2(ix/5.0 + 0.01, 0.965), radius); 8 | inColor -= step(.98, frac(st.x * 5.0)); 9 | return inColor; 10 | } -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_bilateralBlur2D.usf: -------------------------------------------------------------------------------- 1 | #include "/LygiaShader/lygia/filter/bilateral.usf" 2 | #include "/LygiaShader/lygia/draw/digits.usf" 3 | Texture2D Tex; 4 | float2 st; 5 | struct __BilateralBlur 6 | { 7 | float4 drawShader(Texture2D Tex,float2 st) 8 | { 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | float ix = floor(st.x * 5.0); 12 | float kernel_size = max(1.0, ix * 4.0); 13 | color = bilateral(Tex,TexSampler,st, pixel, int(kernel_size)); 14 | color += digits(st - float2(ix/5.0 + 0.01, 0.01), kernel_size, 0.0); 15 | color -= step(.98, frac(st.x * 5.0)); 16 | return color; 17 | } 18 | }; 19 | __BilateralBlur _edgeFilter; 20 | return _edgeFilter.drawShader(Tex,st); 21 | 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_bilateralBlur2D_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/filter/bilateral.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" 4 | 5 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_boxBlur2D.usf: -------------------------------------------------------------------------------- 1 | #include "/LygiaShader/lygia/filter/boxBlur.usf" 2 | #include "/LygiaShader/lygia/draw/digits.usf" 3 | Texture2D Tex; 4 | float2 st; 5 | struct __BoxBlur2D 6 | { 7 | float4 drawShader(Texture2D Tex,float2 st) 8 | { 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | float ix = floor(st.x * 5.0); 12 | float kernel_size = max(1.0, ix * 4.0); 13 | color = boxBlur(Tex,TexSampler, st, pixel, int(kernel_size)); 14 | color += digits(st - float2(ix/5.0 + 0.01, 0.01), kernel_size, 0.0); 15 | color -= step(.98, frac(st.x * 5.0)); 16 | return color; 17 | } 18 | }; 19 | __BoxBlur2D _edgeFilter; 20 | return _edgeFilter.drawShader(Tex,st); 21 | 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_boxBlur2D_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/filter/boxBlur.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_edge2D.usf: -------------------------------------------------------------------------------- 1 | #include "/LygiaShader/lygia/filter/edge.usf" 2 | #include "/LygiaShader/exampleDIgit.usf" 3 | Texture2D Tex; 4 | float2 st; 5 | struct __EdageFilter 6 | { 7 | float4 drawShader(Texture2D Tex,float2 st) 8 | { 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | float ix = floor(st.x * 5.0); 12 | float radius = max(0.1, ix * 0.5); 13 | 14 | if (st.y < 0.5) 15 | color += edgePrewitt(Tex,TexSampler, st, pixel * radius); 16 | else 17 | color += edgeSobel(Tex,TexSampler, st, pixel * radius); 18 | color = drawWidgetDigit(color,ix,st,radius); 19 | return color; 20 | } 21 | }; 22 | __EdageFilter _edgeFilter; 23 | return _edgeFilter.drawShader(Tex,st); 24 | 25 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_edge2D_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/filter/edge.usf" 3 | #include "/LygiaShader/exampleDIgit.usf" 4 | 5 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_gaussinaBlur2D.usf: -------------------------------------------------------------------------------- 1 | #include "/LygiaShader/lygia/filter/gaussianBlur.usf" 2 | #include "/LygiaShader/lygia/draw/digits.usf" 3 | Texture2D Tex; 4 | float2 st; 5 | struct __GaussinaBlur2D 6 | { 7 | float4 drawShader(Texture2D Tex,float2 st) 8 | { 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | float ix = floor(st.x * 5.0); 12 | float kernel_size = max(1.0, ix * 4.0); 13 | color = gaussianBlur(Tex,TexSampler, st, pixel,int(kernel_size)); 14 | color += digits(st - float2(ix/5.0 + 0.01, 0.01), kernel_size, 0.0); 15 | color -= step(.98, frac(st.x * 5.0)); 16 | return color; 17 | } 18 | }; 19 | __GaussinaBlur2D _edgeFilter; 20 | return _edgeFilter.drawShader(Tex,st); 21 | 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_gaussinaBlur2D_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/filter/gaussianBlur.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" 4 | 5 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_kawahara2D.usf: -------------------------------------------------------------------------------- 1 | #include "/LygiaShader/lygia/filter/kuwahara.usf" 2 | #include "/LygiaShader/lygia/draw/digits.usf" 3 | Texture2D Tex; 4 | float2 st; 5 | struct __Kawahara2D 6 | { 7 | float4 drawShader(Texture2D Tex,float2 st) 8 | { 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | float ix = floor(st.x * 5.0); 12 | float kernel_size = max(1.0, ix * 4.0); 13 | color = kuwahara(Tex,TexSampler, st, pixel, int(kernel_size)); 14 | color += digits(st - float2(ix/5.0 + 0.01, 0.01), kernel_size, 0.0); 15 | color -= step(.98, frac(st.x * 5.0)); 16 | return color; 17 | } 18 | }; 19 | __Kawahara2D _edgeFilter; 20 | return _edgeFilter.drawShader(Tex,st); 21 | 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_kawahara2D_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/filter/kuwahara.usf" 3 | #include "/Shaders/lygia/draw/digits.usf" 4 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_laplacian.usf: -------------------------------------------------------------------------------- 1 | #include "/LygiaShader/lygia/filter/laplacian.usf" 2 | #include "/LygiaShader/lygia/draw/digits.usf" 3 | Texture2D Tex; 4 | float2 st; 5 | struct __Laplacian 6 | { 7 | float4 drawShader(Texture2D Tex,float2 st) 8 | { 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | float ix = floor(st.x * 5.0); 12 | float kernel_size = max(1.0, ix * 4.0); 13 | color = laplacian(Tex,TexSampler, st, pixel, kernel_size); 14 | color += digits(st - float2(ix/5.0 + 0.01, 0.01), kernel_size, 0.0); 15 | color -= step(.98, frac(st.x * 5.0)); 16 | return color; 17 | } 18 | }; 19 | __Laplacian _edgeFilter; 20 | return _edgeFilter.drawShader(Tex,st); 21 | 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_laplacian_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/filter/laplacian.usf" 3 | #include "/Shaders/lygia/draw/digits.usf" 4 | 5 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_mean2D.usf: -------------------------------------------------------------------------------- 1 | #include "/LygiaShader/lygia/filter/mean.usf" 2 | #include "/LygiaShader/lygia/draw/digits.usf" 3 | Texture2D Tex; 4 | float2 st; 5 | struct __Mean 6 | { 7 | float4 drawShader(Texture2D Tex,float2 st) 8 | { 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | 12 | float ix = floor(st.x * 5.0); 13 | float radius = max(0.1, ix * 0.5); 14 | 15 | 16 | color += mean(Tex,TexSampler, st, pixel * radius); 17 | 18 | color -= step(st.y, 0.05) * 0.5; 19 | color = clamp(color, float4(0., 0., 0., 1.), float4(1., 1., 1., 1.)); 20 | color += digits(st - float2(ix/5.0 + 0.01, 0.01), radius); 21 | color -= step(.98, frac(st.x * 5.0)); 22 | return color; 23 | } 24 | }; 25 | __Mean _edgeFilter; 26 | return _edgeFilter.drawShader(Tex,st); 27 | 28 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_mean2D_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/filter/mean.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" 4 | 5 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_median2D_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/filter/median.usf" 3 | #include "/LygiaShader/lygia/draw/stroke.usf" 4 | #include "/Shaders/lygia/draw/digits.usf" 5 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_noiseBlur2D_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/filter/noiseBlur.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" 4 | 5 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_radialBlur2D_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/filter/radialBlur.usf" 3 | #include "/LygiaShader/lygia/draw/digits.usf" 4 | 5 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/filter_sharpen2D_inl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/filter/sharpen.usf" 3 | #include "/Shaders/lygia/draw/digits.usf" 4 | 5 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/generative_cnoise.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/generative/cnoise.usf" 3 | float2 st; 4 | struct __Generativecnoise 5 | { 6 | float4 drawShader(float2 st) 7 | { 8 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 9 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 10 | 11 | float d2 = cnoise(float2(st * 5. + View.GameTime)) * 0.5 + 0.5; 12 | float d3 = cnoise(float3(st * 5., View.GameTime)) * 0.5 + 0.5; 13 | 14 | color += lerp(d2, d3, step(0.5, st.x)); 15 | 16 | return color; 17 | } 18 | }; 19 | __Generativecnoise _edgeFilter; 20 | return _edgeFilter.drawShader(st); 21 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/generative_curl.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/generative/curl.usf" 3 | float2 st; 4 | struct __Generativecurl 5 | { 6 | float4 drawShader(float2 st) 7 | { 8 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 9 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 10 | 11 | 12 | float2 d2 = curl(float2(st * 5. + View.GameTime)) * 0.5 + 0.5; 13 | float3 d3 = curl(float3(st * 5., View.GameTime)) * 0.5 + 0.5; 14 | 15 | color.rgb += lerp(float3(d2.x, d2.y, 0.), d3, step(0.5, st.x)); 16 | 17 | return color; 18 | } 19 | }; 20 | __Generativecurl _edgeFilter; 21 | return _edgeFilter.drawShader(st); 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/generative_fbm.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/generative/fbm.usf" 3 | float2 st; 4 | struct __Generativecfbm 5 | { 6 | float4 drawShader(float2 st) 7 | { 8 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 9 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 10 | 11 | 12 | float d2 = fbm(float2(st * 5. + View.GameTime)) * 0.5 + 0.5; 13 | float d3 = fbm(float3(st * 5., View.GameTime)) * 0.5 + 0.5; 14 | 15 | color.rgb += lerp(d2, d3, step(0.5, st.x)); 16 | 17 | return color; 18 | } 19 | }; 20 | __Generativecfbm _edgeFilter; 21 | return _edgeFilter.drawShader(st); 22 | 23 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/generative_noised.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/generative/noised.usf" 3 | float2 st; 4 | struct __Generativenoised 5 | { 6 | float4 drawShader(float2 st) 7 | { 8 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 9 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 10 | 11 | 12 | float2 d2 = noised(float2(st * 5. + View.GameTime)).yz * 0.5 + 0.5; 13 | float3 d3 = noised(float3(st * 5., View.GameTime)).yzw * 0.5 + 0.5; 14 | 15 | color.rgb += lerp(float3(d2,0.0), d3, step(0.5, st.x)); 16 | 17 | return color; 18 | } 19 | }; 20 | __Generativenoised _edgeFilter; 21 | return _edgeFilter.drawShader(st); 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/generative_pnoise.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/generative/pnoise.usf" 3 | float2 st; 4 | struct __Generativecpnoise 5 | { 6 | float4 drawShader(float2 st) 7 | { 8 | 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | 12 | 13 | float d2 = pnoise(float2(st * 5. + View.GameTime), float2(1.2, 3.4)) * 0.5 + 0.5; 14 | float d3 = pnoise(float3(st * 5., View.GameTime), float3(1.2, 3.4, 5.6)) * 0.5 + 0.5; 15 | 16 | color += lerp(d2, d3, step(0.5, st.x)); 17 | 18 | return color; 19 | } 20 | }; 21 | __Generativecpnoise _edgeFilter; 22 | return _edgeFilter.drawShader(st); 23 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/generative_random.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/generative/random.usf" 3 | float2 st; 4 | struct __Generativerandom 5 | { 6 | float4 drawShader(float2 st) 7 | { 8 | 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | 12 | 13 | float d2 = random(float2(st * 5. + View.GameTime)); 14 | float d3 = random(float3(st * 5., View.GameTime)); 15 | 16 | color += lerp(d2, d3, step(0.5, st.x)); 17 | 18 | return color; 19 | } 20 | }; 21 | __Generativerandom _edgeFilter; 22 | return _edgeFilter.drawShader(st); 23 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/generative_snoise.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/generative/snoise.usf" 3 | float2 st; 4 | struct __Generativesnoise 5 | { 6 | float4 drawShader(float2 st) 7 | { 8 | 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | 12 | 13 | float d2 = snoise(float2(st * 5. + View.GameTime)) * 0.5 + 0.5; 14 | float d3 = snoise(float3(st * 5., View.GameTime)) * 0.5 + 0.5; 15 | 16 | color += lerp(d2, d3, step(0.5, st.x)); 17 | 18 | return color; 19 | } 20 | }; 21 | __Generativesnoise _edgeFilter; 22 | return _edgeFilter.drawShader(st); 23 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/generative_voronoi.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/generative/voronoi.usf" 3 | float2 st; 4 | struct __Generativevoronoi 5 | { 6 | float4 drawShader(float2 st) 7 | { 8 | 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | 12 | 13 | float d2 = voronoi(float2(st * 5. + View.GameTime)); 14 | float d3 = voronoi(float3(st * 5., View.GameTime)); 15 | 16 | color += lerp(d2, d3, step(0.5, st.x)); 17 | 18 | return color; 19 | } 20 | }; 21 | __Generativevoronoi _edgeFilter; 22 | return _edgeFilter.drawShader(st); 23 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/generative_worley.usf: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "/LygiaShader/lygia/generative/worley.usf" 3 | float2 st; 4 | struct __Generativeworley 5 | { 6 | float4 drawShader(float2 st) 7 | { 8 | 9 | float4 color = float4(0.0, 0.0, 0.0, 1.0); 10 | float2 pixel = 1.0/View.ViewSizeAndInvSize.xy; 11 | 12 | 13 | float d2 = worley(float2(st * 10. + View.GameTime)); 14 | float d3 = worley(float3(st * 10., View.GameTime)); 15 | 16 | color += lerp(d2, d3, step(0.5, st.x)); 17 | 18 | return color; 19 | } 20 | }; 21 | __Generativeworley _edgeFilter; 22 | return _edgeFilter.drawShader(st); 23 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/animation/easing.usf: -------------------------------------------------------------------------------- 1 | /* 2 | description: Include all available easing animations 3 | */ 4 | 5 | #include "easing/back.usf" 6 | #include "easing/bounce.usf" 7 | #include "easing/circular.usf" 8 | #include "easing/cubic.usf" 9 | #include "easing/elastic.usf" 10 | #include "easing/exponential.usf" 11 | #include "easing/linear.usf" 12 | #include "easing/quadratic.usf" 13 | #include "easing/quartic.usf" 14 | #include "easing/quintic.usf" 15 | #include "easing/sine.usf" 16 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/animation/easing/back.usf: -------------------------------------------------------------------------------- 1 | #include "../../math/const.usf" 2 | 3 | /* 4 | contributors: Hugh Kennedy (https://github.com/hughsk) 5 | description: Back easing. From https://github.com/stackgl/glsl-easings 6 | use: back( x) 7 | */ 8 | 9 | #ifndef FNC_BACKIN 10 | #define FNC_BACKIN 11 | float backIn(in float t) { 12 | return pow(t, 3.) - t * sin(t * PI); 13 | } 14 | #endif 15 | 16 | #ifndef FNC_BACKOUT 17 | #define FNC_BACKOUT 18 | float backOut(in float t) { 19 | return 1. - backIn(1. - t); 20 | } 21 | #endif 22 | 23 | #ifndef FNC_BACKINOUT 24 | #define FNC_BACKINOUT 25 | float backInOut(in float t) { 26 | float f = t < .5 27 | ? 2.0 * t 28 | : 1.0 - (2.0 * t - 1.0); 29 | 30 | float g = backIn(f); 31 | 32 | return t < 0.5 33 | ? 0.5 * g 34 | : 0.5 * (1.0 - g) + 0.5; 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/animation/easing/circular.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Hugh Kennedy (https://github.com/hughsk) 3 | description: Circular easing. From https://github.com/stackgl/glsl-easings 4 | use: circular( x) 5 | */ 6 | 7 | #ifndef FNC_CIRCULARIN 8 | #define FNC_CIRCULARIN 9 | float circularIn(in float t) { 10 | return 1.0 - sqrt(1.0 - t * t); 11 | } 12 | #endif 13 | 14 | #ifndef FNC_CIRCULAROUT 15 | #define FNC_CIRCULAROUT 16 | float circularOut(in float t) { 17 | return sqrt((2.0 - t) * t); 18 | } 19 | #endif 20 | 21 | #ifndef FNC_CIRCULARINOUT 22 | #define FNC_CIRCULARINOUT 23 | float circularInOut(in float t) { 24 | return t < 0.5 25 | ? 0.5 * (1.0 - sqrt(1.0 - 4.0 * t * t)) 26 | : 0.5 * (sqrt((3.0 - 2.0 * t) * (2.0 * t - 1.0)) + 1.0); 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/animation/easing/cubic.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Hugh Kennedy (https://github.com/hughsk) 3 | description: Cubic easing. From https://github.com/stackgl/glsl-easings 4 | use: cubic( x) 5 | */ 6 | 7 | #ifndef FNC_CUBICIN 8 | #define FNC_CUBICIN 9 | float cubicIn(in float t) { 10 | return t * t * t; 11 | } 12 | #endif 13 | 14 | #ifndef FNC_CUBICOUT 15 | #define FNC_CUBICOUT 16 | float cubicOut(in float t) { 17 | float f = t - 1.0; 18 | return f * f * f + 1.0; 19 | } 20 | #endif 21 | 22 | #ifndef FNC_CUBICINOUT 23 | #define FNC_CUBICINOUT 24 | float cubicInOut(in float t) { 25 | return t < 0.5 26 | ? 4.0 * t * t * t 27 | : 0.5 * pow(2.0 * t - 2.0, 3.0) + 1.0; 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/animation/easing/linear.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Hugh Kennedy (https://github.com/hughsk) 3 | description: Linear easing. From https://github.com/stackgl/glsl-easings 4 | use: linear( x) 5 | */ 6 | 7 | #ifndef FNC_LINEAR 8 | #define FNC_LINEAR 9 | float linearIn(in float t) { 10 | return t; 11 | } 12 | 13 | float linearOut(in float t) { 14 | return t; 15 | } 16 | 17 | float linearInOut(in float t) { 18 | return t; 19 | } 20 | #endif 21 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/animation/easing/quadratic.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Hugh Kennedy (https://github.com/hughsk) 3 | description: Quadrtic easing. From https://github.com/stackgl/glsl-easings 4 | use: quadratic( x) 5 | */ 6 | 7 | #ifndef FNC_QUADRATICIN 8 | #define FNC_QUADRATICIN 9 | float quadraticIn(in float t) { 10 | return t * t; 11 | } 12 | #endif 13 | 14 | #ifndef FNC_QUADRATICOUT 15 | #define FNC_QUADRATICOUT 16 | float quadraticOut(in float t) { 17 | return -t * (t - 2.0); 18 | } 19 | #endif 20 | 21 | #ifndef FNC_QUADRATICINOUT 22 | #define FNC_QUADRATICINOUT 23 | float quadraticInOut(in float t) { 24 | float p = 2.0 * t * t; 25 | return t < 0.5 ? p : -p + (4.0 * t) - 1.0; 26 | } 27 | #endif 28 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/animation/easing/quartic.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Hugh Kennedy (https://github.com/hughsk) 3 | description: Quartic easing. From https://github.com/stackgl/glsl-easings 4 | use: quartic( x) 5 | */ 6 | 7 | #ifndef FNC_QUARTICIN 8 | #define FNC_QUARTICIN 9 | float quarticIn(in float t) { 10 | return pow(t, 4.0); 11 | } 12 | #endif 13 | 14 | #ifndef FNC_QUARTICOUT 15 | #define FNC_QUARTICOUT 16 | float quarticOut(in float t) { 17 | return pow(t - 1.0, 3.0) * (1.0 - t) + 1.0; 18 | } 19 | #endif 20 | 21 | #ifndef FNC_QUARTICINOUT 22 | #define FNC_QUARTICINOUT 23 | float quarticInOut(in float t) { 24 | return t < 0.5 25 | ? +8.0 * pow(t, 4.0) 26 | : -8.0 * pow(t - 1.0, 4.0) + 1.0; 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/animation/easing/quintic.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Hugh Kennedy (https://github.com/hughsk) 3 | description: Quintic easing. From https://github.com/stackgl/glsl-easings 4 | use: quintic( x) 5 | */ 6 | 7 | #ifndef FNC_QUINTICIN 8 | #define FNC_QUINTICIN 9 | float quinticIn(in float t) { 10 | return pow(t, 5.0); 11 | } 12 | #endif 13 | 14 | #ifndef FNC_QUINTICOUT 15 | #define FNC_QUINTICOUT 16 | float quinticOut(in float t) { 17 | return 1.0 - (pow(t - 1.0, 5.0)); 18 | } 19 | #endif 20 | 21 | #ifndef FNC_QUINTICINOUT 22 | #define FNC_QUINTICINOUT 23 | float quinticInOut(in float t) { 24 | return t < 0.5 25 | ? +16.0 * pow(t, 5.0) 26 | : -0.5 * pow(2.0 * t - 2.0, 5.0) + 1.0; 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/animation/easing/sine.usf: -------------------------------------------------------------------------------- 1 | #include "../../math/const.usf" 2 | 3 | /* 4 | contributors: Hugh Kennedy (https://github.com/hughsk) 5 | description: Sine easing. From https://github.com/stackgl/glsl-easings 6 | use: sine( x) 7 | */ 8 | 9 | #ifndef FNC_SINEIN 10 | #define FNC_SINEIN 11 | float sineIn(in float t) { 12 | return sin((t - 1.0) * HALF_PI) + 1.0; 13 | } 14 | #endif 15 | 16 | #ifndef FNC_SINEOUT 17 | #define FNC_SINEOUT 18 | float sineOut(in float t) { 19 | return sin(t * HALF_PI); 20 | } 21 | #endif 22 | 23 | #ifndef FNC_SINEINOUT 24 | #define FNC_SINEINOUT 25 | float sineInOut(in float t) { 26 | return -0.5 * (cos(PI * t) - 1.0); 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/blend.usf: -------------------------------------------------------------------------------- 1 | #include "blend/add.usf" 2 | #include "blend/average.usf" 3 | #include "blend/colorDodge.usf" 4 | #include "blend/difference.usf" 5 | #include "blend/glow.usf" 6 | #include "blend/hardMix.usf" 7 | #include "blend/linearBurn.usf" 8 | #include "blend/linearLight.usf" 9 | #include "blend/negation.usf" 10 | #include "blend/phoenix.usf" 11 | #include "blend/reflect.usf" 12 | #include "blend/softLight.usf" 13 | #include "blend/vividLight.usf" 14 | #include "blend/colorBurn.usf" 15 | #include "blend/darken.usf" 16 | #include "blend/exclusion.usf" 17 | #include "blend/hardLight.usf" 18 | #include "blend/lighten.usf" 19 | #include "blend/linearDodge.usf" 20 | #include "blend/multiply.usf" 21 | #include "blend/overlay.usf" 22 | #include "blend/pinLight.usf" 23 | #include "blend/screen.usf" 24 | #include "blend/subtract.usf" -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/blend/add.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Jamie Owen 3 | description: Photoshop Add blend mode mplementations sourced from this article on https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/ 4 | use: blendAdd( base, blend [, opacity]) 5 | license: MIT License (MIT) Copyright (c) 2015 Jamie Owen 6 | */ 7 | 8 | #ifndef FNC_BLENDADD 9 | #define FNC_BLENDADD 10 | float blendAdd(in float base, in float blend) { 11 | return min(base + blend, 1.); 12 | } 13 | 14 | float3 blendAdd(in float3 base, in float3 blend) { 15 | return min(base + blend, float3(1., 1., 1.)); 16 | } 17 | 18 | float3 blendAdd(in float3 base, in float3 blend, float opacity) { 19 | return (blendAdd(base, blend) * opacity + base * (1. - opacity)); 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/blend/average.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Jamie Owen 3 | description: Photoshop Average blend mode mplementations sourced from this article on https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/ 4 | use: blendAverage( base, blend [, opacity]) 5 | license: MIT License (MIT) Copyright (c) 2015 Jamie Owen 6 | */ 7 | 8 | #ifndef FNC_BLENDAVERAGE 9 | #define FNC_BLENDAVERAGE 10 | float blendAverage(in float base, in float blend) { 11 | return (base + blend) * .5; 12 | } 13 | 14 | float3 blendAverage(in float3 base, in float3 blend) { 15 | return (base + blend) * .5; 16 | } 17 | 18 | float3 blendAverage(in float3 base, in float3 blend, float opacity) { 19 | return (blendAverage(base, blend) * opacity + base * (1. - opacity)); 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/blend/difference.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Jamie Owen 3 | description: Photoshop Difference blend mode mplementations sourced from this article on https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/ 4 | use: blendDifference( base, blend [, opacity]) 5 | license: MIT License (MIT) Copyright (c) 2015 Jamie Owen 6 | */ 7 | 8 | #ifndef FNC_BLENDDIFFERENCE 9 | #define FNC_BLENDDIFFERENCE 10 | float blendDifference(in float base, in float blend) { 11 | return abs(base-blend); 12 | } 13 | 14 | float3 blendDifference(in float3 base, in float3 blend) { 15 | return abs(base-blend); 16 | } 17 | 18 | float3 blendDifference(in float3 base, in float3 blend, in float opacity) { 19 | return (blendDifference(base, blend) * opacity + base * (1. - opacity)); 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/blend/exclusion.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Jamie Owen 3 | description: Photoshop Exclusion blend mode mplementations sourced from this article on https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/ 4 | use: blendExclusion( base, blend [, opacity]) 5 | license: MIT License (MIT) Copyright (c) 2015 Jamie Owen 6 | */ 7 | 8 | #ifndef FNC_BLENDEXCLUSION 9 | #define FNC_BLENDEXCLUSION 10 | float blendExclusion(in float base, in float blend) { 11 | return base + blend - 2. * base * blend; 12 | } 13 | 14 | float3 blendExclusion(in float3 base, in float3 blend) { 15 | return base + blend - 2. * base * blend; 16 | } 17 | 18 | float3 blendExclusion(in float3 base, in float3 blend, in float opacity) { 19 | return (blendExclusion(base, blend) * opacity + base * (1. - opacity)); 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/blend/glow.usf: -------------------------------------------------------------------------------- 1 | #include "reflect.usf" 2 | 3 | /* 4 | contributors: Jamie Owen 5 | description: Photoshop Glow blend mode mplementations sourced from this article on https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/ 6 | use: blendGlow( base, blend [, opacity]) 7 | license: MIT License (MIT) Copyright (c) 2015 Jamie Owen 8 | */ 9 | 10 | #ifndef FNC_BLENDGLOW 11 | #define FNC_BLENDGLOW 12 | float blendGlow(in float base, in float blend) { 13 | return blendReflect(blend, base); 14 | } 15 | 16 | float3 blendGlow(in float3 base, in float3 blend) { 17 | return blendReflect(blend, base); 18 | } 19 | 20 | float3 blendGlow(in float3 base, in float3 blend, in float opacity) { 21 | return (blendGlow(base, blend) * opacity + base * (1. - opacity)); 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/blend/multiply.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Jamie Owen 3 | description: Photoshop Multiply blend mode mplementations sourced from this article on https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/ 4 | use: blendMultiply( base, blend [, opacity]) 5 | license: MIT License (MIT) Copyright (c) 2015 Jamie Owen 6 | */ 7 | 8 | #ifndef FNC_BLENDMULTIPLY 9 | #define FNC_BLENDMULTIPLY 10 | float blendMultiply(in float base, in float blend) { 11 | return base * blend; 12 | } 13 | 14 | float3 blendMultiply(in float3 base, in float3 blend) { 15 | return base * blend; 16 | } 17 | 18 | float3 blendMultiply(in float3 base, in float3 blend, float opacity) { 19 | return (blendMultiply(base, blend) * opacity + base * (1. - opacity)); 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/contrast.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Bias high pass 4 | use: contrast( value, amount) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_CONTRAST 11 | #define FNC_CONTRAST 12 | float contrast(in float value, in float amount) { 13 | return (value - 0.5 ) * amount + 0.5; 14 | } 15 | 16 | float3 contrast(in float3 value, in float amount) { 17 | return (value - 0.5 ) * amount + 0.5; 18 | } 19 | 20 | float4 contrast(in float4 value, in float amount) { 21 | return float4(contrast(value.rgb, amount), value.a); 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/desaturate.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Change saturation of a color 4 | use: desaturate( color, float amount) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_DESATURATE 11 | #define FNC_DESATURATE 12 | float3 desaturate(in float3 color, in float amount ) { 13 | float l = dot(float3(.3, .59, .11), color); 14 | return lerp(color, float3(l, l, l), amount); 15 | } 16 | 17 | float4 desaturate(in float4 color, in float amount ) { 18 | return float4(desaturate(color.rgb, amount), color.a); 19 | } 20 | #endif 21 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/exposure.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Change the exposure of a color 4 | use: exposure( color, float amount) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_EXPOSURE 11 | #define FNC_EXPOSURE 12 | float exposure(float value, float amount) { 13 | return value * pow(2., amount); 14 | } 15 | 16 | float3 exposure(float3 color, float amount) { 17 | return color * pow(2., amount); 18 | } 19 | 20 | float4 exposure(float4 color, float amount) { 21 | return float4(exposure( color.rgb, amount ), color.a); 22 | } 23 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/luma.usf: -------------------------------------------------------------------------------- 1 | #include "space/rgb2luma.usf" 2 | 3 | /* 4 | contributors: Hugh Kennedy (https://github.com/hughsk) 5 | description: Get the luminosity of a color. From https://github.com/hughsk/glsl-luma/blob/master/index.usf 6 | use: luma( color) 7 | */ 8 | 9 | #ifndef FNC_LUMA 10 | #define FNC_LUMA 11 | float luma(in float color) { 12 | return float(color); 13 | } 14 | 15 | float luma(in float3 color) { 16 | return rgb2luma(color); 17 | } 18 | 19 | float luma(in float4 color) { 20 | return rgb2luma(color.rgb); 21 | } 22 | #endif 23 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/luminance.usf: -------------------------------------------------------------------------------- 1 | /* 2 | description: Computes the luminance of the specified linear RGB color using the luminance coefficients from Rec. 709. 3 | use: luminance( color) 4 | license: 5 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 7 | */ 8 | 9 | #ifndef FNC_LUMINANCE 10 | #define FNC_LUMINANCE 11 | float luminance(in float3 _linear) { return dot(_linear, float3(0.2126, 0.7152, 0.0722)); } 12 | float luminance(in float4 _linear) { return luminance( _linear.rgb ); } 13 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/mixOklab.usf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Shaders/lygia/color/mixOklab.usf -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/palette.usf: -------------------------------------------------------------------------------- 1 | #include "../math/const.usf" 2 | 3 | /* 4 | contributors: Inigo Quiles 5 | description: Procedural generation of color palette algorithm explained here http://www.iquilezles.org/www/articles/palettes/palettes.htm) 6 | use: palette( t, a, b, c, d) 7 | */ 8 | 9 | #ifndef FNC_PALETTE 10 | #define FNC_PALETTE 11 | float3 palette (in float t, in float3 a, in float3 b, in float3 c, in float3 d) { 12 | return a + b * cos(TAU * ( c * t + d )); 13 | } 14 | 15 | float4 palette (in float t, in float4 a, in float4 b, in float4 c, in float4 d) { 16 | return a + b * cos(TAU * ( c * t + d )); 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/palette/fire.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Simpler fire color ramp 4 | use: fire( value) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_FIRE 11 | #define FNC_FIRE 12 | float3 fire(float x) { return float3(1.0, 0.25, 0.0625) * exp(4.0 * x - 1.0); } 13 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/palette/heatmap.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Heatmap palette 4 | use: heatmap( value) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_HEATMAP 11 | #define FNC_HEATMAP 12 | float3 heatmap(float v) { 13 | float3 r = v * 2.1 - float3(1.8, 1.14, 0.3); 14 | return 1.0 - r * r; 15 | } 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/palette/hue.usf: -------------------------------------------------------------------------------- 1 | #include "../../math/mod.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: 'Physical Hue. Ratio: 1/3 = neon, 1/4 = refracted, 1/5+ = approximate white' 6 | use: hue( hue[, ratio]) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_PALETTE_HUE 13 | #define FNC_PALETTE_HUE 14 | 15 | float3 hue(float x, float r) { 16 | float3 v = abs(mod(frac(1.0 - x) + float3(0.0, 1.0, 2.0) * r, 1.0) * 2.0 - 1.0); 17 | return v * v * (3.0 - 2.0 * v); 18 | } 19 | 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/palette/spectral/gems.usf: -------------------------------------------------------------------------------- 1 | #include "../../../math/bump.usf" 2 | 3 | /* 4 | contributors: ["Jos Stam", "Alias Systems"] 5 | description: | 6 | From Chap 8 Simulating Diffraction from GPU Gems https://developer.nvidia.com/gpugems/gpugems/part-i-natural-effects/chapter-8-simulating-diffraction 7 | use: spectral_gems( x) 8 | examples: 9 | - https://raw.githubusercontent.com/patriciogonzalezvivo/lygia_examples/main/color_wavelength.frag 10 | */ 11 | 12 | #ifndef FNC_SPECTRAL_GEMS 13 | #define FNC_SPECTRAL_GEMS 14 | float3 spectral_gems (float x) { 15 | return bump(float3( 4. * (x - 0.75), // Red 16 | 4. * (x - 0.5), // Green 17 | 4. * (x - 0.25) // Blue 18 | ) ); 19 | } 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/palette/spectral/geoffrey.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: 3 | description: 4 | use: spectral_geoffrey( x) 5 | */ 6 | 7 | #ifndef FNC_SPECTRAL_GEOFFREY 8 | #define FNC_SPECTRAL_GEOFFREY 9 | float3 spectral_geoffrey(float t) { 10 | float3 r = (t * 2.0 - 0.5) * 2.1 - float3(1.8, 1.14, 0.3); 11 | return 0.99 - r * r; 12 | } 13 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/palette/spectral/soft.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Simpler chroma spectrum 4 | use: spectral_soft( value) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #include "../../../math/const.usf" 11 | 12 | #ifndef FNC_SPECTRAL_SOFT 13 | #define FNC_SPECTRAL_SOFT 14 | 15 | float3 spectral_soft(float x) { 16 | float delta = 0.5; 17 | float3 color = float3(1.0, 1.0, 1.0); 18 | float freq = x * PI; 19 | color.r = sin(freq - delta); 20 | color.g = sin(freq); 21 | color.b = sin(freq + delta); 22 | return pow(color, float3(4.0, 4.0, 4.0)); 23 | } 24 | 25 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/palette/wada.usf: -------------------------------------------------------------------------------- 1 | #include "wada/value.usf" 2 | #include "wada/dyad.usf" 3 | #include "wada/triad.usf" 4 | #include "wada/tetrad.usf" -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/palette/water.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Simpler water color ramp 4 | use: water( value) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_WATER 11 | #define FNC_WATER 12 | 13 | float3 water(float x) { 14 | x = 4.* saturate(1.0-x); 15 | return pow(float3(.1, .7, .8), float3(x, x, x)); 16 | } 17 | 18 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space.usf: -------------------------------------------------------------------------------- 1 | /* 2 | description: Include all available color spaces conversions 3 | */ 4 | 5 | #include "space/rgb2hsv.usf" 6 | #include "space/hsv2rgb.usf" 7 | 8 | #include "space/rgb2yuv.usf" 9 | #include "space/yuv2rgb.usf" 10 | 11 | #include "space/rgb2yiq.usf" 12 | #include "space/yiq2rgb.usf" 13 | 14 | #include "space/rgb2YCbCr.usf" 15 | #include "space/YCbCr2rgb.usf" 16 | 17 | #include "space/rgb2YPbPr.usf" 18 | #include "space/YPbPr2rgb.usf" 19 | 20 | #include "space/linear2gamma.usf" 21 | #include "space/gamma2linear.usf" 22 | 23 | #include "space/rgb2cmyk.usf" 24 | #include "space/cmyk2rgb.usf" 25 | 26 | #include "space/w2rgb.usf" 27 | #include "space/k2rgb.usf" -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/cmyk2rgb.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Convert CMYK to RGB 4 | use: cmyk2rgb( cmyk) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_CMYK2RGB 11 | #define FNC_CMYK2RGB 12 | float3 cmyk2rgb(float4 cmyk) { 13 | float invK = 1.0 - cmyk.w; 14 | return saturate(1.0-min(float3(1.0, 1.0, 1.0), cmyk.xyz * invK + cmyk.w)); 15 | } 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/hsl2rgb.usf: -------------------------------------------------------------------------------- 1 | #include "hue2rgb.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: 'Converts a HSL color to linear RGB' 6 | use: hsl2rgb( hsl) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_HSL2RGB 13 | #define FNC_HSL2RGB 14 | float3 hsl2rgb(const in float3 hsl) { 15 | float3 rgb = hue2rgb(hsl.x); 16 | float C = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y; 17 | return (rgb - 0.5) * C + hsl.z; 18 | } 19 | float4 hsl2rgb(const in float4 hsl) { return float4(hsl2rgb(hsl.xyz), hsl.w); } 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/hsv2rgb.usf: -------------------------------------------------------------------------------- 1 | #include "hue2rgb.usf" 2 | /* 3 | contributors: Inigo Quiles 4 | description: | 5 | Convert from HSV to linear RGB 6 | use: hsv2rgb( hsv) 7 | */ 8 | 9 | #ifndef FNC_HSV2RGB 10 | #define FNC_HSV2RGB 11 | float3 hsv2rgb(in float3 hsv) { return ((hue2rgb(hsv.x) - 1.0) * hsv.y + 1.0) * hsv.z; } 12 | float4 hsv2rgb(in float4 hsv) { return float4(hsv2rgb(hsv.rgb), hsv.a); } 13 | #endif 14 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/hue2rgb.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: 'Converts a hue value to a RGB float3 color.' 4 | use: hue2rgb( hue) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_HUE2RGB 11 | #define FNC_HUE2RGB 12 | float3 hue2rgb(float hue) { 13 | float R = abs(hue * 6.0 - 3.0) - 1.0; 14 | float G = 2.0 - abs(hue * 6.0 - 2.0); 15 | float B = 2.0 - abs(hue * 6.0 - 4.0); 16 | return saturate(float3(R,G,B)); 17 | } 18 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/lab2lch.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: "Converts a LCh to Lab color space. \nNote: LCh is simply Lab but converted to polar coordinates (in degrees).\n" 4 | use: lab2rgb( color) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_LAB2LCH 11 | #define FNC_LAB2LCH 12 | float3 lab2lch(float3 lab) { 13 | return float3( 14 | lab.x, 15 | sqrt(dot(lab.yz, lab.yz)), 16 | atan(lab.z, lab.y) * 57.2957795131 17 | ); 18 | } 19 | float4 lab2lch(float4 lab) { return float4(lab2lch(lab.xyz), lab.a); } 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/lab2rgb.usf: -------------------------------------------------------------------------------- 1 | #include "lab2xyz.usf" 2 | #include "xyz2rgb.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: Converts a Lab color to RGB color space. 7 | use: lab2rgb( color) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_LAB2RGB 14 | #define FNC_LAB2RGB 15 | float3 lab2rgb(in float3 lab) { return xyz2rgb( lab2xyz( lab ) ); } 16 | float4 lab2rgb(in float4 lab) { return float4(lab2rgb(lab.rgb), lab.a); } 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/lch2lab.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: "Converts a Lch ot Lab color space. \nNote: LCh is simply Lab but converted to polar coordinates (in degrees).\n" 4 | use: lch2lab( color) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_LCH2LAB 11 | #define FNC_LCH2LAB 12 | float3 lch2lab(float3 lch) { 13 | return float3( 14 | lch.x, 15 | lch.y * cos(lch.z * 0.01745329251), 16 | lch.y * sin(lch.z * 0.01745329251) 17 | ); 18 | } 19 | float4 lch2lab(float4 lch) { return float4(lch2lab(lch.xyz),lch.a);} 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/lch2rgb.usf: -------------------------------------------------------------------------------- 1 | #include "lch2lab.usf" 2 | #include "lab2rgb.usf" 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: "Converts a Lch to linear RGB color space. \nNote: LCh is simply Lab but converted to polar coordinates (in degrees).\n" 6 | use: lch2rgb( color) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_LCH2RGB 13 | #define FNC_LCH2RGB 14 | float3 lch2rgb(float3 lch) { return lab2rgb( lch2lab(lch) ); } 15 | float4 lch2rgb(float4 lch) { return float4(lch2rgb(lch.xyz),lch.a);} 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/oklab2rgb.usf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Shaders/lygia/color/space/oklab2rgb.usf -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/oklab2srgb.usf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Shaders/lygia/color/space/oklab2srgb.usf -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/rgb2YCbCr.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Convert RGB to YCbCr according to https://en.wikipedia.org/wiki/YCbCr 4 | use: rgb2YCbCr( color) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_RGB2YCBCR 11 | #define FNC_RGB2YCBCR 12 | float3 rgb2YCbCr(in float3 rgb){ 13 | float y = dot(rgb, float3(.299, .587, .114)); 14 | float cb = .5 + dot(rgb, float3(-.168736, -.331264, .5)); 15 | float cr = .5 + dot(rgb, float3(.5, -.418688, -.081312)); 16 | return float3(y, cb, cr); 17 | } 18 | 19 | float4 rgb2YCbCr(in float4 rgb) { 20 | return float4(rgb2YCbCr(rgb.rgb),rgb.a); 21 | } 22 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/rgb2cmyk.usf: -------------------------------------------------------------------------------- 1 | #include "../../math/mmin.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Convert CMYK to RGB 6 | use: rgb2cmyk( rgba) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_RGB2CMYK 13 | #define FNC_RGB2CMYK 14 | float4 rgb2cmyk(float3 rgb) { 15 | float k = mmin(1.0 - rgb); 16 | float invK = 1.0 - k; 17 | float3 cmy = (1.0 - rgb - k) / invK; 18 | cmy *= step(0.0, invK); 19 | return saturate(float4(cmy, k)); 20 | } 21 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/rgb2heat.usf: -------------------------------------------------------------------------------- 1 | #include "rgb2hue.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Converts a RGB rainbow pattern back to a single float value 6 | use: rgb2heat( color) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_RGB2HEAT 13 | #define FNC_RGB2HEAT 14 | float rgb2heat(float3 c) { return 1.025 - rgb2hue(c) * 1.538461538; } 15 | float rgb2heat(float4 c) { return rgb2heat(c.rgb); } 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/rgb2hsv.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Sam Hocevar 3 | description: Pass a color in RGB and get HSB color. From http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl 4 | use: rgb2hsv( color) 5 | */ 6 | 7 | #ifndef FNC_RGB2HSV 8 | #define FNC_RGB2HSV 9 | float3 rgb2hsv(in float3 c) { 10 | float4 K = float4(0.0, -0.33333333333333333333, 0.6666666666666666666, -1.); 11 | float4 p = c.g < c.b ? float4(c.bg, K.wz) : float4(c.gb, K.xy); 12 | float4 q = c.r < p.x ? float4(p.xyw, c.r) : float4(c.r, p.yzx); 13 | float d = q.x - min(q.w, q.y); 14 | float e = 1.0e-10; 15 | return float3( abs(q.z + (q.w - q.y) / (6. * d + e)), 16 | d / (q.x + e), 17 | q.x ); 18 | } 19 | float4 rgb2hsv(in float4 c) { return float4(rgb2hsv(c.rgb), c.a); } 20 | #endif 21 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/rgb2hue.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: 3 | - Sam Hocevar 4 | - Patricio Gonzalez Vivo 5 | description: Pass a color in RGB and get HSB color. From http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl 6 | use: rgb2hue( color) 7 | */ 8 | 9 | #ifndef HUE_EPSILON 10 | #define HUE_EPSILON 1e-10 11 | #endif 12 | 13 | #ifndef FNC_RGB2HUE 14 | #define FNC_RGB2HUE 15 | float rgb2hue(in float3 c) { 16 | float4 K = float4(0.0, -0.33333333333333333333, 0.6666666666666666666, -1.0); 17 | float4 p = c.g < c.b ? float4(c.bg, K.wz) : float4(c.gb, K.xy); 18 | float4 q = c.r < p.x ? float4(p.xyw, c.r) : float4(c.r, p.yzx); 19 | float d = q.x - min(q.w, q.y); 20 | return abs(q.z + (q.w - q.y) / (6.0 * d + HUE_EPSILON)); 21 | } 22 | 23 | float rgb2hue(in float4 c) { return rgb2hue(c.rgb); } 24 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/rgb2lab.usf: -------------------------------------------------------------------------------- 1 | #include "rgb2xyz.usf" 2 | #include "xyz2lab.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: Converts a RGB color to Lab color space. 7 | use: rgb2lab( color) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_RGB2LAB 14 | #define FNC_RGB2LAB 15 | float3 rgb2lab(in float3 rgb) { return xyz2lab( rgb2xyz( rgb ) ); } 16 | float4 rgb2lab(in float4 rgb) { return float4(rgb2lab(rgb.rgb),rgb.a); } 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/rgb2lch.usf: -------------------------------------------------------------------------------- 1 | #include "rgb2lab.usf" 2 | #include "lab2lch.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: Converts a RGB color to LCh color space. 7 | use: rgb2lch( color) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_RGB2LCH 14 | #define FNC_RGB2LCH 15 | float3 rgb2lch(const in float3 rgb) { return lab2lch(rgb2lab(rgb)); } 16 | float4 rgb2lch(const in float4 rgb) { return float4(rgb2lch(rgb.rgb),rgb.a); } 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/rgb2luma.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: 'Get''s the luminosity from linear RGB, based on Rec709 luminance (see https://en.wikipedia.org/wiki/Grayscale)' 4 | use: rgb2luma( rgb) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_RGB2LUMA 11 | #define FNC_RGB2LUMA 12 | float rgb2luma(const in float3 rgb) { return dot(rgb, float3(0.2126, 0.7152, 0.0722)); } 13 | float rgb2luma(const in float4 rgb) { return rgb2luma(rgb.rgb); } 14 | #endif 15 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/rgb2oklab.usf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Shaders/lygia/color/space/rgb2oklab.usf -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/rgb2xyY.usf: -------------------------------------------------------------------------------- 1 | #include "rgb2xyz.usf" 2 | #include "xyz2xyY.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: 'Converts a linear RGB color to xyY color space.' 7 | use: rgb2xyY( rgb) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_RGB2XYY 14 | #define FNC_RGB2XYY 15 | float3 rgb2xyY(float3 rgb) { return xyz2xyY(rgb2xyz(rgb));} 16 | float4 rgb2xyY(float4 rgb) { return float4(rgb2xyY(rgb.rgb), rgb.a);} 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/srgb2lab.usf: -------------------------------------------------------------------------------- 1 | #include "rgb2lab.usf" 2 | #include "srgb2rgb.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: Converts a sRGB color to Lab 7 | use: srgb2lab( rgb) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_SRGB2LAB 14 | #define FNC_SRGB2LAB 15 | float3 srgb2lab(const in float3 srgb) { return rgb2lab(srgb2rgb(srgb));} 16 | float4 srgb2lab(const in float4 srgb) { return float4(srgb2lab(srgb.rgb),rgb.a); } 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/srgb2lch.usf: -------------------------------------------------------------------------------- 1 | #include "rgb2lch.usf" 2 | #include "srgb2rgb.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: Converts a sRGB color to Lab 7 | use: srgb2lch( rgb) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_SRGB2LCH 14 | #define FNC_SRGB2LCH 15 | float3 srgb2lch(const in float3 srgb) { return rgb2lch(srgb2rgb(srgb));} 16 | float4 srgb2lch(const in float4 srgb) { return float4(srgb2lch(srgb.rgb),srgb.a); } 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/srgb2luma.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: 'Get''s the luminosity from sRGB. Based on from Rec601 luma (see https://en.wikipedia.org/wiki/Grayscale)' 4 | use: rgb2luma( srgb) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_SRGB2LUMA 11 | #define FNC_SRGB2LUMA 12 | float srgb2luma(float3 srgb) { return dot(srgb, float3(0.299, 0.587, 0.114)); } 13 | float srgb2luma(float4 srgb) { return rgb2luma(srgb.rgb); } 14 | #endif 15 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/srgb2oklab.usf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Shaders/lygia/color/space/srgb2oklab.usf -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/srgb2xyz.usf: -------------------------------------------------------------------------------- 1 | #include "rgb2xyz.glsl" 2 | #include "srgb2rgb.glsl" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: Converts a sRGB color to XYZ 7 | use: srgb2xyz( rgb) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_RGB2XYZ 14 | #define FNC_RGB2XYZ 15 | float3 srgb2xyz(in float3 srgb) { return rgb2xyz(rgb2srgb(srgb));} 16 | float4 srgb2xyz(in float4 srgb) { return float4(rgb2xyz(srgb.rgb),rgb.a); } 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/w2rgb.usf: -------------------------------------------------------------------------------- 1 | #include "gamma2linear.usf" 2 | #include "../../color/palette/spectral.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: Wavelength to RGB 7 | use: w2rgb( wavelength) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_W2RGB 14 | #define FNC_W2RGB 15 | float3 w2rgb(float w) { 16 | 17 | #if defined(W2RGB_APPROXIMATION_FNC) 18 | float x = saturate((w - 400.0)/ 300.0); 19 | return gamma2linear( W2RGB_APPROXIMATION_FNC(x) ); 20 | #else 21 | 22 | #endif 23 | } 24 | 25 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/xyY2rgb.usf: -------------------------------------------------------------------------------- 1 | #include "xyz2rgb.usf" 2 | #include "xyY2xyz.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: 'Converts from xyY to linear RGB' 7 | use: xyY2rgb( xyY) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_XYY2RGB 14 | #define FNC_XYY2RGB 15 | float3 xyY2rgb(float3 xyY) { return xyz2rgb(xyY2xyz(xyY));} 16 | float4 xyY2rgb(float4 xyY) { return float4(xyz2rgb(xyY2xyz(xyY.xyz)), xyY.w);} 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/xyY2srgb.usf: -------------------------------------------------------------------------------- 1 | #include "xyz2srgb.usf" 2 | #include "xyY2xyz.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: 'Converts from xyY to sRGB' 7 | use: xyY2srgb( xyY) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_XYY2SRGB 14 | #define FNC_XYY2SRGB 15 | float3 xyY2srgb(const in float3 xyY) { return xyz2srgb(xyY2xyz(xyY));} 16 | float4 xyY2srgb(const in float4 xyY) { return float4(xyY2srgb(xyY.xyz), xyY.w);} 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/xyY2xyz.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: 'Converts from xyY to XYZ' 4 | use: xyY2xyz( color) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_XYY2XYZ 11 | #define FNC_XYY2XYZ 12 | float3 xyY2xyz(float3 xyY) { 13 | float Y = xyY.z; 14 | float f = 1.0/xyY.y; 15 | float x = Y * xyY.x * f; 16 | float z = Y * (1.0 - xyY.x - xyY.y) * f; 17 | return float3(x, Y, z); 18 | } 19 | float4 xyY2xyz(float4 xyY) { return float4(xyY2xyz(xyY.xyz), xyY.w); } 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/xyz2srgb.usf: -------------------------------------------------------------------------------- 1 | #include "xyz2rgb.usf" 2 | #include "rgb2srgb.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: 'Converts a XYZ color to sRGB. From http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html' 7 | use: xyz2srgb( color) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_XYZ2SRGB 14 | #define FNC_XYZ2SRGB 15 | float3 xyz2srgb(const in float3 xyz) { return rgb2srgb(xyz2rgb(xyz)); } 16 | float4 xyz2srgb(const in float4 xyz) { return float4(xyz2srgb(xyz.rgb), xyz.a); } 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/space/xyz2xyY.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Converts from XYZ to xyY space (Y is the luminance) 4 | use: xyz2rgb( color) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_XYZ2XYY 11 | #define FNC_XYZ2XYY 12 | float3 xyz2xyY(float3 xyz) { 13 | float Y = xyz.y; 14 | float f = 1.0 / (xyz.x + xyz.y + xyz.z); 15 | float x = xyz.x * f; 16 | float y = xyz.y * f; 17 | return float3(x, y, Y); 18 | } 19 | float4 xyz2xyY(float4 xyz) { return float4(xyz2xyY(xyz.xyz), xyz.w);} 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/tonemap/aces.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Narkowicz 2015 3 | description: ACES Filmic Tone Mapping Curve. https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ 4 | use: tonemapACES( x) 5 | */ 6 | 7 | #ifndef FNC_TONEMAPACES 8 | #define FNC_TONEMAPACES 9 | float3 tonemapACES(float3 x) { 10 | const float a = 2.51; 11 | const float b = 0.03; 12 | const float c = 2.43; 13 | const float d = 0.59; 14 | const float e = 0.14; 15 | return saturate((x*(a*x+b))/(x*(c*x+d)+e)); 16 | } 17 | 18 | float4 tonemapACES(float4 x) { 19 | return float4(tonemapACES(x.rgb), x.a); 20 | } 21 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/tonemap/filmic.usf: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "../luminance.usf" 4 | 5 | /* 6 | contributors: [Jim Hejl, Richard Burgess-Dawson ] 7 | description: Haarm-Peter Duikers curve from John Hables presentation "Uncharted 2 HDR Lighting", Page 140, http://www.gdcvault.com/play/1012459/Uncharted_2__HDR_Lighting 8 | use: tonemapFilmic( x) 9 | */ 10 | 11 | #ifndef FNC_TONEMAPFILMIC 12 | #define FNC_TONEMAPFILMIC 13 | float3 tonemapFilmic(float3 color) { 14 | color = max(float3(0.0, 0.0, 0.0), color - 0.004); 15 | color = (color * (6.2 * color + 0.5)) / (color * (6.2 * color + 1.7) + 0.06); 16 | return color; 17 | } 18 | 19 | float4 tonemapFilmic(const float4 x) { return float4( tonemapFilmic(x.rgb), x.a ); } 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/tonemap/linear.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: nan 3 | description: Linear tonemap (no modifications are applied) 4 | use: tonemapLinear( x) 5 | */ 6 | 7 | 8 | #ifndef FNC_TONEMAPLINEAR 9 | #define FNC_TONEMAPLINEAR 10 | float3 tonemapLinear(const float3 x) { return x; } 11 | float4 tonemapLinear(const float4 x) { return x; } 12 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/tonemap/reinhard.usf: -------------------------------------------------------------------------------- 1 | #include "../luminance.usf" 2 | 3 | /* 4 | contributors: [Erik Reinhard, Michael Stark, Peter Shirley, James Ferwerda] 5 | description: Photographic Tone Reproduction for Digital Images. http://www.cmap.polytechnique.fr/~peyre/cours/x2005signal/hdr_photographic.pdf 6 | use: tonemapReinhard( x) 7 | */ 8 | 9 | #ifndef FNC_TONEMAPREINHARD 10 | #define FNC_TONEMAPREINHARD 11 | float3 tonemapReinhard(const float3 x) { return x / (1.0 + luminance(x)); } 12 | float4 tonemapReinhard(const float4 x) { return float4( tonemapReinhard(x.rgb), x.a ); } 13 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/tonemap/reinhardJodie.usf: -------------------------------------------------------------------------------- 1 | 2 | #include "../luminance.usf" 3 | 4 | /* 5 | contributors: [Erik Reinhard, Michael Stark, Peter Shirley, James Ferwerda] 6 | description: Photographic Tone Reproduction for Digital Images. http://www.cmap.polytechnique.fr/~peyre/cours/x2005signal/hdr_photographic.pdf 7 | use: tonemapReinhardJodie( x) 8 | */ 9 | 10 | #ifndef FNC_TONEMAPREINHARDJODIE 11 | #define FNC_TONEMAPREINHARDJODIE 12 | float3 tonemapReinhardJodie(const float3 x) { 13 | float l = luminance(x); 14 | float3 tc = x / (x + 1.0); 15 | return lerp(x / (l + 1.0), tc, tc); 16 | } 17 | float4 tonemapReinhardJodie(const float4 x) { return float4( tonemapReinhardJodie(x.rgb), x.a ); } 18 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/tonemap/uncharted2.usf: -------------------------------------------------------------------------------- 1 | /* 2 | author: John Hable 3 | description: Tonemapping function from presentation. Uncharted 2 HDR Lighting, Page 142 to 143 4 | use: tonemapUncharted2( x) 5 | */ 6 | 7 | #ifndef FNC_TONEMAPUNCHARTED2 8 | #define FNC_TONEMAPUNCHARTED2 9 | float3 tonemapUncharted2(float3 color) { 10 | float A = 0.15; // 0.22 11 | float B = 0.50; // 0.30 12 | float C = 0.10; 13 | float D = 0.20; 14 | float E = 0.02; // 0.01 15 | float F = 0.30; 16 | float W = 11.2; 17 | 18 | float4 x = float4(color, W); 19 | x = ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F; 20 | return x.xyz / x.w; 21 | } 22 | 23 | float4 tonemapUncharted2(const float4 x) { return float4( tonemapUncharted2(x.rgb), x.a); } 24 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/color/tonemap/unreal.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Unreal Engine 4.0 3 | description: Adapted to be close to TonemapACES, with similar range. Gamma 2.2 correction is baked in, don't use with sRGB conversion! https://docs.unrealengine.com/4.26/en-US/RenderingAndGraphics/PostProcessEffects/ColorGrading/ 4 | use: tonemapUnreal( x) 5 | */ 6 | 7 | #ifndef FNC_TONEMAPUNREAL 8 | #define FNC_TONEMAPUNREAL 9 | float3 tonemapUnreal(const float3 x) { return x / (x + 0.155) * 1.019; } 10 | float4 tonemapUnreal(const float4 x) { return float4(tonemapUnreal(x.rgb), x.a); } 11 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/draw/circle.usf: -------------------------------------------------------------------------------- 1 | 2 | #include "../sdf/circleSDF.usf" 3 | 4 | #include "fill.usf" 5 | #include "stroke.usf" 6 | 7 | /* 8 | contributors: Patricio Gonzalez Vivo 9 | description: Draw a circle filled or not. 10 | use: circle( st, size [, width]) 11 | license: 12 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 13 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 14 | */ 15 | 16 | #ifndef FNC_CIRCLE 17 | #define FNC_CIRCLE 18 | float circle(float2 st, float size) { 19 | return fill(circleSDF(st), size); 20 | } 21 | 22 | float circle(float2 st, float size, float strokeWidth) { 23 | return stroke(circleSDF(st), size, strokeWidth); 24 | } 25 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/draw/fill.usf: -------------------------------------------------------------------------------- 1 | #include "../math/aastep.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Fill a SDF. From PixelSpiritDeck https://github.com/patriciogonzalezvivo/PixelSpiritDeck 6 | use: fill( sdf, size [, edge]) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_FILL 13 | #define FNC_FILL 14 | float fill(float x, float size, float edge) { 15 | return 1.0 - smoothstep(size - edge, size + edge, x); 16 | } 17 | 18 | float fill(float x, float size) { 19 | return 1.0 - aastep(size, x); 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/draw/flip.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Flips the float passed in, 0 becomes 1 and 1 becomes 0 4 | use: flip( v, pct) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_FLIP 11 | #define FNC_FLIP 12 | float flip(in float v, in float pct) { 13 | return lerp(v, 1. - v, pct); 14 | } 15 | #endif 16 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/draw/hex.usf: -------------------------------------------------------------------------------- 1 | 2 | #include "../sdf/hexSDF.usf" 3 | 4 | #include "fill.usf" 5 | #include "stroke.usf" 6 | 7 | /* 8 | contributors: Patricio Gonzalez Vivo 9 | description: Draw a hexagon filled or not. 10 | use: hex( st, size [, width]) 11 | license: 12 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 13 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 14 | */ 15 | 16 | #ifndef FNC_HEX 17 | #define FNC_HEX 18 | float hex(float2 st, float size) { 19 | return fill(hexSDF(st), size); 20 | } 21 | 22 | float hex(float2 st, float size, float strokeWidth) { 23 | return stroke(hexSDF(st), size, strokeWidth); 24 | } 25 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/draw/rect.usf: -------------------------------------------------------------------------------- 1 | 2 | #include "../sdf/rectSDF.usf" 3 | 4 | #include "fill.usf" 5 | #include "stroke.usf" 6 | 7 | /* 8 | contributors: Patricio Gonzalez Vivo 9 | description: Draw a rectangel filled or not. 10 | use: rect( st, size [, width]) 11 | license: 12 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 13 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 14 | */ 15 | 16 | #ifndef FNC_RECT 17 | #define FNC_RECT 18 | float rect(float2 st, float2 size) { 19 | return fill(rectSDF(st, size), 1.0); 20 | } 21 | 22 | float rect(float2 st, float2 size, float strokeWidth) { 23 | return stroke(rectSDF(st, size), 1.0, strokeWidth); 24 | } 25 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/draw/tri.usf: -------------------------------------------------------------------------------- 1 | 2 | #include "../sdf/triSDF.usf" 3 | 4 | #include "fill.usf" 5 | #include "stroke.usf" 6 | 7 | /* 8 | contributors: Patricio Gonzalez Vivo 9 | description: Draw a triangle filled or not. 10 | use: tri( st, size [, width]) 11 | license: 12 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 13 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 14 | */ 15 | 16 | #ifndef FNC_TRI 17 | #define FNC_TRI 18 | float tri(float2 st, float size) { 19 | return fill(triSDF(st), size); 20 | } 21 | 22 | float tri(float2 st, float size, float strokeWidth) { 23 | return stroke(triSDF(st), size, strokeWidth); 24 | } 25 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/aabb.usf: -------------------------------------------------------------------------------- 1 | #include "aabb/centroid.usf" 2 | #include "aabb/contain.usf" 3 | #include "aabb/diagonal.usf" 4 | #include "aabb/expand.usf" 5 | #include "aabb/intersect.usf" 6 | #include "aabb/square.usf" -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/aabb/aabb.usf: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: This file contains the definition of the AABB struct 6 | license: 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 9 | */ 10 | 11 | #ifndef STR_AABB 12 | #define STR_AABB 13 | struct AABB { 14 | float3 min; 15 | float3 max; 16 | }; 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/aabb/centroid.usf: -------------------------------------------------------------------------------- 1 | #include "aabb.cuh" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Return center of a AABB 6 | use: centroid( box) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_AABB_CENTROID 13 | #define FNC_AABB_CENTROID 14 | float3 centroid(AABB _box) { return (_box.min + _box.max) * 0.5; } 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/aabb/contain.usf: -------------------------------------------------------------------------------- 1 | 2 | #include "aabb.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: Compute if point is inside AABB 7 | use: inside( box, point ) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_AABB_CONTAIN 14 | #define FNC_AABB_CONTAIN 15 | 16 | bool contain(const in AABB _box, const in float3 _point ) { 17 | return (_point.x >= _box.min.x && _point.x <= _box.max.x) && 18 | (_point.y >= _box.min.y && _point.y <= _box.max.y) && 19 | (_point.z >= _box.min.z && _point.z <= _box.max.z); 20 | } 21 | 22 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/aabb/diagonal.usf: -------------------------------------------------------------------------------- 1 | 2 | #include "aabb.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: Return the diagonal vector of a AABB 7 | use: diagonal( box ) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_AABB_DIAGONAL 14 | #define FNC_AABB_DIAGONAL 15 | 16 | float3 diagonal(const AABB box) { return abs(box.max - box.min); } 17 | 18 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/aabb/square.usf: -------------------------------------------------------------------------------- 1 | #include "diagonal.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Square an AABB using the longest side 6 | use: AABBsquare( box) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_AABB_SQUARE 13 | #define FNC_AABB_SQUARE 14 | 15 | void square(AABB& _box) { 16 | float3 diag = diagonal(_box) * 0.5f; 17 | float3 cntr = _box.min + diag; 18 | float mmax = max( abs(diag.x), max( abs(diag.y), abs(diag.z) ) ); 19 | _box.max = cntr + mmax; 20 | _box.min = cntr - mmax; 21 | } 22 | 23 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/triangle.usf: -------------------------------------------------------------------------------- 1 | #include "triangle/area.usf" 2 | #include "triangle/barycentric.usf" 3 | #include "triangle/centroid.usf" 4 | #include "triangle/contain.usf" 5 | #include "triangle/distanceSq.usf" 6 | #include "triangle/signedDistance.usf" 7 | #include "triangle/closestPoint.usf" 8 | #include "triangle/intersect.usf" 9 | #include "triangle/normal.usf" -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/triangle/area.usf: -------------------------------------------------------------------------------- 1 | #include "triangle.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Returns the area of a triangle 6 | use: normal( tri) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_TRIANGLE_AREA 13 | #define FNC_TRIANGLE_AREA 14 | float area(Triangle _tri) { return length( cross( _tri.b - _tri.a, _tri.c - _tri.a) ) * 0.5f; } 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/triangle/centroid.usf: -------------------------------------------------------------------------------- 1 | #include "triangle.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Returns the centroid of a triangle 6 | use: centroid( tri) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_TRIANGLE_CENTROID 13 | #define FNC_TRIANGLE_CENTROID 14 | 15 | float3 centroid(Triangle _tri) { return (_tri.a + _tri.b + _tri.c) * 0.3333333333333f; } 16 | 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/triangle/contain.usf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Shaders/lygia/geometry/triangle/contain.usf -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/triangle/normal.usf: -------------------------------------------------------------------------------- 1 | #include "triangle.usf" 2 | /* 3 | contributors: Patricio Gonzalez Vivo 4 | description: Returns the normal of a triangle 5 | use: getNormal( tri) 6 | license: 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 9 | */ 10 | 11 | #ifndef FNC_TRIANGLE_NORMAL 12 | #define FNC_TRIANGLE_NORMAL 13 | 14 | float3 normal(Triangle _tri) { return normalize( cross( _tri.b - _tri.a, _tri.c - _tri.a) ); } 15 | 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/triangle/signedDistance.usf: -------------------------------------------------------------------------------- 1 | #include "triangle.usf" 2 | #include "normal.usf" 3 | #include "closestPoint.usf" 4 | 5 | /* 6 | contributors: 7 | description: Returns the signed distance from the surface of a triangle to a point 8 | use: closestDistance( tri, _pos) 9 | */ 10 | 11 | #ifndef FNC_TRIANGLE_SIGNED_DISTANCE 12 | #define FNC_TRIANGLE_SIGNED_DISTANCE 13 | 14 | float signedDistance(Triangle _tri, float3 _triNormal, float3 _p) { 15 | float3 nearest = closestPoint(_tri, _triNormal, _p); 16 | float3 delta = _p - nearest; 17 | float distance = length(delta); 18 | distance *= sign( dot(delta/distance, _triNormal) ); 19 | return distance; 20 | } 21 | 22 | float signedDistance(Triangle _tri, float3 _p) { return signedDistance(_tri, normal(_tri), _p); } 23 | 24 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/geometry/triangle/triangle.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: This file contains the definition of the Triangle struct 4 | license: 5 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 7 | */ 8 | 9 | #ifndef STR_TRIANGLE 10 | #define STR_TRIANGLE 11 | struct Triangle { 12 | float3 a, b, c; 13 | }; 14 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/common/ashikhmin.usf: -------------------------------------------------------------------------------- 1 | #include "../../math/const.usf" 2 | 3 | #ifndef FNC_ASHIKHMIN 4 | #define FNC_ASHIKHMIN 5 | float ashikhmin(float NoH, float roughness) { 6 | // Ashikhmin 2007, "Distribution-based BRDFs" 7 | float a2 = roughness * roughness; 8 | float cos2h = NoH * NoH; 9 | float sin2h = max(1.0 - cos2h, 0.0078125); // 2^(-14/2), so sin2h^2 > 0 in fp16 10 | float sin4h = sin2h * sin2h; 11 | float cot2 = -cos2h / (a2 * sin2h); 12 | return 1.0 / (PI * (4.0 * a2 + 1.0) * sin4h) * (4.0 * exp(cot2) + sin4h); 13 | } 14 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/common/beckmann.usf: -------------------------------------------------------------------------------- 1 | #ifndef FNC_BECKMANN 2 | #define FNC_BECKMANN 3 | float beckmann(float _NoH, float roughness) { 4 | float NoH = max(_NoH, 0.0001); 5 | float cos2Alpha = NoH * NoH; 6 | float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha; 7 | float roughness2 = roughness * roughness; 8 | float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha; 9 | return exp(tan2Alpha / roughness2) / denom; 10 | } 11 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/common/charlie.usf: -------------------------------------------------------------------------------- 1 | #include "../../math/const.usf" 2 | 3 | #ifndef FNC_CHARLIE 4 | #define FNC_CHARLIE 5 | float charlie(float NoH, float roughness) { 6 | // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF" 7 | float invAlpha = 1.0 / roughness; 8 | float cos2h = NoH * NoH; 9 | float sin2h = max(1.0 - cos2h, 0.0078125); // 2^(-14/2), so sin2h^2 > 0 in fp16 10 | return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / TAU; 11 | } 12 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/common/clampNoV.usf: -------------------------------------------------------------------------------- 1 | #ifndef FNC_CLAMPNOV 2 | #define FNC_CLAMPNOV 3 | 4 | #ifndef MIN_N_DOT_V 5 | #define MIN_N_DOT_V 1e-4 6 | #endif 7 | // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886" 8 | float clampNoV(float NoV) { 9 | return max(NoV, MIN_N_DOT_V); 10 | } 11 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/common/envBRDFApprox.usf: -------------------------------------------------------------------------------- 1 | #ifndef FNC_ENVBRDFAPPROX 2 | #define FNC_ENVBRDFAPPROX 3 | 4 | float3 envBRDFApprox(float3 _specularColor, float _NoV, float _roughness) { 5 | float4 c0 = float4( -1, -0.0275, -0.572, 0.022 ); 6 | float4 c1 = float4( 1, 0.0425, 1.04, -0.04 ); 7 | float4 r = _roughness * c0 + c1; 8 | float a004 = min( r.x * r.x, exp2( -9.28 * _NoV ) ) * r.x + r.y; 9 | float2 AB = float2( -1.04, 1.04 ) * a004 + r.zw; 10 | return _specularColor * AB.x + AB.y; 11 | } 12 | 13 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/common/kelemen.usf: -------------------------------------------------------------------------------- 1 | 2 | #include "../../math/saturateMediump.usf" 3 | 4 | #ifndef FNC_KELEMEN 5 | #define FNC_KELEMEN 6 | 7 | // Kelemen 2001, "A Microfacet Based Coupled Specular-Matte BRDF Model with Importance Sampling" 8 | float kelemen(float LoH) { 9 | return saturateMediump(0.25 / (LoH * LoH)); 10 | } 11 | 12 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/common/rayleigh.usf: -------------------------------------------------------------------------------- 1 | #include "../../math/const.usf" 2 | 3 | #ifndef FNC_RAYLEIGH 4 | #define FNC_RAYLEIGH 5 | 6 | // Rayleigh phase 7 | float rayleigh(float mu) { 8 | return 3. * (1. + mu*mu) / (16. * PI); 9 | } 10 | 11 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/common/schlick.usf: -------------------------------------------------------------------------------- 1 | #include "../../math/pow5.usf" 2 | 3 | #ifndef FNC_SCHLICK 4 | #define FNC_SCHLICK 5 | 6 | // Schlick 1994, "An Inexpensive BRDF Model for Physically-Based Rendering" 7 | float3 schlick(const float3 f0, float f90, float VoH) { 8 | float f = pow5(1.0 - VoH); 9 | return f + f0 * (f90 - f); 10 | } 11 | 12 | float3 schlick(float3 f0, float3 f90, float VoH) { 13 | return f0 + (f90 - f0) * pow5(1.0 - VoH); 14 | } 15 | 16 | float schlick(float f0, float f90, float VoH) { 17 | return f0 + (f90 - f0) * pow5(1.0 - VoH); 18 | } 19 | 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/common/specularAO.usf: -------------------------------------------------------------------------------- 1 | #if !defined(TARGET_MOBILE) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEBGL) 2 | #define IBL_SPECULAR_OCCLUSION 3 | #endif 4 | 5 | #ifndef FNC_SPECULARAO 6 | #define FNC_SPECULARAO 7 | float specularAO(float NoV, float ao, float roughness) { 8 | #if !defined(TARGET_MOBILE) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEBGL) 9 | return saturate(pow(NoV + ao, exp2(-16.0 * roughness - 1.0)) - 1.0 + ao); 10 | #else 11 | return 1.0; 12 | #endif 13 | } 14 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/debugCube.usf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Shaders/lygia/lighting/debugCube.usf -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/ior/2eta.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Index of refraction to ratio of index of refraction 4 | use: ior2eta( ior) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_IOR2ETA 11 | #define FNC_IOR2ETA 12 | float ior2eta( const float ior ) { return 1.0/ior; } 13 | float3 ior2eta( const float3 ior ) { return 1.0/ior; } 14 | float4 ior2eta( const float4 ior ) { return float4(1.0/ior.rgb, ior.a); } 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/ior/2f0.usf: -------------------------------------------------------------------------------- 1 | #include "../../math/pow2.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Index of refraction to reflectance at 0 degree https://handlespixels.wordpress.com/tag/f0-reflectance/ 6 | use: ior2f0( ior) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_IOR2F0 13 | #define FNC_IOR2F0 14 | float ior2f0(const float ior) { return pow2(ior - 1.0) / pow2(ior + 1.0); } 15 | float3 ior2f0(const float3 ior) { return pow2(ior - 1.0) / pow2(ior + 1.0); } 16 | float4 ior2f0(const float4 ior) { return float4(pow2(ior.rgb - 1.0) / pow2(ior.rgb + 1.0), ior.a); } 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/light/falloff.usf: -------------------------------------------------------------------------------- 1 | #ifndef FNC_LIGHT_FALLOFF 2 | #define FNC_LIGHT_FALLOFF 3 | float falloff(float _dist, float _lightRadius) { 4 | float att = saturate(1.0 - _dist * _dist / (_lightRadius * _lightRadius)); 5 | att *= att; 6 | return att; 7 | } 8 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/ray.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Generic Ray Structure 4 | license: 5 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 7 | */ 8 | 9 | #ifndef STR_RAY 10 | #define STR_RAY 11 | struct Ray { 12 | float3 origin; 13 | float3 direction; 14 | }; 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/raymarch/map.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: Map of SDF functions to be declare 4 | use: raymarchMap( in pos ) 5 | */ 6 | 7 | #ifndef RAYMARCH_MAP_FNC 8 | #define RAYMARCH_MAP_FNC(POS) raymarchMap(POS) 9 | #endif 10 | 11 | #ifndef RAYMARCH_MAP_TYPE 12 | #define RAYMARCH_MAP_TYPE float4 13 | #endif 14 | 15 | #ifndef RAYMARCH_MAP_DISTANCE 16 | #define RAYMARCH_MAP_DISTANCE a 17 | #endif 18 | 19 | #ifndef RAYMARCH_MAP_MATERIAL 20 | #define RAYMARCH_MAP_MATERIAL rgb 21 | #endif 22 | 23 | #ifndef FNC_RAYMARCHMAP 24 | #define FNC_RAYMARCHMAP 25 | 26 | RAYMARCH_MAP_TYPE RAYMARCH_MAP_FNC( in float3 pos ); 27 | 28 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/specular/beckmann.usf: -------------------------------------------------------------------------------- 1 | #include "../common/beckmann.usf" 2 | 3 | #ifndef FNC_SPECULAR_BECKMANN 4 | #define FNC_SPECULAR_BECKMANN 5 | 6 | float specularBeckmann(float3 L, float3 N, float3 V, float roughness) { 7 | float NoH = dot(N, normalize(L + V)); 8 | return beckmann(NoH, roughness); 9 | } 10 | 11 | float specularBeckmann(float3 L, float3 N, float3 V, float roughness, float fresnel) { 12 | return specularBeckmann(L, N, V, roughness); 13 | } 14 | 15 | float specularBeckmann(float3 L, float3 N, float3 V, float NoV, float NoL, float roughness, float fresnel) { 16 | return specularBeckmann(L, N, V, roughness); 17 | } 18 | 19 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/specular/gaussian.usf: -------------------------------------------------------------------------------- 1 | #ifndef FNC_SPECULAR_GAUSSIAN 2 | #define FNC_SPECULAR_GAUSSIAN 3 | 4 | // https://github.com/glslify/glsl-specular-gaussian 5 | float specularGaussian(float3 L, float3 N, float3 V, float roughness) { 6 | float3 H = normalize(L + V); 7 | float theta = acos(dot(H, N)); 8 | float w = theta / roughness; 9 | return exp(-w*w); 10 | } 11 | 12 | float specularGaussian(float3 L, float3 N, float3 V, float roughness, float fresnel) { 13 | return specularGaussian(L, N, V, roughness); 14 | } 15 | 16 | float specularGaussian(float3 L, float3 N, float3 V, float NoV, float NoL, float roughness, float fresnel) { 17 | return specularGaussian(L, N, V, roughness); 18 | } 19 | 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/toMaterialMetallic.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Convert diffuse/specular/glossiness workflow to PBR metallic factor 4 | use: toMetallic( diffuse, specular, maxSpecular) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | 11 | 12 | 13 | 14 | #ifndef FNC_TOMETALLIC 15 | #define FNC_TOMETTALIC 16 | 17 | 18 | 19 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/lighting/toShininess.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Convertes from PBR roughness/metallic to a shininess factor (typaclly use on diffuse/specular/ambient workflow) 4 | use: float toShininess( roughness, metallic) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_TOSHININESS 11 | #define FNC_TOSHININESS 12 | 13 | float toShininess(float roughness, float metallic) { 14 | float s = .95 - roughness * 0.5; 15 | s *= s; 16 | s *= s; 17 | return s * (80. + 160. * (1.0-metallic)); 18 | } 19 | 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/aastep.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Ronja (@totallyRonja) 3 | description: Performs a smoothstep using standard derivatives for anti-aliased edges at any level of magnification. https://www.ronja-tutorials.com/post/046-fwidth/#non-aliased-step 4 | use: aastep( threshold, value) 5 | */ 6 | 7 | #ifndef FNC_AASTEP 8 | #define FNC_AASTEP 9 | float aastep(float compValue, float gradient){ 10 | float halfChange = fwidth(gradient) / 2; 11 | //base the range of the inverse lerp on the change over one pixel 12 | float lowerEdge = compValue - halfChange; 13 | float upperEdge = compValue + halfChange; 14 | //do the inverse interpolation 15 | float stepped = (gradient - lowerEdge) / (upperEdge - lowerEdge); 16 | stepped = saturate(stepped); 17 | return stepped; 18 | } 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/adaptiveThreshold.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: [Brad Larson, Ben Cochran, Hugues Lismonde, Keitaroh Kobayashi, Alaric Cole, Matthew Clark, Jacob Gundersen, Chris Williams] 3 | description: adaptive threshold from https://github.com/BradLarson/GPUImage/blob/master/framework/Source/GPUImageAdaptiveThresholdFilter.m 4 | use: adaptiveThreshold( value, blur_value[, bias]) 5 | */ 6 | 7 | #ifndef FNC_ADAPTIVETHRESHOLD 8 | #define FNC_ADAPTIVETHRESHOLD 9 | float adaptiveThreshold(in float value, in float blur_value, in float bias) { 10 | return step(blur_value + bias, value); 11 | } 12 | 13 | float adaptiveThreshold(in float value, in float blur_value) { 14 | return step(blur_value - 0.05, value); 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/bump.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: bump in a range between -1 and 1 4 | use: bump( x [, k]) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_BUMP 11 | #define FNC_BUMP 12 | 13 | float bump(float x, float k){ return saturate( (1.0 - x * x) - k); } 14 | float3 bump(float3 x, float3 k){ return saturate( (1.0 - x * x) - k); } 15 | float bump(float x) { return max(1.0 - x * x, 0.0); } 16 | float3 bump(float3 x) { return max(float3(1.,1.,1.) - x * x, float3(0.,0.,0.)); } 17 | 18 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/fract.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: this file contains the definition of the floor function for float2, float3, and float4 types, to match GLSL's behavior. 4 | use: fract( value); 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_FRACT 11 | #define FNC_FRACT 12 | #define fract(X) frac(X) 13 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/gain.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: | 4 | Remapping the unit interval into the unit interval by expanding the sides and compressing the center, and keeping 1/2 mapped to 1/2, that can be done with the gain() function. From https://iquilezles.org/articles/functions/ 5 | use: gain( x, k) 6 | */ 7 | 8 | #ifndef FNC_GAIN 9 | #define FNC_GAIN 10 | float gain(float x, float k) { 11 | const float a = 0.5*pow(2.0*((x<0.5)?x:1.0-x), k); 12 | return (x<0.5)?a:1.0-a; 13 | } 14 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/grad4.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: [Stefan Gustavson, Ian McEwan] 3 | description: grad4, used for snoise(float4 v) 4 | use: grad4( j, ip) 5 | */ 6 | 7 | #ifndef FNC_GRAD4 8 | #define FNC_GRAD4 9 | 10 | float4 grad4(float j, float4 ip) { 11 | const float4 ones = float4(1.0, 1.0, 1.0, -1.0); 12 | float4 p, s; 13 | 14 | p.xyz = floor( frac (float3(j, j, j) * ip.xyz) * 7.0) * ip.z - 1.0; 15 | p.w = 1.5 - dot(abs(p.xyz), ones.xyz); 16 | // GLSL: s = float4(lessThan(p, float4(0.0))); 17 | s = float4(1 - step(float4(0, 0, 0, 0), p)); 18 | p.xyz = p.xyz + (s.xyz * 2.0 - 1.0) * s.www; 19 | 20 | return p; 21 | } 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/greaterThan.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: [Stefan Gustavson, Ian McEwan] 3 | description: greaterThan, returns 1 if x > y, 0 otherwise 4 | use: greaterThan( x, y) 5 | */ 6 | 7 | #ifndef FNC_GREATERTHAN 8 | #define FNC_GREATERTHAN 9 | float greaterThan(float x, float y) { return step(y, x); } 10 | float2 greaterThan(float2 x, float2 y) { return step(y, x); } 11 | float3 greaterThan(float3 x, float3 y) { return step(y, x); } 12 | float4 greaterThan(float4 x, float4 y) { return step(y, x); } 13 | #endif 14 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/highPass.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: bias high pass 4 | use: highPass( value, bias) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_HIGHPASS 11 | #define FNC_HIGHPASS 12 | float highPass(in float value, in float bias) { return max(value - bias, 0.0) / (1.0 - bias); } 13 | #endif 14 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/invCubic.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: inverse cubic polynomial https://iquilezles.org/articles/smoothsteps/ 4 | use: invCubic( value); 5 | */ 6 | 7 | #ifndef FNC_INVCUBIC 8 | #define FNC_INVCUBIC 9 | float invCubic(const in float v) { return 0.5-sin(asin(1.0-2.0*v)/3.0); } 10 | float2 invCubic(const in float2 v) { return 0.5-sin(asin(1.0-2.0*v)/3.0); } 11 | float3 invCubic(const in float3 v) { return 0.5-sin(asin(1.0-2.0*v)/3.0); } 12 | float4 invCubic(const in float4 v) { return 0.5-sin(asin(1.0-2.0*v)/3.0); } 13 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/invQuartic.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: inverse quartic polynomial https://iquilezles.org/articles/smoothsteps/ 4 | use: invQuartic( value); 5 | */ 6 | 7 | #ifndef FNC_INVQUARTIC 8 | #define FNC_INVQUARTIC 9 | float invQuartic(const in float v) { return sqrt(1.0-sqrt(1.0-v)); } 10 | float2 invQuartic(const in float2 v) { return sqrt(1.0-sqrt(1.0-v)); } 11 | float3 invQuartic(const in float3 v) { return sqrt(1.0-sqrt(1.0-v)); } 12 | float4 invQuartic(const in float4 v) { return sqrt(1.0-sqrt(1.0-v)); } 13 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/lengthSq.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Squared length 4 | use: lengthSq( v) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_LENGTHSQ 11 | #define FNC_LENGTHSQ 12 | 13 | float lengthSq(in float2 v) { return dot(v, v); } 14 | float lengthSq(in float3 v) { return dot(v, v); } 15 | float lengthSq(in float4 v) { return dot(v, v); } 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/mirror.usf: -------------------------------------------------------------------------------- 1 | #include "mod.usf" 2 | 3 | /* 4 | contributors: Ian Heisters 5 | description: Transforms the input signal into a triangle wave. For instance, if x goes between 0 and 2, the returned value will go from 0 to 1, and then 1 to 0 in a triangle shape. 6 | use: mirror( x) 7 | */ 8 | 9 | #ifndef FNC_MIRROR 10 | #define FNC_MIRROR 11 | float mirror(in float x) { 12 | float f = frac(x); 13 | float m = floor(mod(x, 2.)); 14 | float fm = f * m; 15 | return f + m - fm * 2.; 16 | } 17 | 18 | float2 mirror(in float2 xy) { 19 | float2 f = frac(xy); 20 | float2 m = floor(mod(xy, 2.)); 21 | float2 fm = f * m; 22 | return f + m - fm * 2.; 23 | } 24 | #endif 25 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/mod289.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: [Stefan Gustavson, Ian McEwan] 3 | description: modulus of 289 4 | use: mod289( x) 5 | */ 6 | 7 | #ifndef FNC_MOD289 8 | #define FNC_MOD289 9 | 10 | float mod289(in float x) { return x - floor(x * (1. / 289.)) * 289.; } 11 | float2 mod289(in float2 x) { return x - floor(x * (1. / 289.)) * 289.; } 12 | float3 mod289(in float3 x) { return x - floor(x * (1. / 289.)) * 289.; } 13 | float4 mod289(in float4 x) { return x - floor(x * (1. / 289.)) * 289.; } 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/parabola.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: | 4 | A nice choice to remap the 0..1 interval into 0..1, such that the corners are mapped to 0 and the center to 1. You can then rise the parabolar to a power k to control its shape. From https://iquilezles.org/articles/functions/ 5 | use: parabola( x, k) 6 | */ 7 | 8 | #ifndef FNC_PARABOLA 9 | #define FNC_PARABOLA 10 | float parabola( float x, float k ) { return pow( 4.0*x*(1.0-x), k ); } 11 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/permute.usf: -------------------------------------------------------------------------------- 1 | #include "mod289.usf" 2 | 3 | /* 4 | contributors: [Stefan Gustavson, Ian McEwan] 5 | description: permute 6 | use: permute( x) 7 | */ 8 | 9 | #ifndef FNC_PERMUTE 10 | #define FNC_PERMUTE 11 | 12 | float permute(in float x) { return mod289(((x * 34.0) + 1.0) * x); } 13 | float2 permute(in float2 x) { return mod289(((x * 34.0) + 1.0) * x); } 14 | float3 permute(in float3 x) { return mod289(((x * 34.0) + 1.0) * x); } 15 | float4 permute(in float4 x) { return mod289(((x * 34.0) + 1.0) * x); } 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/pow2.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: power of 2 4 | use: pow2( x) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_POW2 11 | #define FNC_POW2 12 | 13 | float pow2(in float x) { return x * x; } 14 | float2 pow2(in float2 x) { return x * x; } 15 | float3 pow2(in float3 x) { return x * x; } 16 | float4 pow2(in float4 x) { return x * x; } 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/pow3.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: power of 3 4 | use: pow3( x) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_POW3 11 | #define FNC_POW3 12 | 13 | float pow3(in float x) { return x * x * x; } 14 | float2 pow3(in float2 x) { return x * x * x; } 15 | float3 pow3(in float3 x) { return x * x * x; } 16 | float4 pow3(in float4 x) { return x * x * x; } 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/pow7.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: power of 7 4 | use: pow7( x) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_POW2 11 | #define FNC_POW2 12 | 13 | float pow7(in float x) { return x * x * x * x * x * x * x; } 14 | float2 pow7(in float2 x) { return x * x * x * x * x * x * x; } 15 | float3 pow7(in float3 x) { return x * x * x * x * x * x * x; } 16 | float4 pow7(in float4 x) { return x * x * x * x * x * x * x; } 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/powFast.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: fast approximation to pow() 4 | use: powFast( x, exp) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_POWFAST 11 | #define FNC_POWFAST 12 | 13 | float powFast(const in float a, const in float b) { return a / ((1. - b) * a + b); } 14 | 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quartic.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: quartic polynomial https://iquilezles.org/articles/smoothsteps/ 4 | use: quartic( value); 5 | */ 6 | 7 | #ifndef FNC_QUARTIC 8 | #define FNC_QUARTIC 9 | 10 | float quartic(const in float v) { return v*v*(2.0-v*v); } 11 | float2 quartic(const in float2 v) { return v*v*(2.0-v*v); } 12 | float3 quartic(const in float3 v) { return v*v*(2.0-v*v); } 13 | float4 quartic(const in float4 v) { return v*v*(2.0-v*v); } 14 | 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/2mat4.usf: -------------------------------------------------------------------------------- 1 | #include "type.usf" 2 | #include "2mat3.usf" 3 | #include "../toMat4.usf" 4 | 5 | /* 6 | contributors: Patricio Gonzalez Vivo 7 | description: given a quaternion, returns a rotation 4x4 matrix 8 | use: quat2mat4( Q) 9 | license: 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 11 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 12 | */ 13 | 14 | 15 | #ifndef FNC_QUAT2MAT4 16 | #define FNC_QUAT2MAT4 17 | float4x4 quat2mat4(QUAT q) { return toMat4(quat2mat3(q)); } 18 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/add.usf: -------------------------------------------------------------------------------- 1 | #include "type.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: "Quaternion addition \n" 6 | use: quatAdd( a, b) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_QUATADD 13 | #define FNC_QUATADD 14 | QUAT quatAdd(QUAT a, QUAT b) { return QUAT(a.xyz + b.xyz, a.w + b.w); } 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/conj.usf: -------------------------------------------------------------------------------- 1 | #include "type.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: given a quaternion, returns its conjugate 6 | use: quatConj( Q) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_QUATCONJ 13 | #define FNC_QUATCONJ 14 | QUAT quatConj(QUAT q) { return QUAT(-q.xyz, q.w); } 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/div.usf: -------------------------------------------------------------------------------- 1 | #include "type.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: "Quaternion division \n" 6 | use: quatDiv( a, b) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_QUATDIV 13 | #define FNC_QUATDIV 14 | QUAT quatDiv(QUAT q, float s) { return QUAT(q.xyz / s, q.w / s); } 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/identity.usf: -------------------------------------------------------------------------------- 1 | #include "type.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: returns the identity quaternion 6 | use: QUAT_IDENTITY 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef QUAT_IDENTITY 13 | #define QUAT_IDENTITY QUAT(0.0, 0.0, 0.0, 1.0) 14 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/inverse.usf: -------------------------------------------------------------------------------- 1 | #include "div.usf" 2 | #include "conj.usf" 3 | #include "lengthSq.usf" 4 | 5 | /* 6 | contributors: Patricio Gonzalez Vivo 7 | description: "Quaternion inverse \n" 8 | use: quatDiv( a, b) 9 | license: 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 11 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 12 | */ 13 | 14 | #ifndef FNC_QUATINVERSE 15 | #define FNC_QUATINVERSE 16 | QUAT quatInverse(QUAT q) { return quatDiv(quatConj(q), quatLengthSq(q)); } 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/length.usf: -------------------------------------------------------------------------------- 1 | #include "lengthSq.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: 'Returns the lenght of a quaternion' 6 | use: quatLength( q) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_QUADLENGTH 13 | #define FNC_QUADLENGTH 14 | float quatLength(QUAT q) { return sqrt(quatLengthSq(q)); } 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/lengthSq.usf: -------------------------------------------------------------------------------- 1 | #include "type.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: 'Returns the squared length of a quaternion.' 6 | use: quatLengthSq( q) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_QUATLENGTHSQ 13 | #define FNC_QUATLENGTHSQ 14 | float quatLengthSq(QUAT q) { return dot(q.xyz, q.xyz) + q.w * q.w; } 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/mul.usf: -------------------------------------------------------------------------------- 1 | #include "type.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: 'Quaternion multiplication. Based on http://mathworld.wolfram.com/Quaternion.html' 6 | use: quatMul( a, b) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_QUATMUL 13 | #define FNC_QUATMUL 14 | QUAT quatMul(QUAT q1, QUAT q2) { 15 | return QUAT( 16 | q2.xyz * q1.w + q1.xyz * q2.w + cross(q1.xyz, q2.xyz), 17 | q1.w * q2.w - dot(q1.xyz, q2.xyz) 18 | ); 19 | } 20 | 21 | QUAT quatMul(QUAT q, float s) { return QUAT(q.xyz * s, q.w * s); } 22 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/neg.usf: -------------------------------------------------------------------------------- 1 | #include "type.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: "Quaternion negative. \n" 6 | use: quatNeg( a) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_QUATNEG 13 | #define FNC_QUATNEG 14 | QUAT quatNeg(QUAT q) { return QUAT(-q.xyz, -q.w); } 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/norm.usf: -------------------------------------------------------------------------------- 1 | #include "length.usf" 2 | #include "div.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: returns a normalized quaternion 7 | use: quatNorm( Q) 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_QUATNORM 14 | #define FNC_QUATNORM 15 | QUAT quatNorm(QUAT q) { return quatDiv(q, quatLength(q)); } 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/sub.usf: -------------------------------------------------------------------------------- 1 | #include "type.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: "Quaternion substraction. \n" 6 | use: quatNeg( a, b) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_QUATNEG 13 | #define FNC_QUATNEG 14 | QUAT quatSub(QUAT a, QUAT b) { return QUAT(a.xyz - b.xyz, a.w - b.w); } 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quat/type.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: quaternion type 4 | use: 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef QUAT 11 | #define QUAT float4 12 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/quintic.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: quintic polynomial https://iquilezles.org/articles/smoothsteps/ 4 | use: quintic( value); 5 | */ 6 | 7 | #ifndef FNC_QUINTIC 8 | #define FNC_QUINTIC 9 | 10 | float quintic(const in float v) { return v*v*v*(v*(v*6.0-15.0)+10.0); } 11 | float2 quintic(const in float2 v) { return v*v*v*(v*(v*6.0-15.0)+10.0); } 12 | float3 quintic(const in float3 v) { return v*v*v*(v*(v*6.0-15.0)+10.0); } 13 | float4 quintic(const in float4 v) { return v*v*v*(v*(v*6.0-15.0)+10.0); } 14 | 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/rotate2d.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: returns a 2x2 rotation matrix 4 | use: rotate2d( radians) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_ROTATE2D 11 | #define FNC_ROTATE2D 12 | float2x2 rotate2d(const in float radians){ 13 | float c = cos(radians); 14 | float s = sin(radians); 15 | return float2x2(c, -s, s, c); 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/rotate3dX.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: returns a 3x3 rotation matrix 4 | use: rotate3dX( radians) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_ROTATE3DX 11 | #define FNC_ROTATE3DX 12 | float3x3 rotate3dX(const in float r){ 13 | return float3x3(float3(1.0,0.0,0.0), 14 | float3(0.0,cos(r),-sin(r)), 15 | float3(0.0,sin(r),cos(r))); 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/rotate3dY.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: returns a 3x3 rotation matrix 4 | use: rotate3dY( radians) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_ROTATE3DY 11 | #define FNC_ROTATE3DY 12 | float3x3 rotate3dY(const in float theta){ 13 | return float3x3(float3(cos(theta),0.,-sin(theta)), 14 | float3(0.,1.,0.), 15 | float3(sin(theta),0.,cos(theta))); 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/rotate3dZ.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: returns a 3x3 rotation matrix 4 | use: rotate3dZ( radians) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_ROTATE3DZ 11 | #define FNC_ROTATE3DZ 12 | float3x3 rotate3dZ(const in float r){ 13 | return float3x3(float3(cos(r),-sin(r),0.), 14 | float3(sin(r),cos(r),0.), 15 | float3(0.,0.,1.)); 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/rotate4dX.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: returns a 4x4 rotation matrix 4 | use: rotate4dX( radians) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_ROTATE4DX 11 | #define FNC_ROTATE4DX 12 | float4x4 rotate4dX(const in float phi){ 13 | return float4x4(float4(1.,0.,0.,0), 14 | float4(0.,cos(phi),-sin(phi),0.), 15 | float4(0.,sin(phi),cos(phi),0.), 16 | float4(0.,0.,0.,1.)); 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/rotate4dY.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: returns a 4x4 rotation matrix 4 | use: rotate4dY( radians) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_ROTATE4DY 11 | #define FNC_ROTATE4DY 12 | float4x4 rotate4dY(in float theta){ 13 | return float4x4(float4(cos(theta),0.,-sin(theta),0), 14 | float4(0.,1.,0.,0.), 15 | float4(sin(theta),0.,cos(theta),0.), 16 | float4(0.,0.,0.,1.)); 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/rotate4dZ.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: returns a 4x4 rotation matrix 4 | use: rotate4dZ( radians) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_ROTATE4DZ 11 | #define FNC_ROTATE4DZ 12 | float4x4 rotate4dZ(in float psi){ 13 | return float4x4(float4(cos(psi),-sin(psi),0.,0), 14 | float4(sin(psi),cos(psi),0.,0.), 15 | float4(0.,0.,1.,0.), 16 | float4(0.,0.,0.,1.)); 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/saturateMediump.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: clamp a value between 0 and the medium precision max (65504.0) for floating points 4 | use: saturateMediump( value) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_SATURATEMEDIUMP 11 | #define FNC_SATURATEMEDIUMP 12 | 13 | #ifndef MEDIUMP_FLT_MAX 14 | #define MEDIUMP_FLT_MAX 65504.0 15 | #endif 16 | 17 | #if defined(TARGET_MOBILE) || defined(PLATFORM_WEBGL) || defined(PLATFORM_RPI) 18 | #define saturateMediump(x) min(x, MEDIUMP_FLT_MAX) 19 | #else 20 | #define saturateMediump(x) x 21 | #endif 22 | 23 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/scale2d.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: returns a 2x2 scale matrix 4 | use: 5 | - scale2d( radians) 6 | - scale2d( x, y) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_SCALE2D 13 | float2x2 scale2d(float s) { return float2x2(s, 0.0, 0.0, s); } 14 | float2x2 scale2d(float2 s) { return float2x2(s.x, 0.0, 0.0, s.y); } 15 | float2x2 scale2d(float x, float y) { return float2x2(x, 0.0, 0.0, y); } 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/sum.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Sum elements of a vector 4 | use: sum( value) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_SUM 11 | #define FNC_SUM 12 | float sum( float v ) { return v; } 13 | float sum( float2 v ) { return v.x+v.y; } 14 | float sum( float3 v ) { return v.x+v.y+v.z; } 15 | float sum( float4 v ) { return v.x+v.y+v.z+v.w; } 16 | #endif 17 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/taylorInvSqrt.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: [Stefan Gustavson, Ian McEwan] 3 | description: Fast, accurate inverse square root. 4 | use: taylorInvSqrt( x) 5 | */ 6 | 7 | #ifndef FNC_TAYLORINVSQRT 8 | #define FNC_TAYLORINVSQRT 9 | float taylorInvSqrt(in float r) { return 1.79284291400159 - 0.85373472095314 * r; } 10 | float2 taylorInvSqrt(in float2 r) { return 1.79284291400159 - 0.85373472095314 * r; } 11 | float3 taylorInvSqrt(in float3 r) { return 1.79284291400159 - 0.85373472095314 * r; } 12 | float4 taylorInvSqrt(in float4 r) { return 1.79284291400159 - 0.85373472095314 * r; } 13 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/math/toMat4.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: given a 3x3 returns a 4x4 4 | use: toMat4( m) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_TOMAT4 11 | #define FNC_TOMAT4 12 | float4x4 toMat4(float3x3 m) { 13 | return float4x4(float4(m[0], 0.0), 14 | float4(m[1], 0.0), 15 | float4(m[2], 0.0), 16 | float4(0.0, 0.0, 0.0, 1.0) ); 17 | } 18 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sample/mirror.usf: -------------------------------------------------------------------------------- 1 | #include "../sampler.usf" 2 | #include "../math/mirror.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: fakes a mirror wrapping texture 7 | use: sampleMirror( tex, st); 8 | options: 9 | - SAMPLER_FNC(TEX, Sampler,UV) 10 | license: 11 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 12 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 13 | */ 14 | 15 | #ifndef FNC_SAMPLEMIRROR 16 | #define FNC_SAMPLEMIRROR 17 | float4 sampleMirror(SAMPLER_TYPE tex, float2 st) { 18 | return SAMPLER_FNC( tex, mirror(st) ); 19 | } 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sample/nearest.usf: -------------------------------------------------------------------------------- 1 | #include "../space/nearest.usf" 2 | #include "../sampler.usf" 3 | 4 | /* 5 | contributors: Patricio Gonzalez Vivo 6 | description: fakes a nearest sample 7 | use: tex, st, texResolution); 8 | options: 9 | - SAMPLER_FNC(TEX, Sampler,UV) 10 | license: 11 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 12 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 13 | */ 14 | 15 | #ifndef FNC_SAMPLENEARERS 16 | #define FNC_SAMPLENEARERS 17 | float4 sampleNearest(SAMPLER_TYPE tex, float2 st, float2 texResolution) { 18 | return SAMPLER_FNC( tex, nearest(st, texResolution) ); 19 | } 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sample/normalMap.usf: -------------------------------------------------------------------------------- 1 | #include "../sampler.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Standar way to get normals from a normal map 6 | use: sampleNormal( tex, st) 7 | options: 8 | - SAMPLER_FNC(TEX, Sampler,UV): optional depending the target version of GLSL (texture2D(...) or texture(...)) 9 | license: 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 11 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 12 | */ 13 | 14 | #ifndef FNC_SAMPLENORMALMAP 15 | #define FNC_SAMPLENORMALMAP 16 | float3 sampleNormalMap(in SAMPLER_TYPE tex, in SamplerState texSampler, in float2 st) { return SAMPLER_FNC(tex,texSampler, st).xyz * 2.0 - 1.0; } 17 | #endif 18 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sample/repeat.usf: -------------------------------------------------------------------------------- 1 | #include "../sampler.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: fakes a repeat wrapping texture 6 | use: sampleRepeat( tex, st); 7 | options: 8 | - SAMPLER_FNC(TEX, Sampler,UV) 9 | license: 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 11 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 12 | */ 13 | 14 | #ifndef FNC_SAMPLEREPEAT 15 | #define FNC_SAMPLEREPEAT 16 | float4 sampleRepeat(SAMPLER_TYPE tex, float2 st) { 17 | return SAMPLER_FNC( tex, frac(st) ); 18 | } 19 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sample/zero.usf: -------------------------------------------------------------------------------- 1 | #include "../sampler.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: turns alpha to zero if it's outside the texture normalize coordinates 6 | use: sampleZero( tex, st); 7 | options: 8 | - SAMPLER_FNC(TEX, TEXSAMPLER,UV) 9 | license: 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 11 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 12 | */ 13 | 14 | #ifndef FNC_SAMPLEZERO 15 | #define FNC_SAMPLEZERO 16 | float4 sampleZero(SAMPLER_TYPE tex, float2 st) { 17 | return SAMPLER_FNC( tex, st ) * float4(1.0,1.0,1.0, (st.x <= 0.0 || st.x >= 1.0 || st.y <= 0.0 || st.y >= 1.0)? 0.0 : 1.0); 18 | } 19 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sampler.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: It defines the default sampler type and function for the shader. 4 | license: 5 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 7 | */ 8 | 9 | /** 10 | #ifndef SAMPLER_FNC 11 | #define SAMPLER_FNC(TEX, TEXSAMPLER,UV) tex2D(TEX, TEXSAMPLER,UV) 12 | #endif 13 | 14 | #ifndef SAMPLER_TYPE 15 | #define SAMPLER_TYPE sampler2D 16 | #endif 17 | */ 18 | 19 | #ifndef SAMPLER_FNC 20 | #define SAMPLER_FNC(TEX,TEXSampler, UV) TEX.SampleGrad(TEXSampler,UV,ddx(UV),ddy(UV)); 21 | #endif 22 | 23 | #ifndef SAMPLER_TYPE 24 | #define SAMPLER_TYPE Texture2D 25 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/boxFrameSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: generate the SDF of a bounding box 4 | use: boxFrameSDF( p, b, e ) 5 | */ 6 | 7 | #ifndef FNC_BOXFRAMESDF 8 | #define FNC_BOXFRAMESDF 9 | 10 | float boxFrameSDF( float3 p, float3 b, float e ) { 11 | p = abs(p) - b; 12 | float3 q = abs(p + e) - e; 13 | 14 | return min(min( 15 | length(max(float3(p.x,q.y,q.z),0.0))+min(max(p.x,max(q.y,q.z)),0.0), 16 | length(max(float3(q.x,p.y,q.z),0.0))+min(max(q.x,max(p.y,q.z)),0.0)), 17 | length(max(float3(q.x,q.y,p.z),0.0))+min(max(q.x,max(q.y,p.z)),0.0)); 18 | } 19 | 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/boxSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: generate the SDF of a box 4 | use: boxSDF( in pos [, in borders ] ) 5 | */ 6 | 7 | #ifndef FNC_BOXSDF 8 | #define FNC_BOXSDF 9 | 10 | float boxSDF( float3 p ) { 11 | float3 d = abs(p); 12 | return min(max(d.x,max(d.y,d.z)),0.0) + length(max(d,0.0)); 13 | } 14 | 15 | float boxSDF( float3 p, float3 b ) { 16 | float3 d = abs(p) - b; 17 | return min(max(d.x,max(d.y,d.z)),0.0) + length(max(d,0.0)); 18 | } 19 | 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/capsuleSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: generate a SDF of a capsule 4 | use: capusleSDF( in pos, in a, b, r ) 5 | */ 6 | 7 | #ifndef FNC_CAPSULESDF 8 | #define FNC_CAPSULESDF 9 | 10 | float capsuleSDF( float3 p, float3 a, float3 b, float r ) { 11 | float3 pa = p-a, ba = b-a; 12 | float h = saturate( dot(pa,ba)/dot(ba,ba) ); 13 | return length( pa - ba*h ) - r; 14 | } 15 | 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/crossSDF.usf: -------------------------------------------------------------------------------- 1 | #include "rectSDF.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Returns a cross-shaped SDF 6 | use: crossSDF( st, size s) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_CROSSSDF 13 | #define FNC_CROSSSDF 14 | float crossSDF(in float2 st, in float s) { 15 | float2 size = float2(.25, s); 16 | return min(rectSDF(st.xy, size.xy), 17 | rectSDF(st.xy, size.yx)); 18 | } 19 | #endif 20 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/cubeSDF.usf: -------------------------------------------------------------------------------- 1 | #include "boxSDF.usf" 2 | 3 | /* 4 | description: generate the SDF of a cube 5 | use: cubeSDF( in pos, in size ) 6 | */ 7 | 8 | #ifndef FNC_CUBESDF 9 | #define FNC_CUBESDF 10 | float cubeSDF(float3 p, float s) { return boxSDF(p, float3(s, s, s)); } 11 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/ellipsoidSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: generate the SDF of an approximated ellipsoid 4 | use: ellipsoidSDF( in p, in r ) 5 | */ 6 | 7 | #ifndef FNC_ELLIPSOIDSDF 8 | #define FNC_ELLIPSOIDSDF 9 | 10 | float ellipsoidSDF( in float3 p, in float3 r ) { 11 | float k0 = length(p/r); 12 | float k1 = length(p/(r*r)); 13 | return k0*(k0-1.0)/k1; 14 | } 15 | 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/flowerSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Returns a flower shaped SDF 4 | use: flowerSDF( st, n_sides) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_FLOWERSDF 11 | #define FNC_FLOWERSDF 12 | float flowerSDF(vec2 st, int N) { 13 | #ifdef CENTER_2D 14 | st -= CENTER_2D; 15 | #else 16 | st -= 0.5; 17 | #endif 18 | st *= 4.0; 19 | float r = length(st) * 2.0; 20 | float a = atan2(st.y, st.x); 21 | float v = float(N) * 0.5; 22 | return 1.0 - (abs(cos(a * v)) * 0.5 + 0.5) / r; 23 | } 24 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/heartSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Returns a heart shaped SDF 4 | use: heartSDF( st) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_HEARTSDF 11 | #define FNC_HEARTSDF 12 | float heartSDF(float2 st) { 13 | #ifdef CENTER_2D 14 | st -= CENTER_2D; 15 | #else 16 | st -= 0.5; 17 | #endif 18 | st -= float2(0.0, 0.3); 19 | float r = length(st) * 5.0; 20 | st = normalize(st); 21 | return r - ((st.y * pow(abs(st.x), 0.67)) / (st.y + 1.5) - (2.0) * st.y + 1.26); 22 | } 23 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/hexPrismSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: generate the SDF of a hexagonal prism 4 | use: hexPrismSDF( in pos, in h ) 5 | */ 6 | 7 | #ifndef FNC_HEXPRISMSDF 8 | #define FNC_HEXPRISMSDF 9 | 10 | float hexPrismSDF( float3 p, float2 h ) { 11 | float3 q = abs(p); 12 | float d1 = q.z-h.y; 13 | float d2 = max((q.x*0.866025+q.y*0.5),q.y)-h.x; 14 | return length(max(float2(d1,d2),0.0)) + min(max(d1,d2), 0.); 15 | } 16 | 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/hexSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Returns a hexagon-shaped SDF 4 | use: hexSDF( st) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_HEXSDF 11 | #define FNC_HEXSDF 12 | float hexSDF(in float2 st) { 13 | #ifdef CENTER_2D 14 | st -= CENTER_2D; 15 | st *= 2.0; 16 | #else 17 | st = st * 2.0 - 1.0; 18 | #endif 19 | st = abs(st); 20 | return max(abs(st.y), st.x * .866025 + st.y * .5); 21 | } 22 | #endif 23 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/icosahedronSDF.usf: -------------------------------------------------------------------------------- 1 | #include "../math/const.usf" 2 | 3 | /* 4 | description: generate the SDF of a icosahedron 5 | use: icosahedronSDF( in pos, in size ) 6 | */ 7 | 8 | #ifndef FNC_ICOSAHEDRONSDF 9 | #define FNC_ICOSAHEDRONSDF 10 | 11 | float icosahedronSDF(float3 p, float radius) { 12 | float q = 2.61803398875; // Golden Ratio + 1 = (sqrt(5)+3)/2; 13 | float3 n1 = normalize(float3(q, 1,0)); 14 | float3 n2 = float3(0.57735026919, 0.57735026919, 0.57735026919); // = sqrt(3)/3); 15 | 16 | p = abs(p / radius); 17 | float a = dot(p, n1.xyz); 18 | float b = dot(p, n1.zxy); 19 | float c = dot(p, n1.yzx); 20 | float d = dot(p, n2) - n1.x; 21 | return max(max(max(a,b),c)-n1.x,d) * radius; 22 | } 23 | 24 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/juliaSDF.usf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Shaders/lygia/sdf/juliaSDF.usf -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/kochSDF.usf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Shaders/lygia/sdf/kochSDF.usf -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/lineSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: Segment SDF 4 | use: lineSDF( st, A, B) 5 | */ 6 | 7 | #ifndef FNC_LINESDF 8 | #define FNC_LINESDF 9 | float lineSDF( in float2 st, in float2 a, in float2 b ) { 10 | float2 b_to_a = b - a; 11 | float2 to_a = st - a; 12 | float h = saturate(dot(to_a, b_to_a)/dot(b_to_a, b_to_a)); 13 | return length(to_a - h * b_to_a ); 14 | } 15 | #endif 16 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/linkSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: generate the SDF of a link 4 | use: linkSDF( p, le, r1, r2 ) 5 | */ 6 | 7 | #ifndef FNC_LINKSDF 8 | #define FNC_LINKSDF 9 | float linkSDF( float3 p, float le, float r1, float r2 ) { 10 | float3 q = float3( p.x, max(abs(p.y)-le,0.0), p.z ); 11 | return length(float2(length(q.xy)-r1,q.z)) - r2; 12 | } 13 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/opElongate.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: elongate operation of two SDFs 4 | use: opElongate( in p, in h ) 5 | */ 6 | 7 | #ifndef FNC_OPELONGATE 8 | #define FNC_OPELONGATE 9 | 10 | float2 opElongate( in float2 p, in float2 h ) { 11 | return p-clamp(p,-h,h); 12 | } 13 | 14 | float3 opElongate( in float3 p, in float3 h ) { 15 | return p-clamp(p,-h,h); 16 | } 17 | 18 | float4 opElongate( in float4 p, in float4 h ) { 19 | float3 q = abs(p)-h; 20 | return float4( max(q,0.0), min(max(q.x,max(q.y,q.z)), 0.0) ); 21 | } 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/opExtrude.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: extrude operation of a 2D SDFs into a 3D one 4 | use: opExtrude( in p, in sdf, in h ) 5 | */ 6 | 7 | #ifndef FNC_OPEXTRUDE 8 | #define FNC_OPEXTRUDE 9 | 10 | float opExtrude( in float3 p, in float sdf, in float h ) { 11 | float2 w = float2( sdf, abs(p.z) - h ); 12 | return min(max(w.x,w.y),0.0) + length(max(w,0.0)); 13 | } 14 | 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/opIntersection.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: intersection operation of two SDFs 4 | use: opIntersection( in d1, in d2 [, smooth_factor] ) 5 | */ 6 | 7 | #ifndef FNC_OPINTERSECTION 8 | #define FNC_OPINTERSECTION 9 | 10 | float opIntersection( float d1, float d2 ) { return max(d1,d2); } 11 | 12 | float opIntersection( float d1, float d2, float k ) { 13 | float h = saturate( 0.5 - 0.5*(d2-d1)/k ); 14 | return lerp( d2, d1, h ) + k*h*(1.0-h); 15 | } 16 | 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/opOnion.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: onion operation of one SDFs 4 | use: opOnion( in d, in h ) 5 | */ 6 | 7 | #ifndef FNC_OPONION 8 | #define FNC_OPONION 9 | 10 | float opOnion( in float d, in float h ) { 11 | return abs(d)-h; 12 | } 13 | 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/opRepeat.usf: -------------------------------------------------------------------------------- 1 | #include "../math/mod.usf" 2 | 3 | /* 4 | contributors: Inigo Quiles 5 | description: repite operation of one 2D SDFs 6 | use: opElongate( in p, in h ) 7 | */ 8 | 9 | #ifndef FNC_OPREPEAT 10 | #define FNC_OPREPEAT 11 | 12 | float2 opRepeat( in float2 p, in float s ) { 13 | return mod(p+s*0.5,s)-s*0.5; 14 | } 15 | 16 | float3 opRepeat( in float3 p, in float3 c ) { 17 | return mod(p+0.5*c,c)-0.5*c; 18 | } 19 | 20 | float2 opRepeat( in float2 p, in float2 lima, in float2 limb, in float s ) { 21 | return p-s*clamp(floor(p/s), lima, limb); 22 | } 23 | 24 | float3 opRepeat( in float3 p, in float3 lima, in float3 limb, in float s ) { 25 | return p-s*clamp(floor(p/s), lima, limb); 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/opRevolve.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: revolve operation of a 2D SDFs into a 3D one 4 | use: opRevolve( in p, w ) 5 | */ 6 | 7 | #ifndef FNC_OPREVOLVE 8 | #define FNC_OPREVOLVE 9 | 10 | float2 opRevolve( in float3 p, float w ) { 11 | return float2( length(p.xz) - w, p.y ); 12 | } 13 | 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/opRound.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: round SDFs 4 | use: opRound( in d, h ) 5 | */ 6 | 7 | #ifndef FNC_OPREVOLVE 8 | #define FNC_OPREVOLVE 9 | 10 | float opRound( in float d, in float h ) { 11 | return d - h; 12 | } 13 | 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/opSubtraction.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: Substraction operation of two SDFs 4 | use: opSubstraction( in d1, in d2 [, smooth_factor]) 5 | */ 6 | 7 | #ifndef FNC_OPSUBSTRACTION 8 | #define FNC_OPSUBSTRACTION 9 | 10 | float opSubtraction( float d1, float d2 ) { return max(-d1,d2); } 11 | 12 | float opSubtraction( float d1, float d2, float k ) { 13 | float h = saturate( 0.5 - 0.5*(d2+d1)/k ); 14 | return lerp( d2, -d1, h ) + k*h*(1.0-h); 15 | } 16 | 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/opUnion.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: Union operation of two SDFs 4 | use: opUnion( in d1, in d2 [, smooth_factor] ) 5 | */ 6 | 7 | #ifndef FNC_OPUNION 8 | #define FNC_OPUNION 9 | 10 | float opUnion( float d1, float d2 ) { return min(d1, d2); } 11 | float4 opUnion( float4 d1, float4 d2 ) { return (d1.a < d2.a) ? d1 : d2; } 12 | 13 | // Soft union 14 | float opUnion( float d1, float d2, float k ) { 15 | float h = saturate( 0.5 + 0.5*(d2-d1)/k ); 16 | return lerp( d2, d1, h ) - k*h*(1.0-h); 17 | } 18 | 19 | float4 opUnion( float4 d1, float4 d2, float k ) { 20 | float h = saturate( 0.5 + 0.5*(d2.a - d1.a)/k ); 21 | float4 result = lerp( d2, d1, h ); 22 | result.a -= k*h*(1.0-h); 23 | return result; 24 | } 25 | 26 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/planeSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: generate the SDF of a plane 4 | use: planeSDF( in pos, in h ) 5 | */ 6 | 7 | #ifndef FNC_PLANESDF 8 | #define FNC_PLANESDF 9 | float planeSDF( float3 p ) { 10 | return p.y; 11 | } 12 | 13 | float planeSDF(float3 p, float3 planePoint, float3 planeNormal) { 14 | return (dot(planeNormal, p) + dot(planeNormal, planePoint)) / length(planeNormal); 15 | } 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/polySDF.usf: -------------------------------------------------------------------------------- 1 | #include "../math/const.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Returns a sdf for a regular polygon with V sides. 6 | use: polySDF( st, int V) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_POLYSDF 13 | #define FNC_POLYSDF 14 | float polySDF(in float2 st, in int V) { 15 | #ifdef CENTER_2D 16 | st -= CENTER_2D; 17 | st *= 2.0; 18 | #else 19 | st = st * 2.0 - 1.0; 20 | #endif 21 | float a = atan2(st.x, st.y) + PI; 22 | float r = length(st); 23 | float v = TAU / float(V); 24 | return cos(floor(.5 + a / v) * v - a ) * r; 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/raysSDF.usf: -------------------------------------------------------------------------------- 1 | #include "../math/const.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Returns a sdf for rays with N branches 6 | use: raysSDF( st, N) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_RAYSSDF 13 | #define FNC_RAYSSDF 14 | float raysSDF(in vec2 st, in int N) { 15 | #ifdef CENTER_2D 16 | st -= CENTER_2D; 17 | #else 18 | st -= 0.5; 19 | #endif 20 | return frac(atan2(st.y, st.x) / TAU * float(N)); 21 | } 22 | #endif 23 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/rhombSDF.usf: -------------------------------------------------------------------------------- 1 | #include "triSDF.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Returns a rhomb-shaped sdf 6 | use: rhombSDF( st) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_RHOMBSDF 13 | #define FNC_RHOMBSDF 14 | float rhombSDF(in float2 st) { 15 | float offset = 1.0; 16 | #ifdef CENTER_2D 17 | offset = CENTER_2D.y * 2.0; 18 | #endif 19 | return max(triSDF(st), 20 | triSDF(float2(st.x, offset-st.y))); 21 | 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/sphereSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: generate the SDF of a sphere 4 | use: sphereSDF( in pos[], in size] ) 5 | */ 6 | 7 | #ifndef FNC_SPHERESDF 8 | #define FNC_SPHERESDF 9 | float sphereSDF(float3 p) { return length(p); } 10 | float sphereSDF(float3 p, float s) { return sphereSDF(p) - s; } 11 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/spiralSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Returns a spiral SDF 4 | use: spiralSDF( st, turns) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_SPIRALSDF 11 | #define FNC_SPIRALSDF 12 | float spiralSDF(float2 st, float t) { 13 | #ifdef CENTER_2D 14 | st -= CENTER_2D; 15 | #else 16 | st -= 0.5; 17 | #endif 18 | float r = dot(st, st); 19 | float a = atan2(st.y, st.x); 20 | return abs(sin(frac(log(r) * t + a * 0.159))); 21 | } 22 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/tetrahedronSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: generate the SDF of a tetrahedron 4 | use: tetrahedronSDF( in pos, in h ) 5 | */ 6 | 7 | #ifndef FNC_TETRAHEDRONSDF 8 | #define FNC_TETRAHEDRONSDF 9 | float tetrahedronSDF(float3 p, float h) { 10 | float3 q = abs(p); 11 | 12 | float y = p.y; 13 | float d1 = q.z-max(0.,y); 14 | float d2 = max(q.x*.5 + y*.5,.0) - min(h, h+y); 15 | return length(max(float2(d1,d2),.005)) + min(max(d1,d2), 0.0); 16 | } 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/torusSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Inigo Quiles 3 | description: generate the SDF of a torus 4 | use: torusSDF( in pos, in h [, in ra, in rb] ) 5 | */ 6 | 7 | #ifndef FNC_TORUSSDF 8 | #define FNC_TORUSSDF 9 | float torusSDF( float3 p, float2 t ) { return length( float2(length(p.xz)-t.x,p.y) )-t.y; } 10 | 11 | float torusSDF(in float3 p, in float2 sc, in float ra, in float rb) { 12 | p.x = abs(p.x); 13 | float k = (sc.y*p.x>sc.x*p.y) ? dot(p.xy,sc) : length(p.xy); 14 | return sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb; 15 | } 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/triPrismSDF.usf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/franklzt/lygia_unreal_engine_examples/0675db2912c2a1446926e28d3c9b7b68cfd0afe0/Plugins/LygiaShader/Shaders/lygia/sdf/triPrismSDF.usf -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/triSDF.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Returns a triangle-shaped sdf 4 | use: triSDF( st) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_TRISDF 11 | #define FNC_TRISDF 12 | float triSDF(in float2 st) { 13 | #ifdef CENTER_2D 14 | st -= CENTER_2D; 15 | st *= 5.0; 16 | #else 17 | st -= 0.5; 18 | st *= 5.0; 19 | #endif 20 | return max(abs(st.x) * .866025 + st.y * .5, -st.y * 0.5); 21 | } 22 | #endif 23 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/sdf/vesicaSDF.usf: -------------------------------------------------------------------------------- 1 | #include "circleSDF.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: Returns an almond-shaped sdf 6 | use: vesicaSDF( st, w) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_VESICASDF 13 | #define FNC_VESICASDF 14 | float vesicaSDF(in float2 st, in float w) { 15 | float2 offset = float2(w*0.5,0.); 16 | return max( circleSDF(st-offset), 17 | circleSDF(st+offset)); 18 | } 19 | 20 | float vesicaSDF(in float2 st) { 21 | return vesicaSDF(st, 0.5); 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/aspect.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: 'Fix the aspect ratio of a space keeping things squared for you.' 4 | use: aspect( st, st_size) 5 | examples: 6 | - https://raw.githubusercontent.com/patriciogonzalezvivo/lygia_examples/main/draw_shapes.frag 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_ASPECT 13 | #define FNC_ASPECT 14 | 15 | float2 aspect(float2 st, float2 s) { 16 | st.x = st.x * (s.x / s.y); 17 | return st; 18 | } 19 | 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/cart2polar.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: [Ivan Dianov, Kathy McGuiness] 3 | description: cartesian to polar transformation. 4 | use: cart2polar( st) 5 | */ 6 | 7 | #ifndef FNC_CART2POLAR 8 | #define FNC_CART2POLAR 9 | 10 | float2 cart2polar(in float2 st) { 11 | return float2(atan2(st.y, st.x), length(st)); 12 | } 13 | 14 | float3 cart2polar( in float3 st) { 15 | float r = length(st); 16 | float theta = atan2( length(st.xy), st.z); 17 | float phi = atan2(st.y, st.x); 18 | return float3(r, theta, phi); 19 | } 20 | #endif 21 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/center.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: "It center the coordinates from 0 to 1 to -1 to 1\nSo the center goes\ 4 | \ from 0.5 to 0.0. \n" 5 | use: center( st) 6 | examples: 7 | - https://raw.githubusercontent.com/patriciogonzalezvivo/lygia_examples/main/draw_shapes.frag 8 | license: 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 10 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 11 | */ 12 | 13 | #ifndef FNC_CENTER 14 | #define FNC_CENTER 15 | 16 | float center(float x) { return x * 2.0 - 1.0; } 17 | float2 center(float2 st) { return st * 2.0 - 1.0; } 18 | float3 center(float3 pos) { return pos * 2.0 - 1.0; } 19 | 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/equirect2xyz.usf: -------------------------------------------------------------------------------- 1 | #include "../math/const.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: equirect 2D projection to 3D vector 6 | use: equirect2xyz( uv) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_EQUIRECT2XYZ 13 | #define FNC_EQUIRECT2XYZ 14 | float3 equirect2xyz(float2 uv) { 15 | float Phi = PI - uv.y * PI; 16 | float Theta = uv.x * TWO_PI; 17 | float3 dir = float3(cos(Theta), 0.0, sin(Theta)); 18 | dir.y = cos(Phi);//clamp(cos(Phi), MinCos, 1.0); 19 | dir.xz *= sqrt(1.0 - dir.y * dir.y); 20 | return dir; 21 | } 22 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/fisheye2xyz.usf: -------------------------------------------------------------------------------- 1 | #include "../math/const.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: fisheye 2D projection to 3D vector 6 | use: fisheye2xyz( uv) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_FISHEYE2XYZ 13 | #define FNC_FISHEYE2XYZ 14 | float3 fisheye2xyz(float2 uv) { 15 | float2 ndc = uv * 2.0 - 1.0; 16 | float R = sqrt(ndc.x * ndc.x + ndc.y * ndc.y); 17 | float3 dir = float3(ndc.x / R, 0.0, ndc.y / R); 18 | float Phi = (R) * PI * 0.52; 19 | dir.y = cos(Phi);//clamp(, MinCos, 1.0); 20 | dir.xz *= sqrt(1.0 - dir.y * dir.y); 21 | return dir; 22 | } 23 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/flipY.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: Flip Y axis 4 | use: flipY( st) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_FLIPY 11 | #define FNC_FLIPY 12 | float2 flipY(in float2 st) { return float2(st.x, 1. - st.y);} 13 | float3 flipY(in float3 st) { return float3(st.x, 1. - st.y, st.z);} 14 | float4 flipY(in float4 st) { return float4(st.x, 1. - st.y, st.z, st.w);} 15 | #endif 16 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/nearest.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: sampling function to make a texture behave like GL_NEAREST 4 | use: nearest(float2 st, resolution) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_NEAREST 11 | #define FNC_NEAREST 12 | float2 nearest(in float2 st, in float2 resolution) { 13 | float2 offset = .5 / (resolution - 1.); 14 | return floor(st * resolution) / resolution + offset; 15 | } 16 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/polar2cart.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Ivan Dianov 3 | description: polar to cartesian conversion. 4 | use: polar2cart( polar) 5 | */ 6 | 7 | #ifndef FNC_POLAR2CART 8 | #define FNC_POLAR2CART 9 | float2 polar2cart(in float2 polar) { 10 | return float2(cos(polar.x), sin(polar.x)) * polar.y; 11 | } 12 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/sprite.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: returns a coordinate of a sprite cell 4 | use: sprite( st, grid, index) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_SPRITE 11 | #define FNC_SPRITE 12 | 13 | float2 sprite(float2 st, float2 grid, float index) { 14 | float2 f = 1.0/grid; 15 | float2 cell = float2(floor(index), floor(index * f.x) ); 16 | cell.y = grid.y - cell.y; 17 | return frac( (st+cell)*f ); 18 | } 19 | 20 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/sqTile.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: make some square tiles. XY provide coords inside of the tile. ZW provides tile coords 4 | use: hexTile( st [, scale]) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_SQTILE 11 | #define FNC_SQTILE 12 | float4 sqTile(float2 st) { return float4(frac(st), floor(st)); } 13 | float4 sqTile(float2 st, float scale) { return sqTile(st * scale); } 14 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/triTile.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Mathias Bredholt 3 | description: | 4 | make some triangular tiles. XY provide coords inside of the tile. ZW provides tile coords 5 | use: triTile( st [, scale]) 6 | */ 7 | 8 | #ifndef FNC_TRITILE 9 | #define FNC_TRITILE 10 | float4 triTile(float2 st) { 11 | st = mult(float2x2( 1.0, -1.0 / 1.7320508, 12 | 0.0, 2.0 / 1.7320508), st); 13 | float4 f = float4(st, -st); 14 | float4 i = floor(f); 15 | f = frac(f); 16 | return dot(f.xy, f.xy) < dot(f.zw, f.zw) 17 | ? float4(f.xy, float2(2., 1.) * i.xy) 18 | : float4(f.zw, -(float2(2., 1.) * i.zw + 1.)); 19 | } 20 | 21 | float4 triTile(float2 st, float scale) { return triTile(st * scale); } 22 | #endif 23 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/uncenter.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: 'Moves the center from 0.0 to 0.5' 4 | use: uncenter( st) 5 | examples: 6 | - https://raw.githubusercontent.com/patriciogonzalezvivo/lygia_examples/main/draw_shapes.frag 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_UNCENTER 13 | #define FNC_UNCENTER 14 | 15 | float uncenter(float x) { return x * 0.5 + 0.5; } 16 | float2 uncenter(float2 st) { return st * 0.5 + 0.5; } 17 | float3 uncenter(float3 pos) { return pos * 0.5 + 0.5; } 18 | 19 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/unratio.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: unFix the aspect ratio 4 | use: ratio(float2 st, float2 st_size) 5 | license: 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 7 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 8 | */ 9 | 10 | #ifndef FNC_UNRATIO 11 | #define FNC_UNRATIO 12 | float2 unratio (in float2 st, in float2 size) { 13 | return float2(st.x, st.y*(size.x/size.y)+(size.y*.5-size.x*.5)/size.y); 14 | } 15 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/space/xyz2equirect.usf: -------------------------------------------------------------------------------- 1 | #include "../math/const.usf" 2 | 3 | /* 4 | contributors: Patricio Gonzalez Vivo 5 | description: 3D vector to equirect 2D projection 6 | use: xyz2equirect( d) 7 | license: 8 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 9 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 10 | */ 11 | 12 | #ifndef FNC_XYZ2EQUIRECT 13 | #define FNC_XYZ2EQUIRECT 14 | float2 xyz2equirect(float3 d) { 15 | return float2(atan(d.z, d.x) + PI, acos(-d.y)) / float2(TAU, PI); 16 | } 17 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Shaders/lygia/version.usf: -------------------------------------------------------------------------------- 1 | /* 2 | contributors: Patricio Gonzalez Vivo 3 | description: LYGIA version number 4 | license: 5 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0 6 | - Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license 7 | */ 8 | #ifndef LYGIA_VERSION_MAYOR 9 | #define LYGIA_VERSION_MAYOR 1 10 | #endif 11 | 12 | #ifndef LYGIA_VERSION_MINOR 13 | #define LYGIA_VERSION_MINOR 2 14 | #endif 15 | 16 | #ifndef LYGIA_VERSION_PATCH 17 | #define LYGIA_VERSION_PATCH 2 18 | #endif -------------------------------------------------------------------------------- /Plugins/LygiaShader/Source/LygiaShader/Public/LygiaShader.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Modules/ModuleManager.h" 7 | 8 | class FLygiaShaderModule : public IModuleInterface 9 | { 10 | public: 11 | 12 | /** IModuleInterface implementation */ 13 | virtual void StartupModule() override; 14 | virtual void ShutdownModule() override; 15 | }; 16 | -------------------------------------------------------------------------------- /Plugins/LygiaShader/Source/LygiaShader/Public/ShaderFileBlueprintLib.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Kismet/BlueprintFunctionLibrary.h" 7 | #include "ShaderFileBlueprintLib.generated.h" 8 | 9 | /** 10 | * 11 | */ 12 | UCLASS() 13 | class LYGIASHADER_API UShaderFileBlueprintLib : public UBlueprintFunctionLibrary 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | UFUNCTION(BlueprintCallable) 19 | static void CopyHLSLFileAsUSH(FString PluginName= ""); 20 | 21 | UFUNCTION(BlueprintCallable) 22 | static void CopyHLSLFileAsushInPlugin(); 23 | }; 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lygia_unreal_engine_examples 2 | These are HLSL examples of how to use LYGIA Shader Library on Unreal Engine. 3 | 4 | All the examples are in LygiaShader plugin folder.This Example use material for demonstration. 5 | Just play the demo map to see the result. Embed all the example codes in custom node. 6 | 7 | -------------------------------------------------------------------------------- /Source/LygiaProject.Target.cs: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class LygiaProjectTarget : TargetRules 7 | { 8 | public LygiaProjectTarget(TargetInfo Target) : base(Target) 9 | { 10 | Type = TargetType.Game; 11 | DefaultBuildSettings = BuildSettingsVersion.V2; 12 | 13 | ExtraModuleNames.AddRange( new string[] { "LygiaProject" } ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Source/LygiaProject/LygiaProject.cpp: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #include "LygiaProject.h" 4 | 5 | #include "Modules/ModuleManager.h" 6 | 7 | void FLygiaProjectModule::StartupModule() 8 | { 9 | //FString ShaderDirectory = FPaths::Combine(FPaths::ProjectDir(), TEXT("Shaders")); 10 | //AddShaderSourceDirectoryMapping("/Project", ShaderDirectory); 11 | } 12 | 13 | void FLygiaProjectModule::ShutdownModule() 14 | { 15 | //ResetAllShaderSourceDirectoryMappings(); 16 | } 17 | 18 | //IMPLEMENT_PRIMARY_GAME_MODULE(FILikeTrainsModule, ILikeTrains, "ILikeTrains" ); 19 | 20 | IMPLEMENT_PRIMARY_GAME_MODULE(FLygiaProjectModule, LygiaProject, "LygiaProject"); 21 | 22 | 23 | -------------------------------------------------------------------------------- /Source/LygiaProject/LygiaProject.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | class FLygiaProjectModule : public IModuleInterface 8 | { 9 | public: 10 | 11 | /** IModuleInterface implementation */ 12 | virtual void StartupModule() override; 13 | virtual void ShutdownModule() override; 14 | }; -------------------------------------------------------------------------------- /Source/LygiaProject/Public/FileBlueprintLib.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Kismet/BlueprintFunctionLibrary.h" 7 | #include "FileBlueprintLib.generated.h" 8 | 9 | /** 10 | * 11 | */ 12 | UCLASS() 13 | class LYGIAPROJECT_API UFileBlueprintLib : public UBlueprintFunctionLibrary 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | UFUNCTION(BlueprintCallable) 19 | static void CopyHLSLFileAsUSH(FString PluginName= ""); 20 | }; 21 | -------------------------------------------------------------------------------- /Source/LygiaProjectEditor.Target.cs: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class LygiaProjectEditorTarget : TargetRules 7 | { 8 | public LygiaProjectEditorTarget(TargetInfo Target) : base(Target) 9 | { 10 | Type = TargetType.Editor; 11 | DefaultBuildSettings = BuildSettingsVersion.V2; 12 | 13 | ExtraModuleNames.AddRange( new string[] { "LygiaProject" } ); 14 | } 15 | } 16 | --------------------------------------------------------------------------------