Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using Unity.Entities;
using Unity.Entities.Serialization;
using Unity.Transforms;
using System.Threading.Tasks;
using Unity.Rendering;
#if UNITY_EDITOR
using UnityEditor;
#endif
//Ambi: AmbientNeoPixel Arduino Sketch
//Created By: Cory Malantonio
#include <Adafruit_NeoPixel.h>
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(50, PIN, NEO_RGB + NEO_KHZ800);
int r[11]; // array for each color value
int g[11];
int b[11];
// Source: http://www.codeavarice.com/dev-blog/tutorial-burning-edges-dissolve-shader-in-unity
Shader "Custom/Dissolving" {
Properties{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo (RGB)", 2D) = "white" {}
[NoScaleOffset]_BumpMap("Normal (RGB)", 2D) = "bump" {}
_BumpScale("Normal Scale", Range(0,10)) = 1
_Glossiness("Smoothness", Range(0,1)) = 0.5
_Metallic("Metallic", Range(0,1)) = 0.0
[NoScaleOffset]_MetallicGlossMap("Metallic Map", 2D) = "white" {}
public static bool CustomFoldout(string title, bool display)
{
var style = new GUIStyle("ShurikenModuleTitle")
{
font = new GUIStyle(EditorStyles.label).font,
fontStyle = FontStyle.Bold,
border = new RectOffset(15, 7, 4, 4),
fixedHeight = 22,
contentOffset = new Vector2(20f, -2f)
};
//Source: https://farfarer.com/blog/2013/02/11/pre-integrated-skin-shader-unity-3d/
Shader "Custom/Skin Shader" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Diffuse (RGB)", 2D) = "white" {}
_SpecularTex ("Specular (R) Gloss (G) SSS Mask (B)", 2D) = "yellow" {}
_BumpMap ("Normal (Normal)", 2D) = "bump" {}
// BRDF Lookup texture, light direction on x and curvature on y.
_BRDFTex ("BRDF Lookup (RGB)", 2D) = "gray" {}
// Curvature scale. Multiplier for the curvature - best to keep this very low - between 0.02 and 0.002.
// Original shader by cboe - Mar, 23, 2009
// Enhanced to 3 axis movement by Seon - Jan, 21, 2010
// Added _WaveSpeed - Jan, 26, 2010
//
// Requirements: assumes you are using a subdivided plane created with X (width) * Z (height) where Y is flat.
// Requirements: assumes UV as: left X (U0) is attatched to pole, and Top Z (V1) is at top of pole.
//
// Enjoy!
Shader "Custom/FlagWave"
// Source from : https://farfarer.com/blog/2012/09/11/translucent-shader-unity3d/
Shader "Custom/Translucent" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_BumpMap ("Normal (Normal)", 2D) = "bump" {}
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
//_Thickness = Thickness texture (invert normals, bake AO).
@nevarman
nevarman / ReadOnlySerializeFieldAttribute.cs
Last active February 28, 2017 15:18
Makes your private or protected serialized fields non editable from Unity editor
using System;
using UnityEngine;
using System.Collections;
[AttributeUsage(AttributeTargets.Field)]
public class ReadOnlySerializeFieldAttribute : PropertyAttribute
{
public ReadOnlySerializeFieldAttribute()
{ }
}
@nevarman
nevarman / CommentAttribute.cs
Last active February 28, 2017 15:17
Comment Attribute for Unity Scripts. Add this attribute to top of first property in a class for a quick comment on Editor
using System;
using UnityEngine;
using System.Collections;
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true)]
public class CommentAttribute : PropertyAttribute
{
/// <summary>
/// <para>The header text.</para>
/// </summary>
public readonly string comment;
@nevarman
nevarman / Splat.shader
Created January 15, 2016 12:23
Splat effect shader like painting spill
Shader "Special/Splat"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_NoiseTex ("Texture", 2D) = "white" {}
_Warp ("Warp", Range(0,1)) = 0
}
SubShader
{