Skip to content

Instantly share code, notes, and snippets.

Shader "custom/UI/Default"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[Header(Blending Factor)]
[Enum(UnityEngine.Rendering.BlendMode)] _SrcFactor("Src Factor", Float) = 5 // SrcAlpha
[Enum(UnityEngine.Rendering.BlendMode)] _DstFactor("Dst Factor", Float) = 10 // OneMinusSrcAlpha
@@ -0,0 +1,82 @@
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
Shader "custom/Sprites/Default"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
//// rayの定義に視野角を使うか
#define RAY_FOVY
//// アニメーションするか
// #define SCALE_ANIMATION
#define GO_ANIMATION
//// rotateするか
// #define USE_ROTATE
void Menger(PVector centerPosition, float sideWidth)
{
rect(centerPosition.x - sideWidth / 6, centerPosition.y - sideWidth / 6,
sideWidth/3, sideWidth/3);
if(sideWidth < 3) return;
for(int i=-1; i<2; i++)
{
for(int j=-1; j<2; j++)
{
if(i==0 && j==0) continue;
//// 何の距離関数を使うか
// #define DF_SPHERE
#define DF_ROUND_CUBE
// #define DF_CUBE
//// rayの定義に視野角を使うか
#define RAY_FOVY
//// repeatするか
// #define USE_REPEAT
@shutosg
shutosg / distanceFog.frag
Last active March 4, 2017 23:29
glslスニペット
// 距離に応じたフォグ
// rLenがカメラと衝突点との距離
float fogCoef = 0.03;
float fogAmount = 1.0 - exp(-rLen * fogCoef);
vec3 fogColor = vec3(0.9, 0.6, 0.7);
gl_FragColor = vec4(mix(color, fogColor, fogAmount), 1.0);
var activeComp = app.project.activeItem;
function main() {
var markers = null;
if (activeComp instanceof CompItem == false) {
alert("コンポが選択されていません。");
return;
}
if (activeComp.selectedLayers.length > 1) {
alert ("レイヤーを1つだけ選択するか、コンポのみ選択してください。\nレイヤーを選択していない場合はアクティブなコンポのマーカーが使われます。");
return;