Skip to content

Instantly share code, notes, and snippets.

@PopupAsylumUK
PopupAsylumUK / SmoothClip.snippet
Created May 23, 2017 13:01
A Smooth Clipping Function
public static float SmoothClip(float input, float min, float max, float spread, float step) {
float timelinePosition = (input - min) / (max - min) * (1 - spread) + spread;
float signedDistanceToScrubber = timelinePosition - step;
float normalizedDistanceToScrubber = signedDistanceToScrubber / spread;
return Mathf.Clamp01(1 - normalizedDistanceToScrubber);
}
@PopupAsylumUK
PopupAsylumUK / ShadowMeshBatcher.cs
Last active April 12, 2017 13:52
A script that finds meshes in the scene that could probably all be rendered as a single shadow caster and creates a moderately optimized mesh or meshes for shadow rendering. The resulting meshes should be cast shadows only, and the meshes they represent/replace should not cast shadows.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class ShadowMeshBatcher : EditorWindow {
[MenuItem("Window/Shadow Mesh Batcher")]
static void Init() {
// Get existing open window or if none, make a new one: