Commit 867cdf40 authored by 18손재민's avatar 18손재민

Merge branch 'model' into bullet

# Conflicts:
#	Assets/Scenes/SampleScene.unity
parents 63276992 43dd583c
fileFormatVersion: 2
guid: f6f93333f3ec5cf49badbe0a60075051
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 540a325ce856e21479f41ef886286897
folderAsset: yes
timeCreated: 1429137304
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 0d698a76b760c2d448398c4ade539014
timeCreated: 1429137534
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d0471f40cfc48924891900a655f254b4
timeCreated: 1429137555
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 1
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: 1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BubbleMaterial
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EmissionScaleUI: 0
- _Glossiness: 0.5
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 0.5187329, g: 0.5441177, b: 0.084018186, a: 1}
fileFormatVersion: 2
guid: b950759616a34b54682a848174608396
timeCreated: 1429140547
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2d405dffd4c836847b0f1019636359a3
timeCreated: 1429138431
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d36c47a2fc27964468a3572c7581b353
timeCreated: 1429138431
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 1
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: 1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CeilingMaterial
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _NORMALMAP
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 2800000, guid: d36c47a2fc27964468a3572c7581b353, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 2d405dffd4c836847b0f1019636359a3, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EmissionScaleUI: 0
- _Glossiness: 0.5
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
fileFormatVersion: 2
guid: a2443034c622eb14db7002a2e6f5d35c
timeCreated: 1429138495
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DemoMaterial1
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _METALLICGLOSSMAP
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 8400000, guid: ee86928849ca70d4a8721756ef035d5a, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EmissionScaleUI: 0
- _Glossiness: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.36551726, g: 1, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
fileFormatVersion: 2
guid: c2689f85d58b6b0408989a116d4adca4
timeCreated: 1433119971
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DemoMaterial2
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _METALLICGLOSSMAP
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 8400000, guid: 2355fb304e48a9a4aa641fe726db268a, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EmissionScaleUI: 0
- _Glossiness: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
fileFormatVersion: 2
guid: 4789aadd8efebd7469ead939cb9dffeb
timeCreated: 1433119979
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: a9e52b891dfb5194db862d49e432fea7
timeCreated: 1429137338
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: be4c8aafc6843d347b4e2bdd8febce3c
timeCreated: 1433167560
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
public class DemoScript : MonoBehaviour
{
public List<GameObject> Mirrors;
public GameObject LightBulb;
public UnityEngine.UI.Toggle RecursionToggle;
private float rotationModifier = -1.0f;
private float moveModifier = 1.0f;
private Material lightBulbMaterial;
private enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 }
private RotationAxes axes = RotationAxes.MouseXAndY;
private float sensitivityX = 15F;
private float sensitivityY = 15F;
private float minimumX = -360F;
private float maximumX = 360F;
private float minimumY = -60F;
private float maximumY = 60F;
private float rotationX = 0F;
private float rotationY = 0F;
private Quaternion originalRotation;
// Use this for initialization
void Start()
{
originalRotation = transform.localRotation;
Renderer r = LightBulb.GetComponent<Renderer>();
if (Application.isPlaying)
{
r.sharedMaterial = r.material;
}
lightBulbMaterial = r.sharedMaterial;
}
// Update is called once per frame
void Update()
{
RotateMirror();
MoveLightBulb();
UpdateMouseLook();
UpdateMovement();
}
public void MirrorRecursionToggled()
{
ChangeMirrorRecursion();
}
public void ChangeMirrorRecursion()
{
foreach (GameObject o in Mirrors)
{
MirrorScript s = o.GetComponent<MirrorScript>();
s.MirrorRecursion = RecursionToggle.isOn;
}
}
private void UpdateMovement()
{
float speed = 4.0f * Time.deltaTime;
if (Input.GetKey(KeyCode.W))
{
transform.Translate(0.0f, 0.0f, speed);
}
else if (Input.GetKey(KeyCode.S))
{
transform.Translate(0.0f, 0.0f, -speed);
}
if (Input.GetKey(KeyCode.A))
{
transform.Translate(-speed, 0.0f, 0.0f);
}
else if (Input.GetKey(KeyCode.D))
{
transform.Translate(speed, 0.0f, 0.0f);
}
if (Input.GetKeyDown(KeyCode.M))
{
RecursionToggle.isOn = !RecursionToggle.isOn;
}
}
private void RotateMirror()
{
GameObject Mirror = Mirrors[0];
float angle = Mirror.transform.rotation.eulerAngles.y;
if (angle > 65 && angle < 100)
{
rotationModifier = -rotationModifier;
angle = angle - 65.0f;
Mirror.transform.Rotate(0.0f, -angle, 0.0f);
}
else if (angle > 100 && angle < 295)
{
rotationModifier = -rotationModifier;
angle = 295.0f - angle;
Mirror.transform.Rotate(0.0f, angle, 0.0f);
}
else
{
Mirror.transform.Rotate(0.0f, rotationModifier * Time.deltaTime * 20.0f, 0.0f);
}
}
private void MoveLightBulb()
{
float x = LightBulb.transform.position.x;
if (x > 5)
{
moveModifier = -moveModifier;
x = 5;
}
else if (x < -5)
{
moveModifier = -moveModifier;
x = -5;
}
else
{
x += (Time.deltaTime * moveModifier);
}
Light l = LightBulb.GetComponent<Light>();
LightBulb.transform.position = new Vector3(x, LightBulb.transform.position.y, LightBulb.transform.position.z);
float i = Mathf.Min(1.0f, l.intensity);
lightBulbMaterial.SetColor("_EmissionColor", new Color(i, i, i));
}
private void UpdateMouseLook()
{
if (axes == RotationAxes.MouseXAndY)
{
// Read the mouse input axis
rotationX += Input.GetAxis("Mouse X") * sensitivityX;
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationX = ClampAngle(rotationX, minimumX, maximumX);
rotationY = ClampAngle(rotationY, minimumY, maximumY);
Quaternion xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
Quaternion yQuaternion = Quaternion.AngleAxis(rotationY, -Vector3.right);
transform.localRotation = originalRotation * xQuaternion * yQuaternion;
}
else if (axes == RotationAxes.MouseX)
{
rotationX += Input.GetAxis("Mouse X") * sensitivityX;
rotationX = ClampAngle(rotationX, minimumX, maximumX);
Quaternion xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
transform.localRotation = originalRotation * xQuaternion;
}
else
{
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationY = ClampAngle(rotationY, minimumY, maximumY);
Quaternion yQuaternion = Quaternion.AngleAxis(-rotationY, Vector3.right);
transform.localRotation = originalRotation * yQuaternion;
}
}
public static float ClampAngle(float angle, float min, float max)
{
if (angle < -360F)
{
angle += 360F;
}
if (angle > 360F)
{
angle -= 360F;
}
return Mathf.Clamp(angle, min, max);
}
}
fileFormatVersion: 2
guid: 9567ec42f445d834bb3dbfd68367fe91
timeCreated: 1429138630
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DemoTexture1
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_Width: 768
m_Height: 768
m_AntiAliasing: 1
m_DepthFormat: 1
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
fileFormatVersion: 2
guid: ee86928849ca70d4a8721756ef035d5a
timeCreated: 1433119712
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DemoTexture2
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_Width: 768
m_Height: 768
m_AntiAliasing: 1
m_DepthFormat: 1
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
fileFormatVersion: 2
guid: 2355fb304e48a9a4aa641fe726db268a
timeCreated: 1433119719
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: FloorMaterial
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _NORMALMAP
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 2800000, guid: d0471f40cfc48924891900a655f254b4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 0d698a76b760c2d448398c4ade539014, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EmissionScaleUI: 0
- _Glossiness: 0.5
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
fileFormatVersion: 2
guid: 8a58251f1a8604543a927f20e08c7fc2
timeCreated: 1429137544
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LightBulbMaterial
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _EMISSION
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EmissionScaleUI: 1
- _Glossiness: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmisColor: {r: 0.2, g: 0.2, b: 0.2, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
fileFormatVersion: 2
guid: 6f4dc25bc3a48f44fa262735f5146fbc
timeCreated: 1429152978
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 1b92b7eadaacf8144b9fea8a65b13b2f
timeCreated: 1429137707
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: cca45df9f66663e4eacff8366cd60779
timeCreated: 1429137708
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 1
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: 1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: WallMaterial1
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _NORMALMAP
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 2800000, guid: cca45df9f66663e4eacff8366cd60779, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 1b92b7eadaacf8144b9fea8a65b13b2f, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EmissionScaleUI: 0
- _Glossiness: 0.5
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
fileFormatVersion: 2
guid: 13cb7c8eca89404418087021045270f6
timeCreated: 1429137755
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 5c2d85b378d66ae4fb189234b5cc52be
folderAsset: yes
timeCreated: 1429137304
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: e1aefcd27d8528140b344bffdf493a38
folderAsset: yes
timeCreated: 1525210719
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
//
// Magic Mirror Lite (c) 2015 Digital Ruby, LLC
// http://www.digitalruby.com
//
using System;
using UnityEngine;
using UnityEditor;
namespace DigitalRuby.RainMaker
{
public class MagicMirrorEditor : Editor
{
private Texture2D logo;
public override void OnInspectorGUI()
{
if (logo == null)
{
string[] guids = AssetDatabase.FindAssets("MagicMirrorLogo");
foreach (string guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
logo = AssetDatabase.LoadMainAssetAtPath(path) as Texture2D;
if (logo != null)
{
break;
}
}
}
if (logo != null)
{
const float maxLogoWidth = 450.0f;
EditorGUILayout.Separator();
float w = EditorGUIUtility.currentViewWidth;
Rect r = new Rect();
r.width = Math.Min(w - 40.0f, maxLogoWidth);
r.height = r.width / 2.7f;
Rect r2 = GUILayoutUtility.GetRect(r.width, r.height);
r.x = ((EditorGUIUtility.currentViewWidth - r.width) * 0.5f) - 4.0f;
r.y = r2.y;
GUI.DrawTexture(r, logo, ScaleMode.StretchToFill);
if (GUI.Button(r, "", new GUIStyle()))
{
Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/content/103687?aid=1011lGnL");
}
EditorGUILayout.Separator();
}
DrawDefaultInspector();
}
}
[CustomEditor(typeof(MirrorCameraScript))]
public class MirrorCameraScriptEditor : MagicMirrorEditor
{
}
[CustomEditor(typeof(MirrorReflectionScript))]
public class MirrorReflectionScriptEditor : MagicMirrorEditor
{
}
[CustomEditor(typeof(MirrorScript))]
public class MirrorScriptEditor : MagicMirrorEditor
{
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 19155fa2ccbaf8444ad930182a2d696e
timeCreated: 1525210719
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 1aede80a470c5a342a6a0132ae36d367
timeCreated: 1525210723
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 1
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
filterMode: 1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 2
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 0
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 1024
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 1024
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &101916
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 439134}
- component: {fileID: 2096356}
- component: {fileID: 4501582}
- component: {fileID: 11427038}
m_Layer: 0
m_Name: MirrorCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &439134
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 101916}
m_LocalRotation: {x: 0, y: 1, z: 0, w: -0.00000016292068}
m_LocalPosition: {x: 0, y: 0, z: -0.1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 423996}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &2096356
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 101916}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!45 &4501582
Skybox:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 101916}
m_Enabled: 1
m_CustomSkybox: {fileID: 0}
--- !u!114 &11427038
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 101916}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d31f93e447eac7b45971505a2891c813, type: 3}
m_Name:
m_EditorClassIdentifier:
MirrorObject: {fileID: 126772}
VRMode: 0
--- !u!1 &123684
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 423996}
- component: {fileID: 11435476}
m_Layer: 0
m_Name: Mirror
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &423996
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 123684}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 4, z: 6}
m_LocalScale: {x: 8, y: 8, z: 8}
m_Children:
- {fileID: 404332}
- {fileID: 439134}
- {fileID: 421490}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &11435476
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 123684}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 77b7fc7cdbba2b4489915a8923a46f91, type: 3}
m_Name:
m_EditorClassIdentifier:
MaximumPerPixelLights: 2
TextureSize: 768
ClipPlaneOffset: 0.07
FarClipPlane: 1000
ReflectLayers:
serializedVersion: 2
m_Bits: 4294967295
AddFlareLayer: 0
NormalIsForward: 1
AspectRatio: 1.5
MirrorRecursion: 0
--- !u!1 &126434
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 404332}
- component: {fileID: 3361970}
- component: {fileID: 6408786}
- component: {fileID: 2363376}
m_Layer: 0
m_Name: MirrorFrame
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &404332
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 126434}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.01}
m_LocalScale: {x: 1, y: 1, z: 0.05}
m_Children: []
m_Father: {fileID: 423996}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3361970
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 126434}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!64 &6408786
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 126434}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 3
m_Convex: 0
m_CookingOptions: 14
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &2363376
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 126434}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: ec0cb013296c97943bb4bb4a6a23ae17, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!1 &126772
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 421490}
- component: {fileID: 3370550}
- component: {fileID: 6480290}
- component: {fileID: 11497506}
- component: {fileID: 2372380}
m_Layer: 0
m_Name: MirrorReflection
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &421490
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 126772}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 423996}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3370550
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 126772}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!64 &6480290
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 126772}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 3
m_Convex: 0
m_CookingOptions: 14
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &11497506
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 126772}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d8a68502eb355794680af8e3cae39702, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!23 &2372380
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 126772}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 232c0653700ee46418c8a4a6f0402d92, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
fileFormatVersion: 2
guid: 977d462d3da090443aa549827d636355
labels:
- Mirror
- Reflection
- Camera
- Shiny
- Fogged
- Film
- Magic
timeCreated: 1429139875
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: dfe449fc75e695a44ad068b38fa7ac0a
timeCreated: 1429158312
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.VR;
public class MirrorCameraScript : MonoBehaviour
{
public GameObject MirrorObject;
public bool VRMode;
private Renderer mirrorRenderer;
private Material mirrorMaterial;
private MirrorScript mirrorScript;
private Camera cameraObject;
private RenderTexture reflectionTexture;
private Matrix4x4 reflectionMatrix;
private int oldReflectionTextureSize;
private static bool renderingMirror;
private void Start()
{
mirrorScript = GetComponentInParent<MirrorScript>();
cameraObject = GetComponent<Camera>();
//cameraObject.enabled = true;
if (mirrorScript.AddFlareLayer)
{
cameraObject.gameObject.AddComponent<FlareLayer>();
}
mirrorRenderer = MirrorObject.GetComponent<Renderer>();
if (Application.isPlaying)
{
foreach (Material m in mirrorRenderer.sharedMaterials)
{
if (m.name == "MirrorMaterial")
{
mirrorRenderer.sharedMaterial = m;
break;
}
}
}
mirrorMaterial = mirrorRenderer.sharedMaterial;
CreateRenderTexture();
}
private void CreateRenderTexture()
{
if (reflectionTexture == null || oldReflectionTextureSize != mirrorScript.TextureSize)
{
if (reflectionTexture)
{
DestroyImmediate(reflectionTexture);
}
reflectionTexture = new RenderTexture(mirrorScript.TextureSize, mirrorScript.TextureSize, 16);
reflectionTexture.filterMode = FilterMode.Bilinear;
reflectionTexture.antiAliasing = 1;
reflectionTexture.name = "MirrorRenderTexture_" + GetInstanceID();
reflectionTexture.hideFlags = HideFlags.HideAndDontSave;
reflectionTexture.autoGenerateMips = false;
reflectionTexture.wrapMode = TextureWrapMode.Clamp;
mirrorMaterial.SetTexture("_MainTex", reflectionTexture);
oldReflectionTextureSize = mirrorScript.TextureSize;
}
if (cameraObject.targetTexture != reflectionTexture)
{
cameraObject.targetTexture = reflectionTexture;
}
}
private void Update()
{
if (VRMode && Camera.current == Camera.main) {
return;
}
CreateRenderTexture();
}
private void UpdateCameraProperties(Camera src, Camera dest)
{
dest.clearFlags = src.clearFlags;
dest.backgroundColor = src.backgroundColor;
if (src.clearFlags == CameraClearFlags.Skybox)
{
Skybox sky = src.GetComponent<Skybox>();
Skybox mysky = dest.GetComponent<Skybox>();
if (!sky || !sky.material)
{
mysky.enabled = false;
}
else
{
mysky.enabled = true;
mysky.material = sky.material;
}
}
dest.orthographic = src.orthographic;
dest.orthographicSize = src.orthographicSize;
if (mirrorScript.AspectRatio > 0.0f)
{
dest.aspect = mirrorScript.AspectRatio;
}
else
{
dest.aspect = src.aspect;
}
dest.renderingPath = src.renderingPath;
}
internal void RenderMirror()
{
Camera cameraLookingAtThisMirror;
// bail if we don't have a camera or renderer
if (renderingMirror || !enabled || (cameraLookingAtThisMirror = Camera.current) == null ||
mirrorRenderer == null || mirrorMaterial == null || !mirrorRenderer.enabled)
{
return;
}
renderingMirror = true;
int oldPixelLightCount = QualitySettings.pixelLightCount;
if (QualitySettings.pixelLightCount != mirrorScript.MaximumPerPixelLights)
{
QualitySettings.pixelLightCount = mirrorScript.MaximumPerPixelLights;
}
try
{
UpdateCameraProperties(cameraLookingAtThisMirror, cameraObject);
if (mirrorScript.MirrorRecursion)
{
mirrorMaterial.EnableKeyword("MIRROR_RECURSION");
cameraObject.ResetWorldToCameraMatrix();
cameraObject.ResetProjectionMatrix();
cameraObject.projectionMatrix = cameraObject.projectionMatrix * Matrix4x4.Scale(new Vector3(-1, 1, 1));
cameraObject.cullingMask = ~(1 << 4) & mirrorScript.ReflectLayers.value;
GL.invertCulling = true;
cameraObject.Render();
GL.invertCulling = false;
}
else
{
mirrorMaterial.DisableKeyword("MIRROR_RECURSION");
Vector3 pos = transform.position;
Vector3 normal = (mirrorScript.NormalIsForward ? transform.forward : transform.up);
// Reflect camera around reflection plane
float d = -Vector3.Dot(normal, pos) - mirrorScript.ClipPlaneOffset;
Vector4 reflectionPlane = new Vector4(normal.x, normal.y, normal.z, d);
CalculateReflectionMatrix(ref reflectionPlane);
Vector3 oldpos = cameraObject.transform.position;
float oldclip = cameraObject.farClipPlane;
Vector3 newpos = reflectionMatrix.MultiplyPoint(oldpos);
Matrix4x4 worldToCameraMatrix = cameraLookingAtThisMirror.worldToCameraMatrix;
if (VRMode)
{
if(cameraLookingAtThisMirror.stereoActiveEye == Camera.MonoOrStereoscopicEye.Left)
{
worldToCameraMatrix[12] += 0.011f;
}
else if (cameraLookingAtThisMirror.stereoActiveEye == Camera.MonoOrStereoscopicEye.Right)
{
worldToCameraMatrix[12] -= 0.011f;
}
}
worldToCameraMatrix *= reflectionMatrix;
cameraObject.worldToCameraMatrix = worldToCameraMatrix;
// Clip out background
Vector4 clipPlane = CameraSpacePlane(ref worldToCameraMatrix, ref pos, ref normal, 1.0f);
cameraObject.projectionMatrix = cameraLookingAtThisMirror.CalculateObliqueMatrix(clipPlane);
GL.invertCulling = true;
cameraObject.transform.position = newpos;
cameraObject.farClipPlane = mirrorScript.FarClipPlane;
cameraObject.cullingMask = ~(1 << 4) & mirrorScript.ReflectLayers.value;
cameraObject.Render();
cameraObject.transform.position = oldpos;
cameraObject.farClipPlane = oldclip;
GL.invertCulling = false;
}
}
finally
{
renderingMirror = false;
if (QualitySettings.pixelLightCount != oldPixelLightCount)
{
QualitySettings.pixelLightCount = oldPixelLightCount;
}
}
}
// Cleanup all the objects we possibly have created
private void OnDisable()
{
if (reflectionTexture)
{
DestroyImmediate(reflectionTexture);
reflectionTexture = null;
}
}
private Vector4 CameraSpacePlane(ref Matrix4x4 worldToCameraMatrix, ref Vector3 pos, ref Vector3 normal, float sideSign)
{
Vector3 offsetPos = pos + normal * mirrorScript.ClipPlaneOffset;
Vector3 cpos = worldToCameraMatrix.MultiplyPoint(offsetPos);
Vector3 cnormal = worldToCameraMatrix.MultiplyVector(normal).normalized * sideSign;
return new Vector4(cnormal.x, cnormal.y, cnormal.z, -Vector3.Dot(cpos, cnormal));
}
private void CalculateReflectionMatrix(ref Vector4 plane)
{
// Calculates reflection matrix around the given plane
reflectionMatrix.m00 = (1F - 2F * plane[0] * plane[0]);
reflectionMatrix.m01 = (-2F * plane[0] * plane[1]);
reflectionMatrix.m02 = (-2F * plane[0] * plane[2]);
reflectionMatrix.m03 = (-2F * plane[3] * plane[0]);
reflectionMatrix.m10 = (-2F * plane[1] * plane[0]);
reflectionMatrix.m11 = (1F - 2F * plane[1] * plane[1]);
reflectionMatrix.m12 = (-2F * plane[1] * plane[2]);
reflectionMatrix.m13 = (-2F * plane[3] * plane[1]);
reflectionMatrix.m20 = (-2F * plane[2] * plane[0]);
reflectionMatrix.m21 = (-2F * plane[2] * plane[1]);
reflectionMatrix.m22 = (1F - 2F * plane[2] * plane[2]);
reflectionMatrix.m23 = (-2F * plane[3] * plane[2]);
reflectionMatrix.m30 = 0F;
reflectionMatrix.m31 = 0F;
reflectionMatrix.m32 = 0F;
reflectionMatrix.m33 = 1F;
}
private static void CalculateObliqueMatrix(ref Matrix4x4 projection, ref Vector4 clipPlane)
{
Vector4 q = projection.inverse * new Vector4
(
Sign(clipPlane.x),
Sign(clipPlane.y),
1.0f,
1.0f
);
Vector4 c = clipPlane * (2.0F / (Vector4.Dot(clipPlane, q)));
// third row = clip plane - fourth row
projection[2] = c.x - projection[3];
projection[6] = c.y - projection[7];
projection[10] = c.z - projection[11];
projection[14] = c.w - projection[15];
}
private static float Sign(float a)
{
if (a > 0.0f) return 1.0f;
if (a < 0.0f) return -1.0f;
return 0.0f;
}
}
fileFormatVersion: 2
guid: d31f93e447eac7b45971505a2891c813
timeCreated: 1433170477
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &176440
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 417700}
- component: {fileID: 2033590}
- component: {fileID: 4528834}
m_Layer: 0
m_Name: MirrorChild
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &417700
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 176440}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &2033590
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 176440}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!45 &4528834
Skybox:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 176440}
m_Enabled: 1
m_CustomSkybox: {fileID: 0}
fileFormatVersion: 2
guid: 1ce49965b4f65fb4e8f1fedc56784c68
timeCreated: 1433170512
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: eb4c03eb86b02bf4091b5ef5fb841e3d
timeCreated: 1429152566
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MirrorDetailMaterial
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHABLEND_ON
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: eb4c03eb86b02bf4091b5ef5fb841e3d, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _EmissionScaleUI: 0
- _Glossiness: 0.5
- _Metallic: 0
- _Mode: 2
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SrcBlend: 5
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
fileFormatVersion: 2
guid: 5bf5f776d303c9543be8af0b7d5b52b0
timeCreated: 1429152440
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MirrorFrameMaterial
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHABLEND_ON
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: dfe449fc75e695a44ad068b38fa7ac0a, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _EmissionScaleUI: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 2
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
fileFormatVersion: 2
guid: ec0cb013296c97943bb4bb4a6a23ae17
timeCreated: 1429158200
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MirrorMaterial
m_Shader: {fileID: 4800000, guid: 257a8b4d70710924f88ec03f5c74c396, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Cube:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailTex:
m_Texture: {fileID: 2800000, guid: fda2acf1bd029a24dab1b86bbac260e1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _LightMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ReflectionTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Tex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- PixelSnap: 0
- _AlbedoEmissionFactor: 0.1
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DirectionalLightMultiplier: 1
- _DstBlend: 0
- _EmissionScaleUI: 0
- _Exposure: 1
- _Gloss: 0.75
- _Glossiness: 1
- _InvFade: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _PointSpotLightMultiplier: 2
- _Rotation: 0
- _Shininess: 1
- _Smoothness: 1
- _Specular: 0.1
- _SpecularArea: 0.1
- _SpecularIntensity: 0.75
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.08088237, g: 0.08088237, b: 0.08088237, a: 1}
- _EmisColor: {r: 0.2, g: 0.2, b: 0.2, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
- _EmissiveColor: {r: 0.1, g: 0.1, b: 0.1, a: 1}
- _ReflectColor: {r: 1, g: 1, b: 1, a: 1}
- _ReflectionColor: {r: 1, g: 1, b: 1, a: 1}
- _SpecColor: {r: 1, g: 1, b: 1, a: 1}
- _SpecularColor: {r: 0, g: 0, b: 0, a: 1}
- _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
- _TintColor: {r: 1, g: 1, b: 1, a: 1}
fileFormatVersion: 2
guid: 232c0653700ee46418c8a4a6f0402d92
timeCreated: 1429052977
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MirrorMaterialBumpMap
m_Shader: {fileID: 4800000, guid: 46d5611267502e3468d1430b2fdbd316, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 2800000, guid: 483fa56b44d017444ac0c6010bc08b47, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailTex:
m_Texture: {fileID: 2800000, guid: fda2acf1bd029a24dab1b86bbac260e1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EmissionScaleUI: 0
- _Glossiness: 0.5
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SpecularArea: 0.1
- _SpecularIntensity: 0.75
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.08088237, g: 0.08088237, b: 0.08088237, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
- _ReflectionColor: {r: 1, g: 1, b: 1, a: 1}
- _SpecColor: {r: 1, g: 1, b: 1, a: 1}
fileFormatVersion: 2
guid: d9eaa94ef39cab84b9f7c7c1b51cf0af
timeCreated: 1432866211
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
public class MirrorReflectionScript : MonoBehaviour
{
private MirrorCameraScript childScript;
private void Start()
{
childScript = gameObject.transform.parent.gameObject.GetComponentInChildren<MirrorCameraScript>();
if (childScript == null)
{
Debug.LogError("Child script (MirrorCameraScript) should be in sibling object");
}
}
private void OnWillRenderObject()
{
childScript.RenderMirror();
}
}
fileFormatVersion: 2
guid: d8a68502eb355794680af8e3cae39702
timeCreated: 1433176789
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections.Generic;
using UnityEngine;
// [ExecuteInEditMode] // Make mirror live-update even when not in play mode
public class MirrorScript : MonoBehaviour
{
[Tooltip("Maximum number of per pixel lights that will show in the mirrored image")]
public int MaximumPerPixelLights = 2;
[Tooltip("Texture size for the mirror, depending on how close the player can get to the mirror, this will need to be larger")]
public int TextureSize = 768;
[Tooltip("Subtracted from the near plane of the mirror")]
public float ClipPlaneOffset = 0.07f;
[Tooltip("Far clip plane for mirro camera")]
public float FarClipPlane = 1000.0f;
[Tooltip("What layers will be reflected?")]
public LayerMask ReflectLayers = -1;
[Tooltip("Add a flare layer to the reflection camera?")]
public bool AddFlareLayer = false;
[Tooltip("For quads, the normal points forward (true). For planes, the normal points up (false)")]
public bool NormalIsForward = true;
[Tooltip("Aspect ratio (width / height). Set to 0 to use default.")]
public float AspectRatio = 0.0f;
[Tooltip("Set to true if you have multiple mirrors facing each other to get an infinite effect, otherwise leave as false for a more realistic mirror effect.")]
public bool MirrorRecursion;
}
\ No newline at end of file
fileFormatVersion: 2
guid: 77b7fc7cdbba2b4489915a8923a46f91
timeCreated: 1429047166
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Shader "Custom/Mirror"
{
Properties
{
_MainTex ("Emissive Texture", 2D) = "black" {}
_DetailTex ("Detail Texture", 2D) = "white" {}
_Color ("Detail Tint Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (1,1,1,1)
_SpecularArea ("Specular Area", Range (0, 0.99)) = 0.1
_SpecularIntensity ("Specular Intensity", Range (0, 1)) = 0.75
_ReflectionColor ("Reflection Tint Color", Color) = (1,1,1,1)
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 300
CGPROGRAM
#pragma surface surf BlinnPhong fullforwardshadows
#pragma multi_compile __ MIRROR_RECURSION
#include "UnityCG.cginc"
fixed4 _Color;
fixed4 _ReflectionColor;
half _SpecularArea;
half _SpecularIntensity;
sampler2D _DetailTex;
sampler2D _MainTex;
struct Input
{
float2 uv_DetailTex;
float4 screenPos;
};
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 detail = tex2D(_DetailTex, IN.uv_DetailTex);
#if MIRROR_RECURSION
fixed4 refl = tex2D(_MainTex, IN.uv_DetailTex);
#else
IN.screenPos.w = max(0.001, IN.screenPos.w);
fixed4 refl = tex2Dproj(_MainTex, UNITY_PROJ_COORD(IN.screenPos));
#endif
o.Albedo = detail.rgb * _Color.rgb;
o.Alpha = 1;
o.Specular = 1.0f - _SpecularArea;
o.Gloss = _SpecularIntensity;
o.Emission = refl.rgb * _ReflectionColor.rgb;
}
ENDCG
}
FallBack "Reflective/Specular"
}
\ No newline at end of file
fileFormatVersion: 2
guid: 257a8b4d70710924f88ec03f5c74c396
timeCreated: 1429052951
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
Shader "Custom/MirrorBumpMap"
{
Properties
{
_MainTex ("Emissive Texture", 2D) = "black" {}
_DetailTex ("Detail Texture", 2D) = "white" {}
_BumpMap ("Bump Map Texture", 2D) = "bumpmap" {}
_Color ("Detail Tint Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (1,1,1,1)
_SpecularArea ("Specular Area", Range (0, 0.99)) = 0.1
_SpecularIntensity ("Specular Intensity", Range (0, 1)) = 0.75
_ReflectionColor ("Reflection Tint Color", Color) = (1,1,1,1)
}
SubShader
{
Tags { "RenderType"="Opaque"}
LOD 300
CGPROGRAM
#pragma surface surf BlinnPhong
#pragma multi_compile __ MIRROR_RECURSION
#include "UnityCG.cginc"
fixed4 _Color;
fixed4 _ReflectionColor;
half _SpecularArea;
half _SpecularIntensity;
sampler2D _MainTex;
sampler2D _DetailTex;
sampler2D _BumpMap;
struct Input
{
float2 uv_DetailTex;
float2 uv_BumpMap;
float4 screenPos;
};
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 detail = tex2D(_DetailTex, IN.uv_DetailTex);
#if MIRROR_RECURSION
fixed4 refl = tex2D(_MainTex, IN.uv_DetailTex);
#else
IN.screenPos.w = max(0.001, IN.screenPos.w);
fixed4 refl = tex2Dproj(_MainTex, UNITY_PROJ_COORD(IN.screenPos));
#endif
o.Albedo = detail.rgb * _Color.rgb;
o.Alpha = 1;
o.Specular = 1.0f - _SpecularArea;
o.Gloss = _SpecularIntensity;
o.Emission = refl.rgb * _ReflectionColor.rgb;
o.Normal = UnpackNormal(tex2D (_BumpMap, IN.uv_BumpMap));
}
ENDCG
}
FallBack "Reflective/Specular"
}
\ No newline at end of file
fileFormatVersion: 2
guid: 46d5611267502e3468d1430b2fdbd316
timeCreated: 1432866229
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Custom/MirrorOld"
{
Properties
{
_DetailTex ("Base (RGB)", 2D) = "white" {}
[HideInInspector] _MainTex ("", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f
{
float2 uv : TEXCOORD0;
float4 refl : TEXCOORD1;
float4 pos : SV_POSITION;
};
float4 _DetailTex_ST;
v2f vert(float4 pos : POSITION, float2 uv : TEXCOORD0)
{
v2f o;
o.pos = UnityObjectToClipPos (pos);
o.uv = TRANSFORM_TEX(uv, _DetailTex);
o.refl = ComputeScreenPos (o.pos);
return o;
}
sampler2D _MainTex;
sampler2D _DetailTex;
fixed4 frag(v2f i) : SV_Target
{
fixed4 tex = tex2D(_DetailTex, i.uv);
i.refl.w = max(0.001, i.refl.w);
fixed4 refl = tex2Dproj(_MainTex, UNITY_PROJ_COORD(i.refl));
return tex * refl;
}
ENDCG
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: f8f27710acee93241a41ce46a5b106bf
timeCreated: 1433180129
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: fda2acf1bd029a24dab1b86bbac260e1
timeCreated: 1429065244
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 483fa56b44d017444ac0c6010bc08b47
timeCreated: 1432866413
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 1
externalNormalMap: 1
heightScale: .100000001
normalMapFilter: 1
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: 1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
Magic Mirror, by Jeff Johnson, CEO Digital Ruby, LLC
http://www.digitalruby.com
Version: 1.2.0
Magic Mirror is a very realistic mirror effect for Unity.
A demonstration prefab is included with a mirror frame, as well as a crack to give you an idea of how to construct a mirror. When loading this prefab into your scene, you may want to copy and paste it, or break the prefab so that you can customize your own mirror how you like. The crack and frame are entirely optional, and are just added for extra effect. If you don't like them, simply delete them.
MirrorScript.cs controls handling of the mirror render texture as well as dealing with how the mirror camera behaves. The script supports any rotation of the mirror, so you can have it face up, down, sideways, rotated however you want.
The mirror material uses a custom shader with a number of parameters that control how the mirror renders.
- _MainTex ("", 2D) = "black" {}
This texture is set by MirrorScript.cs to show a reflection. It is possible to not use MirrorScript.cs and supply your own texture if you want to really make a magic mirror, such as a camera in another part of your scene, or a static texture of your choice. In this case, leave _MainTex null and set _DetailTex to your render texture or other texture.
- _DetailTex ("Detail Texture (RGB)", 2D) = "white" {}
This texture can give the mirror a silvery / filmy like overlay, and is entirely optional. The supplied prefab sets this to a silvery / filmy texture. If you have removed the MirrorScript.cs file and are supplying your own texture, make sure to set _DetailTex, and NOT _MainTex, _MainTex should be null if you are supplying your own mirror texture (like your own camera somewhere else in the scene).
- _Color ("Detail Tint Color", Color) = (1,1,1,1)
Controls tinting of the _DetailTex parameter. For a mostly shiny mirror, you would want to keep this to a mostly black color. If you want the reflection to be barely visible and have the detail texture show more, you can change this to a mostly white color. Should you be supplying your own mirror texture and disabled MirrorScript.cs, you'll probably want the tint color mostly white.
- _SpecColor ("Specular Color", Color) = (1,1,1,1)
Tints the color of light as it reflects off of the mirror
- _SpecularArea ("Specular Area", Range (0, 0.99)) = 0.1
How much the total surface area of the mirror reflects light. The larger the value, the more the surface reflects light. Higher values cause the entire mirror to reflect light, while smaller values keep the majority of the reflection to the point of the mirror that the light impacts most.
- _SpecularIntensity ("Specular Intensity", Range (0, 1)) = 0.75
The reflectivity of light off the mirror. The higher the value, the more the mirror will reflect light off and give a more blinding like effect.
- _ReflectionColor ("Reflection Tint Color", Color) = (1,1,1,1)
Allows tinting of the reflection (_MainTex)
Limitations / Other Tidbits:
- Magic Mirror works well as long as there isn't another magic mirror in the visible plane of another magic mirror. For proper mirror recursion, see Magic Mirror Pro: https://www.assetstore.unity3d.com/en/#!/content/103687?aid=1011lGnL
- Water refuses to play nice with this, and so for now, the water layer will not be rendered inside mirrors.
- Magic Mirror can be performance intensive, especially if placed outdoors or in scenes with lots of lights or other effects. To reduce performance problems, you can tweak the MaximumPerPixelLights parameter to be lower.
- Magic Mirror works best on quads, and it's best to stick with the prefab object and customize it as needed.
Contact Me:
I am always very willing to answer any other questions you may have. Please contact me at jjxtra@gmail.com and I'll be happy to help you with Magic Mirror.
If you need more than one mirror and/or recursive reflections that support water, get Magic Mirror Pro: Recursive edition
https://www.assetstore.unity3d.com/en/#!/content/103687?aid=1011lGnL
Thanks!
- Jeff
fileFormatVersion: 2
guid: 2211d1d7055b37f46bb170e9eaf9a4af
timeCreated: 1429159464
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -59,7 +59,7 @@ AnimatorStateMachine:
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 1102447597006780576}
m_Position: {x: 200, y: 0, z: 0}
m_Position: {x: 228, y: 72, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ModelTestCode : MonoBehaviour
{
[SerializeField] private Material mat;
[SerializeField] public static int count = 0;
public int number;
public Renderer mirrorReflect;
// Start is called before the first frame update
void Start()
{
number = count++;
mat = new Material(Shader.Find("Custom/Mirror"));
mirrorReflect.materials[0] = mat;
}
// Update is called once per frame
void Update()
{
}
}
fileFormatVersion: 2
guid: fe3b19b1fce79e04989fc513e331d61d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 449b2ca4d925da541bb45c84b63aab98
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -10,8 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 1244481854741161101}
- component: {fileID: 1244481854741161102}
- component: {fileID: 1244481854741161100}
m_Layer: 0
m_Layer: 9
m_Name: Reflection Probe
m_TagString: Untagged
m_Icon: {fileID: 0}
......@@ -26,7 +25,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1244481854741161103}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 0.568, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1244481854748242454}
......@@ -65,21 +64,6 @@ ReflectionProbe:
m_UseOcclusionCulling: 1
m_Importance: 1
m_CustomBakedTexture: {fileID: 0}
--- !u!114 &1244481854741161100
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1244481854741161103}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e1dd51c2faa2bf14a9c711dadc76f117, type: 3}
m_Name:
m_EditorClassIdentifier:
direction: 0
mirror: {fileID: 1244481854748242454}
mainCam: {fileID: 0}
--- !u!1 &1244481854748732982
GameObject:
m_ObjectHideFlags: 0
......@@ -94,7 +78,8 @@ GameObject:
- component: {fileID: 2694312363380670797}
- component: {fileID: 7225251243996645269}
- component: {fileID: 17874052963739924}
m_Layer: 0
- component: {fileID: 1188277518114524885}
m_Layer: 9
m_Name: mirror
m_TagString: wall
m_Icon: {fileID: 0}
......@@ -205,3 +190,19 @@ MonoBehaviour:
mapPos: {x: 0, y: 0}
len: 1
type: 2
--- !u!114 &1188277518114524885
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1244481854748732982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e1dd51c2faa2bf14a9c711dadc76f117, type: 3}
m_Name:
m_EditorClassIdentifier:
direction: 0
mirror: {fileID: 0}
probe: {fileID: 1244481854741161101}
mainCam: {fileID: 0}
......@@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 5992419591198202452}
- component: {fileID: 1788580750165913660}
- component: {fileID: 2953616027608884528}
m_Layer: 0
m_Layer: 9
m_Name: wall
m_TagString: wall
m_Icon: {fileID: 0}
......
fileFormatVersion: 2
guid: 449b2ca4d925da541bb45c84b63aab98
guid: 82929a89b7e0e464991daba748cb2b6e
PrefabImporter:
externalObjects: {}
userData:
......
fileFormatVersion: 2
guid: 4ea1f6c8373c4484faa04e687403d543
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5956712601806148718
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5956712601805655926}
- component: {fileID: 5956712601794644638}
- component: {fileID: 5956712601806075721}
m_Layer: 0
m_Name: Mirror
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5956712601805655926
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806148718}
m_LocalRotation: {x: -0, y: -0.7071067, z: -0, w: 0.70710695}
m_LocalPosition: {x: -3.43, y: 0.44306278, z: 3.59}
m_LocalScale: {x: 8, y: 8, z: 8}
m_Children:
- {fileID: 5956712601805702164}
- {fileID: 5956712601805658424}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: -90.00001, z: 0}
--- !u!114 &5956712601794644638
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806148718}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 77b7fc7cdbba2b4489915a8923a46f91, type: 3}
m_Name:
m_EditorClassIdentifier:
MaximumPerPixelLights: 2
TextureSize: 768
ClipPlaneOffset: 0.07
FarClipPlane: 1000
ReflectLayers:
serializedVersion: 2
m_Bits: 4294967295
AddFlareLayer: 0
NormalIsForward: 1
AspectRatio: 1.5
MirrorRecursion: 0
--- !u!114 &5956712601806075721
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806148718}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe3b19b1fce79e04989fc513e331d61d, type: 3}
m_Name:
m_EditorClassIdentifier:
mat: {fileID: 0}
number: 0
mirrorReflect: {fileID: 5956712601803703382}
--- !u!1 &5956712601806149758
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5956712601805658424}
- component: {fileID: 5956712601802840444}
- component: {fileID: 5956712601808049896}
- component: {fileID: 5956712601794709352}
- component: {fileID: 5956712601803703382}
m_Layer: 0
m_Name: MirrorReflection
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5956712601805658424
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806149758}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5956712601805655926}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &5956712601802840444
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806149758}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!64 &5956712601808049896
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806149758}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 3
m_Convex: 0
m_CookingOptions: 14
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &5956712601794709352
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806149758}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d8a68502eb355794680af8e3cae39702, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!23 &5956712601803703382
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806149758}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 232c0653700ee46418c8a4a6f0402d92, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!1 &5956712601806174550
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5956712601805702164}
- component: {fileID: 5956712601804180398}
- component: {fileID: 5956712601810028292}
- component: {fileID: 5956712601794653076}
m_Layer: 0
m_Name: MirrorCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5956712601805702164
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806174550}
m_LocalRotation: {x: 0, y: 1, z: 0, w: -0.00000016292068}
m_LocalPosition: {x: 0, y: 0, z: -0.1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5956712601805655926}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &5956712601804180398
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806174550}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!45 &5956712601810028292
Skybox:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806174550}
m_Enabled: 1
m_CustomSkybox: {fileID: 0}
--- !u!114 &5956712601794653076
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5956712601806174550}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d31f93e447eac7b45971505a2891c813, type: 3}
m_Name:
m_EditorClassIdentifier:
MirrorObject: {fileID: 5956712601806149758}
VRMode: 0
fileFormatVersion: 2
guid: 6cee9ce2ee605c54c957dc68c69cea90
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
......@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 170076734}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
......
......@@ -11,16 +11,21 @@ public class MirrorReflect : MonoBehaviour
private Direction direction = Direction.X;
public Transform mirror;
public Transform probe;
public Transform mainCam;
private float offset;
private Vector3 probePos;
// Update is called once per frame
void Update()
private void Start()
{
mirror = gameObject.transform;
mainCam = Camera.main.transform; // find main camera
}
// Update is called once per frame
void Update()
{
if (direction == Direction.X)
{
offset = mirror.position.x - mainCam.position.x;
......@@ -38,6 +43,17 @@ public class MirrorReflect : MonoBehaviour
probePos.z = mirror.position.z + offset;
}
transform.position = probePos;
probe.position = probePos;
if (GetComponent<Renderer>().isVisible)
{
Debug.Log("visible");
gameObject.layer = 9;
}
else
{
Debug.Log("invisible");
gameObject.layer = 0;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment