Skip to content

Instantly share code, notes, and snippets.

@belzecue
belzecue / Console.cs
Last active December 17, 2016 10:42 — forked from mminer/Console.cs
Unity script to display in-game debug console.
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// A console to display Unity's debug logs in-game.
/// </summary>
public class Console : MonoBehaviour
{
struct Log
{
/**
* The following code is derived from the original code from: http://schemingdeveloper.com.
* The derived version was developed by Rune Skovbo Johansen - http://runevision.com
*
* Modifications in the derived version:
*
* - Averaged normals are calculated as a weighted average based on face area,
* known as "face weighted normals" or "area weighted normals".
*
* - An ignoreFactor parameter has been added which can cull normals from the average
@belzecue
belzecue / CameraTrackingRefraction.cs
Created May 21, 2018 19:15 — forked from runevision/CameraTrackingRefraction.cs
Unity CommandBuffer replacement for GrabPass - works with multiple separate cameras.
using UnityEngine;
using UnityEngine.Rendering;
// This script is added to cameras automatically at runtime by the ObjectNeedingRefraction scripts.
public class CameraTrackingRefraction : MonoBehaviour {
[System.NonSerialized]
public int lastRenderedFrame = -1;
Camera cam;
using UnityEngine;
using System.Collections.Generic;
[System.Serializable]
public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, ISerializationCallbackReceiver {
[SerializeField]
private List<TKey> keys = new List<TKey> ();
[SerializeField]
private List<TValue> values = new List<TValue> ();

Generating Procedural Game Worlds with Wave Function Collapse

Wave Function Collapse (WFC) by @exutumno is a new algorithm that can generate procedural patterns from a sample image. It's especially exciting for game designers, letting us draw our ideas instead of hand coding them. We'll take a look at the kinds of output WFC can produce and the meaning of the algorithm's parameters. Then we'll walk through setting up WFC in javascript and the Unity game engine.

sprites

The traditional approach to this sort of output is to hand code algorithms that generate features, and combine them to alter your game map. For example you could sprinkle some trees at random coordinates, draw roads with a brownian motion, and add rooms with a Binary Space Partition. This is powerful but time consuming, and your original vision can someti

@belzecue
belzecue / DualMap.shader
Created June 29, 2018 18:39 — forked from romainPechot/DualMap.shader
Dual Maps Shader. Use last texture like a filter. Show first texture if pixel transparent, second if pixel is full visible (crossfade if value is inbetween)
Shader "DualMaps"
{
Properties
{
_MainTex("Main (RGB)", 2D) = "black" {}
_SecTex("Main (RGB)", 2D) = "white" {}
_FilTex("Filter (Alpha)", 2D) = "black"{}
}
SubShader
@belzecue
belzecue / Dither.shader
Created July 21, 2018 16:25 — forked from josephbk117/Dither.shader
Dithering Image Effect For Unity
Shader "Hidden/Dither"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Cull Off ZWrite Off ZTest Always
@belzecue
belzecue / ColouredFog.shader
Created July 21, 2018 16:27 — forked from josephbk117/ColouredFog.shader
Screen Space Multi-Coloured Fog - Unity Shader
Shader "BitshiftProductions/ColouredFog"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_ColorLookUp("Fog Colour Look Up", 2D) = "white"{}
_FogSpread("Fog Spread", Float) = 10.0
}
SubShader
{
@belzecue
belzecue / FastUIJigle.shader
Created July 21, 2018 16:27 — forked from josephbk117/FastUIJigle.shader
Fast UI Jiggle shader for Unity
Shader "BitshiftProductions/Fast-UI-Jiggle"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Color("Tint", Color) = (1,1,1,1)
_WobblesPerSecond("Wobbles per Second ", Float) = 1
_WobblePeriod("Wobble Period (pixels)", Float) = 1
_WobbleAmplitude("Wobble Amplitude (pixels)", Float) = 0.03
}
@belzecue
belzecue / PixelateImageEffect.cs
Created July 21, 2018 16:28 — forked from josephbk117/PixelateImageEffect.cs
Pixelate Image Effect For Unity
using UnityEngine;
[ExecuteInEditMode, RequireComponent(typeof(Camera))]
public class PixelateImageEffect : MonoBehaviour
{
public Material material;
public int pixelDensity = 64;
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{