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 "PostEffect/Bezel" | |
{ | |
Properties | |
{ | |
_MainTex ("Texture", 2D) = "white" {} | |
_HorizontalCount ("Horizontal Screen Count", Int) = 7 | |
_VerticalCount ("Vertical Screen Count", Int) = 2 | |
_Bezel ("Bezel Size", Vector) = (0.01, 0.01, -1, -1) |
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 Random = System.Random; | |
using UnityEngine; | |
namespace mattatz { | |
public class Rand { | |
Random rnd; |
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 System.Collections; | |
namespace mattatz.Utils { | |
/* | |
* FBXモデルのrootにhelperオブジェクトが置いてある場合に発生する回転のバグを修正するやつ. | |
* rootオブジェクトをx軸に-90度回転させ,親オブジェクトを追加する. | |
* http://answers.unity3d.com/questions/13988/asset-import-from-3dsmax-rotation-issue.html | |
*/ |
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 "Mattatz/UVTransform" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_TexScale ("Scale of Tex", Float) = 1.0 | |
_TexRatio ("Ratio of Tex", Float) = 1.0 | |
_Theta ("Rotation of Tex", Float) = 0.0 | |
_PlaneScale ("Scale of Plane Mesh", Vector) = (1, 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
// Vertical gradient cube texture | |
export default class GradientCubeTexture extends THREE.CubeTexture { | |
constructor(bottom = '#4488aa', top = '#aaddff', size = 32) { | |
super() | |
// px, nx, py, ny, pz, nz | |
this.images[0] = this.create(top, bottom, size) | |
this.images[1] = this.create(top, bottom, size) |
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
// Column major 4x4 matrix for CUDA. | |
// Sources: | |
// - https://github.com/JAGJ10/Snow/blob/master/Snow/matrix.h | |
// - https://github.com/mrdoob/three.js/blob/master/src/math/Matrix4.js | |
#pragma once | |
#include "cuda_runtime.h" | |
struct mat4 { |
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
#ifndef _LOOK_AT_MATRIX_ | |
#define _LOOK_AT_MATRIX_ | |
float4x4 look_at_matrix(float3 at, float3 eye, float3 up) { | |
float3 zaxis = normalize(at - eye); | |
float3 xaxis = normalize(cross(up, zaxis)); | |
float3 yaxis = cross(zaxis, xaxis); | |
return float4x4( | |
xaxis.x, yaxis.x, zaxis.x, 0, | |
xaxis.y, yaxis.y, zaxis.y, 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
#ifndef _MATRIX_TO_QUATERNION_ | |
#define _MATRIX_TO_QUATERNION_ | |
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/ | |
float4 matrix_to_quaternion(float4x4 m) { | |
float tr = m[0][0] + m[1][1] + m[2][2]; | |
float4 q = float4(0, 0, 0, 0); | |
if (tr > 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
Shader "Mattatz/StencilSample" { | |
Properties { | |
_Outline ("Outline Length", Range(0.0, 1.0)) = 0.2 | |
_Color ("Color", Color) = (0.8, 0.8, 0.8, 1.0) | |
_OutlineColor ("Outline Color", Color) = (0.2, 0.2, 0.2, 1.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 UnityEngine; | |
using System.Collections; | |
namespace Utils { | |
public class RandomPointOnMesh { | |
public static Vector3 Sample (Mesh mesh) { | |
int[] triangles = mesh.triangles; | |
int index = Mathf.FloorToInt(Random.value * (triangles.Length / 3)); |
OlderNewer