Skip to content

Instantly share code, notes, and snippets.

@kosakasakas
Last active August 29, 2015 14:11
Show Gist options
  • Save kosakasakas/c664924756ecfb45d8f2 to your computer and use it in GitHub Desktop.
Save kosakasakas/c664924756ecfb45d8f2 to your computer and use it in GitHub Desktop.
ユニティちゃんを超ARしてみたときのコード群
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class test : SetupLux {
public int cubemapSize = 16;
public GameObject targetObj;
public float gamma = 1.15f;
private Vector3 cameraPos = new Vector3 (10, 0, 0);
private Camera cam;
private Cubemap diff;
private Cubemap spec;
private int bias = 8;
private int interval = 8;
// for blur
public int radius = 8;
public int iterations = 1;
private float avgR = 0;
private float avgG = 0;
private float avgB = 0;
private float avgA = 0;
private float blurPixelCount = 0;
// Use this for initialization
public override void Start () {
base.Start ();
updateCameraPosition ();
UpdateCubemap (63);
}
// Update is called once per frame
public override void Update () {
base.Update ();
updateCameraPosition ();
}
void updateCameraPosition() {
if (targetObj != null) {
cameraPos = targetObj.transform.localPosition + new Vector3(10, 0, 0);
}
print (cameraPos.x);
}
void LateUpdate(){
int count = Time.frameCount % interval;
if (count == 0) {
UpdateCubemap (63); // all six faces
}
}
void UpdateCubemap(int faceMask, int faceToRender = -1) {
if (!cam) {
GameObject go = new GameObject ("CubemapCamera", typeof(Camera));
go.hideFlags = HideFlags.HideAndDontSave;
go.transform.position = cameraPos;
go.transform.rotation = Quaternion.identity;
cam = go.camera;
cam.farClipPlane = 100; // don't render very far into cubemap
cam.enabled = false;
}
if (!spec && !diff) {
spec = new Cubemap(cubemapSize, TextureFormat.ARGB32, true);
diff = new Cubemap(cubemapSize, TextureFormat.ARGB32, true);
spec.filterMode = FilterMode.Trilinear;
diff.filterMode = FilterMode.Trilinear;
spec.hideFlags = HideFlags.HideAndDontSave;
diff.hideFlags = HideFlags.HideAndDontSave;
Shader.SetGlobalTexture("_SpecCubeIBL", spec);
Shader.SetGlobalTexture("_DiffCubeIBL", diff);
}
cam.transform.position = cameraPos;
cam.RenderToCubemap(spec, faceMask);
if (faceToRender >= 0) {
faceToRender = faceToRender % 6;
} else {
for (int i = 0; i < 6; ++i) {
CubemapFace face = (CubemapFace) i;
diff.SetPixels(GammaCorrection(FastBlur ( spec, face, radius, iterations), cubemapSize, cubemapSize, gamma), face);
}
diff.Apply();
}
}
Color[] GammaCorrection(Color[] input, int width, int height, float gamma) {
Color[] output = new Color[width * height];
for (int w = 0; w < width; ++w) {
for (int h = 0; h < height; ++h) {
output[width * w + h].r = 255.0f * Mathf.Pow(1.0f / 255.0f * input[width * w + h].r, 1.0f / gamma);
output[width * w + h].g = 255.0f * Mathf.Pow(1.0f / 255.0f * input[width * w + h].g, 1.0f / gamma);
output[width * w + h].b = 255.0f * Mathf.Pow(1.0f / 255.0f * input[width * w + h].b, 1.0f / gamma);
output[width * w + h].a = 255.0f;
}
}
return output;
}
Color[] FastBlur(Cubemap input, CubemapFace face, int radius, int iterations) {
Cubemap output = new Cubemap (input.height, TextureFormat.ARGB32, true);
// copy cubemap
for (int i = 0; i < 6; ++i) {
CubemapFace targetFace = (CubemapFace) i;
output.SetPixels(input.GetPixels(targetFace),targetFace);
}
output.Apply();
for(int i = 0; i < iterations; ++i) {
// x
output.SetPixels(BlurImage( output, face, radius, true), face);
output.Apply();
// y
output.SetPixels(BlurImage( output, face, radius, false), face);
output.Apply();
}
return output.GetPixels(face);
}
Color[] BlurImage(Cubemap image, CubemapFace face, int blurSize, bool horizontal) {
Cubemap blurred = new Cubemap (image.height, TextureFormat.ARGB32, true);
int _W = cubemapSize;
int _H = cubemapSize;
int xx, yy, x, y;
float colBias = 1.0f;
if(horizontal) {
for (yy = 0; yy < _H; ++ yy) {
for( xx = 0; xx < _W; ++xx) {
ResetPixel();
//Right side of pixel
for (x = xx; (x < xx + blurSize); ++x) {
if (x < _W) {
AddPixel(image.GetPixel(face, x, yy));
} else {
int index_x = x - _W;
int index_y = yy;
Color col = getOverRightPixel(image, face, index_x, index_y);
AddPixel(col);
}
}
//Left side of pixel
for (x = xx; (x > xx - blurSize); --x) {
if (x <= 0) {
int index_x = 0 - x;
int index_y = yy;
Color col = getOverLeftPixel(image, face, index_x, index_y);
AddPixel(col);
} else {
AddPixel(image.GetPixel( face, x, yy));
}
}
CalcPixel();
blurred.SetPixel(face, xx, yy, new Color(colBias*avgR, colBias*avgG, colBias*avgB, 1.0f));
}
}
} else {
for (xx = 0; xx < _W; ++xx) {
for (yy = 0; yy < _H; ++yy) {
ResetPixel();
// Over pixel
for (y = yy; (y < yy + blurSize); ++y) {
if (y <= _H) {
AddPixel(image.GetPixel(face, xx, y));
} else {
int index_x = xx;
int index_y = y - _H;
Color col = getOverBottomPixel(image, face, index_x, index_y);
AddPixel(col);
}
}
// Under pixel
for (y = yy; (y > yy - blurSize); --y) {
if (y < 0) {
int index_x = xx;
int index_y = 0 - y;
Color col = getOverTopPixel(image, face, index_x, index_y);
AddPixel(col);
} else {
AddPixel(image.GetPixel(face, xx, y));
}
}
CalcPixel();
blurred.SetPixel( face, xx, yy, new Color(colBias* avgR, colBias*avgG,colBias* avgB, 1.0f));
}
}
}
blurred.Apply ();
return blurred.GetPixels(face);
}
void AddPixel(Color pixel) {
avgR += pixel.r;
avgG += pixel.g;
avgB += pixel.b;
++blurPixelCount;
}
void ResetPixel() {
avgR = 0.0f;
avgG = 0.0f;
avgB = 0.0f;
blurPixelCount = 0;
}
void CalcPixel() {
avgR /= blurPixelCount;
avgG /= blurPixelCount;
avgB /= blurPixelCount;
}
Color getOverRightPixel(Cubemap image, CubemapFace face, int index_x, int index_y) {
Color pixCol;
CubemapFace targetFace = CubemapFace.NegativeX;
int x = 0, y = 0;
if (face == CubemapFace.PositiveX) {
targetFace = CubemapFace.NegativeZ;
x = index_x;
y = index_y;
} else if (face == CubemapFace.PositiveZ) {
targetFace = CubemapFace.PositiveX;
x = index_x;
y = index_y;
} else if (face == CubemapFace.NegativeZ) {
targetFace = CubemapFace.NegativeX;
x = index_x;
y = index_y;
} else if (face == CubemapFace.NegativeX) {
targetFace = CubemapFace.PositiveZ;
x = index_x;
y = index_y;
} else if (face == CubemapFace.PositiveY) {
targetFace = CubemapFace.PositiveX;
x = cubemapSize - index_y;
y = index_x;
} else if (face == CubemapFace.NegativeY) {
targetFace = CubemapFace.PositiveX;
x = index_y;
y = cubemapSize - index_x;
}
pixCol = image.GetPixel (targetFace, x, y);
return pixCol;
}
Color getOverLeftPixel(Cubemap image, CubemapFace face, int index_x, int index_y) {
Color pixCol;
CubemapFace targetFace = CubemapFace.NegativeX;
int x = 0, y = 0;
if (face == CubemapFace.PositiveX) {
targetFace = CubemapFace.PositiveZ;
x = cubemapSize - index_x;
y = index_y;
} else if (face == CubemapFace.PositiveZ) {
targetFace = CubemapFace.NegativeX;
x = cubemapSize - index_x;
y = index_y;
} else if (face == CubemapFace.NegativeZ) {
targetFace = CubemapFace.PositiveX;
x = cubemapSize - index_x;
y = index_y;
} else if (face == CubemapFace.NegativeX) {
targetFace = CubemapFace.NegativeZ;
x = cubemapSize - index_x;
y = index_y;
} else if (face == CubemapFace.PositiveY) {
targetFace = CubemapFace.NegativeX;
x = index_y;
y = index_x;
} else if (face == CubemapFace.NegativeY) {
targetFace = CubemapFace.NegativeX;
x = index_y;
y = cubemapSize - index_x;
}
pixCol = image.GetPixel (targetFace, x, y);
return pixCol;
}
Color getOverBottomPixel(Cubemap image, CubemapFace face, int index_x, int index_y) {
Color pixCol;
CubemapFace targetFace = CubemapFace.NegativeX;
int x = 0, y = 0;
if (face == CubemapFace.PositiveX) {
targetFace = CubemapFace.NegativeY;
x = cubemapSize - index_y;
y = index_x;
} else if (face == CubemapFace.PositiveZ) {
targetFace = CubemapFace.NegativeY;
x = index_x;
y = index_y;
} else if (face == CubemapFace.NegativeZ) {
targetFace = CubemapFace.NegativeY;
x = cubemapSize - index_x;
y = cubemapSize - index_y;
} else if (face == CubemapFace.NegativeX) {
targetFace = CubemapFace.NegativeY;
x = index_y;
y = cubemapSize - index_x;
} else if (face == CubemapFace.PositiveY) {
targetFace = CubemapFace.PositiveZ;
x = index_x;
y = cubemapSize - index_y;
} else if (face == CubemapFace.NegativeY) {
targetFace = CubemapFace.NegativeZ;
x = cubemapSize - index_x;
y = index_y;
}
pixCol = image.GetPixel (targetFace, x, y);
return pixCol;
}
Color getOverTopPixel(Cubemap image, CubemapFace face, int index_x, int index_y) {
Color pixCol;
CubemapFace targetFace = CubemapFace.NegativeX;
int x = 0, y = 0;
if (face == CubemapFace.PositiveX) {
targetFace = CubemapFace.PositiveY;
x = cubemapSize - index_y;
y = index_x;
} else if (face == CubemapFace.PositiveZ) {
targetFace = CubemapFace.PositiveY;
x = index_x;
y = cubemapSize - index_y;
} else if (face == CubemapFace.NegativeZ) {
targetFace = CubemapFace.PositiveY;
x = cubemapSize - index_x;
y = cubemapSize - index_y;
} else if (face == CubemapFace.NegativeX) {
targetFace = CubemapFace.PositiveY;
x = index_y;
y = index_x;
} else if (face == CubemapFace.PositiveY) {
targetFace = CubemapFace.NegativeZ;
x = cubemapSize - index_x;
y = cubemapSize - index_y;
} else if (face == CubemapFace.NegativeY) {
targetFace = CubemapFace.PositiveZ;
x = index_x;
y = index_y;
}
pixCol = image.GetPixel (targetFace, x, y);
return pixCol;
}
}
# Blender v2.72 (sub 0) OBJ File: 'semi_sphere.blend'
# www.blender.org
mtllib semi_sphere.mtl
o Sphere.002_Sphere.004
v -0.195090 0.000000 -0.980785
v -0.382683 0.000000 -0.923880
v -0.555570 0.000000 -0.831470
v -0.707107 0.000000 -0.707107
v -0.831470 0.000000 -0.555570
v -0.923880 0.000000 -0.382683
v -0.980785 0.000000 -0.195090
v -1.000000 0.000000 -0.000000
v -0.191342 -0.038060 -0.980785
v -0.375330 -0.074658 -0.923880
v -0.544895 -0.108386 -0.831470
v -0.693520 -0.137950 -0.707107
v -0.815493 -0.162212 -0.555570
v -0.906127 -0.180240 -0.382683
v -0.961940 -0.191342 -0.195090
v -0.980785 -0.195090 -0.000000
v -0.180240 -0.074658 -0.980785
v -0.353553 -0.146447 -0.923880
v -0.513280 -0.212608 -0.831470
v -0.653281 -0.270598 -0.707107
v -0.768178 -0.318190 -0.555570
v -0.853553 -0.353553 -0.382683
v -0.906127 -0.375330 -0.195090
v -0.923879 -0.382684 -0.000000
v -0.162212 -0.108386 -0.980785
v -0.318190 -0.212608 -0.923880
v -0.461940 -0.308658 -0.831470
v -0.587938 -0.392848 -0.707107
v -0.691342 -0.461940 -0.555570
v -0.768178 -0.513280 -0.382683
v -0.815493 -0.544895 -0.195090
v -0.831469 -0.555570 -0.000000
v -0.137950 -0.137950 -0.980785
v -0.270598 -0.270598 -0.923880
v -0.392847 -0.392848 -0.831470
v -0.500000 -0.500000 -0.707107
v -0.587938 -0.587938 -0.555570
v -0.653281 -0.653282 -0.382683
v -0.693520 -0.693520 -0.195090
v -0.707107 -0.707107 -0.000000
v -0.108386 -0.162212 -0.980785
v -0.212607 -0.318190 -0.923880
v -0.308658 -0.461940 -0.831470
v -0.392847 -0.587938 -0.707107
v -0.461940 -0.691342 -0.555570
v -0.513280 -0.768178 -0.382683
v -0.544895 -0.815493 -0.195090
v -0.555570 -0.831470 -0.000000
v -0.074658 -0.180240 -0.980785
v -0.146446 -0.353554 -0.923880
v -0.212607 -0.513280 -0.831470
v -0.270598 -0.653282 -0.707107
v -0.318189 -0.768178 -0.555570
v -0.353553 -0.853554 -0.382683
v -0.375330 -0.906128 -0.195090
v -0.382683 -0.923880 -0.000000
v -0.038060 -0.191342 -0.980785
v -0.074658 -0.375331 -0.923880
v -0.108386 -0.544895 -0.831470
v -0.137949 -0.693520 -0.707107
v -0.162211 -0.815493 -0.555570
v -0.180240 -0.906128 -0.382683
v -0.191341 -0.961940 -0.195090
v -0.195090 -0.980785 -0.000000
v 0.000000 -0.195091 -0.980785
v 0.000000 -0.382684 -0.923880
v 0.000000 -0.555570 -0.831470
v 0.000000 -0.707107 -0.707107
v 0.000000 -0.831470 -0.555570
v 0.000000 -0.923880 -0.382683
v 0.000000 -0.980785 -0.195090
v 0.000000 -1.000000 -0.000000
v 0.038061 -0.191342 -0.980785
v 0.074658 -0.375330 -0.923880
v 0.108387 -0.544895 -0.831470
v 0.137950 -0.693520 -0.707107
v 0.162212 -0.815493 -0.555570
v 0.180240 -0.906128 -0.382683
v 0.191342 -0.961940 -0.195090
v 0.195091 -0.980785 -0.000000
v 0.074658 -0.180240 -0.980785
v 0.146447 -0.353554 -0.923880
v 0.212608 -0.513280 -0.831470
v 0.270598 -0.653282 -0.707107
v 0.318190 -0.768178 -0.555570
v 0.353554 -0.853554 -0.382683
v 0.375331 -0.906127 -0.195090
v 0.382684 -0.923880 -0.000000
v 0.108387 -0.162212 -0.980785
v 0.212608 -0.318190 -0.923880
v 0.308659 -0.461940 -0.831470
v 0.392848 -0.587938 -0.707107
v 0.461940 -0.691342 -0.555570
v 0.513280 -0.768178 -0.382683
v 0.544895 -0.815493 -0.195090
v 0.555571 -0.831470 -0.000000
v 0.137950 -0.137950 -0.980785
v 0.270599 -0.270598 -0.923880
v 0.392848 -0.392848 -0.831470
v 0.500000 -0.500000 -0.707107
v 0.587938 -0.587938 -0.555570
v 0.653282 -0.653282 -0.382683
v 0.693520 -0.693520 -0.195090
v 0.707107 -0.707107 -0.000000
v 0.162212 -0.108386 -0.980785
v 0.318190 -0.212608 -0.923880
v 0.461940 -0.308658 -0.831470
v 0.587938 -0.392847 -0.707107
v 0.691342 -0.461940 -0.555570
v 0.768178 -0.513280 -0.382683
v 0.815493 -0.544895 -0.195090
v 0.831470 -0.555570 -0.000000
v 0.180240 -0.074658 -0.980785
v 0.353554 -0.146447 -0.923880
v 0.513280 -0.212608 -0.831470
v 0.653282 -0.270598 -0.707107
v 0.768178 -0.318190 -0.555570
v 0.853554 -0.353553 -0.382683
v 0.906128 -0.375330 -0.195090
v 0.923880 -0.382683 -0.000000
v 0.191342 -0.038060 -0.980785
v 0.375331 -0.074658 -0.923880
v 0.544896 -0.108386 -0.831470
v 0.693520 -0.137950 -0.707107
v 0.815493 -0.162212 -0.555570
v 0.906128 -0.180240 -0.382683
v 0.961940 -0.191342 -0.195090
v 0.980786 -0.195090 -0.000000
v 0.195091 0.000000 -0.980785
v 0.382684 0.000000 -0.923880
v 0.555571 0.000000 -0.831470
v 0.707107 0.000000 -0.707107
v 0.831470 0.000000 -0.555570
v 0.923880 -0.000000 -0.382683
v 0.980785 0.000000 -0.195090
v 1.000000 0.000000 -0.000000
v 0.191342 0.038060 -0.980785
v 0.375331 0.074658 -0.923880
v 0.544896 0.108386 -0.831470
v 0.693520 0.137950 -0.707107
v 0.815493 0.162212 -0.555570
v 0.906128 0.180240 -0.382683
v 0.961940 0.191342 -0.195090
v 0.980786 0.195090 -0.000000
v 0.180240 0.074658 -0.980785
v 0.353554 0.146447 -0.923880
v 0.513280 0.212608 -0.831470
v 0.653282 0.270598 -0.707107
v 0.768178 0.318190 -0.555570
v 0.853554 0.353553 -0.382683
v 0.906127 0.375330 -0.195090
v 0.923880 0.382684 -0.000000
v 0.162212 0.108387 -0.980785
v 0.318190 0.212608 -0.923880
v 0.461940 0.308658 -0.831470
v 0.587938 0.392848 -0.707107
v 0.691342 0.461940 -0.555570
v 0.768178 0.513280 -0.382683
v 0.815493 0.544895 -0.195090
v 0.831470 0.555570 -0.000000
v 0.137950 0.137950 -0.980785
v 0.270598 0.270598 -0.923880
v 0.392848 0.392848 -0.831470
v 0.500000 0.500000 -0.707107
v 0.587938 0.587938 -0.555570
v 0.653282 0.653281 -0.382683
v 0.693520 0.693520 -0.195090
v 0.707107 0.707107 -0.000000
v 0.108387 0.162212 -0.980785
v 0.212608 0.318190 -0.923880
v 0.308659 0.461940 -0.831470
v 0.392848 0.587938 -0.707107
v 0.461940 0.691342 -0.555570
v 0.513280 0.768178 -0.382683
v 0.544895 0.815493 -0.195090
v 0.555570 0.831470 -0.000000
v 0.074658 0.180240 -0.980785
v 0.146447 0.353553 -0.923880
v 0.212608 0.513280 -0.831470
v 0.270598 0.653282 -0.707107
v 0.318190 0.768178 -0.555570
v 0.353554 0.853553 -0.382683
v 0.375330 0.906127 -0.195090
v 0.382684 0.923880 -0.000000
v 0.038061 0.191342 -0.980785
v 0.074658 0.375330 -0.923880
v 0.108387 0.544895 -0.831470
v 0.137950 0.693520 -0.707107
v 0.162212 0.815493 -0.555570
v 0.180240 0.906127 -0.382683
v 0.191342 0.961939 -0.195090
v 0.195090 0.980785 -0.000000
v 0.000000 0.195091 -0.980785
v 0.000000 0.382683 -0.923880
v 0.000000 0.555570 -0.831470
v 0.000000 0.707107 -0.707107
v 0.000000 0.831469 -0.555570
v 0.000000 0.923879 -0.382683
v 0.000000 0.980785 -0.195090
v 0.000000 1.000000 -0.000000
v -0.038060 0.191342 -0.980785
v -0.074658 0.375330 -0.923880
v -0.108386 0.544895 -0.831470
v -0.137949 0.693520 -0.707107
v -0.162211 0.815493 -0.555570
v -0.180240 0.906127 -0.382683
v -0.191342 0.961939 -0.195090
v -0.195090 0.980785 -0.000000
v -0.074658 0.180240 -0.980785
v -0.146446 0.353553 -0.923880
v -0.212607 0.513280 -0.831470
v -0.270598 0.653281 -0.707107
v -0.318189 0.768177 -0.555570
v -0.353553 0.853553 -0.382683
v -0.375330 0.906127 -0.195090
v -0.382683 0.923879 -0.000000
v -0.108386 0.162212 -0.980785
v -0.212607 0.318190 -0.923880
v -0.308658 0.461940 -0.831470
v -0.392847 0.587938 -0.707107
v -0.461939 0.691341 -0.555570
v -0.513280 0.768178 -0.382683
v -0.544895 0.815493 -0.195090
v -0.555570 0.831469 -0.000000
v -0.137949 0.137950 -0.980785
v -0.270598 0.270598 -0.923880
v -0.392847 0.392847 -0.831470
v -0.500000 0.500000 -0.707107
v -0.587937 0.587937 -0.555570
v -0.653281 0.653281 -0.382683
v -0.693519 0.693519 -0.195090
v -0.707106 0.707106 -0.000000
v -0.162211 0.108387 -0.980785
v -0.318189 0.212607 -0.923880
v -0.461939 0.308658 -0.831470
v -0.587937 0.392847 -0.707107
v -0.691341 0.461939 -0.555570
v -0.768177 0.513280 -0.382683
v -0.815492 0.544895 -0.195090
v -0.831469 0.555570 -0.000000
v 0.000000 0.000000 -1.000000
v -0.180240 0.074658 -0.980785
v -0.353553 0.146447 -0.923880
v -0.513280 0.212607 -0.831470
v -0.653281 0.270598 -0.707107
v -0.768177 0.318189 -0.555570
v -0.853553 0.353553 -0.382683
v -0.906127 0.375330 -0.195090
v -0.923879 0.382683 -0.000000
v -0.191342 0.038060 -0.980785
v -0.375330 0.074658 -0.923880
v -0.544895 0.108386 -0.831470
v -0.693520 0.137950 -0.707107
v -0.815492 0.162211 -0.555570
v -0.906127 0.180240 -0.382683
v -0.961939 0.191341 -0.195090
v -0.980785 0.195090 -0.000000
vt 0.000000 0.500000
vt 0.009607 0.402455
vt 0.019030 0.404329
vt 0.009607 0.500000
vt 0.038060 0.500000
vt 0.046936 0.409880
vt 0.092253 0.418894
vt 0.084265 0.500000
vt 0.146446 0.500000
vt 0.153240 0.431025
vt 0.227552 0.445807
vt 0.222215 0.500000
vt 0.308658 0.500000
vt 0.312335 0.462671
vt 0.404329 0.480970
vt 0.402455 0.500000
vt 0.243360 0.393696
vt 0.323223 0.426777
vt 0.038060 0.308658
vt 0.046936 0.312335
vt 0.073223 0.323223
vt 0.115911 0.340905
vt 0.173359 0.364701
vt 0.409880 0.462671
vt 0.269030 0.345671
vt 0.340905 0.393696
vt 0.084265 0.222215
vt 0.092254 0.227552
vt 0.115911 0.243360
vt 0.154329 0.269030
vt 0.206031 0.303576
vt 0.418894 0.445807
vt 0.303576 0.303576
vt 0.364701 0.364701
vt 0.146447 0.146447
vt 0.153240 0.153240
vt 0.173359 0.173359
vt 0.206031 0.206031
vt 0.250000 0.250000
vt 0.431025 0.431025
vt 0.345671 0.269030
vt 0.393696 0.340905
vt 0.222215 0.084265
vt 0.227552 0.092253
vt 0.243360 0.115911
vt 0.269030 0.154329
vt 0.303576 0.206031
vt 0.445807 0.418894
vt 0.393696 0.243360
vt 0.426777 0.323223
vt 0.308658 0.038060
vt 0.312335 0.046936
vt 0.323223 0.073223
vt 0.340905 0.115911
vt 0.364701 0.173359
vt 0.462671 0.409880
vt 0.445807 0.227552
vt 0.462671 0.312335
vt 0.402455 0.009607
vt 0.404329 0.019030
vt 0.409880 0.046936
vt 0.418894 0.092253
vt 0.431025 0.153240
vt 0.480970 0.404329
vt 0.500000 0.222215
vt 0.500000 0.308658
vt 0.500000 0.000000
vt 0.500000 0.009607
vt 0.500000 0.038060
vt 0.500000 0.084265
vt 0.500000 0.146447
vt 0.500000 0.402455
vt 0.554193 0.227552
vt 0.537329 0.312335
vt 0.597545 0.009607
vt 0.595671 0.019030
vt 0.590120 0.046936
vt 0.581106 0.092253
vt 0.568975 0.153240
vt 0.519030 0.404329
vt 0.606304 0.243360
vt 0.573223 0.323223
vt 0.691342 0.038060
vt 0.687665 0.046936
vt 0.676777 0.073223
vt 0.659095 0.115911
vt 0.635299 0.173359
vt 0.537329 0.409880
vt 0.654329 0.269030
vt 0.606304 0.340905
vt 0.777785 0.084265
vt 0.772447 0.092254
vt 0.756640 0.115911
vt 0.730970 0.154329
vt 0.696424 0.206031
vt 0.554193 0.418894
vt 0.696424 0.303576
vt 0.635299 0.364701
vt 0.853553 0.146447
vt 0.846760 0.153240
vt 0.826641 0.173359
vt 0.793969 0.206031
vt 0.750000 0.250000
vt 0.568975 0.431025
vt 0.730970 0.345671
vt 0.659095 0.393696
vt 0.915735 0.222215
vt 0.907746 0.227552
vt 0.884089 0.243360
vt 0.845671 0.269030
vt 0.793969 0.303576
vt 0.581106 0.445807
vt 0.756640 0.393696
vt 0.676777 0.426777
vt 0.961940 0.308658
vt 0.953063 0.312335
vt 0.926777 0.323223
vt 0.884089 0.340905
vt 0.826641 0.364701
vt 0.590120 0.462671
vt 0.772447 0.445807
vt 0.687665 0.462671
vt 0.990392 0.402455
vt 0.980970 0.404329
vt 0.953063 0.409880
vt 0.907746 0.418894
vt 0.846760 0.431025
vt 0.595671 0.480970
vt 0.777785 0.500000
vt 0.691342 0.500000
vt 1.000000 0.500000
vt 0.990392 0.500000
vt 0.961940 0.500000
vt 0.915735 0.500000
vt 0.853553 0.500000
vt 0.597545 0.500000
vt 0.772447 0.554193
vt 0.687665 0.537329
vt 0.990392 0.597545
vt 0.980970 0.595671
vt 0.953063 0.590120
vt 0.907746 0.581106
vt 0.846760 0.568975
vt 0.595671 0.519030
vt 0.756640 0.606304
vt 0.676777 0.573223
vt 0.961940 0.691342
vt 0.953063 0.687665
vt 0.926777 0.676777
vt 0.884088 0.659095
vt 0.826640 0.635299
vt 0.590120 0.537329
vt 0.730970 0.654329
vt 0.659095 0.606304
vt 0.915735 0.777785
vt 0.907746 0.772448
vt 0.884089 0.756640
vt 0.845671 0.730970
vt 0.793969 0.696424
vt 0.581106 0.554193
vt 0.696424 0.696424
vt 0.635299 0.635299
vt 0.853553 0.853553
vt 0.846760 0.846760
vt 0.826640 0.826641
vt 0.793969 0.793969
vt 0.750000 0.750000
vt 0.568975 0.568975
vt 0.654329 0.730970
vt 0.606304 0.659095
vt 0.777785 0.915735
vt 0.772447 0.907747
vt 0.756640 0.884089
vt 0.730970 0.845671
vt 0.696424 0.793969
vt 0.554193 0.581106
vt 0.606304 0.756640
vt 0.573223 0.676777
vt 0.691341 0.961940
vt 0.687665 0.953064
vt 0.676777 0.926777
vt 0.659095 0.884089
vt 0.635299 0.826641
vt 0.537329 0.590120
vt 0.554193 0.772448
vt 0.537329 0.687665
vt 0.597545 0.990393
vt 0.595671 0.980970
vt 0.590120 0.953064
vt 0.581106 0.907747
vt 0.568975 0.846760
vt 0.519030 0.595671
vt 0.500000 0.777785
vt 0.500000 0.691342
vt 0.500000 1.000000
vt 0.500000 0.990392
vt 0.500000 0.961940
vt 0.500000 0.915735
vt 0.500000 0.853553
vt 0.500000 0.597545
vt 0.445807 0.772448
vt 0.462671 0.687665
vt 0.402455 0.990393
vt 0.404329 0.980970
vt 0.409880 0.953064
vt 0.418894 0.907746
vt 0.431025 0.846760
vt 0.480970 0.595671
vt 0.393696 0.756640
vt 0.426777 0.676777
vt 0.308658 0.961940
vt 0.312335 0.953064
vt 0.323223 0.926777
vt 0.340905 0.884089
vt 0.364701 0.826641
vt 0.462671 0.590120
vt 0.345671 0.730970
vt 0.393696 0.659095
vt 0.222215 0.915735
vt 0.227552 0.907746
vt 0.243360 0.884089
vt 0.269030 0.845671
vt 0.303576 0.793969
vt 0.445807 0.581106
vt 0.303576 0.696424
vt 0.364701 0.635299
vt 0.146447 0.853553
vt 0.153240 0.846760
vt 0.173359 0.826641
vt 0.206031 0.793969
vt 0.250000 0.750000
vt 0.431025 0.568975
vt 0.269030 0.654329
vt 0.340905 0.606304
vt 0.084265 0.777785
vt 0.092254 0.772447
vt 0.115911 0.756640
vt 0.154329 0.730970
vt 0.206031 0.696424
vt 0.418894 0.554193
vt 0.243360 0.606304
vt 0.323223 0.573223
vt 0.038061 0.691342
vt 0.046937 0.687665
vt 0.073223 0.676777
vt 0.115911 0.659095
vt 0.173359 0.635299
vt 0.409880 0.537329
vt 0.227552 0.554193
vt 0.312335 0.537329
vt 0.009608 0.597545
vt 0.019030 0.595671
vt 0.046937 0.590120
vt 0.092254 0.581105
vt 0.153240 0.568975
vt 0.404329 0.519030
vt 0.500000 0.500000
usemtl None
s off
f 8/1 16/2 15/3 7/4
f 6/5 14/6 13/7 5/8
f 4/9 12/10 11/11 3/12
f 2/13 10/14 9/15 1/16
f 7/4 15/3 14/6 6/5
f 5/8 13/7 12/10 4/9
f 3/12 11/11 10/14 2/13
f 11/11 19/17 18/18 10/14
f 16/2 24/19 23/20 15/3
f 14/6 22/21 21/22 13/7
f 12/10 20/23 19/17 11/11
f 10/14 18/18 17/24 9/15
f 15/3 23/20 22/21 14/6
f 13/7 21/22 20/23 12/10
f 19/17 27/25 26/26 18/18
f 24/19 32/27 31/28 23/20
f 22/21 30/29 29/30 21/22
f 20/23 28/31 27/25 19/17
f 18/18 26/26 25/32 17/24
f 23/20 31/28 30/29 22/21
f 21/22 29/30 28/31 20/23
f 27/25 35/33 34/34 26/26
f 32/27 40/35 39/36 31/28
f 30/29 38/37 37/38 29/30
f 28/31 36/39 35/33 27/25
f 26/26 34/34 33/40 25/32
f 31/28 39/36 38/37 30/29
f 29/30 37/38 36/39 28/31
f 35/33 43/41 42/42 34/34
f 40/35 48/43 47/44 39/36
f 38/37 46/45 45/46 37/38
f 36/39 44/47 43/41 35/33
f 34/34 42/42 41/48 33/40
f 39/36 47/44 46/45 38/37
f 37/38 45/46 44/47 36/39
f 43/41 51/49 50/50 42/42
f 48/43 56/51 55/52 47/44
f 46/45 54/53 53/54 45/46
f 44/47 52/55 51/49 43/41
f 42/42 50/50 49/56 41/48
f 47/44 55/52 54/53 46/45
f 45/46 53/54 52/55 44/47
f 51/49 59/57 58/58 50/50
f 56/51 64/59 63/60 55/52
f 54/53 62/61 61/62 53/54
f 52/55 60/63 59/57 51/49
f 50/50 58/58 57/64 49/56
f 55/52 63/60 62/61 54/53
f 53/54 61/62 60/63 52/55
f 59/57 67/65 66/66 58/58
f 64/59 72/67 71/68 63/60
f 62/61 70/69 69/70 61/62
f 60/63 68/71 67/65 59/57
f 58/58 66/66 65/72 57/64
f 63/60 71/68 70/69 62/61
f 61/62 69/70 68/71 60/63
f 67/65 75/73 74/74 66/66
f 72/67 80/75 79/76 71/68
f 70/69 78/77 77/78 69/70
f 68/71 76/79 75/73 67/65
f 66/66 74/74 73/80 65/72
f 71/68 79/76 78/77 70/69
f 69/70 77/78 76/79 68/71
f 75/73 83/81 82/82 74/74
f 80/75 88/83 87/84 79/76
f 78/77 86/85 85/86 77/78
f 76/79 84/87 83/81 75/73
f 74/74 82/82 81/88 73/80
f 79/76 87/84 86/85 78/77
f 77/78 85/86 84/87 76/79
f 83/81 91/89 90/90 82/82
f 88/83 96/91 95/92 87/84
f 86/85 94/93 93/94 85/86
f 84/87 92/95 91/89 83/81
f 82/82 90/90 89/96 81/88
f 87/84 95/92 94/93 86/85
f 85/86 93/94 92/95 84/87
f 91/89 99/97 98/98 90/90
f 96/91 104/99 103/100 95/92
f 94/93 102/101 101/102 93/94
f 92/95 100/103 99/97 91/89
f 90/90 98/98 97/104 89/96
f 95/92 103/100 102/101 94/93
f 93/94 101/102 100/103 92/95
f 99/97 107/105 106/106 98/98
f 104/99 112/107 111/108 103/100
f 102/101 110/109 109/110 101/102
f 100/103 108/111 107/105 99/97
f 98/98 106/106 105/112 97/104
f 103/100 111/108 110/109 102/101
f 101/102 109/110 108/111 100/103
f 107/105 115/113 114/114 106/106
f 112/107 120/115 119/116 111/108
f 110/109 118/117 117/118 109/110
f 108/111 116/119 115/113 107/105
f 106/106 114/114 113/120 105/112
f 111/108 119/116 118/117 110/109
f 109/110 117/118 116/119 108/111
f 115/113 123/121 122/122 114/114
f 120/115 128/123 127/124 119/116
f 118/117 126/125 125/126 117/118
f 116/119 124/127 123/121 115/113
f 114/114 122/122 121/128 113/120
f 119/116 127/124 126/125 118/117
f 117/118 125/126 124/127 116/119
f 123/121 131/129 130/130 122/122
f 128/123 136/131 135/132 127/124
f 126/125 134/133 133/134 125/126
f 124/127 132/135 131/129 123/121
f 122/122 130/130 129/136 121/128
f 127/124 135/132 134/133 126/125
f 125/126 133/134 132/135 124/127
f 131/129 139/137 138/138 130/130
f 136/131 144/139 143/140 135/132
f 134/133 142/141 141/142 133/134
f 132/135 140/143 139/137 131/129
f 130/130 138/138 137/144 129/136
f 135/132 143/140 142/141 134/133
f 133/134 141/142 140/143 132/135
f 139/137 147/145 146/146 138/138
f 144/139 152/147 151/148 143/140
f 142/141 150/149 149/150 141/142
f 140/143 148/151 147/145 139/137
f 138/138 146/146 145/152 137/144
f 143/140 151/148 150/149 142/141
f 141/142 149/150 148/151 140/143
f 147/145 155/153 154/154 146/146
f 152/147 160/155 159/156 151/148
f 150/149 158/157 157/158 149/150
f 148/151 156/159 155/153 147/145
f 146/146 154/154 153/160 145/152
f 151/148 159/156 158/157 150/149
f 149/150 157/158 156/159 148/151
f 155/153 163/161 162/162 154/154
f 160/155 168/163 167/164 159/156
f 158/157 166/165 165/166 157/158
f 156/159 164/167 163/161 155/153
f 154/154 162/162 161/168 153/160
f 159/156 167/164 166/165 158/157
f 157/158 165/166 164/167 156/159
f 163/161 171/169 170/170 162/162
f 168/163 176/171 175/172 167/164
f 166/165 174/173 173/174 165/166
f 164/167 172/175 171/169 163/161
f 162/162 170/170 169/176 161/168
f 167/164 175/172 174/173 166/165
f 165/166 173/174 172/175 164/167
f 171/169 179/177 178/178 170/170
f 176/171 184/179 183/180 175/172
f 174/173 182/181 181/182 173/174
f 172/175 180/183 179/177 171/169
f 170/170 178/178 177/184 169/176
f 175/172 183/180 182/181 174/173
f 173/174 181/182 180/183 172/175
f 179/177 187/185 186/186 178/178
f 184/179 192/187 191/188 183/180
f 182/181 190/189 189/190 181/182
f 180/183 188/191 187/185 179/177
f 178/178 186/186 185/192 177/184
f 183/180 191/188 190/189 182/181
f 181/182 189/190 188/191 180/183
f 187/185 195/193 194/194 186/186
f 192/187 200/195 199/196 191/188
f 190/189 198/197 197/198 189/190
f 188/191 196/199 195/193 187/185
f 186/186 194/194 193/200 185/192
f 191/188 199/196 198/197 190/189
f 189/190 197/198 196/199 188/191
f 195/193 203/201 202/202 194/194
f 200/195 208/203 207/204 199/196
f 198/197 206/205 205/206 197/198
f 196/199 204/207 203/201 195/193
f 194/194 202/202 201/208 193/200
f 199/196 207/204 206/205 198/197
f 197/198 205/206 204/207 196/199
f 203/201 211/209 210/210 202/202
f 208/203 216/211 215/212 207/204
f 206/205 214/213 213/214 205/206
f 204/207 212/215 211/209 203/201
f 202/202 210/210 209/216 201/208
f 207/204 215/212 214/213 206/205
f 205/206 213/214 212/215 204/207
f 211/209 219/217 218/218 210/210
f 216/211 224/219 223/220 215/212
f 214/213 222/221 221/222 213/214
f 212/215 220/223 219/217 211/209
f 210/210 218/218 217/224 209/216
f 215/212 223/220 222/221 214/213
f 213/214 221/222 220/223 212/215
f 219/217 227/225 226/226 218/218
f 224/219 232/227 231/228 223/220
f 222/221 230/229 229/230 221/222
f 220/223 228/231 227/225 219/217
f 218/218 226/226 225/232 217/224
f 223/220 231/228 230/229 222/221
f 221/222 229/230 228/231 220/223
f 227/225 235/233 234/234 226/226
f 232/227 240/235 239/236 231/228
f 230/229 238/237 237/238 229/230
f 228/231 236/239 235/233 227/225
f 226/226 234/234 233/240 225/232
f 231/228 239/236 238/237 230/229
f 229/230 237/238 236/239 228/231
f 235/233 244/241 243/242 234/234
f 240/235 249/243 248/244 239/236
f 238/237 247/245 246/246 237/238
f 236/239 245/247 244/241 235/233
f 234/234 243/242 242/248 233/240
f 239/236 248/244 247/245 238/237
f 237/238 246/246 245/247 236/239
f 244/241 252/249 251/250 243/242
f 249/243 257/251 256/252 248/244
f 247/245 255/253 254/254 246/246
f 245/247 253/255 252/249 244/241
f 243/242 251/250 250/256 242/248
f 248/244 256/252 255/253 247/245
f 246/246 254/254 253/255 245/247
f 1/16 9/15 241/257
f 9/15 17/24 241/257
f 17/24 25/32 241/257
f 25/32 33/40 241/257
f 33/40 41/48 241/257
f 41/48 49/56 241/257
f 49/56 57/64 241/257
f 57/64 65/72 241/257
f 65/72 73/80 241/257
f 73/80 81/88 241/257
f 81/88 89/96 241/257
f 89/96 97/104 241/257
f 97/104 105/112 241/257
f 105/112 113/120 241/257
f 113/120 121/128 241/257
f 121/128 129/136 241/257
f 129/136 137/144 241/257
f 137/144 145/152 241/257
f 145/152 153/160 241/257
f 153/160 161/168 241/257
f 161/168 169/176 241/257
f 169/176 177/184 241/257
f 177/184 185/192 241/257
f 185/192 193/200 241/257
f 193/200 201/208 241/257
f 201/208 209/216 241/257
f 209/216 217/224 241/257
f 217/224 225/232 241/257
f 225/232 233/240 241/257
f 233/240 242/248 241/257
f 242/248 250/256 241/257
f 252/249 3/12 2/13 251/250
f 250/256 1/16 241/257
f 257/251 8/1 7/4 256/252
f 255/253 6/5 5/8 254/254
f 253/255 4/9 3/12 252/249
f 251/250 2/13 1/16 250/256
f 256/252 7/4 6/5 255/253
f 254/254 5/8 4/9 253/255
o Sphere
v -0.693519 0.195090 0.693519
Shader "FX/Matte Shadow" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader {
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
LOD 200
Blend Zero SrcColor
CGPROGRAM
#pragma surface surf ShadowOnly alphatest:_Cutoff
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
inline fixed4 LightingShadowOnly (SurfaceOutput s, fixed3 lightDir, fixed atten)
{
fixed4 c;
c.rgb = s.Albedo*atten;
c.a = s.Alpha;
return c;
}
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = _Color;
o.Albedo = c.rgb;
o.Alpha = 1;
}
ENDCG
}
Fallback "Transparent/Cutout/VertexLit"
}
using UnityEngine;
using System.Collections;
public class WebCamBehaviourScript : MonoBehaviour
{
public int Width = 1920;
public int Height = 1080;
public int FPS = 30;
// Use this for initialization
void Start()
{
var devices = WebCamTexture.devices;
if ( devices.Length == 0 ) {
Debug.LogError( "Webカメラが検出できませんでした。" );
return;
}
// WebCamテクスチャを作成する
var webcamTexture = new WebCamTexture( Width, Height, FPS );
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
}
// Update is called once per frame
void Update()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment