This file contains 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
// Based heavily on https://roystan.net/articles/toon-shader.html | |
Shader "Custom/Simple Toon" | |
{ | |
Properties | |
{ | |
_Color("Color", Color) = (1,1,1,1) | |
_MainTex("Main Texture", 2D) = "white" {} | |
// Ambient light is applied uniformly to all surfaces on the object. | |
[HDR] |
This file contains 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
// -----JS CODE----- | |
var highBrowCount = 0; | |
/** | |
* BrowsRaisedEvent, triggered when the user's brows change to raised. | |
* LensStudio does all of this detection for us, we just listen for the event. | |
* @param {BrowsRaisedEvent} ev | |
*/ | |
// Callback for the BrowsRaisedEvent |
This file contains 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
// -----JS CODE----- | |
/** | |
* UpdateEvent, fires every frame | |
* @param {UpdateEvent} ev | |
*/ | |
// Callback for the UpdateEvent | |
function onUpdate(ev) { | |
print(getDeltaTime()); | |
} |
This file contains 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
// -----JS CODE----- | |
//@input vec3 Rotation | |
//@input float Speed | |
// Equivalent to GameObject | |
var object = script.getSceneObject(); | |
// Just like Unity Transform! | |
var transform = script.getTransform(); |
This file contains 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
// -----JS CODE----- | |
// Code runs runs during the `Initialized` event | |
// Properties set out of function scope are per-instance values | |
var isVisible = true; | |
var so = script.getSceneObject(); | |
var mesh = so.getComponentByIndex("MeshVisual", 0); | |
var mat = mesh.getMaterial(0).clone(); |
This file contains 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/TextureTransition" { | |
Properties { | |
_Color ("Color", Color) = (1,1,1,1) | |
_EdgeColor ("Edge Color", Color) = (1,1,1,1) | |
_Blend ("Blend Value", Range(0,1)) = 0 | |
_EdgeSize ("Edge Size", Range(0,1)) = 0.05 | |
_Noise ("Noise Texture", 2D) = "white" | |
} |
This file contains 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
// check for window.orientation || window.screen.orientation.angle | |
let h; | |
switch (window.screen.orientation.angle) { | |
case 0: | |
h = "portrait"; | |
break; | |
case 180: | |
h = "portrait-upside-down"; | |
break; | |
case -90: |
This file contains 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
// Virtual occlusion, hide objects behind, without being visible to the user | |
// Useful with AR Utils: https://github.com/jonas-johansson/ARCoreUtils | |
// Shader src: https://forum.unity.com/threads/clipping-objects-behind-a-higher-plane.492147/#post-3205094 | |
Shader "Custom/ARStencilOcclusion" { | |
SubShader { | |
Tags { "Queue" = "Background-1" } | |
Pass { |
This file contains 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 UnityEngine; | |
namespace UnityStandardAssets.Utility | |
{ | |
public class AutoMoveAndRotate : MonoBehaviour | |
{ | |
public Vector3andSpace moveUnitsPerSecond; | |
public Vector3andSpace rotateDegreesPerSecond; | |
public bool ignoreTimescale; |
This file contains 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
// An outline shader made for Unity with the help of @OverlandGame by @miichidk | |
// It adjusts the size of the outline to automatically accomodate screen width and camera distance. | |
// See how it looks here: https://twitter.com/OverlandGame/status/791035637583388672 | |
// How to use: Create a material which uses this shader, and apply this material to any meshrenderer as second material. | |
Shader "OutlineShader" | |
{ | |
Properties | |
{ | |
_Width ("Width", Float ) = 1 | |
_Color ("Color", Color) = (1,1,1,1) |
NewerOlder