This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void vert(inout appdata_full v, out Input o) | |
{ | |
UNITY_INITIALIZE_OUTPUT(Input, o); | |
// get the camera basis vectors | |
float3 forward = -normalize(UNITY_MATRIX_V._m20_m21_m22); | |
float3 up = float3(0, 1, 0); //normalize(UNITY_MATRIX_V._m10_m11_m12); | |
float3 right = normalize(UNITY_MATRIX_V._m00_m01_m02); | |
// rotate to face camera |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Tesselation/Triangle_Tesselation" { | |
Properties { | |
_TessEdge ("Edge Tess", Range(1,64)) = 2 | |
} | |
SubShader { | |
Pass { | |
CGPROGRAM | |
#pragma target 5.0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cpp port by @saephoed | |
// ogre based (working; some minor bugs; no ui) port of | |
// see http://experilous.com/1/planet-generator/2014-09-28/planet-generator.js | |
// see http://experilous.com/1/blog/post/procedural-planet-generation | |
// see twitter @AndyGainey | |
/// hpp /// | |
#ifndef INCLUDED_World |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
public class RectTransformTools { | |
[MenuItem("GameObject/Adjust RectTransform Anchors %l")] | |
static void Adjust() | |
{ | |
foreach(GameObject gameObject in Selection.gameObjects){ | |
adjustRectTransform(gameObject); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
using System.IO; | |
public static class PrefabLoader | |
{ | |
//So, there's no "load all assets in directory" function in unity. | |
//I guess this is to avoid people using Prefabs as "data blobs". | |
//They'd rather you use ScriptableObjects... which is fine in some cases, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float raySphereIntersect(vec3 r0, vec3 rd, vec3 s0, float sr) { | |
// - r0: ray origin | |
// - rd: normalized ray direction | |
// - s0: sphere center | |
// - sr: sphere radius | |
// - Returns distance from r0 to first intersecion with sphere, | |
// or -1.0 if no intersection. | |
float a = dot(rd, rd); | |
vec3 s0_r0 = r0 - s0; | |
float b = 2.0 * dot(rd, s0_r0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Skybox/Cubemap LOD" { | |
Properties { | |
_Tint ("Tint Color", Color) = (.5, .5, .5, .5) | |
[Gamma] _Exposure ("Exposure", Range(0, 8)) = 1.0 | |
_Rotation ("Rotation", Range(0, 360)) = 0 | |
_LodLevel ("LOD Level", Range(0, 10)) = 0 | |
[NoScaleOffset] _Tex ("Cubemap (HDR)", Cube) = "grey" {} | |
} | |
SubShader { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
public class MoveComponentContext | |
{ | |
enum Destination | |
{ | |
Top, | |
Bottom |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/CheapToggle" | |
{ | |
Properties | |
{ | |
_ColorA ( "Color A", Color ) = ( 1, 1, 1, 1 ) | |
_ColorB ( "Color B", Color ) = ( 1, 1, 1, 1 ) | |
_MainTex ("Albedo (RGB)", 2D) = "white" {} | |
_Glossiness ("Smoothness", Range(0,1)) = 0.5 | |
_Metallic ("Metallic", Range(0,1)) = 0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using UnityEngine; | |
namespace ZS.Tools | |
{ | |
/// <summary> | |
/// Provides means to deep-copy a TerrainData object because Unitys' built-in "Instantiate" method |