Skip to content

Instantly share code, notes, and snippets.

@belzecue
belzecue / Draw.cs
Created August 24, 2018 07:14 — forked from nothke/Draw.cs
///
/// Draw lines at runtime
/// by Nothke
/// unlicensed, aka do whatever you want with it
/// made during Stugan 2016 :)
/// ..(it's midnight, and Robbie clicks A LOT, LOUDLY!)
///
/// Important:
/// - Should be called in OnPostRender() (after everything else has been drawn)
/// therefore the script that calls it must be attached to the camera
@belzecue
belzecue / FlowMap.shader
Created August 24, 2018 11:09 — forked from TarasOsiris/FlowMap.shader
Flow Map Shader for Unity3D. Used with Sprites.
Shader "Custom/Flow Map"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
// Flow
_FlowMap ("Flow Map", 2D) = "white" {}
_FlowSpeed ("Flow Speed", float) = 0.05
@belzecue
belzecue / OutlineShader.shader
Created August 24, 2018 11:12 — forked from michidk/OutlineShader.shader
An outline shader made for Unity with the help of @OverlandGame. It adjusts the size of the outline to automatically accomodate screen width and camera distance.
// An outline shader made for Unity with the help of @OverlandGame by @miichidk
// It adjusts the size of the outline to automatically accomodate screen width and camera distance.
// See how it looks here: https://twitter.com/OverlandGame/status/791035637583388672
// How to use: Create a material which uses this shader, and apply this material to any meshrenderer as second material.
Shader "OutlineShader"
{
Properties
{
_Width ("Width", Float ) = 1
_Color ("Color", Color) = (1,1,1,1)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ObjectPool : Singleton<ObjectPool>
{
public int StartCount = 10;
public GameObject[] Prefabs;
private readonly List<GameObject> available = new List<GameObject>();
using UnityEngine;
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
public class LSystemGenerator : MonoBehaviour
{
[Serializable]
@belzecue
belzecue / GLSL-Noise.md
Last active January 21, 2024 03:20 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@belzecue
belzecue / SimpleGeo.cs
Created August 24, 2018 15:58 — forked from phosphoer/SimpleGeo.cs
Simple Geometry Painter for Unity
// The MIT License (MIT)
// Copyright (c) 2016 David Evans @phosphoer
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
using UnityEngine;
using System.Collections;
using System;
public class Math3d : MonoBehaviour {
private static Transform tempChild = null;
private static Transform tempParent = null;
public static void Init(){
@belzecue
belzecue / Metronome.cs
Created April 6, 2019 18:43 — forked from bzgeb/Metronome.cs
Pretty solid metronome for Unity
using UnityEngine;
using System.Collections;
public class Metronome : MonoBehaviour
{
public double bpm = 140.0F;
double nextTick = 0.0F; // The next tick in dspTime
double sampleRate = 0.0F;
bool ticked = false;
@belzecue
belzecue / BendingTrees.cginc
Created April 6, 2019 18:50 — forked from bzgeb/BendingTrees.cginc
This is how trees and grass bend
fixed4 TerrainWaveGrass (inout float4 vertex, float waveAmount, fixed4 color)
{
float4 _waveXSize = float4(0.012, 0.02, 0.06, 0.024) * _WaveAndDistance.y;
float4 _waveZSize = float4 (0.006, .02, 0.02, 0.05) * _WaveAndDistance.y;
float4 waveSpeed = float4 (0.3, .5, .4, 1.2) * 4;
float4 _waveXmove = float4(0.012, 0.02, -0.06, 0.048) * 2;
float4 _waveZmove = float4 (0.006, .02, -0.02, 0.1);
float4 waves;