refine scene on demo

add layout
master
uc-hoba 8 years ago
parent 9fcd03d68b
commit a82c15bedc
  1. 2
      Unity_2018_Frozen/Assets/Frozen/DSAsset/Elsa-Standby.asset
  2. 948
      Unity_2018_Frozen/Assets/Frozen/Frozen.unity
  3. 2
      Unity_2018_Frozen/Assets/Frozen/Material/GiantSnowflake.mat
  4. 4
      Unity_2018_Frozen/Assets/Frozen/PostProcessingProfile.asset
  5. 6
      Unity_2018_Frozen/Assets/Frozen/Script/CharacterBehaviour.cs
  6. 5
      Unity_2018_Frozen/Assets/Frozen/Script/CharacterDummy.cs
  7. 81
      Unity_2018_Frozen/Assets/Frozen/Script/ElsaEffectGenerator.cs
  8. 13
      Unity_2018_Frozen/Assets/Frozen/Script/ElsaEffectGenerator.cs.meta
  9. 14
      Unity_2018_Frozen/Assets/Frozen/Script/FrozenScreenToWorldSpace.cs
  10. 9
      Unity_2018_Frozen/Assets/Frozen/Script/SceneController.cs
  11. 4
      Unity_2018_Frozen/Assets/Frozen/Texture/Character/Kristoff.png
  12. 4
      Unity_2018_Frozen/Assets/Frozen/Texture/Character/Olaf_CC065053.png
  13. 4
      Unity_2018_Frozen/Assets/Frozen/Texture/Character/Olaf_CC065056.png
  14. 4
      Unity_2018_Frozen/Assets/Frozen/Texture/Character/Sven.png
  15. 4
      Unity_2018_Frozen/Assets/Frozen/Texture/Character/anna.png
  16. BIN
      Unity_2018_Frozen/Assets/Frozen/Texture/space-dark-mountain-layout.jpg
  17. 88
      Unity_2018_Frozen/Assets/Frozen/Texture/space-dark-mountain-layout.jpg.meta
  18. BIN
      Unity_2018_Frozen/Assets/Frozen/Texture/space-ice-forest-layout.jpg
  19. 88
      Unity_2018_Frozen/Assets/Frozen/Texture/space-ice-forest-layout.jpg.meta
  20. 31
      Unity_2018_Frozen/Assets/KinectOpticalFlow/KinectOpticalFlowMath.cs

@ -12,4 +12,4 @@ MonoBehaviour:
m_Name: Elsa-Standby
m_EditorClassIdentifier:
m_VideoLocation: 1
m_VideoPath: ../FrozenMaterial/Demo/Olaf-standby.avi
m_VideoPath: ../FrozenMaterial/night/Elsa_Icon.avi

File diff suppressed because it is too large Load Diff

@ -72,5 +72,5 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 2.0670986e-25}
- _Color: {r: 1, g: 1, b: 1, a: 0.99999887}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

@ -100,14 +100,14 @@ MonoBehaviour:
m_Enabled: 1
m_Settings:
bloom:
intensity: 2.17
intensity: 1
threshold: 1.1
softKnee: 0.5
radius: 4
antiFlicker: 0
lensDirt:
texture: {fileID: 0}
intensity: 3
intensity: 0
colorGrading:
m_Enabled: 1
m_Settings:

@ -11,7 +11,7 @@ public class CharacterBehaviour : MonoBehaviour
private bool standby = true;
[Range(3, 15)]
[Range(0, 15)]
public float disappearTime = 5;
public Material mat;
@ -290,6 +290,7 @@ public class CharacterBehaviour : MonoBehaviour
transform.position = dummy.transform.position;
transform.rotation = dummy.transform.rotation;
UpdateWallRoiFromPosition();
UpdateButtonPos();
}
void UpdateWallRoiFromPosition()
@ -378,9 +379,12 @@ public class CharacterBehaviour : MonoBehaviour
public float GetDisappear()
{
return disappearTime;
/*
float distime = disappearTime - Random.Range(0, disappearTime / 2);
distime = disappearTime * distime - distime * distime + 0.5f * distime;
return distime;
*/
}
IEnumerator RandomPosNoTriggerOther()

@ -6,4 +6,9 @@ public class CharacterDummy : MonoBehaviour
{
public Area area;
private void Start()
{
if (GetComponent<CharacterBehaviour>() == null)
gameObject.SetActive(false);
}
}

@ -0,0 +1,81 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace UltraCombos.Frozen
{
public class ElsaEffectGenerator : MonoBehaviour
{
[SerializeField]
KinectOpticalFlowMath kinectMath;
bool isHit = false;
Vector3 hitPoint = Vector3.zero;
private void Start()
{
}
private void Update()
{
float padding = 0.5f;
Ray ray = new Ray(Vector3.zero, -new Vector3(kinectMath.averageVelocity.x, 0, kinectMath.averageVelocity.z));
float enter = 0.0f;
isHit = false;
Vector3 hit_point = Vector3.zero;
if (isHit == false)
{
if (FrozenScreenToWorldSpace.Instance.GetWallPlane(Area.LeftWall).Raycast(ray, out enter))
{
hit_point = ray.GetPoint(enter);
if (Mathf.Abs(hit_point.z) < FrozenScreenToWorldSpace.Instance.width * 0.5f - padding)
{
isHit = true;
}
}
}
if (isHit == false)
{
if (FrozenScreenToWorldSpace.Instance.GetWallPlane(Area.RightWall).Raycast(ray, out enter))
{
hit_point = ray.GetPoint(enter);
if (Mathf.Abs(hit_point.z) < FrozenScreenToWorldSpace.Instance.width * 0.5f - padding)
{
isHit = true;
}
}
}
if (isHit == false)
{
if (FrozenScreenToWorldSpace.Instance.GetWallPlane(Area.TopWall).Raycast(ray, out enter))
{
hit_point = ray.GetPoint(enter);
if (Mathf.Abs(hit_point.x) < FrozenScreenToWorldSpace.Instance.length * 0.5f - padding)
{
isHit = true;
}
}
}
if (isHit)
{
hitPoint = hit_point + transform.position;
}
}
private void OnDrawGizmosSelected()
{
Gizmos.DrawLine(transform.position, transform.position - new Vector3(kinectMath.averageVelocity.x, 0, kinectMath.averageVelocity.z) * 50.0f);
if (isHit == false)
return;
Gizmos.DrawWireCube(hitPoint, Vector3.one);
}
}
}

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: a7fe449ac7fdb6943ac4f06843bce261
timeCreated: 1525923394
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -59,6 +59,8 @@ public class FrozenScreenToWorldSpace : MonoBehaviour {
Dictionary<Area, RenderTextureROI> RenderTextureROIList = new Dictionary<Area, RenderTextureROI>();
Dictionary<Area, Plane> wallPlaneList = new Dictionary<Area, Plane>();
private float totalLength;
private float totalWidth;
@ -80,6 +82,9 @@ public class FrozenScreenToWorldSpace : MonoBehaviour {
RenderTextureROIList.Add(Area.RightWall, RightWall);
RenderTextureROIList.Add(Area.TopWall, TopWall);
RenderTextureROIList.Add(Area.Floor, Floor);
wallPlaneList.Add(Area.LeftWall, new Plane(Vector3.right, new Vector3(-length * 0.5f, 0, 0)));
wallPlaneList.Add(Area.RightWall, new Plane(Vector3.left, new Vector3(length * 0.5f, 0, 0)));
wallPlaneList.Add(Area.TopWall, new Plane(Vector3.back, new Vector3(0, 0, width * 0.5f)));
}
public RenderTextureROI GetROI(Area area)
@ -89,6 +94,13 @@ public class FrozenScreenToWorldSpace : MonoBehaviour {
return null;
}
public Plane GetWallPlane(Area area)
{
if (wallPlaneList.ContainsKey(area))
return wallPlaneList[area];
return new Plane();
}
public Vector2 GetFinalScreenPos(Area area, Vector2 wallROI)
{
if(!RenderTextureROIList.ContainsKey(area))
@ -136,7 +148,7 @@ public class FrozenScreenToWorldSpace : MonoBehaviour {
break;
case Area.RightWall:
{
roi.x = (-position.z + width * 0.5f) / width;
roi.x = (position.z + width * 0.5f) / width;
roi.y = position.y / height;
}
break;

@ -26,6 +26,11 @@ namespace UltraCombos.Frozen
[SerializeField]
KinectOpticalFlow kinect;
[SerializeField]
ParticleViewerProcedural particleViewer;
[SerializeField, Range(0, 1)]
float dayParticleRate = 1.0f;
[SerializeField]
List<CharacterBehaviour> dayCharacters = new List<CharacterBehaviour>();
@ -49,9 +54,11 @@ namespace UltraCombos.Frozen
uniform.rate = rate;
spaceMaterial.SetFloat("_Rate", rate);
snowMaterial.SetFloat("_Size", Mathf.Lerp(0.0f, snowSize, rate));
//snowMaterial.SetFloat("_Size", Mathf.Lerp(0.0f, snowSize, rate));
snowMaterial.SetFloat("_Size", snowSize);
cosineGradient.rate = rate;
kinect.kinectAmount = rate < 0.5 ? 1.0f : 30.0f;
particleViewer.VertexCount = (int)(Mathf.Lerp(dayParticleRate, 1.0f, rate) * particleViewer.buffer.count);
foreach (var chr in dayCharacters)
{

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bcd4d160496391f65c5d82c25a813a33ced7f1fbd744286fda05c11d15bc8591
size 4243930
oid sha256:e21eaba3dcbee8af9bf2367f66fd0f9791c1bd69015eedc520d81fc6e2e4ffdb
size 1162727

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cc30b571b0a3b792a969403d61dc7481db57c77f185a68bbde281e25a82e501e
size 1326760
oid sha256:28c4ed9f97f5aefcf6b76345fe0ed3abf03931af0abc1d958cf885b07ff1f1ce
size 727689

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:968e932b0aca3755bd816432b2fc5fe1c56c841991449f3d67904e1bae7e6caa
size 1976079
oid sha256:c2faa189a760073f8c2b0e0f6faf54b0bfaed45a941b420d52f5fb11f6895845
size 603903

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d1484e6561e9e445d90940eb970fcc04a2ca0add754c1c03046cc4c3fe594529
size 4262397
oid sha256:2fce8b15277572ebc8e3f31e9d07ead49cec49670cec71a775ed9c9df64736a0
size 1085805

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:72b035a931b5164f7a6d6231faefb249771435ff155980abbbfcbd6c9022b4f2
size 2654649
oid sha256:40b107230b06ddd8ea2f317a961c19b436e6edce5e8a270092ca4c8db701fe7e
size 488374

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 MiB

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 4078dff6c078ddd49865b51d25d30894
timeCreated: 1525943464
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 MiB

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 8836979775ffec34395d5625d0de7a0c
timeCreated: 1525943466
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

@ -14,12 +14,18 @@ namespace UltraCombos
float step;
float stamp = 0.0f;
[SerializeField]
int countThreshold = 30;
int home_count;
Vector4[] samples = new Vector4[512 * 424];
Vector4[] position_samples = new Vector4[512 * 424 * 2];
Vector4[] velocity_samples = new Vector4[512 * 424 * 2];
public Vector3 averagePositinon = Vector3.zero;
public float standardDeviation = -1.0f;
public Vector3 averageVelocity = Vector3.zero;
[SerializeField]
string debug;
public string DebugString { get { return debug; } }
@ -38,26 +44,35 @@ namespace UltraCombos
var data = new int[kinect.HomeCountBuffer.count];
kinect.HomeCountBuffer.GetData(data);
home_count = data[0];
kinect.HomePositionBuffer.GetData(samples, 0, 0, home_count);
kinect.HomePositionBuffer.GetData(position_samples, 0, 0, home_count);
kinect.HomeVelocityBuffer.GetData(velocity_samples, 0, 0, home_count);
if (home_count > 0)
averagePositinon = Vector3.zero;
averageVelocity = Vector3.zero;
if (home_count > countThreshold)
{
float div = 1.0f / home_count;
float avg_dist = 0.0f;
averagePositinon = Vector3.zero;
standardDeviation = 0.0f;
for (int i = 0; i < home_count; i++)
{
var smp = new Vector3(samples[i].x, samples[i].y, samples[i].z);
averagePositinon += smp;
float dist = new Vector2(smp.x - transform.position.x, smp.z - transform.position.z).magnitude;
var pos_smp = new Vector3(position_samples[i].x, position_samples[i].y, position_samples[i].z);
averagePositinon += pos_smp;
float dist = new Vector2(pos_smp.x - transform.position.x, pos_smp.z - transform.position.z).magnitude;
avg_dist += dist;
standardDeviation += Mathf.Pow(dist, 2.0f);
var vel_smp = new Vector3(velocity_samples[i].x, velocity_samples[i].y, velocity_samples[i].z);
averageVelocity += vel_smp;
}
averagePositinon.Scale(Vector4.one * div);
avg_dist *= div;
standardDeviation = Mathf.Sqrt(standardDeviation * div - avg_dist * avg_dist);
averageVelocity.Scale(Vector4.one * div);
debug = string.Format("{0}({1}): {2}", averagePositinon, avg_dist, standardDeviation);
}
else
@ -66,8 +81,6 @@ namespace UltraCombos
debug = "null";
}
}
}
}

Loading…
Cancel
Save