Skip to content

Instantly share code, notes, and snippets.

View Agoxandr's full-sized avatar

Alexander Filippov Agoxandr

  • Braunschweig, Germany
View GitHub Profile
@Agoxandr
Agoxandr / Blending.cginc
Last active July 18, 2019 11:18
Surface shader with ripples and drips. https://youtu.be/igxwtovIlO0
#pragma once
half heightBlend(half h1, half h2, half slope, half contrast)
{
h2 = 1 - h2;
return saturate((saturate((slope - min(h1, h2)) / max(abs(h1 - h2), 0.1)) - contrast) / max(1.0 - contrast, 0.1));
//half tween = saturate((slope - min(h1, h2)) / max(abs(h1 - h2), 0.1));
//half threshold = contrast;
//half width = 1.0 - contrast;
//return saturate((tween - threshold) / max(width, 0.1));
@Agoxandr
Agoxandr / LODTools.cs
Created July 19, 2021 18:29
Adds a LOD Group to everything you select and sets the children correctly.
using UnityEditor;
using UnityEngine;
public class LODTools
{
[MenuItem("Tools/Add LOD Group/LOD 3")]
private static void AddGroup()
{
var objects = Selection.objects;
foreach (var ob in objects)
@Agoxandr
Agoxandr / Permutation with a maximum of 3 fixed points.cs
Last active December 15, 2021 06:56
Bestimmen Sie begründet die Anzahl der Permutationen von [6] mit höchstens drei Fixpunkten.
var unchaged = new int[] { 1, 2, 3, 4, 5, 6 };
var perms = GetPermutations(unchaged, 6);
int counter = 0;
var tolerances = new int[] { 0, 0, 0, 0 };
foreach (var perm in perms)
{
var list = perm.ToList();
var text = "";
int tolerance = 0;
for (int i = 0; i < list.Count; i++)