Skip to content

Instantly share code, notes, and snippets.

View noisecrime's full-sized avatar

NoiseCrime noisecrime

View GitHub Profile
@mstevenson
mstevenson / SaveFBX.cs
Created August 5, 2013 20:05
ASCII FBX file exporter for Unity. Extracted from Michal Mandrysz's Unity Summer of Code 2009 external lightmapping project.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
/*
@aras-p
aras-p / shadow_filter.md
Created August 9, 2013 21:02
hacking shadow filtering in unity

Forward rendering:

  • Most of "shadow sampling" is in AutoLight.cginc include file somewhere in Unity.
  • Now, if you copy that file into your project somewhere, and have some shaders in the same folder - then these shaders will use yur local "hijacked" copy.
  • In all the functions that sample shadowmap, you could for example add more taps etc.

Deferred lighting:

  • most of shadow sampling code is in Internal-PrePassCollectShadows.shader / Internal-PrePassLighting.shader.
  • copy these built-in shaders into Resources folder of your project (Resources so they are always included into game build)
  • restart Unity and hack them.
@Farfarer
Farfarer / SmoothingAngleFix.cs
Last active February 2, 2017 15:27
Auto-fix Unity's tangent space generation when importing models.
// Place this file into a directory called Editor inside of your Assets directory.
// Unity 5.3+:
// Models imported after you do that will have:
// - Normals set to Import.
// - Set the bool "useMikk" to true:
// Tangents set to Calculate Tangent Space (MikkTSpace).
// - Set the bool "useMikk" to false:
// Tangents set to Split Tangents (UnityTSpace).
@aras-p
aras-p / Projector Light.shader
Last active September 9, 2024 14:33
Projector shaders without fixed function
Shader "Projector/Light" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_ShadowTex ("Cookie", 2D) = "" {}
_FalloffTex ("FallOff", 2D) = "" {}
}
Subshader {
Pass {
ZWrite Off
@frarees
frarees / MinMaxSliderAttribute.cs
Last active December 5, 2024 23:26
MinMaxSlider for Unity
// https://frarees.github.io/default-gist-license
using System;
using UnityEngine;
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class MinMaxSliderAttribute : PropertyAttribute
{
public float Min { get; set; }
public float Max { get; set; }
// SM3.0+
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
#pragma multi_compile_fwdbase
#include "MyCode.cginc"
ENDCG
@benblo
benblo / SceneUtility.cs
Created April 15, 2014 13:29
Utility to open all scenes of a Unity project and process them: resave, refactor data, etc. To be used with EditorCoroutines: https://gist.github.com/benblo/10732554
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using Object = UnityEngine.Object;
using UnityEditor;
namespace Swing.Editor
{
@stramit
stramit / CoroutineTween.cs
Last active August 16, 2016 23:34
CoroutineTween.cs
/*
* This code is provided as is without warranty, guarantee of function,
* or provided support
*/
using System.Collections;
using UnityEngine.Events;
namespace UnityEngine.UI.CoroutineTween
{
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active April 10, 2025 02:30
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);
using System.Collections.Generic;
using System.Reflection;
namespace UnityEngine.EventSystems
{
[AddComponentMenu("Event/Standalone Input Module")]
public class StandaloneInputModule : PointerInputModule
{
private float m_NextAction;