浏览代码

fix shadow settings and add a sun script to see shadows move based on time of day

/main
Filip Iliescu 8 年前
当前提交
ff01d44e
共有 6 个文件被更改,包括 103 次插入23 次删除
  1. 12
      Assets/TestScenes/MobileDeferredTest/ClassicDeferredPipeline.asset
  2. 53
      Assets/TestScenes/MobileDeferredTest/ClassicDeferredTest.unity
  3. 9
      Assets/TestScenes/MobileDeferredTest/Scripts.meta
  4. 40
      Assets/TestScenes/MobileDeferredTest/Scripts/Sun.cs
  5. 12
      Assets/TestScenes/MobileDeferredTest/Scripts/Sun.cs.meta

12
Assets/TestScenes/MobileDeferredTest/ClassicDeferredPipeline.asset


m_EditorClassIdentifier:
m_ShadowSettings:
enabled: 1
shadowAtlasWidth: 2048
shadowAtlasHeight: 2048
maxShadowDistance: 50
directionalLightCascadeCount: 1
directionalLightCascades: {x: 0.15, y: 0.1, z: 0.8}
directionalLightNearPlaneOffset: 5
shadowAtlasWidth: 1024
shadowAtlasHeight: 1024
maxShadowDistance: 1000
directionalLightCascadeCount: 3
directionalLightCascades: {x: 0.2, y: 0.15, z: 0.8}
directionalLightNearPlaneOffset: 1
m_PointLightMesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
m_SpotLightMesh: {fileID: 4300000, guid: 93e85ba57f65145538a8ac97bd005d40, type: 3}
m_QuadMesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}

53
Assets/TestScenes/MobileDeferredTest/ClassicDeferredTest.unity


m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.18328291, g: 0.2289299, b: 0.30645376, a: 1}
m_IndirectSpecularColor: {r: 0.1797753, g: 0.22508909, b: 0.30660287, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0

m_Component:
- component: {fileID: 267028025}
- component: {fileID: 267028024}
- component: {fileID: 267028026}
m_Layer: 0
m_Name: Sun
m_TagString: Untagged

serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 2
m_Intensity: 3
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10

m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Bias: 0.176
m_NormalBias: 0.59
m_NearPlane: 0.28
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}

m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 267028023}
m_LocalRotation: {x: 0.6843819, y: 0.4697298, z: -0.55498856, w: 0.054433767}
m_LocalPosition: {x: 31.1, y: 78.5, z: -54.3}
m_LocalRotation: {x: 0.434125, y: 0.75677305, z: -0.29959124, w: 0.3861026}
m_LocalPosition: {x: 28.4, y: 80.7, z: -52.6}
m_LocalEulerAnglesHint: {x: 36.577003, y: -118.08401, z: -226.50099}
m_LocalEulerAnglesHint: {x: 52.062004, y: -211.83199, z: -316.176}
--- !u!114 &267028026
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 267028023}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 86fb67de2496b4335bc8326f24b35f39, type: 3}
m_Name:
m_EditorClassIdentifier:
eyePosition: {fileID: 95697987}
daytimeSkyColor: {r: 1, g: 0.9568628, b: 0.83921576, a: 1}
nighttimeSkyColor: {r: 0.04, g: 0.19, b: 0.27, a: 1}
radius: 10
daySeconds: 2400
speed: 0.02
blend: 0.75
--- !u!1 &287655541
GameObject:
m_ObjectHideFlags: 0

m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 480371293}
m_LocalRotation: {x: 0.5, y: 0.5, z: -0.5, w: 0.5}
m_LocalPosition: {x: 60, y: 27.9, z: -52}
m_LocalPosition: {x: 61.8, y: 27.9, z: -52}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1436098192}

m_Color: {r: 0.81858146, g: 0.021896647, b: 0.99264705, a: 1}
m_Intensity: 30
m_Range: 500
m_SpotAngle: 82
m_SpotAngle: 83.4
m_CookieSize: 10
m_Shadows:
m_Type: 1

m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 696494501}
m_LocalRotation: {x: 0.02170083, y: 0.0053889398, z: -0.00011697372, w: 0.99975}
m_LocalPosition: {x: -43, y: 73.1, z: 55.7}
m_LocalPosition: {x: -49.9, y: 80.5, z: 56.3}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 797301775}

m_TimeSlicingMode: 0
m_Resolution: 128
m_UpdateFrequency: 0
m_BoxSize: {x: 10, y: 10, z: 500}
m_BoxSize: {x: 15, y: 10, z: 1000}
m_BoxOffset: {x: 0, y: 0, z: 0}
m_NearClip: 0.3
m_FarClip: 1000

m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 923295470}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -30.6, y: 63.8, z: -88.4}
m_LocalScale: {x: 10, y: 10, z: 10}
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068}
m_LocalPosition: {x: -37.03, y: 69.1, z: -88.1}
m_LocalScale: {x: 10, y: 13, z: 10}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
--- !u!1 &945195326
GameObject:
m_ObjectHideFlags: 0

m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1879588685}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 39.8, y: 6.005382, z: -49}
m_LocalPosition: {x: 39.8, y: 5.3, z: -49}
m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}

9
Assets/TestScenes/MobileDeferredTest/Scripts.meta


fileFormatVersion: 2
guid: 4f9828a3db4dc4d848659b3602e34801
folderAsset: yes
timeCreated: 1493098543
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

40
Assets/TestScenes/MobileDeferredTest/Scripts/Sun.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Sun : MonoBehaviour {
public Transform eyePosition;
Light sunlight;
public Color daytimeSkyColor = new Color(0.31f, 0.88f, 1f);
public Color nighttimeSkyColor = new Color(0.04f, 0.19f, 0.27f);
// Use this for initialization
void Start () {
sunlight = GetComponent<Light> ();
sunlight.color = daytimeSkyColor;
}
public float radius = 6;
public float daySeconds = 1200;
public float speed = 0.01f;
public float blend = 0.25f;
private float timeAnim = 0;
// Update is called once per frame
void Update () {
timeAnim = (timeAnim + speed * Time.deltaTime) % daySeconds;
Vector3 midpoint = eyePosition.position; midpoint.y -= 0.5f;
float sunangle = timeAnim * 360;
sunlight.transform.position = midpoint + Quaternion.Euler(0,0,sunangle)*(radius*Vector3.right);
sunlight.transform.LookAt (midpoint);
sunlight.color = Color.Lerp(daytimeSkyColor, nighttimeSkyColor, timeAnim/blend);
}
}

12
Assets/TestScenes/MobileDeferredTest/Scripts/Sun.cs.meta


fileFormatVersion: 2
guid: 86fb67de2496b4335bc8326f24b35f39
timeCreated: 1493092812
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存