Skip to content

Instantly share code, notes, and snippets.

View khadzhynov's full-sized avatar

Mykhailo Khadzhynov khadzhynov

View GitHub Profile
@khadzhynov
khadzhynov / UiDistortion.shader
Created February 15, 2023 20:16
A simple shader to apply distortion (normal map) to UI Image in unity. Featured with map UV scrolling and blend mask.
Shader "GG/UiDistortion"
{
Properties
{
[NoScaleOffset] [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
[NoScaleOffset] _DistortionMask ("Distortion mask", 2D) = "white" {}
[Normal] _Distortion ("Distortion", 2D) = "white" {}
_DistortionAmount ("Distortion Amount", Range(-1, 1)) = 0.05
_DistortionScrollH ("Distortion Horizontal scroll", Range(-0.5, 0.5)) = 0.5
@khadzhynov
khadzhynov / FibbonachiXp.cs
Created July 22, 2022 21:07
Unity C# Fibbonachi LevelUp Xp progress
using System;
using UnityEngine;
namespace GG.Utils
{
[Serializable]
public class FibbonachiXp
{
//just useful value (approx)
public const float FIBBONACHI_MULTIPLIER = 1.618f;
@khadzhynov
khadzhynov / Chrome
Created November 13, 2021 15:26
Chrome metal shader for Unity3D - surface shader - 2 variants: simple metalness slider and metalness map - Thanks for Nukeop for noise function
Shader "GG/Chrome"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
[NoScaleOffset] _Normal ("Normal", 2D) = "bump" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_Scale ("Scale", Range(0.0001,1)) = 0.1
@khadzhynov
khadzhynov / CubemapPsychodelic.shader
Created October 21, 2021 19:50
Psychodelic Sky Exercise
Shader "GG/Skybox/CubemapPsychodelic"
{
Properties
{
_Tint("Tint Color", Color) = (.5, .5, .5, .5)
_Color1 ("Color1", Color) = (1, .5, .5, .5)
_Color2 ("Color2", Color) = (.5, .5, 1, .5)
[Gamma] _Exposure("Exposure", Range(0, 8)) = 1.0
_Rotation("Rotation", Range(0, 360)) = 0
[NoScaleOffset] _Tex("Cubemap (HDR)", Cube) = "grey" {}
@khadzhynov
khadzhynov / SkyboxCubemapHorizonHSV.shader
Created April 14, 2021 17:10
Cubemap shader with adjustable vertical Scale/Offset and HSV color controls.
/*
Cubemap shader with adjustable vertical Scale/Offset and HSV color controls.
Creation goal was to enable user to create several casually-looking skyboxes in different colors from single image, drawn in 2d editing software.
Features:
- Doesn't requires 6-sides cubemap, or spherical projection: texture can be easily drawn in any 2d image editing software;
- "V Offset" option allows to move horizon line up and down with ease;
- "V Scale" allows to stretch texture;
- Rotation feature sets horizontal offset (as in original shader).
- HSV controls allows to change colors.