v1.0.0
This commit is contained in:
Коммит
f314a97a96
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9d5725e51a459904183d368e565e53f1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fcb06e68a19a3d24db09bfb621fbf136
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,41 @@
|
|||
Shader "Unlit/GreyScaleShader" {
|
||||
Properties{
|
||||
_MainTex("Texture", 2D) = "white" { }
|
||||
}
|
||||
SubShader{
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert(appdata_base v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : COLOR
|
||||
{
|
||||
float texcol_a = tex2D(_MainTex, i.uv).a;
|
||||
return fixed4(texcol_a, texcol_a, texcol_a, 1.0f);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback "VertexLit"
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c2722ab374f36be47809aa8464dc7e88
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,94 @@
|
|||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "AR/HolographicImageBlendGrayscaleShader"
|
||||
{
|
||||
// Referring to https://forum.unity3d.com/threads/holographic-photo-blending-with-photocapture.416023/.
|
||||
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
_VignetteScale ("Vignette Scale", RANGE(0,2)) = 0
|
||||
_VignetteOffset ("Vignette Offset" , Vector) = (0,0,0,0)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertexPositionInProjectionSpace : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexInProjectionSpace : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4x4 _WorldToCameraMatrix;
|
||||
float4x4 _CameraProjectionMatrix;
|
||||
float _VignetteScale;
|
||||
float4 _VignetteOffset;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertexPositionInProjectionSpace = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
// Calculate the vertex position in world space.
|
||||
float4 vertexPositionInWorldSpace = mul(unity_ObjectToWorld, float4(v.vertex.xyz,1));
|
||||
// Now take the world space vertex position and transform it so that
|
||||
// it is relative to the physical web camera on the HoloLens.
|
||||
float4 vertexPositionInCameraSpace = mul(_WorldToCameraMatrix, float4(vertexPositionInWorldSpace.xyz,1));
|
||||
|
||||
// Convert our camera relative vertex into clip space.
|
||||
o.vertexInProjectionSpace = mul(_CameraProjectionMatrix, float4(vertexPositionInCameraSpace.xyz, 1.0));
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
// Transform the vertex into normalized coordinate space. Basically
|
||||
// we want to map where our vertex should be on the screen into the -1 to 1 range
|
||||
// for both the x and y axes.
|
||||
float2 signedUV = i.vertexInProjectionSpace.xy / i.vertexInProjectionSpace.w;
|
||||
|
||||
// The HoloLens uses an additive display so the color black will
|
||||
// be transparent. If the texture is smaller than the canvas, color the extra
|
||||
// area on the canvas black so it will be transparent on the HoloLens.
|
||||
if(abs(signedUV.x) > 1.0 || abs(signedUV.y) > 1.0)
|
||||
{
|
||||
return fixed4( 0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
// Currently our signedUV's x and y coordinates will fall between -1 and 1.
|
||||
// We need to map this range from 0 to 1 so that we can sample our texture.
|
||||
float2 uv = signedUV * 0.5 + float2(0.5, 0.5);
|
||||
float texcol_a = tex2D(_MainTex, uv).a;
|
||||
fixed4 finalColor = fixed4(texcol_a, texcol_a, texcol_a, 1.0f);
|
||||
|
||||
// Finally add a circular vignette effect starting from the center
|
||||
// of the image.
|
||||
signedUV.x = signedUV.x + _VignetteOffset.x*2;
|
||||
signedUV.y = signedUV.y + _VignetteOffset.y*2;
|
||||
finalColor *= 1.0 -(length(signedUV) * _VignetteScale);
|
||||
|
||||
return finalColor;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bfd38a7c0f219d04cbb85cccd67e6c24
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,31 @@
|
|||
%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: holographicImageBlendGrayscale_material
|
||||
m_Shader: {fileID: 4800000, guid: bfd38a7c0f219d04cbb85cccd67e6c24, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _VignetteScale: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _VignetteOffset: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9e3e5b82a75e3bf49af73e300e782fc4
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,92 @@
|
|||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "AR/HolographicImageBlendShader"
|
||||
{
|
||||
// Referring to https://forum.unity3d.com/threads/holographic-photo-blending-with-photocapture.416023/.
|
||||
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
_VignetteScale ("Vignette Scale", RANGE(0,2)) = 0
|
||||
_VignetteOffset ("Vignette Offset" , Vector) = (0,0,0,0)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertexPositionInProjectionSpace : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertexInProjectionSpace : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4x4 _WorldToCameraMatrix;
|
||||
float4x4 _CameraProjectionMatrix;
|
||||
float _VignetteScale;
|
||||
float4 _VignetteOffset;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertexPositionInProjectionSpace = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
// Calculate the vertex position in world space.
|
||||
float4 vertexPositionInWorldSpace = mul(unity_ObjectToWorld, float4(v.vertex.xyz,1));
|
||||
// Now take the world space vertex position and transform it so that
|
||||
// it is relative to the physical web camera on the HoloLens.
|
||||
float4 vertexPositionInCameraSpace = mul(_WorldToCameraMatrix, float4(vertexPositionInWorldSpace.xyz,1));
|
||||
|
||||
// Convert our camera relative vertex into clip space.
|
||||
o.vertexInProjectionSpace = mul(_CameraProjectionMatrix, float4(vertexPositionInCameraSpace.xyz, 1.0));
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
// Transform the vertex into normalized coordinate space. Basically
|
||||
// we want to map where our vertex should be on the screen into the -1 to 1 range
|
||||
// for both the x and y axes.
|
||||
float2 signedUV = i.vertexInProjectionSpace.xy / i.vertexInProjectionSpace.w;
|
||||
|
||||
// The HoloLens uses an additive display so the color black will
|
||||
// be transparent. If the texture is smaller than the canvas, color the extra
|
||||
// area on the canvas black so it will be transparent on the HoloLens.
|
||||
if(abs(signedUV.x) > 1.0 || abs(signedUV.y) > 1.0)
|
||||
{
|
||||
return fixed4( 0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
// Currently our signedUV's x and y coordinates will fall between -1 and 1.
|
||||
// We need to map this range from 0 to 1 so that we can sample our texture.
|
||||
float2 uv = signedUV * 0.5 + float2(0.5, 0.5);
|
||||
fixed4 finalColor = tex2D(_MainTex, uv);
|
||||
|
||||
// Finally add a circular vignette effect starting from the center
|
||||
// of the image.
|
||||
signedUV.x = signedUV.x + _VignetteOffset.x*2;
|
||||
signedUV.y = signedUV.y + _VignetteOffset.y*2;
|
||||
finalColor *= 1.0 -(length(signedUV) * _VignetteScale);
|
||||
|
||||
return finalColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b9b32109bf3c6dd4fa82b185590d4728
|
||||
timeCreated: 1484969656
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,30 @@
|
|||
%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: holographicImageBlend_material
|
||||
m_Shader: {fileID: 4800000, guid: b9b32109bf3c6dd4fa82b185590d4728, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _VignetteScale: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _VignetteOffset: {r: 0, g: 0, b: 0, a: 0}
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: aed621489774212488cb7b4e9d659c34
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,31 @@
|
|||
%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: quadGrayscale_material
|
||||
m_Shader: {fileID: 4800000, guid: c2722ab374f36be47809aa8464dc7e88, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _VignetteScale: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _VignetteOffset: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d7b0d8921623a7f49b0a11d00fdb830a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,30 @@
|
|||
%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: quad_material
|
||||
m_Shader: {fileID: 10752, 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:
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: e266aedc629209a4196966ac4bf20d68, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _VignetteScale: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _VignetteOffset: {r: 0, g: 0, b: 0, a: 0}
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c6c794685b86d5f4aa546d153e837e53
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: aa1227c7b338a8e40a14f70bf54802d3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 94ecd811915c80f489f4ad542aedb8dc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cd0b40f22390c654db38e60cfd8a1e97
|
||||
folderAsset: yes
|
||||
timeCreated: 1491840432
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e5190298c0cd1f84cae4a70175b168cb
|
||||
folderAsset: yes
|
||||
timeCreated: 1491840432
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,34 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: eff_glitter_2
|
||||
m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: edeb7e83eb5c79141b277485fc394ef1, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _InvFade
|
||||
second: 1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _TintColor
|
||||
second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5e3be67cd26a8c84f8591311788878bf
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,34 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: eff_par_1
|
||||
m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 9d8517a79e5109340bc294b1c416e958, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _InvFade
|
||||
second: 1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _TintColor
|
||||
second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cae24ebfe28432740ae25bcaa9ac5f7a
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,34 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: eff_smoke_2
|
||||
m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 505d04466eb65ad4da367a7a848684d0, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _InvFade
|
||||
second: 1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _TintColor
|
||||
second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0f9f987fb21af65448ae4f41bd90ca13
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2eba0944667b64844a060df4fd29f688
|
||||
folderAsset: yes
|
||||
timeCreated: 1491840432
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0ff7fb238b264d249b06d5faab227e44
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 74126a4cb7422f9459ea3670cfcb6a50
|
||||
folderAsset: yes
|
||||
timeCreated: 1491840432
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Двоичные данные
Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealARHeadExample/AR/EyeLaser/Textures/Eff_Glitter2.png
Normal file
Двоичные данные
Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealARHeadExample/AR/EyeLaser/Textures/Eff_Glitter2.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 22 KiB |
|
@ -0,0 +1,47 @@
|
|||
fileFormatVersion: 2
|
||||
guid: edeb7e83eb5c79141b277485fc394ef1
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
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
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 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: 5
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
Двоичные данные
Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealARHeadExample/AR/EyeLaser/Textures/Eff_smoke_1.png
Normal file
Двоичные данные
Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealARHeadExample/AR/EyeLaser/Textures/Eff_smoke_1.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 34 KiB |
|
@ -0,0 +1,47 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 505d04466eb65ad4da367a7a848684d0
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
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
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 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: 5
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
Двоичные данные
Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealARHeadExample/AR/EyeLaser/Textures/eff_par_1.tga
Normal file
Двоичные данные
Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealARHeadExample/AR/EyeLaser/Textures/eff_par_1.tga
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 192 KiB |
|
@ -0,0 +1,51 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9d8517a79e5109340bc294b1c416e958
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
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
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: 0
|
||||
aniso: 0
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 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: 5
|
||||
buildTargetSettings:
|
||||
- buildTarget: iPhone
|
||||
maxTextureSize: 1024
|
||||
textureFormat: 32
|
||||
compressionQuality: 50
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 62b63665d2a3c874a80fab508e64879d
|
||||
folderAsset: yes
|
||||
timeCreated: 1491840432
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,175 @@
|
|||
%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: axes_x_material
|
||||
m_Shader: {fileID: 4800000, guid: 9e8dc7d6627895842b0b4a0d26e4ad21, type: 3}
|
||||
m_ShaderKeywords: _DIRECTIONAL_LIGHT _DISABLE_ALBEDO_MAP _GLOSSYREFLECTIONS_OFF
|
||||
_HOVER_LIGHT _PROXIMITY_LIGHT _SPECULARHIGHLIGHTS_OFF _SPECULAR_HIGHLIGHTS
|
||||
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}
|
||||
- _ChannelMap:
|
||||
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}
|
||||
- _IridescentSpectrumMap:
|
||||
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}
|
||||
- _NormalMap:
|
||||
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:
|
||||
- _AlbedoAlphaMode: 0
|
||||
- _AlbedoAssignedAtRuntime: 0
|
||||
- _BlendOp: 0
|
||||
- _BlendedClippingWidth: 1
|
||||
- _BorderLight: 0
|
||||
- _BorderLightOpaque: 0
|
||||
- _BorderLightOpaqueAlpha: 1
|
||||
- _BorderLightReplacesAlbedo: 0
|
||||
- _BorderLightUsesHoverColor: 0
|
||||
- _BorderMinValue: 0.1
|
||||
- _BorderWidth: 0.1
|
||||
- _BumpScale: 1
|
||||
- _ClippingBorder: 0
|
||||
- _ClippingBorderWidth: 0.025
|
||||
- _ColorWriteMask: 15
|
||||
- _CullMode: 2
|
||||
- _CustomMode: 0
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DirectionalLight: 1
|
||||
- _DstBlend: 0
|
||||
- _EdgeSmoothingValue: 0.002
|
||||
- _EnableChannelMap: 0
|
||||
- _EnableEmission: 0
|
||||
- _EnableHoverColorOverride: 0
|
||||
- _EnableLocalSpaceTriplanarMapping: 0
|
||||
- _EnableNormalMap: 0
|
||||
- _EnableProximityLightColorOverride: 0
|
||||
- _EnableTriplanarMapping: 0
|
||||
- _EnvironmentColorIntensity: 0.5
|
||||
- _EnvironmentColorThreshold: 1.5
|
||||
- _EnvironmentColoring: 0
|
||||
- _FadeBeginDistance: 0.85
|
||||
- _FadeCompleteDistance: 0.5
|
||||
- _FadeMinValue: 0
|
||||
- _FluentLightIntensity: 1
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _HoverLight: 1
|
||||
- _IgnoreZScale: 0
|
||||
- _InnerGlow: 0
|
||||
- _InnerGlowPower: 4
|
||||
- _InstancedColor: 0
|
||||
- _Iridescence: 0
|
||||
- _IridescenceAngle: -0.78
|
||||
- _IridescenceIntensity: 0.5
|
||||
- _IridescenceThreshold: 0.05
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _NearLightFade: 0
|
||||
- _NearPlaneFade: 0
|
||||
- _NormalMapScale: 1
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _ProximityLight: 1
|
||||
- _ProximityLightSubtractive: 0
|
||||
- _ProximityLightTwoSided: 0
|
||||
- _Reflections: 0
|
||||
- _Refraction: 0
|
||||
- _RefractiveIndex: 0
|
||||
- _RenderQueueOverride: -1
|
||||
- _RimLight: 0
|
||||
- _RimPower: 0.25
|
||||
- _RoundCornerMargin: 0.01
|
||||
- _RoundCornerRadius: 0.25
|
||||
- _RoundCorners: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SphericalHarmonics: 0
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComparison: 0
|
||||
- _StencilOperation: 0
|
||||
- _StencilReference: 0
|
||||
- _TriplanarMappingBlendSharpness: 4
|
||||
- _UVSec: 0
|
||||
- _VertexColors: 0
|
||||
- _VertexExtrusion: 0
|
||||
- _VertexExtrusionSmoothNormals: 0
|
||||
- _VertexExtrusionValue: 0
|
||||
- _ZOffsetFactor: 0
|
||||
- _ZOffsetUnits: 0
|
||||
- _ZTest: 4
|
||||
- _ZWrite: 1
|
||||
- _node_2675: 1.5
|
||||
- _node_3534: 1
|
||||
m_Colors:
|
||||
- _ClippingBorderColor: {r: 1, g: 0.2, b: 0, a: 1}
|
||||
- _Color: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EnvironmentColorX: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _EnvironmentColorY: {r: 0, g: 1, b: 0, a: 1}
|
||||
- _EnvironmentColorZ: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _HoverColorOverride: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _InnerGlowColor: {r: 1, g: 1, b: 1, a: 0.75}
|
||||
- _ProximityLightCenterColorOverride: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _ProximityLightMiddleColorOverride: {r: 0, g: 1, b: 0, a: 0.5}
|
||||
- _ProximityLightOuterColorOverride: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _RimColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
- _node_5051: {r: 1, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bf7df81430281864b8bf32a806666b20
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,175 @@
|
|||
%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: axes_y_material
|
||||
m_Shader: {fileID: 4800000, guid: 9e8dc7d6627895842b0b4a0d26e4ad21, type: 3}
|
||||
m_ShaderKeywords: _DIRECTIONAL_LIGHT _DISABLE_ALBEDO_MAP _GLOSSYREFLECTIONS_OFF
|
||||
_HOVER_LIGHT _PROXIMITY_LIGHT _SPECULARHIGHLIGHTS_OFF _SPECULAR_HIGHLIGHTS
|
||||
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}
|
||||
- _ChannelMap:
|
||||
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}
|
||||
- _IridescentSpectrumMap:
|
||||
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}
|
||||
- _NormalMap:
|
||||
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:
|
||||
- _AlbedoAlphaMode: 0
|
||||
- _AlbedoAssignedAtRuntime: 0
|
||||
- _BlendOp: 0
|
||||
- _BlendedClippingWidth: 1
|
||||
- _BorderLight: 0
|
||||
- _BorderLightOpaque: 0
|
||||
- _BorderLightOpaqueAlpha: 1
|
||||
- _BorderLightReplacesAlbedo: 0
|
||||
- _BorderLightUsesHoverColor: 0
|
||||
- _BorderMinValue: 0.1
|
||||
- _BorderWidth: 0.1
|
||||
- _BumpScale: 1
|
||||
- _ClippingBorder: 0
|
||||
- _ClippingBorderWidth: 0.025
|
||||
- _ColorWriteMask: 15
|
||||
- _CullMode: 2
|
||||
- _CustomMode: 0
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DirectionalLight: 1
|
||||
- _DstBlend: 0
|
||||
- _EdgeSmoothingValue: 0.002
|
||||
- _EnableChannelMap: 0
|
||||
- _EnableEmission: 0
|
||||
- _EnableHoverColorOverride: 0
|
||||
- _EnableLocalSpaceTriplanarMapping: 0
|
||||
- _EnableNormalMap: 0
|
||||
- _EnableProximityLightColorOverride: 0
|
||||
- _EnableTriplanarMapping: 0
|
||||
- _EnvironmentColorIntensity: 0.5
|
||||
- _EnvironmentColorThreshold: 1.5
|
||||
- _EnvironmentColoring: 0
|
||||
- _FadeBeginDistance: 0.85
|
||||
- _FadeCompleteDistance: 0.5
|
||||
- _FadeMinValue: 0
|
||||
- _FluentLightIntensity: 1
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _HoverLight: 1
|
||||
- _IgnoreZScale: 0
|
||||
- _InnerGlow: 0
|
||||
- _InnerGlowPower: 4
|
||||
- _InstancedColor: 0
|
||||
- _Iridescence: 0
|
||||
- _IridescenceAngle: -0.78
|
||||
- _IridescenceIntensity: 0.5
|
||||
- _IridescenceThreshold: 0.05
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _NearLightFade: 0
|
||||
- _NearPlaneFade: 0
|
||||
- _NormalMapScale: 1
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _ProximityLight: 1
|
||||
- _ProximityLightSubtractive: 0
|
||||
- _ProximityLightTwoSided: 0
|
||||
- _Reflections: 0
|
||||
- _Refraction: 0
|
||||
- _RefractiveIndex: 0
|
||||
- _RenderQueueOverride: -1
|
||||
- _RimLight: 0
|
||||
- _RimPower: 0.25
|
||||
- _RoundCornerMargin: 0.01
|
||||
- _RoundCornerRadius: 0.25
|
||||
- _RoundCorners: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SphericalHarmonics: 0
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComparison: 0
|
||||
- _StencilOperation: 0
|
||||
- _StencilReference: 0
|
||||
- _TriplanarMappingBlendSharpness: 4
|
||||
- _UVSec: 0
|
||||
- _VertexColors: 0
|
||||
- _VertexExtrusion: 0
|
||||
- _VertexExtrusionSmoothNormals: 0
|
||||
- _VertexExtrusionValue: 0
|
||||
- _ZOffsetFactor: 0
|
||||
- _ZOffsetUnits: 0
|
||||
- _ZTest: 4
|
||||
- _ZWrite: 1
|
||||
- _node_2675: 1.5
|
||||
- _node_3534: 1
|
||||
m_Colors:
|
||||
- _ClippingBorderColor: {r: 1, g: 0.2, b: 0, a: 1}
|
||||
- _Color: {r: 0, g: 1, b: 0, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EnvironmentColorX: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _EnvironmentColorY: {r: 0, g: 1, b: 0, a: 1}
|
||||
- _EnvironmentColorZ: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _HoverColorOverride: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _InnerGlowColor: {r: 1, g: 1, b: 1, a: 0.75}
|
||||
- _ProximityLightCenterColorOverride: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _ProximityLightMiddleColorOverride: {r: 0, g: 1, b: 0, a: 0.5}
|
||||
- _ProximityLightOuterColorOverride: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _RimColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
- _node_5051: {r: 0, g: 1, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 43285e232533ac74496547f963f62d20
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,175 @@
|
|||
%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: axes_z_material
|
||||
m_Shader: {fileID: 4800000, guid: 9e8dc7d6627895842b0b4a0d26e4ad21, type: 3}
|
||||
m_ShaderKeywords: _DIRECTIONAL_LIGHT _DISABLE_ALBEDO_MAP _GLOSSYREFLECTIONS_OFF
|
||||
_HOVER_LIGHT _PROXIMITY_LIGHT _SPECULARHIGHLIGHTS_OFF _SPECULAR_HIGHLIGHTS
|
||||
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}
|
||||
- _ChannelMap:
|
||||
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}
|
||||
- _IridescentSpectrumMap:
|
||||
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}
|
||||
- _NormalMap:
|
||||
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:
|
||||
- _AlbedoAlphaMode: 0
|
||||
- _AlbedoAssignedAtRuntime: 0
|
||||
- _BlendOp: 0
|
||||
- _BlendedClippingWidth: 1
|
||||
- _BorderLight: 0
|
||||
- _BorderLightOpaque: 0
|
||||
- _BorderLightOpaqueAlpha: 1
|
||||
- _BorderLightReplacesAlbedo: 0
|
||||
- _BorderLightUsesHoverColor: 0
|
||||
- _BorderMinValue: 0.1
|
||||
- _BorderWidth: 0.1
|
||||
- _BumpScale: 1
|
||||
- _ClippingBorder: 0
|
||||
- _ClippingBorderWidth: 0.025
|
||||
- _ColorWriteMask: 15
|
||||
- _CullMode: 2
|
||||
- _CustomMode: 0
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DirectionalLight: 1
|
||||
- _DstBlend: 0
|
||||
- _EdgeSmoothingValue: 0.002
|
||||
- _EnableChannelMap: 0
|
||||
- _EnableEmission: 0
|
||||
- _EnableHoverColorOverride: 0
|
||||
- _EnableLocalSpaceTriplanarMapping: 0
|
||||
- _EnableNormalMap: 0
|
||||
- _EnableProximityLightColorOverride: 0
|
||||
- _EnableTriplanarMapping: 0
|
||||
- _EnvironmentColorIntensity: 0.5
|
||||
- _EnvironmentColorThreshold: 1.5
|
||||
- _EnvironmentColoring: 0
|
||||
- _FadeBeginDistance: 0.85
|
||||
- _FadeCompleteDistance: 0.5
|
||||
- _FadeMinValue: 0
|
||||
- _FluentLightIntensity: 1
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _HoverLight: 1
|
||||
- _IgnoreZScale: 0
|
||||
- _InnerGlow: 0
|
||||
- _InnerGlowPower: 4
|
||||
- _InstancedColor: 0
|
||||
- _Iridescence: 0
|
||||
- _IridescenceAngle: -0.78
|
||||
- _IridescenceIntensity: 0.5
|
||||
- _IridescenceThreshold: 0.05
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _NearLightFade: 0
|
||||
- _NearPlaneFade: 0
|
||||
- _NormalMapScale: 1
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _ProximityLight: 1
|
||||
- _ProximityLightSubtractive: 0
|
||||
- _ProximityLightTwoSided: 0
|
||||
- _Reflections: 0
|
||||
- _Refraction: 0
|
||||
- _RefractiveIndex: 0
|
||||
- _RenderQueueOverride: -1
|
||||
- _RimLight: 0
|
||||
- _RimPower: 0.25
|
||||
- _RoundCornerMargin: 0.01
|
||||
- _RoundCornerRadius: 0.25
|
||||
- _RoundCorners: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SphericalHarmonics: 0
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComparison: 0
|
||||
- _StencilOperation: 0
|
||||
- _StencilReference: 0
|
||||
- _TriplanarMappingBlendSharpness: 4
|
||||
- _UVSec: 0
|
||||
- _VertexColors: 0
|
||||
- _VertexExtrusion: 0
|
||||
- _VertexExtrusionSmoothNormals: 0
|
||||
- _VertexExtrusionValue: 0
|
||||
- _ZOffsetFactor: 0
|
||||
- _ZOffsetUnits: 0
|
||||
- _ZTest: 4
|
||||
- _ZWrite: 1
|
||||
- _node_2675: 1.5
|
||||
- _node_3534: 1
|
||||
m_Colors:
|
||||
- _ClippingBorderColor: {r: 1, g: 0.2, b: 0, a: 1}
|
||||
- _Color: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EnvironmentColorX: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _EnvironmentColorY: {r: 0, g: 1, b: 0, a: 1}
|
||||
- _EnvironmentColorZ: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _HoverColorOverride: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _InnerGlowColor: {r: 1, g: 1, b: 1, a: 0.75}
|
||||
- _ProximityLightCenterColorOverride: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _ProximityLightMiddleColorOverride: {r: 0, g: 1, b: 0, a: 0.5}
|
||||
- _ProximityLightOuterColorOverride: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _RimColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
- _node_5051: {r: 0, g: 0, b: 1, a: 1}
|
||||
m_BuildTextureStacks: []
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d5ede656d6b06bf46891f8996993709f
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,195 @@
|
|||
%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: head_material
|
||||
m_Shader: {fileID: 4800000, guid: 9e8dc7d6627895842b0b4a0d26e4ad21, type: 3}
|
||||
m_ShaderKeywords: _DIRECTIONAL_LIGHT _DISABLE_ALBEDO_MAP _HOVER_LIGHT _PROXIMITY_LIGHT
|
||||
_SPECULAR_HIGHLIGHTS _USEMAINTEX_ON
|
||||
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}
|
||||
- _ChannelMap:
|
||||
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}
|
||||
- _EmissionTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescentSpectrumMap:
|
||||
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}
|
||||
- _NormalMap:
|
||||
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:
|
||||
- _AlbedoAlphaMode: 0
|
||||
- _AlbedoAssignedAtRuntime: 0
|
||||
- _BlendOp: 0
|
||||
- _BlendedClippingWidth: 1
|
||||
- _BorderLight: 0
|
||||
- _BorderLightOpaque: 0
|
||||
- _BorderLightOpaqueAlpha: 1
|
||||
- _BorderLightReplacesAlbedo: 0
|
||||
- _BorderLightUsesHoverColor: 0
|
||||
- _BorderMinValue: 0.1
|
||||
- _BorderWidth: 0.1
|
||||
- _BumpScale: 1
|
||||
- _ClippingBorder: 0
|
||||
- _ClippingBorderWidth: 0.025
|
||||
- _ColorMask: 15
|
||||
- _ColorWriteMask: 15
|
||||
- _Cull: 2
|
||||
- _CullMode: 2
|
||||
- _CustomMode: 0
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DirectionalLight: 1
|
||||
- _DstBlend: 0
|
||||
- _EdgeSmoothingValue: 0.002
|
||||
- _EnableChannelMap: 0
|
||||
- _EnableEmission: 0
|
||||
- _EnableHoverColorOverride: 0
|
||||
- _EnableLocalSpaceTriplanarMapping: 0
|
||||
- _EnableNormalMap: 0
|
||||
- _EnableProximityLightColorOverride: 0
|
||||
- _EnableTriplanarMapping: 0
|
||||
- _EnvironmentColorIntensity: 0.5
|
||||
- _EnvironmentColorThreshold: 1.5
|
||||
- _EnvironmentColoring: 0
|
||||
- _FadeBeginDistance: 0.85
|
||||
- _FadeCompleteDistance: 0.5
|
||||
- _FadeMinValue: 0
|
||||
- _FluentLightIntensity: 1
|
||||
- _Gloss: 0.5
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _HoverLight: 1
|
||||
- _IgnoreZScale: 0
|
||||
- _InnerGlow: 0
|
||||
- _InnerGlowPower: 4
|
||||
- _InstancedColor: 0
|
||||
- _Iridescence: 0
|
||||
- _IridescenceAngle: -0.78
|
||||
- _IridescenceIntensity: 0.5
|
||||
- _IridescenceThreshold: 0.05
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _NearLightFade: 0
|
||||
- _NearPlaneFade: 0
|
||||
- _NormalMapScale: 1
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _ProximityLight: 1
|
||||
- _ProximityLightSubtractive: 0
|
||||
- _ProximityLightTwoSided: 0
|
||||
- _Reflections: 0
|
||||
- _Refraction: 0
|
||||
- _RefractiveIndex: 0
|
||||
- _RenderQueueOverride: -1
|
||||
- _RimLight: 0
|
||||
- _RimPower: 0.25
|
||||
- _RoundCornerMargin: 0.01
|
||||
- _RoundCornerRadius: 0.25
|
||||
- _RoundCorners: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _Specular: 0.5
|
||||
- _SpecularHighlights: 1
|
||||
- _SphericalHarmonics: 0
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilComparison: 0
|
||||
- _StencilOp: 0
|
||||
- _StencilOperation: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilReference: 0
|
||||
- _StencilWriteMask: 255
|
||||
- _TriplanarMappingBlendSharpness: 4
|
||||
- _UVSec: 0
|
||||
- _UseBumpMap: 0
|
||||
- _UseColor: 0
|
||||
- _UseEmissionTex: 0
|
||||
- _UseMainTex: 1
|
||||
- _VertexColors: 0
|
||||
- _VertexExtrusion: 0
|
||||
- _VertexExtrusionSmoothNormals: 0
|
||||
- _VertexExtrusionValue: 0
|
||||
- _WireThickness: 100
|
||||
- _ZOffsetFactor: 0
|
||||
- _ZOffsetUnits: 0
|
||||
- _ZTest: 4
|
||||
- _ZWrite: 1
|
||||
- _node_2675: 1.5
|
||||
- _node_3534: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _ClippingBorderColor: {r: 1, g: 0.2, b: 0, a: 1}
|
||||
- _Color: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EnvironmentColorX: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _EnvironmentColorY: {r: 0, g: 1, b: 0, a: 1}
|
||||
- _EnvironmentColorZ: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _HoverColorOverride: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _InnerGlowColor: {r: 1, g: 1, b: 1, a: 0.75}
|
||||
- _ProximityLightCenterColorOverride: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _ProximityLightMiddleColorOverride: {r: 0, g: 1, b: 0, a: 0.5}
|
||||
- _ProximityLightOuterColorOverride: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _RimColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
- _SpecColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
- _WireColor: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _node_5051: {r: 1, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1c52eaf983cbc8f46a56f9277b1aa4fc
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8f7b6fe62779ca542b5639160371342a
|
||||
folderAsset: yes
|
||||
timeCreated: 1491840432
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b6195aa9e06195e43b114c8f5af6c802
|
||||
folderAsset: yes
|
||||
timeCreated: 1491840432
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,148 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: eff_heart_1
|
||||
m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _EMISSION _USEMAINTEX_ON
|
||||
m_LightmapFlags: 1
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 880e6f8c0cd73da43b1a38fd8e2430c6, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _ColorWriteMask
|
||||
second: 15
|
||||
- first:
|
||||
name: _Cull
|
||||
second: 2
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _GlossMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _GlossyReflections
|
||||
second: 1
|
||||
- first:
|
||||
name: _InvFade
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SmoothnessTextureChannel
|
||||
second: 0
|
||||
- first:
|
||||
name: _SpecularHighlights
|
||||
second: 1
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _UseColor
|
||||
second: 0
|
||||
- first:
|
||||
name: _UseMainTex
|
||||
second: 1
|
||||
- first:
|
||||
name: _ZTest
|
||||
second: 4
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _TintColor
|
||||
second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ad5093fa98352c143b3c25c57500625e
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8f2c090b01d08b740ab3a23133bf4973
|
||||
folderAsset: yes
|
||||
timeCreated: 1491840432
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8ae78ef421da8ee45ad57258d87783fb
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 38094f182faef4d4a9aa4e240181aae9
|
||||
folderAsset: yes
|
||||
timeCreated: 1491840432
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Двоичные данные
Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealARHeadExample/AR/MouthLaser/Textures/Eff_Heart_1.png
Normal file
Двоичные данные
Assets/NrealLightWithDlibFaceLandmarkDetectorExample/NrealARHeadExample/AR/MouthLaser/Textures/Eff_Heart_1.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 30 KiB |
|
@ -0,0 +1,47 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 880e6f8c0cd73da43b1a38fd8e2430c6
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
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
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 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: 5
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 408cadbeae788964599a7daa877403b2
|
||||
folderAsset: yes
|
||||
timeCreated: 1491840432
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,95 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &100000
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 400000}
|
||||
- component: {fileID: 3300000}
|
||||
- component: {fileID: 13600000}
|
||||
- component: {fileID: 2300000}
|
||||
m_Layer: 5
|
||||
m_Name: Axes_X
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &400000
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068}
|
||||
m_LocalPosition: {x: 25, y: 0, z: 0}
|
||||
m_LocalScale: {x: 10, y: 25, z: 10}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &2300000
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: bf7df81430281864b8bf32a806666b20, 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_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &3300000
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!136 &13600000
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
m_Radius: 0.5
|
||||
m_Height: 2
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 100000}
|
||||
m_IsPrefabParent: 1
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5d70eb56850e92f4fb57b3cb287d5853
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,95 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &100000
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 400000}
|
||||
- component: {fileID: 3300000}
|
||||
- component: {fileID: 13600000}
|
||||
- component: {fileID: 2300000}
|
||||
m_Layer: 5
|
||||
m_Name: Axes_Y
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &400000
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 25, z: 0}
|
||||
m_LocalScale: {x: 10, y: 25, z: 10}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &2300000
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 43285e232533ac74496547f963f62d20, 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_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &3300000
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!136 &13600000
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
m_Radius: 0.5
|
||||
m_Height: 2
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 100000}
|
||||
m_IsPrefabParent: 1
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9d3c06631a8c081429b78dfd0f1ce1b6
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,95 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &100000
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 400000}
|
||||
- component: {fileID: 3300000}
|
||||
- component: {fileID: 13600000}
|
||||
- component: {fileID: 2300000}
|
||||
m_Layer: 5
|
||||
m_Name: Axes_Z
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &400000
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 25}
|
||||
m_LocalScale: {x: 10, y: 25, z: 10}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &2300000
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: d5ede656d6b06bf46891f8996993709f, 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_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &3300000
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!136 &13600000
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 100000}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
m_Radius: 0.5
|
||||
m_Height: 2
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 100000}
|
||||
m_IsPrefabParent: 1
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8d9aa1c65197d82468391d62fe6ad474
|
||||
NativeFormatImporter:
|
||||
userData:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dcbce20fc93b6144caed5bb6ed6748bd
|
||||
folderAsset: yes
|
||||
timeCreated: 1491840432
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,133 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: unnamed
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _EmissionScaleUI
|
||||
second: 0
|
||||
- first:
|
||||
name: _GlossMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _GlossyReflections
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SmoothnessTextureChannel
|
||||
second: 0
|
||||
- first:
|
||||
name: _SpecularHighlights
|
||||
second: 1
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 0.8, g: 0.8, b: 0.8, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _EmissionColorUI
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: baae31a5d0331a540aa52ffeea4e1a01
|
||||
timeCreated: 1461779258
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,66 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8a05aacd8769f38418a842f162e019b0
|
||||
ModelImporter:
|
||||
serializedVersion: 16
|
||||
fileIDToRecycleName:
|
||||
100000: //RootNode
|
||||
400000: //RootNode
|
||||
2300000: //RootNode
|
||||
3300000: //RootNode
|
||||
4300000: male
|
||||
7400000: Default Take
|
||||
9500000: //RootNode
|
||||
materials:
|
||||
importMaterials: 1
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
optimizeGameObjects: 0
|
||||
motionNodeName:
|
||||
animationCompression: 1
|
||||
animationRotationError: .5
|
||||
animationPositionError: .5
|
||||
animationScaleError: .5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
clipAnimations: []
|
||||
isReadable: 1
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
importBlendShapes: 1
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
optimizeMeshForGPU: 1
|
||||
weldVertices: 1
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVPackMargin: 4
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
splitTangentsAcrossUV: 1
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 1
|
||||
importAnimation: 1
|
||||
copyAvatar: 0
|
||||
humanDescription:
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: .5
|
||||
foreArmTwist: .5
|
||||
upperLegTwist: .5
|
||||
legTwist: .5
|
||||
armStretch: .0500000007
|
||||
legStretch: .0500000007
|
||||
feetSpacing: 0
|
||||
rootMotionBoneName:
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
animationType: 2
|
||||
additionalBone: 0
|
||||
userData:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 06cde69191fc83d478b66e9868aa0f0a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,268 @@
|
|||
using OpenCVForUnity.CoreModule;
|
||||
using OpenCVForUnity.ImgprocModule;
|
||||
using OpenCVForUnity.VideoModule;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NrealLightWithDlibFaceLandmarkDetectorExample
|
||||
{
|
||||
/// <summary>
|
||||
/// Optical Flow Points Filter.
|
||||
/// v 1.0.4
|
||||
/// </summary>
|
||||
public class OFPointsFilter : PointsFilterBase
|
||||
{
|
||||
public double diffCheckSensitivity = 1;
|
||||
|
||||
bool flag = false;
|
||||
double diffDlib = 1;
|
||||
MatOfPoint prevTrackPtsMat;
|
||||
|
||||
// Optical Flow
|
||||
Mat prevgray, gray;
|
||||
List<Point> prevTrackPts;
|
||||
List<Point> nextTrackPts;
|
||||
MatOfPoint2f mOP2fPrevTrackPts;
|
||||
MatOfPoint2f mOP2fNextTrackPts;
|
||||
MatOfByte status;
|
||||
MatOfFloat err;
|
||||
|
||||
public OFPointsFilter(int numberOfElements) : base(numberOfElements)
|
||||
{
|
||||
diffDlib = diffDlib * (double)numberOfElements / 68.0;
|
||||
prevTrackPtsMat = new MatOfPoint();
|
||||
|
||||
// Initialize Optical Flow
|
||||
InitializeOpticalFlow();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes points by filter.
|
||||
/// </summary>
|
||||
/// <param name="img">Image mat.</param>
|
||||
/// <param name="srcPoints">Input points.</param>
|
||||
/// <param name="dstPoints">Output points.</param>
|
||||
/// <param name="drawDebugPoints">if true, draws debug points.</param>
|
||||
/// <returns>Output points.</returns>
|
||||
public override List<Vector2> Process(Mat img, List<Vector2> srcPoints, List<Vector2> dstPoints = null, bool drawDebugPoints = false)
|
||||
{
|
||||
if (srcPoints != null && srcPoints.Count != numberOfElements)
|
||||
{
|
||||
throw new ArgumentException("The number of elements is different.");
|
||||
}
|
||||
|
||||
if (srcPoints == null)
|
||||
{
|
||||
return dstPoints == null ? srcPoints : dstPoints;
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
if (img.channels() == 4)
|
||||
{
|
||||
Imgproc.cvtColor(img, prevgray, Imgproc.COLOR_RGBA2GRAY);
|
||||
}
|
||||
else if (img.channels() == 3)
|
||||
{
|
||||
Imgproc.cvtColor(img, prevgray, Imgproc.COLOR_RGB2GRAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (prevgray.total() == 0)
|
||||
{
|
||||
prevgray = img.clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
img.copyTo(prevgray);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < numberOfElements; i++)
|
||||
{
|
||||
prevTrackPts[i] = new Point(srcPoints[i].x, srcPoints[i].y);
|
||||
}
|
||||
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (srcPoints != null)
|
||||
{
|
||||
|
||||
if (dstPoints == null)
|
||||
{
|
||||
dstPoints = new List<Vector2>();
|
||||
}
|
||||
if (dstPoints != null && dstPoints.Count != numberOfElements)
|
||||
{
|
||||
dstPoints.Clear();
|
||||
for (int i = 0; i < numberOfElements; i++)
|
||||
{
|
||||
dstPoints.Add(new Vector2());
|
||||
}
|
||||
}
|
||||
|
||||
if (img.channels() == 4)
|
||||
{
|
||||
Imgproc.cvtColor(img, gray, Imgproc.COLOR_RGBA2GRAY);
|
||||
}
|
||||
else if (img.channels() == 3)
|
||||
{
|
||||
Imgproc.cvtColor(img, gray, Imgproc.COLOR_RGB2GRAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gray.total() == 0)
|
||||
{
|
||||
gray = img.clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
img.copyTo(gray);
|
||||
}
|
||||
}
|
||||
|
||||
if (prevgray.total() > 0)
|
||||
{
|
||||
mOP2fPrevTrackPts.fromList(prevTrackPts);
|
||||
mOP2fNextTrackPts.fromList(nextTrackPts);
|
||||
Video.calcOpticalFlowPyrLK(prevgray, gray, mOP2fPrevTrackPts, mOP2fNextTrackPts, status, err);
|
||||
prevTrackPts = mOP2fPrevTrackPts.toList();
|
||||
nextTrackPts = mOP2fNextTrackPts.toList();
|
||||
|
||||
// clac diffDlib
|
||||
prevTrackPtsMat.fromList(prevTrackPts);
|
||||
OpenCVForUnity.CoreModule.Rect rect = Imgproc.boundingRect(prevTrackPtsMat);
|
||||
double diffDlib = this.diffDlib * rect.area() / 40000.0 * diffCheckSensitivity;
|
||||
|
||||
// if the face is moving so fast, use dlib to detect the face
|
||||
double diff = calDistanceDiff(prevTrackPts, nextTrackPts);
|
||||
if (drawDebugPoints)
|
||||
Debug.Log("variance:" + diff);
|
||||
if (diff > diffDlib)
|
||||
{
|
||||
for (int i = 0; i < numberOfElements; i++)
|
||||
{
|
||||
nextTrackPts[i].x = srcPoints[i].x;
|
||||
nextTrackPts[i].y = srcPoints[i].y;
|
||||
|
||||
dstPoints[i] = srcPoints[i];
|
||||
}
|
||||
|
||||
if (drawDebugPoints)
|
||||
{
|
||||
Debug.Log("DLIB");
|
||||
for (int i = 0; i < numberOfElements; i++)
|
||||
{
|
||||
Imgproc.circle(img, new Point(srcPoints[i].x, srcPoints[i].y), 2, new Scalar(255, 0, 0, 255), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// In this case, use Optical Flow
|
||||
for (int i = 0; i < numberOfElements; i++)
|
||||
{
|
||||
dstPoints[i] = new Vector2((float)nextTrackPts[i].x, (float)nextTrackPts[i].y);
|
||||
}
|
||||
|
||||
if (drawDebugPoints)
|
||||
{
|
||||
Debug.Log("Optical Flow");
|
||||
for (int i = 0; i < numberOfElements; i++)
|
||||
{
|
||||
Imgproc.circle(img, nextTrackPts[i], 2, new Scalar(0, 0, 255, 255), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Swap(ref prevTrackPts, ref nextTrackPts);
|
||||
Swap(ref prevgray, ref gray);
|
||||
}
|
||||
return dstPoints;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets filter.
|
||||
/// </summary>
|
||||
public override void Reset()
|
||||
{
|
||||
flag = false;
|
||||
|
||||
// Reset Optical Flow
|
||||
for (int i = 0; i < numberOfElements; i++)
|
||||
{
|
||||
prevTrackPts[i].x = 0.0;
|
||||
prevTrackPts[i].y = 0.0;
|
||||
}
|
||||
for (int i = 0; i < numberOfElements; i++)
|
||||
{
|
||||
nextTrackPts[i].x = 0.0;
|
||||
nextTrackPts[i].y = 0.0;
|
||||
}
|
||||
|
||||
if (prevgray != null)
|
||||
{
|
||||
prevgray.Dispose();
|
||||
prevgray = new Mat();
|
||||
}
|
||||
if (gray != null)
|
||||
{
|
||||
gray.Dispose();
|
||||
gray = new Mat();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To release the resources for the initialized method.
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
DisposeOpticalFlow();
|
||||
|
||||
if (prevTrackPtsMat != null)
|
||||
prevTrackPtsMat.Dispose();
|
||||
}
|
||||
|
||||
protected virtual void InitializeOpticalFlow()
|
||||
{
|
||||
prevTrackPts = new List<Point>();
|
||||
for (int i = 0; i < numberOfElements; i++)
|
||||
{
|
||||
prevTrackPts.Add(new Point(0, 0));
|
||||
}
|
||||
nextTrackPts = new List<Point>();
|
||||
for (int i = 0; i < numberOfElements; i++)
|
||||
{
|
||||
nextTrackPts.Add(new Point(0, 0));
|
||||
}
|
||||
prevgray = new Mat();
|
||||
gray = new Mat();
|
||||
mOP2fPrevTrackPts = new MatOfPoint2f();
|
||||
mOP2fNextTrackPts = new MatOfPoint2f();
|
||||
status = new MatOfByte();
|
||||
err = new MatOfFloat();
|
||||
}
|
||||
|
||||
protected virtual void DisposeOpticalFlow()
|
||||
{
|
||||
if (prevTrackPts != null)
|
||||
prevTrackPts.Clear();
|
||||
if (nextTrackPts != null)
|
||||
nextTrackPts.Clear();
|
||||
if (prevgray != null)
|
||||
prevgray.Dispose();
|
||||
if (gray != null)
|
||||
gray.Dispose();
|
||||
if (mOP2fPrevTrackPts != null)
|
||||
mOP2fPrevTrackPts.Dispose();
|
||||
if (mOP2fNextTrackPts != null)
|
||||
mOP2fNextTrackPts.Dispose();
|
||||
if (status != null)
|
||||
status.Dispose();
|
||||
if (err != null)
|
||||
err.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9d5ac71c97cae9c459dcddb10a6844f1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,72 @@
|
|||
using OpenCVForUnity.CoreModule;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NrealLightWithDlibFaceLandmarkDetectorExample
|
||||
{
|
||||
/// <summary>
|
||||
/// Points Filter Base.
|
||||
/// v 1.0.4
|
||||
/// </summary>
|
||||
public abstract class PointsFilterBase
|
||||
{
|
||||
protected int numberOfElements;
|
||||
|
||||
public PointsFilterBase(int numberOfElements)
|
||||
{
|
||||
this.numberOfElements = numberOfElements;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes points by filter.
|
||||
/// </summary>
|
||||
/// <param name="img">Image mat.</param>
|
||||
/// <param name="srcPoints">Input points.</param>
|
||||
/// <param name="dstPoints">Output points.</param>
|
||||
/// <param name="drawDebugPoints">if true, draws debug points.</param>
|
||||
/// <returns>Output points.</returns>
|
||||
public abstract List<Vector2> Process(Mat img, List<Vector2> srcPoints, List<Vector2> dstPoints = null, bool drawDebugPoints = false);
|
||||
|
||||
/// <summary>
|
||||
/// Resets filter.
|
||||
/// </summary>
|
||||
public abstract void Reset();
|
||||
|
||||
/// <summary>
|
||||
/// To release the resources for the initialized method.
|
||||
/// </summary>
|
||||
public abstract void Dispose();
|
||||
|
||||
// This function is to calculate the variance
|
||||
protected virtual double calDistanceDiff(IList<Point> curPoints, IList<Point> lastPoints)
|
||||
{
|
||||
double variance = 0.0;
|
||||
double sum = 0.0;
|
||||
List<double> diffs = new List<double>();
|
||||
if (curPoints.Count == lastPoints.Count)
|
||||
{
|
||||
for (int i = 0; i < curPoints.Count; i++)
|
||||
{
|
||||
double diff = Math.Sqrt(Math.Pow(curPoints[i].x - lastPoints[i].x, 2.0) + Math.Pow(curPoints[i].y - lastPoints[i].y, 2.0));
|
||||
sum += diff;
|
||||
diffs.Add(diff);
|
||||
}
|
||||
double mean = sum / diffs.Count;
|
||||
for (int i = 0; i < curPoints.Count; i++)
|
||||
{
|
||||
variance += Math.Pow(diffs[i] - mean, 2);
|
||||
}
|
||||
return variance / diffs.Count;
|
||||
}
|
||||
return variance;
|
||||
}
|
||||
|
||||
protected virtual void Swap<T>(ref T a, ref T b)
|
||||
{
|
||||
var t = a;
|
||||
a = b;
|
||||
b = t;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c299f4942fb8869438cf22f66f03b397
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fd6bd6a7ebf64b2498232c74f819c0a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 61e571e61522ba245bf39eb028db506e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 202869b187345e64a8d939d6146a52b2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,868 @@
|
|||
#if !(PLATFORM_LUMIN && !UNITY_EDITOR)
|
||||
|
||||
using DlibFaceLandmarkDetector;
|
||||
using NrealLightWithOpenCVForUnity.UnityUtils.Helper;
|
||||
using OpenCVForUnity.CoreModule;
|
||||
using OpenCVForUnity.ImgprocModule;
|
||||
using OpenCVForUnity.ObjdetectModule;
|
||||
using OpenCVForUnity.RectangleTrack;
|
||||
using OpenCVForUnity.UnityUtils;
|
||||
using OpenCVForUnity.UnityUtils.Helper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using Rect = OpenCVForUnity.CoreModule.Rect;
|
||||
|
||||
namespace NrealLightWithDlibFaceLandmarkDetectorExample
|
||||
{
|
||||
/// <summary>
|
||||
/// Nreal Face Landmark Detection Example
|
||||
/// An example of face landmark detection using OpenCVForUnity and DlibLandmarkDetector on Nreal Light.
|
||||
/// Referring to https://github.com/Itseez/opencv/blob/master/modules/objdetect/src/detection_based_tracker.cpp.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(NRCamTextureToMatHelper), typeof(ImageOptimizationHelper))]
|
||||
public class NrealFaceLandmarkDetectionExample : MonoBehaviour
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Determines if enables the detection.
|
||||
/// </summary>
|
||||
public bool enableDetection = true;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if enable downscale.
|
||||
/// </summary>
|
||||
public bool enableDownScale;
|
||||
|
||||
/// <summary>
|
||||
/// The enable downscale toggle.
|
||||
/// </summary>
|
||||
public Toggle enableDownScaleToggle;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if uses separate detection.
|
||||
/// </summary>
|
||||
public bool useSeparateDetection = false;
|
||||
|
||||
/// <summary>
|
||||
/// The use separate detection toggle.
|
||||
/// </summary>
|
||||
public Toggle useSeparateDetectionToggle;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if use OpenCV FaceDetector for face detection.
|
||||
/// </summary>
|
||||
public bool useOpenCVDetector;
|
||||
|
||||
/// <summary>
|
||||
/// The use OpenCV FaceDetector toggle.
|
||||
/// </summary>
|
||||
public Toggle useOpenCVDetectorToggle;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if displays camera image.
|
||||
/// </summary>
|
||||
public bool displayCameraImage = false;
|
||||
|
||||
/// <summary>
|
||||
/// The display camera image toggle.
|
||||
/// </summary>
|
||||
public Toggle displayCameraImageToggle;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if displays detected face rect.
|
||||
/// </summary>
|
||||
public bool displayDetectedFaceRect = false;
|
||||
|
||||
/// <summary>
|
||||
/// The is display detected face rect toggle.
|
||||
/// </summary>
|
||||
public Toggle displayDetectedFaceRectToggle;
|
||||
|
||||
/// <summary>
|
||||
/// The min detection size ratio.
|
||||
/// </summary>
|
||||
public float minDetectionSizeRatio = 0.07f;
|
||||
|
||||
/// <summary>
|
||||
/// The webcam texture to mat helper.
|
||||
/// </summary>
|
||||
NRCamTextureToMatHelper webCamTextureToMatHelper;
|
||||
|
||||
/// <summary>
|
||||
/// The image optimization helper.
|
||||
/// </summary>
|
||||
ImageOptimizationHelper imageOptimizationHelper;
|
||||
|
||||
/// <summary>
|
||||
/// The texture.
|
||||
/// </summary>
|
||||
Texture2D texture;
|
||||
|
||||
/// <summary>
|
||||
/// The cascade.
|
||||
/// </summary>
|
||||
CascadeClassifier cascade;
|
||||
|
||||
/// <summary>
|
||||
/// The quad renderer.
|
||||
/// </summary>
|
||||
Renderer quad_renderer;
|
||||
|
||||
/// <summary>
|
||||
/// The detection result.
|
||||
/// </summary>
|
||||
List<Rect> detectionResult = new List<Rect>();
|
||||
|
||||
/// <summary>
|
||||
/// The face landmark detector.
|
||||
/// </summary>
|
||||
FaceLandmarkDetector faceLandmarkDetector;
|
||||
|
||||
/// <summary>
|
||||
/// The dlib shape predictor file name.
|
||||
/// </summary>
|
||||
string dlibShapePredictorFileName = "sp_human_face_68.dat";
|
||||
|
||||
/// <summary>
|
||||
/// The dlib shape predictor file path.
|
||||
/// </summary>
|
||||
string dlibShapePredictorFilePath;
|
||||
|
||||
Scalar COLOR_WHITE = new Scalar(255, 255, 255, 255);
|
||||
Scalar COLOR_GRAY = new Scalar(128, 128, 128, 255);
|
||||
|
||||
Mat grayMat4Thread;
|
||||
CascadeClassifier cascade4Thread;
|
||||
FaceLandmarkDetector faceLandmarkDetector4Thread;
|
||||
readonly static Queue<Action> ExecuteOnMainThread = new Queue<Action>();
|
||||
System.Object sync = new System.Object();
|
||||
|
||||
bool _isThreadRunning = false;
|
||||
bool isThreadRunning
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (sync)
|
||||
return _isThreadRunning;
|
||||
}
|
||||
set
|
||||
{
|
||||
lock (sync)
|
||||
_isThreadRunning = value;
|
||||
}
|
||||
}
|
||||
|
||||
RectangleTracker rectangleTracker;
|
||||
float coeffTrackingWindowSize = 2.0f;
|
||||
float coeffObjectSizeToTrack = 0.85f;
|
||||
List<Rect> detectedObjectsInRegions = new List<Rect>();
|
||||
List<Rect> resultObjects = new List<Rect>();
|
||||
List<List<Vector2>> resultFaceLandmarkPoints = new List<List<Vector2>>();
|
||||
|
||||
bool _isDetecting = false;
|
||||
bool isDetecting
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (sync)
|
||||
return _isDetecting;
|
||||
}
|
||||
set
|
||||
{
|
||||
lock (sync)
|
||||
_isDetecting = value;
|
||||
}
|
||||
}
|
||||
|
||||
bool _hasUpdatedDetectionResult = false;
|
||||
bool hasUpdatedDetectionResult
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (sync)
|
||||
return _hasUpdatedDetectionResult;
|
||||
}
|
||||
set
|
||||
{
|
||||
lock (sync)
|
||||
_hasUpdatedDetectionResult = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the main camera.
|
||||
/// </summary>
|
||||
Camera mainCamera;
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
protected void Start()
|
||||
{
|
||||
enableDownScaleToggle.isOn = enableDownScale;
|
||||
useSeparateDetectionToggle.isOn = useSeparateDetection;
|
||||
useOpenCVDetectorToggle.isOn = useOpenCVDetector;
|
||||
displayCameraImageToggle.isOn = displayCameraImage;
|
||||
displayDetectedFaceRectToggle.isOn = displayDetectedFaceRect;
|
||||
|
||||
imageOptimizationHelper = gameObject.GetComponent<ImageOptimizationHelper>();
|
||||
webCamTextureToMatHelper = gameObject.GetComponent<NRCamTextureToMatHelper>();
|
||||
webCamTextureToMatHelper.outputColorFormat = WebCamTextureToMatHelper.ColorFormat.GRAY;
|
||||
webCamTextureToMatHelper.Initialize();
|
||||
|
||||
rectangleTracker = new RectangleTracker();
|
||||
|
||||
dlibShapePredictorFileName = NrealLightWithDlibFaceLandmarkDetectorExample.dlibShapePredictorFileName;
|
||||
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
|
||||
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
|
||||
{
|
||||
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
|
||||
}
|
||||
faceLandmarkDetector = new FaceLandmarkDetector(dlibShapePredictorFilePath);
|
||||
|
||||
|
||||
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("sp_human_face_6.dat");
|
||||
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
|
||||
{
|
||||
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
|
||||
}
|
||||
faceLandmarkDetector4Thread = new FaceLandmarkDetector(dlibShapePredictorFilePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the web cam texture to mat helper initialized event.
|
||||
/// </summary>
|
||||
public void OnWebCamTextureToMatHelperInitialized()
|
||||
{
|
||||
Debug.Log("OnWebCamTextureToMatHelperInitialized");
|
||||
|
||||
Mat grayMat = webCamTextureToMatHelper.GetMat();
|
||||
|
||||
texture = new Texture2D(grayMat.cols(), grayMat.rows(), TextureFormat.Alpha8, false);
|
||||
texture.wrapMode = TextureWrapMode.Clamp;
|
||||
quad_renderer = gameObject.GetComponent<Renderer>() as Renderer;
|
||||
quad_renderer.sharedMaterial.SetTexture("_MainTex", texture);
|
||||
quad_renderer.sharedMaterial.SetVector("_VignetteOffset", new Vector4(0, 0));
|
||||
quad_renderer.sharedMaterial.SetFloat("_VignetteScale", 0.0f);
|
||||
|
||||
//Debug.Log("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
|
||||
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
quad_renderer.sharedMaterial.SetMatrix("_CameraProjectionMatrix", webCamTextureToMatHelper.GetProjectionMatrix());
|
||||
#else
|
||||
mainCamera = NRKernal.NRSessionManager.Instance.NRHMDPoseTracker.centerCamera;
|
||||
quad_renderer.sharedMaterial.SetMatrix("_CameraProjectionMatrix", mainCamera.projectionMatrix);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
cascade = new CascadeClassifier();
|
||||
cascade.load(Utils.getFilePath("objdetect/lbpcascade_frontalface.xml"));
|
||||
#if !UNITY_WSA_10_0 || UNITY_EDITOR
|
||||
// "empty" method is not working on the UWP platform.
|
||||
if (cascade.empty())
|
||||
{
|
||||
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
|
||||
}
|
||||
#endif
|
||||
|
||||
grayMat4Thread = new Mat();
|
||||
cascade4Thread = new CascadeClassifier();
|
||||
cascade4Thread.load(Utils.getFilePath("objdetect/haarcascade_frontalface_alt.xml"));
|
||||
#if !UNITY_WSA_10_0 || UNITY_EDITOR
|
||||
// "empty" method is not working on the UWP platform.
|
||||
if (cascade4Thread.empty())
|
||||
{
|
||||
Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the web cam texture to mat helper disposed event.
|
||||
/// </summary>
|
||||
public void OnWebCamTextureToMatHelperDisposed()
|
||||
{
|
||||
Debug.Log("OnWebCamTextureToMatHelperDisposed");
|
||||
|
||||
StopThread();
|
||||
lock (ExecuteOnMainThread)
|
||||
{
|
||||
ExecuteOnMainThread.Clear();
|
||||
}
|
||||
isDetecting = false;
|
||||
|
||||
|
||||
if (texture != null)
|
||||
{
|
||||
Texture2D.Destroy(texture);
|
||||
texture = null;
|
||||
}
|
||||
|
||||
if (cascade != null)
|
||||
cascade.Dispose();
|
||||
|
||||
if (grayMat4Thread != null)
|
||||
grayMat4Thread.Dispose();
|
||||
|
||||
if (cascade4Thread != null)
|
||||
cascade4Thread.Dispose();
|
||||
|
||||
rectangleTracker.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the web cam texture to mat helper error occurred event.
|
||||
/// </summary>
|
||||
/// <param name="errorCode">Error code.</param>
|
||||
public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode)
|
||||
{
|
||||
Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
lock (ExecuteOnMainThread)
|
||||
{
|
||||
while (ExecuteOnMainThread.Count > 0)
|
||||
{
|
||||
ExecuteOnMainThread.Dequeue().Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
if (webCamTextureToMatHelper.IsPlaying() && webCamTextureToMatHelper.DidUpdateThisFrame())
|
||||
{
|
||||
Mat grayMat = webCamTextureToMatHelper.GetMat();
|
||||
|
||||
Mat downScaleMat = null;
|
||||
float DOWNSCALE_RATIO;
|
||||
if (enableDownScale)
|
||||
{
|
||||
downScaleMat = imageOptimizationHelper.GetDownScaleMat(grayMat);
|
||||
DOWNSCALE_RATIO = imageOptimizationHelper.downscaleRatio;
|
||||
}
|
||||
else
|
||||
{
|
||||
downScaleMat = grayMat;
|
||||
DOWNSCALE_RATIO = 1.0f;
|
||||
}
|
||||
|
||||
if (useOpenCVDetector)
|
||||
Imgproc.equalizeHist(downScaleMat, downScaleMat);
|
||||
|
||||
if (enableDetection && !isDetecting)
|
||||
{
|
||||
isDetecting = true;
|
||||
|
||||
downScaleMat.copyTo(grayMat4Thread);
|
||||
|
||||
StartThread(ThreadWorker);
|
||||
}
|
||||
|
||||
if (!useSeparateDetection)
|
||||
{
|
||||
|
||||
if (hasUpdatedDetectionResult)
|
||||
{
|
||||
hasUpdatedDetectionResult = false;
|
||||
|
||||
rectangleTracker.UpdateTrackedObjects(detectionResult);
|
||||
}
|
||||
|
||||
rectangleTracker.GetObjects(resultObjects, true);
|
||||
|
||||
// set original size image
|
||||
OpenCVForUnityUtils.SetImage(faceLandmarkDetector, grayMat);
|
||||
|
||||
resultFaceLandmarkPoints.Clear();
|
||||
foreach (Rect rect in resultObjects)
|
||||
{
|
||||
|
||||
// restore to original size rect
|
||||
rect.x = (int)(rect.x * DOWNSCALE_RATIO);
|
||||
rect.y = (int)(rect.y * DOWNSCALE_RATIO);
|
||||
rect.width = (int)(rect.width * DOWNSCALE_RATIO);
|
||||
rect.height = (int)(rect.height * DOWNSCALE_RATIO);
|
||||
|
||||
// detect face landmark points
|
||||
List<Vector2> points = faceLandmarkDetector.DetectLandmark(new UnityEngine.Rect(rect.x, rect.y, rect.width, rect.height));
|
||||
resultFaceLandmarkPoints.Add(points);
|
||||
}
|
||||
|
||||
if (!displayCameraImage)
|
||||
{
|
||||
// fill all black.
|
||||
Imgproc.rectangle(grayMat, new Point(0, 0), new Point(grayMat.width(), grayMat.height()), new Scalar(0, 0, 0, 0), -1);
|
||||
}
|
||||
|
||||
if (displayDetectedFaceRect)
|
||||
{
|
||||
// draw face rects
|
||||
foreach (Rect rect in resultObjects)
|
||||
{
|
||||
OpenCVForUnityUtils.DrawFaceRect(grayMat, new UnityEngine.Rect(rect.x, rect.y, rect.width, rect.height), COLOR_GRAY, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// draw face landmark points
|
||||
foreach (List<Vector2> points in resultFaceLandmarkPoints)
|
||||
{
|
||||
OpenCVForUnityUtils.DrawFaceLandmark(grayMat, points, COLOR_WHITE, 4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Rect[] rectsWhereRegions;
|
||||
|
||||
if (hasUpdatedDetectionResult)
|
||||
{
|
||||
hasUpdatedDetectionResult = false;
|
||||
|
||||
//Debug.Log("process: get rectsWhereRegions were got from detectionResult");
|
||||
rectsWhereRegions = detectionResult.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
//Debug.Log("process: get rectsWhereRegions from previous positions");
|
||||
if (useOpenCVDetector)
|
||||
{
|
||||
rectsWhereRegions = rectangleTracker.CreateCorrectionBySpeedOfRects();
|
||||
}
|
||||
else
|
||||
{
|
||||
rectsWhereRegions = rectangleTracker.CreateRawRects();
|
||||
}
|
||||
}
|
||||
|
||||
detectedObjectsInRegions.Clear();
|
||||
foreach (Rect rect in rectsWhereRegions)
|
||||
{
|
||||
if (useOpenCVDetector)
|
||||
{
|
||||
DetectInRegion(downScaleMat, rect, detectedObjectsInRegions, cascade, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DetectInRegion(downScaleMat, rect, detectedObjectsInRegions, faceLandmarkDetector);
|
||||
}
|
||||
}
|
||||
|
||||
rectangleTracker.UpdateTrackedObjects(detectedObjectsInRegions);
|
||||
rectangleTracker.GetObjects(resultObjects, false);
|
||||
|
||||
// set original size image
|
||||
OpenCVForUnityUtils.SetImage(faceLandmarkDetector, grayMat);
|
||||
|
||||
resultFaceLandmarkPoints.Clear();
|
||||
foreach (Rect rect in resultObjects)
|
||||
{
|
||||
|
||||
// restore to original size rect
|
||||
rect.x = (int)(rect.x * DOWNSCALE_RATIO);
|
||||
rect.y = (int)(rect.y * DOWNSCALE_RATIO);
|
||||
rect.width = (int)(rect.width * DOWNSCALE_RATIO);
|
||||
rect.height = (int)(rect.height * DOWNSCALE_RATIO);
|
||||
|
||||
// detect face landmark points
|
||||
List<Vector2> points = faceLandmarkDetector.DetectLandmark(new UnityEngine.Rect(rect.x, rect.y, rect.width, rect.height));
|
||||
resultFaceLandmarkPoints.Add(points);
|
||||
}
|
||||
|
||||
if (!displayCameraImage)
|
||||
{
|
||||
// fill all black.
|
||||
Imgproc.rectangle(grayMat, new Point(0, 0), new Point(grayMat.width(), grayMat.height()), new Scalar(0, 0, 0, 0), -1);
|
||||
}
|
||||
|
||||
if (displayDetectedFaceRect)
|
||||
{
|
||||
// draw previous rects
|
||||
DrawDownScaleFaceRects(grayMat, rectsWhereRegions, DOWNSCALE_RATIO, COLOR_GRAY, 1);
|
||||
|
||||
// draw face rects
|
||||
foreach (Rect rect in resultObjects)
|
||||
{
|
||||
OpenCVForUnityUtils.DrawFaceRect(grayMat, new UnityEngine.Rect(rect.x, rect.y, rect.width, rect.height), COLOR_GRAY, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// draw face landmark points
|
||||
foreach (List<Vector2> points in resultFaceLandmarkPoints)
|
||||
{
|
||||
OpenCVForUnityUtils.DrawFaceLandmark(grayMat, points, COLOR_WHITE, 4);
|
||||
}
|
||||
}
|
||||
|
||||
Utils.fastMatToTexture2D(grayMat, texture);
|
||||
}
|
||||
|
||||
if (webCamTextureToMatHelper.IsPlaying())
|
||||
{
|
||||
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
Matrix4x4 cameraToWorldMatrix = webCamTextureToMatHelper.GetCameraToWorldMatrix();
|
||||
#else
|
||||
Matrix4x4 cameraToWorldMatrix = mainCamera.cameraToWorldMatrix;
|
||||
#endif
|
||||
|
||||
Matrix4x4 worldToCameraMatrix = cameraToWorldMatrix.inverse;
|
||||
|
||||
quad_renderer.sharedMaterial.SetMatrix("_WorldToCameraMatrix", worldToCameraMatrix);
|
||||
|
||||
/*
|
||||
// Position the canvas object slightly in front
|
||||
// of the real world web camera.
|
||||
Vector3 position = cameraToWorldMatrix.GetColumn(3) - cameraToWorldMatrix.GetColumn(2);
|
||||
position *= 1.5f;
|
||||
|
||||
// Rotate the canvas object so that it faces the user.
|
||||
Quaternion rotation = Quaternion.LookRotation(-cameraToWorldMatrix.GetColumn(2), cameraToWorldMatrix.GetColumn(1));
|
||||
|
||||
gameObject.transform.position = position;
|
||||
gameObject.transform.rotation = rotation;
|
||||
*/
|
||||
|
||||
//
|
||||
// Adjusting the position and scale of the display screen
|
||||
// to counteract the phenomenon of texture margins (transparent areas in MR space) being displayed as black when recording video using NRVideoCapture.
|
||||
//
|
||||
// Position the canvas object slightly in front
|
||||
// of the real world web camera.
|
||||
float overlayDistance = 1.5f;
|
||||
Vector3 ccCameraSpacePos = UnProjectVector(webCamTextureToMatHelper.GetProjectionMatrix(), new Vector3(0.0f, 0.0f, overlayDistance));
|
||||
Vector3 tlCameraSpacePos = UnProjectVector(webCamTextureToMatHelper.GetProjectionMatrix(), new Vector3(-overlayDistance, overlayDistance, overlayDistance));
|
||||
|
||||
//position
|
||||
Vector3 position = cameraToWorldMatrix.MultiplyPoint3x4(ccCameraSpacePos);
|
||||
gameObject.transform.position = position;
|
||||
|
||||
//scale
|
||||
Vector3 scale = new Vector3(Mathf.Abs(tlCameraSpacePos.x - ccCameraSpacePos.x) * 2, Mathf.Abs(tlCameraSpacePos.y - ccCameraSpacePos.y) * 2, 1);
|
||||
gameObject.transform.localScale = scale;
|
||||
|
||||
// Rotate the canvas object so that it faces the user.
|
||||
Quaternion rotation = Quaternion.LookRotation(-cameraToWorldMatrix.GetColumn(2), cameraToWorldMatrix.GetColumn(1));
|
||||
gameObject.transform.rotation = rotation;
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
private Vector3 UnProjectVector(Matrix4x4 proj, Vector3 to)
|
||||
{
|
||||
Vector3 from = new Vector3(0, 0, 0);
|
||||
var axsX = proj.GetRow(0);
|
||||
var axsY = proj.GetRow(1);
|
||||
var axsZ = proj.GetRow(2);
|
||||
from.z = to.z / axsZ.z;
|
||||
from.y = (to.y - (from.z * axsY.z)) / axsY.y;
|
||||
from.x = (to.x - (from.z * axsX.z)) / axsX.x;
|
||||
return from;
|
||||
}
|
||||
//
|
||||
|
||||
private void StartThread(Action action)
|
||||
{
|
||||
#if WINDOWS_UWP || (!UNITY_WSA_10_0 && (NET_4_6 || NET_STANDARD_2_0))
|
||||
System.Threading.Tasks.Task.Run(() => action());
|
||||
#else
|
||||
System.Threading.ThreadPool.QueueUserWorkItem(_ => action());
|
||||
#endif
|
||||
}
|
||||
|
||||
private void StopThread()
|
||||
{
|
||||
if (!isThreadRunning)
|
||||
return;
|
||||
|
||||
while (isThreadRunning)
|
||||
{
|
||||
//Wait threading stop
|
||||
}
|
||||
}
|
||||
|
||||
private void ThreadWorker()
|
||||
{
|
||||
isThreadRunning = true;
|
||||
|
||||
if (useOpenCVDetector)
|
||||
{
|
||||
DetectObject(grayMat4Thread, out detectionResult, cascade4Thread, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DetectObject(grayMat4Thread, out detectionResult, faceLandmarkDetector4Thread);
|
||||
}
|
||||
|
||||
lock (ExecuteOnMainThread)
|
||||
{
|
||||
if (ExecuteOnMainThread.Count == 0)
|
||||
{
|
||||
ExecuteOnMainThread.Enqueue(() =>
|
||||
{
|
||||
OnDetectionDone();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
isThreadRunning = false;
|
||||
}
|
||||
|
||||
private void DetectObject(Mat img, out List<Rect> detectedObjects, FaceLandmarkDetector landmarkDetector)
|
||||
{
|
||||
OpenCVForUnityUtils.SetImage(landmarkDetector, img);
|
||||
|
||||
List<UnityEngine.Rect> detectResult = landmarkDetector.Detect();
|
||||
|
||||
detectedObjects = new List<Rect>();
|
||||
|
||||
int len = detectResult.Count;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
UnityEngine.Rect r = detectResult[i];
|
||||
detectedObjects.Add(new Rect((int)r.x, (int)r.y, (int)r.width, (int)r.height));
|
||||
}
|
||||
}
|
||||
|
||||
private void DetectObject(Mat img, out List<Rect> detectedObjects, CascadeClassifier cascade, bool correctToDlibResult = false)
|
||||
{
|
||||
int d = Mathf.Min(img.width(), img.height());
|
||||
d = (int)Mathf.Round(d * minDetectionSizeRatio);
|
||||
|
||||
MatOfRect objects = new MatOfRect();
|
||||
if (cascade != null)
|
||||
cascade.detectMultiScale(img, objects, 1.1, 2, Objdetect.CASCADE_SCALE_IMAGE, new Size(d, d), new Size());
|
||||
|
||||
detectedObjects = objects.toList();
|
||||
|
||||
if (correctToDlibResult)
|
||||
{
|
||||
int len = detectedObjects.Count;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
Rect r = detectedObjects[i];
|
||||
// correct the deviation of the detection result of the face rectangle of OpenCV and Dlib.
|
||||
r.x += (int)(r.width * 0.05f);
|
||||
r.y += (int)(r.height * 0.1f);
|
||||
r.width = (int)(r.width * 0.9f);
|
||||
r.height = (int)(r.height * 0.9f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDetectionDone()
|
||||
{
|
||||
hasUpdatedDetectionResult = true;
|
||||
|
||||
isDetecting = false;
|
||||
}
|
||||
|
||||
private void DetectInRegion(Mat img, Rect region, List<Rect> detectedObjectsInRegions, FaceLandmarkDetector landmarkDetector)
|
||||
{
|
||||
Rect r0 = new Rect(new Point(), img.size());
|
||||
Rect r1 = new Rect(region.x, region.y, region.width, region.height);
|
||||
Rect.inflate(r1, (int)((r1.width * coeffTrackingWindowSize) - r1.width) / 2,
|
||||
(int)((r1.height * coeffTrackingWindowSize) - r1.height) / 2);
|
||||
r1 = Rect.intersect(r0, r1);
|
||||
|
||||
if ((r1.width <= 0) || (r1.height <= 0))
|
||||
{
|
||||
Debug.Log("detectInRegion: Empty intersection");
|
||||
return;
|
||||
}
|
||||
|
||||
using (Mat img1_roi = new Mat(img, r1))
|
||||
using (Mat img1 = new Mat(r1.size(), img.type()))
|
||||
{
|
||||
img1_roi.copyTo(img1);
|
||||
|
||||
OpenCVForUnityUtils.SetImage(landmarkDetector, img1);
|
||||
|
||||
List<UnityEngine.Rect> detectResult = landmarkDetector.Detect();
|
||||
|
||||
int len = detectResult.Count;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
UnityEngine.Rect tmp = detectResult[i];
|
||||
Rect r = new Rect((int)(tmp.x + r1.x), (int)(tmp.y + r1.y), (int)tmp.width, (int)tmp.height);
|
||||
detectedObjectsInRegions.Add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DetectInRegion(Mat img, Rect region, List<Rect> detectedObjectsInRegions, CascadeClassifier cascade, bool correctToDlibResult = false)
|
||||
{
|
||||
Rect r0 = new Rect(new Point(), img.size());
|
||||
Rect r1 = new Rect(region.x, region.y, region.width, region.height);
|
||||
Rect.inflate(r1, (int)((r1.width * coeffTrackingWindowSize) - r1.width) / 2,
|
||||
(int)((r1.height * coeffTrackingWindowSize) - r1.height) / 2);
|
||||
r1 = Rect.intersect(r0, r1);
|
||||
|
||||
if ((r1.width <= 0) || (r1.height <= 0))
|
||||
{
|
||||
Debug.Log("detectInRegion: Empty intersection");
|
||||
return;
|
||||
}
|
||||
|
||||
int d = Math.Min(region.width, region.height);
|
||||
d = (int)Math.Round(d * coeffObjectSizeToTrack);
|
||||
|
||||
using (MatOfRect tmpobjects = new MatOfRect())
|
||||
using (Mat img1 = new Mat(img, r1)) //subimage for rectangle -- without data copying
|
||||
{
|
||||
cascade.detectMultiScale(img1, tmpobjects, 1.1, 2, 0 | Objdetect.CASCADE_DO_CANNY_PRUNING | Objdetect.CASCADE_SCALE_IMAGE | Objdetect.CASCADE_FIND_BIGGEST_OBJECT, new Size(d, d), new Size());
|
||||
|
||||
Rect[] tmpobjectsArray = tmpobjects.toArray();
|
||||
int len = tmpobjectsArray.Length;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
Rect tmp = tmpobjectsArray[i];
|
||||
Rect r = new Rect(new Point(tmp.x + r1.x, tmp.y + r1.y), tmp.size());
|
||||
|
||||
if (correctToDlibResult)
|
||||
{
|
||||
// correct the deviation of the detection result of the face rectangle of OpenCV and Dlib.
|
||||
r.x += (int)(r.width * 0.05f);
|
||||
r.y += (int)(r.height * 0.1f);
|
||||
r.width = (int)(r.width * 0.9f);
|
||||
r.height = (int)(r.height * 0.9f);
|
||||
}
|
||||
|
||||
detectedObjectsInRegions.Add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDownScaleFaceRects(Mat img, Rect[] rects, float downscaleRatio, Scalar color, int thickness)
|
||||
{
|
||||
int len = rects.Length;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
Rect rect = new Rect(
|
||||
(int)(rects[i].x * downscaleRatio),
|
||||
(int)(rects[i].y * downscaleRatio),
|
||||
(int)(rects[i].width * downscaleRatio),
|
||||
(int)(rects[i].height * downscaleRatio)
|
||||
);
|
||||
Imgproc.rectangle(img, rect, color, thickness);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the destroy event.
|
||||
/// </summary>
|
||||
void OnDestroy()
|
||||
{
|
||||
webCamTextureToMatHelper.Dispose();
|
||||
imageOptimizationHelper.Dispose();
|
||||
|
||||
if (faceLandmarkDetector != null)
|
||||
faceLandmarkDetector.Dispose();
|
||||
|
||||
if (faceLandmarkDetector4Thread != null)
|
||||
faceLandmarkDetector4Thread.Dispose();
|
||||
|
||||
if (rectangleTracker != null)
|
||||
rectangleTracker.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the back button click event.
|
||||
/// </summary>
|
||||
public void OnBackButtonClick()
|
||||
{
|
||||
SceneManager.LoadScene("NrealLightWithDlibFaceLandmarkDetectorExample");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the play button click event.
|
||||
/// </summary>
|
||||
public void OnPlayButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.Play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the pause button click event.
|
||||
/// </summary>
|
||||
public void OnPauseButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.Pause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the stop button click event.
|
||||
/// </summary>
|
||||
public void OnStopButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.Stop();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the change camera button click event.
|
||||
/// </summary>
|
||||
public void OnChangeCameraButtonClick()
|
||||
{
|
||||
webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.IsFrontFacing();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the enable downscale toggle value changed event.
|
||||
/// </summary>
|
||||
public void OnEnableDownScaleToggleValueChanged()
|
||||
{
|
||||
enableDownScale = enableDownScaleToggle.isOn;
|
||||
|
||||
if (webCamTextureToMatHelper != null && webCamTextureToMatHelper.IsInitialized())
|
||||
{
|
||||
webCamTextureToMatHelper.Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the use separate detection toggle value changed event.
|
||||
/// </summary>
|
||||
public void OnUseSeparateDetectionToggleValueChanged()
|
||||
{
|
||||
useSeparateDetection = useSeparateDetectionToggle.isOn;
|
||||
|
||||
if (rectangleTracker != null)
|
||||
{
|
||||
lock (rectangleTracker)
|
||||
{
|
||||
rectangleTracker.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the use OpenCV Detector toggle value changed event.
|
||||
/// </summary>
|
||||
public void OnUseOpenCVDetectorToggleValueChanged()
|
||||
{
|
||||
useOpenCVDetector = useOpenCVDetectorToggle.isOn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the display camera image toggle value changed event.
|
||||
/// </summary>
|
||||
public void OnDisplayCameraImageToggleValueChanged()
|
||||
{
|
||||
displayCameraImage = displayCameraImageToggle.isOn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the display detected face rect toggle value changed event.
|
||||
/// </summary>
|
||||
public void OnDisplayDetectedFaceRectToggleValueChanged()
|
||||
{
|
||||
displayDetectedFaceRect = displayDetectedFaceRectToggle.isOn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 934d7f5cde1a6cf4388e33e9c0f8d251
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1d31b772686bedf4bbe000a38329472f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,128 @@
|
|||
using NRKernal;
|
||||
using OpenCVForUnity.CoreModule;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NrealLightWithDlibFaceLandmarkDetectorExample
|
||||
{
|
||||
/// <summary>
|
||||
/// NrealLightWithDlibFaceLandmarkDetector Example
|
||||
/// </summary>
|
||||
public class NrealLightWithDlibFaceLandmarkDetectorExample : MonoBehaviour
|
||||
{
|
||||
public Text exampleTitle;
|
||||
public Text versionInfo;
|
||||
public ScrollRect scrollRect;
|
||||
static float verticalNormalizedPosition = 1f;
|
||||
|
||||
public enum DlibShapePredictorNamePreset : int
|
||||
{
|
||||
sp_human_face_68,
|
||||
sp_human_face_68_for_mobile,
|
||||
sp_human_face_17,
|
||||
sp_human_face_17_for_mobile,
|
||||
sp_human_face_6,
|
||||
}
|
||||
|
||||
public Dropdown dlibShapePredictorNameDropdown;
|
||||
|
||||
static DlibShapePredictorNamePreset dlibShapePredictorName = DlibShapePredictorNamePreset.sp_human_face_17_for_mobile;
|
||||
|
||||
/// <summary>
|
||||
/// The name of dlib shape predictor file to use in the example scenes.
|
||||
/// </summary>
|
||||
public static string dlibShapePredictorFileName
|
||||
{
|
||||
get
|
||||
{
|
||||
return dlibShapePredictorName.ToString() + ".dat";
|
||||
}
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
protected void Start()
|
||||
{
|
||||
exampleTitle.text = "NrealLightWithDlibFaceLandmarkDetector Example " + Application.version;
|
||||
|
||||
versionInfo.text = Core.NATIVE_LIBRARY_NAME + " " + OpenCVForUnity.UnityUtils.Utils.getVersion() + " (" + Core.VERSION + ")";
|
||||
versionInfo.text += " / " + "dlibfacelandmarkdetector" + " " + DlibFaceLandmarkDetector.UnityUtils.Utils.getVersion();
|
||||
versionInfo.text += " / UnityEditor " + Application.unityVersion;
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
versionInfo.text += " / NRSDK " + NRVersionInfo.GetVersion();
|
||||
#endif
|
||||
versionInfo.text += " / ";
|
||||
|
||||
#if UNITY_EDITOR
|
||||
versionInfo.text += "Editor";
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
versionInfo.text += "Windows";
|
||||
#elif UNITY_STANDALONE_OSX
|
||||
versionInfo.text += "Mac OSX";
|
||||
#elif UNITY_STANDALONE_LINUX
|
||||
versionInfo.text += "Linux";
|
||||
#elif UNITY_ANDROID
|
||||
versionInfo.text += "Android";
|
||||
#elif UNITY_IOS
|
||||
versionInfo.text += "iOS";
|
||||
#elif UNITY_WSA
|
||||
versionInfo.text += "WSA";
|
||||
#elif UNITY_WEBGL
|
||||
versionInfo.text += "WebGL";
|
||||
#endif
|
||||
versionInfo.text += " ";
|
||||
#if ENABLE_MONO
|
||||
versionInfo.text += "Mono";
|
||||
#elif ENABLE_IL2CPP
|
||||
versionInfo.text += "IL2CPP";
|
||||
#elif ENABLE_DOTNET
|
||||
versionInfo.text += ".NET";
|
||||
#endif
|
||||
|
||||
scrollRect.verticalNormalizedPosition = verticalNormalizedPosition;
|
||||
|
||||
dlibShapePredictorNameDropdown.value = (int)dlibShapePredictorName;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnScrollRectValueChanged()
|
||||
{
|
||||
verticalNormalizedPosition = scrollRect.verticalNormalizedPosition;
|
||||
}
|
||||
|
||||
|
||||
public void OnShowLicenseButtonClick()
|
||||
{
|
||||
SceneManager.LoadScene("ShowLicense");
|
||||
}
|
||||
|
||||
public void OnNrealPhotoCaptureExampleButtonClick()
|
||||
{
|
||||
SceneManager.LoadScene("NrealPhotoCaptureExample");
|
||||
}
|
||||
|
||||
public void OnNrealFaceLandmarkDetectionExampleButtonClick()
|
||||
{
|
||||
SceneManager.LoadScene("NrealFaceLandmarkDetectionExample");
|
||||
}
|
||||
|
||||
public void OnNrealARHeadExampleButtonClick()
|
||||
{
|
||||
SceneManager.LoadScene("NrealARHeadExample");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Raises the dlib shape predictor name dropdown value changed event.
|
||||
/// </summary>
|
||||
public void OnDlibShapePredictorNameDropdownValueChanged(int result)
|
||||
{
|
||||
dlibShapePredictorName = (DlibShapePredictorNamePreset)result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d0bcdd3ded5b570449db6dcdfd3bbb65
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d7aa38009802d144e8821c86732ecf56
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2fc0511929724934797899a0c4fd9ff5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,419 @@
|
|||
using DlibFaceLandmarkDetector;
|
||||
using NRKernal;
|
||||
using NRKernal.NRExamples;
|
||||
using NRKernal.Record;
|
||||
using OpenCVForUnity.CoreModule;
|
||||
using OpenCVForUnity.ImgprocModule;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NrealLightWithDlibFaceLandmarkDetectorExample
|
||||
{
|
||||
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
using GalleryDataProvider = NativeGalleryDataProvider;
|
||||
#else
|
||||
using GalleryDataProvider = MockGalleryDataProvider;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Nreal PhotoCapture Example
|
||||
/// An example of holographic photo blending using the NRPhotocCapture class on Nreal Light.
|
||||
/// </summary>
|
||||
public class NrealPhotoCaptureExample : MonoBehaviour
|
||||
{
|
||||
/// <summary> The photo capture object. </summary>
|
||||
private NRPhotoCapture m_PhotoCaptureObject;
|
||||
/// <summary> The camera resolution. </summary>
|
||||
private Resolution m_CameraResolution;
|
||||
private bool isOnPhotoProcess = false;
|
||||
GalleryDataProvider galleryDataTool;
|
||||
|
||||
|
||||
GameObject m_Canvas = null;
|
||||
Renderer m_CanvasRenderer = null;
|
||||
Texture2D m_Texture = null;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if enable BlendMode Blend.
|
||||
/// </summary>
|
||||
public bool isBlendModeBlend;
|
||||
|
||||
/// <summary>
|
||||
/// The is BlendMode Blend toggle.
|
||||
/// </summary>
|
||||
public Toggle isBlendModeBlendToggle;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if save texture to gallery.
|
||||
/// </summary>
|
||||
public bool saveTextureToGallery;
|
||||
|
||||
/// <summary>
|
||||
/// The save texture to gallery toggle.
|
||||
/// </summary>
|
||||
public Toggle saveTextureToGalleryToggle;
|
||||
|
||||
/// <summary>
|
||||
/// The rgba mat.
|
||||
/// </summary>
|
||||
Mat rgbMat;
|
||||
|
||||
/// <summary>
|
||||
/// The face landmark detector.
|
||||
/// </summary>
|
||||
FaceLandmarkDetector faceLandmarkDetector;
|
||||
|
||||
/// <summary>
|
||||
/// The dlib shape predictor file name.
|
||||
/// </summary>
|
||||
string dlibShapePredictorFileName;// = "sp_human_face_68.dat";
|
||||
|
||||
/// <summary>
|
||||
/// The dlib shape predictor file path.
|
||||
/// </summary>
|
||||
string dlibShapePredictorFilePath;
|
||||
|
||||
|
||||
protected void Start()
|
||||
{
|
||||
dlibShapePredictorFileName = NrealLightWithDlibFaceLandmarkDetectorExample.dlibShapePredictorFileName;
|
||||
|
||||
isBlendModeBlendToggle.isOn = isBlendModeBlend;
|
||||
saveTextureToGalleryToggle.isOn = saveTextureToGallery;
|
||||
|
||||
m_Canvas = GameObject.Find("PhotoCaptureCanvas");
|
||||
m_CanvasRenderer = m_Canvas.GetComponent<Renderer>() as Renderer;
|
||||
m_CanvasRenderer.enabled = false;
|
||||
}
|
||||
|
||||
/// <summary> Use this for initialization. </summary>
|
||||
void Create(Action<NRPhotoCapture> onCreated)
|
||||
{
|
||||
if (m_PhotoCaptureObject != null)
|
||||
{
|
||||
NRDebugger.Info("The NRPhotoCapture has already been created.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a PhotoCapture object
|
||||
NRPhotoCapture.CreateAsync(false, delegate (NRPhotoCapture captureObject)
|
||||
{
|
||||
m_CameraResolution = NRPhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
|
||||
|
||||
if (captureObject == null)
|
||||
{
|
||||
NRDebugger.Error("Can not get a captureObject.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_PhotoCaptureObject = captureObject;
|
||||
|
||||
CameraParameters cameraParameters = new CameraParameters();
|
||||
cameraParameters.cameraResolutionWidth = m_CameraResolution.width;
|
||||
cameraParameters.cameraResolutionHeight = m_CameraResolution.height;
|
||||
cameraParameters.pixelFormat = CapturePixelFormat.BGRA32;
|
||||
cameraParameters.frameRate = NativeConstants.RECORD_FPS_DEFAULT;
|
||||
cameraParameters.blendMode = (isBlendModeBlend) ? BlendMode.Blend : BlendMode.RGBOnly;
|
||||
|
||||
// Activate the camera
|
||||
m_PhotoCaptureObject.StartPhotoModeAsync(cameraParameters, delegate (NRPhotoCapture.PhotoCaptureResult result)
|
||||
{
|
||||
NRDebugger.Info("Start PhotoMode Async");
|
||||
if (result.success)
|
||||
{
|
||||
onCreated?.Invoke(m_PhotoCaptureObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
isOnPhotoProcess = false;
|
||||
this.Close();
|
||||
NRDebugger.Error("Start PhotoMode faild." + result.resultType);
|
||||
}
|
||||
}, true);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary> Take a photo. </summary>
|
||||
void TakeAPhoto()
|
||||
{
|
||||
if (isOnPhotoProcess)
|
||||
{
|
||||
NRDebugger.Warning("Currently in the process of taking pictures, Can not take photo .");
|
||||
return;
|
||||
}
|
||||
|
||||
isOnPhotoProcess = true;
|
||||
if (m_PhotoCaptureObject == null)
|
||||
{
|
||||
this.Create((capture) =>
|
||||
{
|
||||
capture.TakePhotoAsync(OnCapturedPhotoToMemory);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
m_PhotoCaptureObject.TakePhotoAsync(OnCapturedPhotoToMemory);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Executes the 'captured photo memory' action. </summary>
|
||||
/// <param name="result"> The result.</param>
|
||||
/// <param name="photoCaptureFrame"> The photo capture frame.</param>
|
||||
void OnCapturedPhotoToMemory(NRPhotoCapture.PhotoCaptureResult result, PhotoCaptureFrame photoCaptureFrame)
|
||||
{
|
||||
Debug.Log("photoCaptureFrame.pixelFormat " + photoCaptureFrame.pixelFormat);
|
||||
Debug.Log("photoCaptureFrame.hasLocationData " + photoCaptureFrame.hasLocationData);
|
||||
Debug.Log("photoCaptureFrame.dataLength " + photoCaptureFrame.dataLength);
|
||||
|
||||
Matrix4x4 cameraToWorldMatrix;
|
||||
Matrix4x4 projectionMatrix;
|
||||
|
||||
if (photoCaptureFrame.hasLocationData)
|
||||
{
|
||||
photoCaptureFrame.TryGetCameraToWorldMatrix(out cameraToWorldMatrix);
|
||||
photoCaptureFrame.TryGetProjectionMatrix(out projectionMatrix);
|
||||
}
|
||||
else
|
||||
{
|
||||
Camera mainCamera = NRSessionManager.Instance.NRHMDPoseTracker.centerCamera;
|
||||
cameraToWorldMatrix = mainCamera.cameraToWorldMatrix;
|
||||
|
||||
bool _result;
|
||||
EyeProjectMatrixData pm = NRFrame.GetEyeProjectMatrix(out _result, 0.3f, 1000f);
|
||||
projectionMatrix = pm.RGBEyeMatrix;
|
||||
}
|
||||
|
||||
Debug.Log("cameraToWorldMatrix:\n" + cameraToWorldMatrix.ToString());
|
||||
Debug.Log("projectionMatrix:\n" + projectionMatrix.ToString());
|
||||
|
||||
Matrix4x4 worldToCameraMatrix = cameraToWorldMatrix.inverse;
|
||||
|
||||
|
||||
if (m_Texture == null)
|
||||
{
|
||||
m_Texture = new Texture2D(m_CameraResolution.width, m_CameraResolution.height, TextureFormat.RGB24, false);
|
||||
rgbMat = new Mat(m_Texture.height, m_Texture.width, CvType.CV_8UC3);
|
||||
|
||||
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
|
||||
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
|
||||
{
|
||||
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
|
||||
}
|
||||
faceLandmarkDetector = new FaceLandmarkDetector(dlibShapePredictorFilePath);
|
||||
}
|
||||
|
||||
// Copy the raw image data into our target texture
|
||||
photoCaptureFrame.UploadImageDataToTexture(m_Texture);
|
||||
|
||||
|
||||
OpenCVForUnity.UnityUtils.Utils.texture2DToMat(m_Texture, rgbMat);
|
||||
|
||||
OpenCVForUnityUtils.SetImage(faceLandmarkDetector, rgbMat);
|
||||
|
||||
//detect face
|
||||
List<FaceLandmarkDetector.RectDetection> detectResult = faceLandmarkDetector.DetectRectDetection();
|
||||
|
||||
// fill all black.
|
||||
//Imgproc.rectangle (rgbMat, new Point (0, 0), new Point (rgbMat.width (), rgbMat.height ()), new Scalar (0, 0, 0, 0), -1);
|
||||
// draw an edge lines.
|
||||
Imgproc.rectangle(rgbMat, new Point(0, 0), new Point(rgbMat.width(), rgbMat.height()), new Scalar(255, 0, 0, 255), 2);
|
||||
// draw a diagonal line.
|
||||
//Imgproc.line (rgbMat, new Point (0, 0), new Point (rgbMat.cols (), rgbMat.rows ()), new Scalar (255, 0, 0, 255));
|
||||
|
||||
foreach (var r in detectResult)
|
||||
{
|
||||
Debug.Log("rect : " + r.rect);
|
||||
|
||||
//detect landmark points
|
||||
List<Vector2> points = faceLandmarkDetector.DetectLandmark(r.rect);
|
||||
|
||||
Debug.Log("face points count : " + points.Count);
|
||||
//draw landmark points
|
||||
OpenCVForUnityUtils.DrawFaceLandmark(rgbMat, points, new Scalar(0, 255, 0, 255), 2);
|
||||
|
||||
//draw face rect
|
||||
OpenCVForUnityUtils.DrawFaceRect(rgbMat, r.rect, new Scalar(255, 0, 0, 255), 2);
|
||||
}
|
||||
|
||||
Imgproc.putText(rgbMat, "W:" + rgbMat.width() + " H:" + rgbMat.height() + " SO:" + Screen.orientation, new Point(5, rgbMat.rows() - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 1.5, new Scalar(0, 255, 0, 255), 2, Imgproc.LINE_AA, false);
|
||||
|
||||
OpenCVForUnity.UnityUtils.Utils.matToTexture2D(rgbMat, m_Texture);
|
||||
|
||||
|
||||
|
||||
m_Texture.wrapMode = TextureWrapMode.Clamp;
|
||||
|
||||
m_CanvasRenderer.enabled = true;
|
||||
m_CanvasRenderer.sharedMaterial.SetTexture("_MainTex", m_Texture);
|
||||
m_CanvasRenderer.sharedMaterial.SetMatrix("_WorldToCameraMatrix", worldToCameraMatrix);
|
||||
m_CanvasRenderer.sharedMaterial.SetMatrix("_CameraProjectionMatrix", projectionMatrix);
|
||||
m_CanvasRenderer.sharedMaterial.SetVector("_VignetteOffset", new Vector4(0, 0));
|
||||
m_CanvasRenderer.sharedMaterial.SetFloat("_VignetteScale", 0.0f);
|
||||
|
||||
|
||||
/*
|
||||
// Position the canvas object slightly in front
|
||||
// of the real world web camera.
|
||||
Vector3 position = cameraToWorldMatrix.GetColumn(3) - cameraToWorldMatrix.GetColumn(2);
|
||||
position *= 1.5f;
|
||||
|
||||
// Rotate the canvas object so that it faces the user.
|
||||
Quaternion rotation = Quaternion.LookRotation(-cameraToWorldMatrix.GetColumn(2), cameraToWorldMatrix.GetColumn(1));
|
||||
|
||||
m_Canvas.transform.position = position;
|
||||
m_Canvas.transform.rotation = rotation;
|
||||
*/
|
||||
|
||||
// Adjusting the position and scale of the display screen
|
||||
// to counteract the phenomenon of texture margins (transparent areas in MR space) being displayed as black when recording video using NRVideoCapture.
|
||||
//
|
||||
// Position the canvas object slightly in front
|
||||
// of the real world web camera.
|
||||
float overlayDistance = 1.5f;
|
||||
Vector3 ccCameraSpacePos = UnProjectVector(projectionMatrix, new Vector3(0.0f, 0.0f, overlayDistance));
|
||||
Vector3 tlCameraSpacePos = UnProjectVector(projectionMatrix, new Vector3(-overlayDistance, overlayDistance, overlayDistance));
|
||||
|
||||
//position
|
||||
Vector3 position = cameraToWorldMatrix.MultiplyPoint3x4(ccCameraSpacePos);
|
||||
m_Canvas.transform.position = position;
|
||||
|
||||
//scale
|
||||
Vector3 scale = new Vector3(Mathf.Abs(tlCameraSpacePos.x - ccCameraSpacePos.x) * 2, Mathf.Abs(tlCameraSpacePos.y - ccCameraSpacePos.y) * 2, 1);
|
||||
m_Canvas.transform.localScale = scale;
|
||||
|
||||
// Rotate the canvas object so that it faces the user.
|
||||
Quaternion rotation = Quaternion.LookRotation(-cameraToWorldMatrix.GetColumn(2), cameraToWorldMatrix.GetColumn(1));
|
||||
m_Canvas.transform.rotation = rotation;
|
||||
//
|
||||
|
||||
|
||||
|
||||
Debug.Log("Took picture!");
|
||||
|
||||
if (saveTextureToGallery)
|
||||
SaveTextureToGallery(m_Texture);
|
||||
|
||||
// Release camera resource after capture the photo.
|
||||
this.Close();
|
||||
}
|
||||
|
||||
//
|
||||
private Vector3 UnProjectVector(Matrix4x4 proj, Vector3 to)
|
||||
{
|
||||
Vector3 from = new Vector3(0, 0, 0);
|
||||
var axsX = proj.GetRow(0);
|
||||
var axsY = proj.GetRow(1);
|
||||
var axsZ = proj.GetRow(2);
|
||||
from.z = to.z / axsZ.z;
|
||||
from.y = (to.y - (from.z * axsY.z)) / axsY.y;
|
||||
from.x = (to.x - (from.z * axsX.z)) / axsX.x;
|
||||
return from;
|
||||
}
|
||||
//
|
||||
|
||||
/// <summary> Closes this object. </summary>
|
||||
void Close()
|
||||
{
|
||||
if (m_PhotoCaptureObject == null)
|
||||
{
|
||||
NRDebugger.Error("The NRPhotoCapture has not been created.");
|
||||
return;
|
||||
}
|
||||
// Deactivate our camera
|
||||
m_PhotoCaptureObject.StopPhotoModeAsync(OnStoppedPhotoMode);
|
||||
}
|
||||
|
||||
/// <summary> Executes the 'stopped photo mode' action. </summary>
|
||||
/// <param name="result"> The result.</param>
|
||||
void OnStoppedPhotoMode(NRPhotoCapture.PhotoCaptureResult result)
|
||||
{
|
||||
// Shutdown our photo capture resource
|
||||
m_PhotoCaptureObject?.Dispose();
|
||||
m_PhotoCaptureObject = null;
|
||||
isOnPhotoProcess = false;
|
||||
}
|
||||
|
||||
/// <summary> Executes the 'destroy' action. </summary>
|
||||
void OnDestroy()
|
||||
{
|
||||
// Shutdown our photo capture resource
|
||||
m_PhotoCaptureObject?.Dispose();
|
||||
m_PhotoCaptureObject = null;
|
||||
|
||||
|
||||
if (m_Texture != null)
|
||||
{
|
||||
Texture2D.Destroy(m_Texture);
|
||||
m_Texture = null;
|
||||
}
|
||||
|
||||
if (rgbMat != null)
|
||||
rgbMat.Dispose();
|
||||
|
||||
if (faceLandmarkDetector != null)
|
||||
faceLandmarkDetector.Dispose();
|
||||
}
|
||||
|
||||
|
||||
public void SaveTextureToGallery(Texture2D _texture)
|
||||
{
|
||||
try
|
||||
{
|
||||
string filename = string.Format("Nreal_Shot_{0}.png", NRTools.GetTimeStamp().ToString());
|
||||
byte[] _bytes = _texture.EncodeToPNG();
|
||||
NRDebugger.Info(_bytes.Length / 1024 + "Kb was saved as: " + filename);
|
||||
if (galleryDataTool == null)
|
||||
{
|
||||
galleryDataTool = new GalleryDataProvider();
|
||||
}
|
||||
|
||||
galleryDataTool.InsertImage(_bytes, filename, "Screenshots");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
NRDebugger.Error("[TakePicture] Save picture faild!");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the back button click event.
|
||||
/// </summary>
|
||||
public void OnBackButtonClick()
|
||||
{
|
||||
SceneManager.LoadScene("NrealLightWithDlibFaceLandmarkDetectorExample");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the take photo button click event.
|
||||
/// </summary>
|
||||
public void OnTakePhotoButtonClick()
|
||||
{
|
||||
TakeAPhoto();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the is BlendMode Blend toggle value changed event.
|
||||
/// </summary>
|
||||
public void OnIsBlendModeBlendToggleValueChanged()
|
||||
{
|
||||
isBlendModeBlend = isBlendModeBlendToggle.isOn;
|
||||
|
||||
if (m_PhotoCaptureObject != null)
|
||||
this.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the save texture to gallery toggle value changed event.
|
||||
/// </summary>
|
||||
public void OnSaveTextureToGalleryToggleValueChanged()
|
||||
{
|
||||
saveTextureToGallery = saveTextureToGalleryToggle.isOn;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1ac4eca3efefdb44e969c2f7e6122c27
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 520afb35f601e704faf80973be1c4a05
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1c93efbfc058f854aaa16ed1a6eb97d4
|
||||
folderAsset: yes
|
||||
timeCreated: 1479443957
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f7c57559e5ca892409cb9a5b9ee4d309
|
||||
folderAsset: yes
|
||||
timeCreated: 1493639110
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,522 @@
|
|||
using OpenCVForUnity.CoreModule;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Rect = OpenCVForUnity.CoreModule.Rect;
|
||||
|
||||
namespace OpenCVForUnity.RectangleTrack
|
||||
{
|
||||
/// <summary>
|
||||
/// Rectangle tracker.
|
||||
/// Referring to https://github.com/Itseez/opencv/blob/master/modules/objdetect/src/detection_based_tracker.cpp.
|
||||
/// v 1.0.4
|
||||
/// </summary>
|
||||
public class RectangleTracker
|
||||
{
|
||||
public List<TrackedObject> trackedObjects
|
||||
{
|
||||
get { return _trackedObjects; }
|
||||
}
|
||||
|
||||
private List<TrackedObject> _trackedObjects;
|
||||
|
||||
|
||||
public TrackerParameters trackerParameters
|
||||
{
|
||||
get { return _trackerParameters; }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
_trackerParameters = value;
|
||||
}
|
||||
}
|
||||
|
||||
private TrackerParameters _trackerParameters;
|
||||
|
||||
|
||||
public List<float> weightsPositionsSmoothing
|
||||
{
|
||||
get { return _weightsPositionsSmoothing; }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
_weightsPositionsSmoothing = value;
|
||||
}
|
||||
}
|
||||
|
||||
private List<float> _weightsPositionsSmoothing = new List<float>();
|
||||
|
||||
public List<float> weightsSizesSmoothing
|
||||
{
|
||||
get { return _weightsSizesSmoothing; }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
_weightsSizesSmoothing = value;
|
||||
}
|
||||
}
|
||||
|
||||
private List<float> _weightsSizesSmoothing = new List<float>();
|
||||
|
||||
public RectangleTracker(TrackerParameters trackerParamerers = null)
|
||||
{
|
||||
_trackedObjects = new List<TrackedObject>();
|
||||
|
||||
if (trackerParamerers != null)
|
||||
{
|
||||
this._trackerParameters = trackerParamerers;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._trackerParameters = new TrackerParameters();
|
||||
}
|
||||
|
||||
_weightsPositionsSmoothing.Add(1);
|
||||
_weightsSizesSmoothing.Add(0.5f);
|
||||
_weightsSizesSmoothing.Add(0.3f);
|
||||
_weightsSizesSmoothing.Add(0.2f);
|
||||
}
|
||||
|
||||
public enum TrackedRectState : int
|
||||
{
|
||||
NEW_RECTANGLE = -1,
|
||||
INTERSECTED_RECTANGLE = -2
|
||||
}
|
||||
|
||||
|
||||
public void GetObjects(List<Rect> result, bool smoothing = true)
|
||||
{
|
||||
result.Clear();
|
||||
|
||||
int count = _trackedObjects.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Rect r;
|
||||
if (smoothing)
|
||||
{
|
||||
r = GetSmoothingRect(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = _trackedObjects[i].position;
|
||||
}
|
||||
|
||||
if (_trackedObjects[i].state > TrackedState.NEW_DISPLAYED && _trackedObjects[i].state < TrackedState.NEW_HIDED)
|
||||
result.Add(r);
|
||||
|
||||
//LOGD("DetectionBasedTracker::process: found a object with SIZE %d x %d, rect={%d, %d, %d x %d}", r.width, r.height, r.x, r.y, r.width, r.height);
|
||||
//Debug.Log("GetObjects" + r.width + " " + r.height + " " + r.x + " " + r.y + " " + r.width + " " + r.height + " " + trackedObjects[i].state + " " + trackedObjects[i].numDetectedFrames + " " + trackedObjects[i].numFramesNotDetected);
|
||||
}
|
||||
}
|
||||
|
||||
public void GetObjects(List<TrackedRect> result, bool smoothing = true)
|
||||
{
|
||||
result.Clear();
|
||||
|
||||
int count = _trackedObjects.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Rect r;
|
||||
if (smoothing)
|
||||
{
|
||||
r = GetSmoothingRect(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = _trackedObjects[i].position;
|
||||
}
|
||||
|
||||
result.Add(new TrackedRect(_trackedObjects[i].id, r, _trackedObjects[i].state, _trackedObjects[i].numDetectedFrames, _trackedObjects[i].numFramesNotDetected));
|
||||
|
||||
//LOGD("DetectionBasedTracker::process: found a object with SIZE %d x %d, rect={%d, %d, %d x %d}", r.width, r.height, r.x, r.y, r.width, r.height);
|
||||
//Debug.Log("GetObjects" + r.width + " " + r.height + " " + r.x + " " + r.y + " " + r.width + " " + r.height + " " + trackedObjects[i].state + " " + trackedObjects[i].numDetectedFrames + " " + trackedObjects[i].numFramesNotDetected);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateTrackedObjects(List<Rect> detectedObjects)
|
||||
{
|
||||
if (detectedObjects == null)
|
||||
throw new ArgumentNullException("detectedObjects");
|
||||
|
||||
Rect[] correctionRects = CreateCorrectionBySpeedOfRects();
|
||||
|
||||
int N1 = (int)_trackedObjects.Count;
|
||||
int N2 = (int)detectedObjects.Count;
|
||||
|
||||
for (int i = 0; i < N1; i++)
|
||||
{
|
||||
_trackedObjects[i].numDetectedFrames++;
|
||||
}
|
||||
|
||||
int[] correspondence = Enumerable.Repeat<int>((int)TrackedRectState.NEW_RECTANGLE, N2).ToArray();
|
||||
|
||||
|
||||
for (int i = 0; i < N1; i++)
|
||||
{
|
||||
TrackedObject curObject = _trackedObjects[i];
|
||||
|
||||
int bestIndex = -1;
|
||||
int bestArea = -1;
|
||||
|
||||
//int numpositions = (int)curObject.lastPositions.Count;
|
||||
//if (numpositions > 0) UnityEngine.Debug.LogError("numpositions > 0 is false");
|
||||
|
||||
//OpenCVRect prevRect = curObject.lastPositions[numpositions - 1];
|
||||
Rect prevRect = correctionRects[i];
|
||||
|
||||
for (int j = 0; j < N2; j++)
|
||||
{
|
||||
if (correspondence[j] >= 0)
|
||||
{
|
||||
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: j=" + j + " is rejected, because it has correspondence=" + correspondence[j]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (correspondence[j] != (int)TrackedRectState.NEW_RECTANGLE)
|
||||
{
|
||||
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: j=" + j + " is rejected, because it is intersected with another rectangle");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IsCollideByRectangle(prevRect, detectedObjects[j], _trackerParameters.coeffRectangleOverlap))
|
||||
{
|
||||
Rect r = Intersect(prevRect, detectedObjects[j]);
|
||||
if ((r.width > 0) && (r.height > 0))
|
||||
{
|
||||
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: There is intersection between prevRect and detectedRect r={" + r.x + ", " + r.y + ", " + r.width + ", " + r.height + "]");
|
||||
|
||||
correspondence[j] = (int)TrackedRectState.INTERSECTED_RECTANGLE;
|
||||
|
||||
if (r.area() > bestArea)
|
||||
{
|
||||
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: The area of intersection is " + r.area() + " it is better than bestArea= " + bestArea);
|
||||
|
||||
bestIndex = j;
|
||||
bestArea = (int)r.area();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bestIndex >= 0)
|
||||
{
|
||||
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: The best correspondence for i=" + i + " is j=" + bestIndex);
|
||||
|
||||
correspondence[bestIndex] = i;
|
||||
|
||||
Rect bestRect = detectedObjects[bestIndex];
|
||||
|
||||
for (int j = 0; j < N2; j++)
|
||||
{
|
||||
if (correspondence[j] >= 0)
|
||||
continue;
|
||||
|
||||
if (IsCollideByRectangle(detectedObjects[j], bestRect, _trackerParameters.coeffRectangleOverlap))
|
||||
{
|
||||
Rect r = Intersect(detectedObjects[j], bestRect);
|
||||
|
||||
if ((r.width > 0) && (r.height > 0))
|
||||
{
|
||||
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: Found intersection between rectangles j= " + j + " and bestIndex= " + bestIndex + " rectangle j= " + j + " is marked as intersected");
|
||||
|
||||
correspondence[j] = (int)TrackedRectState.INTERSECTED_RECTANGLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: There is no correspondence for i= " + i);
|
||||
curObject.numFramesNotDetected++;
|
||||
}
|
||||
}
|
||||
|
||||
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: start second cycle");
|
||||
for (int j = 0; j < N2; j++)
|
||||
{
|
||||
int i = correspondence[j];
|
||||
if (i >= 0)
|
||||
{//add position
|
||||
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: add position");
|
||||
|
||||
_trackedObjects[i].lastPositions.Add(detectedObjects[j]);
|
||||
while ((int)_trackedObjects[i].lastPositions.Count > (int)_trackerParameters.numLastPositionsToTrack)
|
||||
{
|
||||
_trackedObjects[i].lastPositions.Remove(_trackedObjects[i].lastPositions[0]);
|
||||
}
|
||||
_trackedObjects[i].numFramesNotDetected = 0;
|
||||
if (_trackedObjects[i].state != TrackedState.DELETED)
|
||||
_trackedObjects[i].state = TrackedState.DISPLAYED;
|
||||
}
|
||||
else if (i == (int)TrackedRectState.NEW_RECTANGLE)
|
||||
{ //new object
|
||||
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: new object");
|
||||
|
||||
_trackedObjects.Add(new TrackedObject(detectedObjects[j]));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: was auxiliary intersection");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int t = 0;
|
||||
TrackedObject it;
|
||||
while (t < _trackedObjects.Count)
|
||||
{
|
||||
it = _trackedObjects[t];
|
||||
|
||||
if (it.state == TrackedState.DELETED)
|
||||
{
|
||||
_trackedObjects.Remove(it);
|
||||
}
|
||||
else if ((it.numFramesNotDetected > _trackerParameters.maxTrackLifetime)//ALL
|
||||
||
|
||||
((it.numDetectedFrames <= _trackerParameters.numStepsToWaitBeforeFirstShow)
|
||||
&&
|
||||
(it.numFramesNotDetected > _trackerParameters.numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown)))
|
||||
{
|
||||
it.state = TrackedState.DELETED;
|
||||
t++;
|
||||
}
|
||||
else if (it.state >= TrackedState.DISPLAYED)
|
||||
{//DISPLAYED, NEW_DISPLAYED, HIDED
|
||||
|
||||
if (it.numDetectedFrames < _trackerParameters.numStepsToWaitBeforeFirstShow)
|
||||
{
|
||||
it.state = TrackedState.PENDING;
|
||||
}
|
||||
else if (it.numDetectedFrames == _trackerParameters.numStepsToWaitBeforeFirstShow)
|
||||
{
|
||||
//i, trackedObjects[i].numDetectedFrames, innerParameters.numStepsToWaitBeforeFirstShow);
|
||||
it.state = TrackedState.NEW_DISPLAYED;
|
||||
}
|
||||
else if (it.numFramesNotDetected == _trackerParameters.numStepsToShowWithoutDetecting)
|
||||
{
|
||||
it.state = TrackedState.NEW_HIDED;
|
||||
}
|
||||
else if (it.numFramesNotDetected > _trackerParameters.numStepsToShowWithoutDetecting)
|
||||
{
|
||||
it.state = TrackedState.HIDED;
|
||||
}
|
||||
|
||||
t++;
|
||||
}
|
||||
else
|
||||
{//NEW
|
||||
t++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Rect[] CreateCorrectionBySpeedOfRects()
|
||||
{
|
||||
//Debug.Log("DetectionBasedTracker::process: get _rectsWhereRegions from previous positions");
|
||||
Rect[] rectsWhereRegions = new Rect[_trackedObjects.Count];
|
||||
|
||||
int count = _trackedObjects.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int n = _trackedObjects[i].lastPositions.Count;
|
||||
//if (n > 0) UnityEngine.Debug.LogError("n > 0 is false");
|
||||
|
||||
Rect r = _trackedObjects[i].lastPositions[n - 1].clone();
|
||||
|
||||
//if (r.area() == 0)
|
||||
//{
|
||||
// Debug.Log("DetectionBasedTracker::process: ERROR: ATTENTION: strange algorithm's behavior: trackedObjects[i].rect() is empty");
|
||||
// continue;
|
||||
//}
|
||||
|
||||
//correction by speed of rectangle
|
||||
if (n > 1)
|
||||
{
|
||||
Point center = CenterRect(r);
|
||||
Point center_prev = CenterRect(_trackedObjects[i].lastPositions[n - 2]);
|
||||
Point shift = new Point((center.x - center_prev.x) * _trackerParameters.coeffObjectSpeedUsingInPrediction,
|
||||
(center.y - center_prev.y) * _trackerParameters.coeffObjectSpeedUsingInPrediction);
|
||||
|
||||
r.x += (int)Math.Round(shift.x);
|
||||
r.y += (int)Math.Round(shift.y);
|
||||
}
|
||||
|
||||
rectsWhereRegions[i] = r;
|
||||
}
|
||||
|
||||
return rectsWhereRegions;
|
||||
}
|
||||
|
||||
public Rect[] CreateRawRects()
|
||||
{
|
||||
Rect[] rectsWhereRegions = new Rect[_trackedObjects.Count];
|
||||
|
||||
int count = _trackedObjects.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
rectsWhereRegions[i] = _trackedObjects[i].position;
|
||||
}
|
||||
|
||||
return rectsWhereRegions;
|
||||
}
|
||||
|
||||
private Point CenterRect(Rect r)
|
||||
{
|
||||
return new Point(r.x + (r.width / 2), r.y + (r.height / 2));
|
||||
}
|
||||
|
||||
private Rect GetSmoothingRect(int i)
|
||||
{
|
||||
//Debug.Log("trackedObjects[i].numFramesNotDetected: " + trackedObjects[i].numFramesNotDetected);
|
||||
|
||||
List<float> weightsSizesSmoothing = _weightsSizesSmoothing;
|
||||
List<float> weightsPositionsSmoothing = _weightsPositionsSmoothing;
|
||||
|
||||
List<Rect> lastPositions = _trackedObjects[i].lastPositions;
|
||||
|
||||
int N = lastPositions.Count;
|
||||
if (N <= 0)
|
||||
{
|
||||
Debug.Log("DetectionBasedTracker::calcTrackedObjectPositionToShow: ERROR: no positions for i=" + i);
|
||||
return new Rect();
|
||||
}
|
||||
|
||||
int Nsize = Math.Min(N, (int)weightsSizesSmoothing.Count);
|
||||
int Ncenter = Math.Min(N, (int)weightsPositionsSmoothing.Count);
|
||||
|
||||
Point center = new Point();
|
||||
double w = 0, h = 0;
|
||||
if (Nsize > 0)
|
||||
{
|
||||
double sum = 0;
|
||||
for (int j = 0; j < Nsize; j++)
|
||||
{
|
||||
int k = N - j - 1;
|
||||
w += lastPositions[k].width * weightsSizesSmoothing[j];
|
||||
h += lastPositions[k].height * weightsSizesSmoothing[j];
|
||||
sum += weightsSizesSmoothing[j];
|
||||
}
|
||||
w /= sum;
|
||||
h /= sum;
|
||||
}
|
||||
else
|
||||
{
|
||||
w = lastPositions[N - 1].width;
|
||||
h = lastPositions[N - 1].height;
|
||||
}
|
||||
|
||||
if (Ncenter > 0)
|
||||
{
|
||||
double sum = 0;
|
||||
for (int j = 0; j < Ncenter; j++)
|
||||
{
|
||||
int k = N - j - 1;
|
||||
Point tl = lastPositions[k].tl();
|
||||
Point br = lastPositions[k].br();
|
||||
Point c1;
|
||||
|
||||
c1 = new Point(tl.x * 0.5f, tl.y * 0.5f);
|
||||
Point c2;
|
||||
|
||||
c2 = new Point(br.x * 0.5f, br.y * 0.5f);
|
||||
c1 = new Point(c1.x + c2.x, c1.y + c2.y);
|
||||
|
||||
center = new Point(center.x + (c1.x * weightsPositionsSmoothing[j]), center.y + (c1.y * weightsPositionsSmoothing[j]));
|
||||
sum += weightsPositionsSmoothing[j];
|
||||
}
|
||||
center = new Point(center.x * (1 / sum), center.y * (1 / sum));
|
||||
}
|
||||
else
|
||||
{
|
||||
int k = N - 1;
|
||||
Point tl = lastPositions[k].tl();
|
||||
Point br = lastPositions[k].br();
|
||||
Point c1;
|
||||
|
||||
c1 = new Point(tl.x * 0.5f, tl.y * 0.5f);
|
||||
Point c2;
|
||||
|
||||
c2 = new Point(br.x * 0.5f, br.y * 0.5f);
|
||||
|
||||
center = new Point(c1.x + c2.x, c1.y + c2.y);
|
||||
}
|
||||
Point tl2 = new Point(center.x - (w * 0.5f), center.y - (h * 0.5f));
|
||||
Rect res = new Rect((int)Math.Round(tl2.x), (int)Math.Round(tl2.y), (int)Math.Round(w), (int)Math.Round(h));
|
||||
|
||||
//Debug.Log("DetectionBasedTracker::calcTrackedObjectPositionToShow: Result for i=" + i + ": {" + res.x + ", " + res.y + ", " + res.width + ", " + res.height + "}");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_trackedObjects.Clear();
|
||||
}
|
||||
|
||||
private Rect Intersect(Rect a, Rect b)
|
||||
{
|
||||
int x1 = Math.Max(a.x, b.x);
|
||||
int x2 = Math.Min(a.x + a.width, b.x + b.width);
|
||||
int y1 = Math.Max(a.y, b.y);
|
||||
int y2 = Math.Min(a.y + a.height, b.y + b.height);
|
||||
|
||||
if (x2 >= x1 && y2 >= y1)
|
||||
return new Rect(x1, y1, x2 - x1, y2 - y1);
|
||||
else
|
||||
return new Rect();
|
||||
}
|
||||
|
||||
//private bool IsCollideByCircle(Rect a, Rect b, float coeffRectangleOverlap)
|
||||
//{
|
||||
// int r1 = (int)(a.width / 2.0f);
|
||||
// int r2 = (int)(b.width / 2.0f);
|
||||
// int px1 = a.x + r1;
|
||||
// int py1 = a.y + r1;
|
||||
// int px2 = b.x + r2;
|
||||
// int py2 = b.y + r2;
|
||||
|
||||
// if ((px2 - px1) * (px2 - px1) + (py2 - py1) * (py2 - py1) <= (r1 + r2) * (r1 + r2) * coeffRectangleOverlap)
|
||||
// return true;
|
||||
// else
|
||||
// return false;
|
||||
//}
|
||||
|
||||
private bool IsCollideByRectangle(Rect a, Rect b, float coeffRectangleOverlap)
|
||||
{
|
||||
int mw = (int)(a.width * coeffRectangleOverlap);
|
||||
int mh = (int)(a.height * coeffRectangleOverlap);
|
||||
int mx1 = (int)(a.x + (a.width - mw) / 2.0f);
|
||||
int my1 = (int)(a.y + (a.height - mh) / 2.0f);
|
||||
int mx2 = (int)(mx1 + mw);
|
||||
int my2 = (int)(my1 + mh);
|
||||
|
||||
int ew = (int)(b.width * coeffRectangleOverlap);
|
||||
int eh = (int)(b.height * coeffRectangleOverlap);
|
||||
int ex1 = (int)(b.x + (b.width - ew) / 2.0f);
|
||||
int ey1 = (int)(b.y + (b.height - eh) / 2.0f);
|
||||
int ex2 = (int)(ex1 + ew);
|
||||
int ey2 = (int)(ey1 + eh);
|
||||
|
||||
if (mx1 <= ex2 && ex1 <= mx2 && my1 <= ey2 && ey1 <= my2)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2729ba24949514e4987e9b249f4115f9
|
||||
timeCreated: 1493639110
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,52 @@
|
|||
using OpenCVForUnity.CoreModule;
|
||||
using PositionsVector = System.Collections.Generic.List<OpenCVForUnity.CoreModule.Rect>;
|
||||
|
||||
namespace OpenCVForUnity.RectangleTrack
|
||||
{
|
||||
public enum TrackedState : int
|
||||
{
|
||||
NEW = 0,
|
||||
PENDING = 1,
|
||||
NEW_DISPLAYED = 2,
|
||||
DISPLAYED = 3,
|
||||
NEW_HIDED = 4,
|
||||
HIDED = 5,
|
||||
DELETED = 6
|
||||
}
|
||||
|
||||
public class TrackedObject
|
||||
{
|
||||
public PositionsVector lastPositions;
|
||||
public int numDetectedFrames;
|
||||
public int numFramesNotDetected;
|
||||
public int id;
|
||||
public TrackedState state;
|
||||
|
||||
public Rect position
|
||||
{
|
||||
get { return lastPositions[lastPositions.Count - 1].clone(); }
|
||||
}
|
||||
|
||||
static private int _id = 0;
|
||||
|
||||
public TrackedObject(Rect rect)
|
||||
{
|
||||
lastPositions = new PositionsVector();
|
||||
|
||||
numDetectedFrames = 1;
|
||||
numFramesNotDetected = 0;
|
||||
state = TrackedState.NEW;
|
||||
|
||||
lastPositions.Add(rect.clone());
|
||||
|
||||
_id = GetNextId();
|
||||
id = _id;
|
||||
}
|
||||
|
||||
static int GetNextId()
|
||||
{
|
||||
_id++;
|
||||
return _id;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f59f132f755a0354c887f6c0e12e99a5
|
||||
timeCreated: 1493639110
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,21 @@
|
|||
using OpenCVForUnity.CoreModule;
|
||||
|
||||
namespace OpenCVForUnity.RectangleTrack
|
||||
{
|
||||
public class TrackedRect : Rect
|
||||
{
|
||||
public int numDetectedFrames;
|
||||
public int numFramesNotDetected;
|
||||
public int id;
|
||||
public TrackedState state;
|
||||
|
||||
public TrackedRect(int id, Rect rect, TrackedState state, int numDetectedFrames, int numFramesNotDetected)
|
||||
: base(rect.x, rect.y, rect.width, rect.height)
|
||||
{
|
||||
this.numDetectedFrames = numDetectedFrames;
|
||||
this.numFramesNotDetected = numFramesNotDetected;
|
||||
this.id = id;
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d05ff3f2c557b92438a33f05b1203d21
|
||||
timeCreated: 1493639110
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,33 @@
|
|||
namespace OpenCVForUnity.RectangleTrack
|
||||
{
|
||||
public class TrackerParameters
|
||||
{
|
||||
public int numLastPositionsToTrack = 4;
|
||||
public int numStepsToWaitBeforeFirstShow = 6;
|
||||
public int numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown = 3;
|
||||
public int numStepsToShowWithoutDetecting = 3;
|
||||
|
||||
public int maxTrackLifetime = 5;
|
||||
|
||||
public float coeffObjectSpeedUsingInPrediction = 0.8f;
|
||||
public float coeffRectangleOverlap = 0.7f;
|
||||
|
||||
public TrackerParameters()
|
||||
{
|
||||
}
|
||||
|
||||
public TrackerParameters Clone()
|
||||
{
|
||||
TrackerParameters trackerParameters = new TrackerParameters();
|
||||
trackerParameters.numLastPositionsToTrack = numLastPositionsToTrack;
|
||||
trackerParameters.numStepsToWaitBeforeFirstShow = numStepsToWaitBeforeFirstShow;
|
||||
trackerParameters.numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown = numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown;
|
||||
trackerParameters.numStepsToShowWithoutDetecting = numStepsToShowWithoutDetecting;
|
||||
trackerParameters.maxTrackLifetime = maxTrackLifetime;
|
||||
trackerParameters.coeffObjectSpeedUsingInPrediction = coeffObjectSpeedUsingInPrediction;
|
||||
trackerParameters.coeffRectangleOverlap = coeffRectangleOverlap;
|
||||
|
||||
return trackerParameters;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 20ef35f558fce4646b446cab40538276
|
||||
timeCreated: 1493639110
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче