浏览代码

Add the 'Line' light archetype and fix the scene

/main
Evgenii Golubev 8 年前
当前提交
50204d4c
共有 3 个文件被更改,包括 86 次插入21 次删除
  1. 10
      Assets/ScriptableRenderLoop/AdditionalLightData.cs
  2. 20
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  3. 77
      Assets/TestScenes/HDTest/HDRenderLoopTest.unity

10
Assets/ScriptableRenderLoop/AdditionalLightData.cs


namespace UnityEngine.Experimental.ScriptableRenderLoop
{
//@TODO: We should continously move these values
public enum LightArchetype {Punctual, Rectangle, Line};
//@TODO: We should continuously move these values
public const int DefaultShadowResolution = 512;
public int shadowResolution = DefaultShadowResolution;

public bool affectDiffuse = true;
public bool affectSpecular = true;
// Area Light Hack
public bool treatAsAreaLight = false;
public bool isDoubleSided = false;
public LightArchetype archetype = LightArchetype.Punctual;
public bool isDoubleSided = false;
[RangeAttribute(0.0f, 20.0f)]
public float areaLightLength = 0.0f;

20
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


// Note: LightType.Area is offline only, use for baking, no need to test it
var lightData = new LightData();
// Early out if we reach the maximum
if (additionalData.treatAsAreaLight)
if (additionalData.archetype != LightArchetype.Punctual)
// Early out if we reach the maximum
lightData.lightType = GPULightType.Rectangle;
if (additionalData.archetype == LightArchetype.Rectangle)
{
lightData.lightType = GPULightType.Rectangle;
}
else
{
lightData.lightType = GPULightType.Line;
}
}
else
{

lightData.size = new Vector2(additionalData.areaLightLength, additionalData.areaLightWidth);
lightData.twoSided = additionalData.isDoubleSided;
if (additionalData.treatAsAreaLight)
if (additionalData.archetype == LightArchetype.Punctual)
lightList.areaLights.Add(lightData);
lightList.punctualLights.Add(lightData);
lightList.punctualLights.Add(lightData);
// Area and line lights are both currently stored as area lights on the GPU.
lightList.areaLights.Add(lightData);
}
}

77
Assets/TestScenes/HDTest/HDRenderLoopTest.unity


m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3

shadowDimmer: 1
affectDiffuse: 1
affectSpecular: 1
treatAsAreaLight: 0
archetype: 0
isDoubleSided: 0
areaLightLength: 0
areaLightWidth: 0

shadowDimmer: 1
affectDiffuse: 1
affectSpecular: 1
treatAsAreaLight: 0
archetype: 0
isDoubleSided: 0
areaLightLength: 0
areaLightWidth: 0

shadowDimmer: 1
affectDiffuse: 1
affectSpecular: 1
treatAsAreaLight: 0
archetype: 0
isDoubleSided: 0
areaLightLength: 0
areaLightWidth: 0

shadowDimmer: 1
affectDiffuse: 1
affectSpecular: 1
treatAsAreaLight: 0
archetype: 0
isDoubleSided: 0
areaLightLength: 0
areaLightWidth: 0

shadowDimmer: 1
affectDiffuse: 1
affectSpecular: 1
treatAsAreaLight: 1
archetype: 0
isDoubleSided: 1
areaLightLength: 16
areaLightWidth: 2

- component: {fileID: 925222277}
- component: {fileID: 925222276}
- component: {fileID: 925222275}
- component: {fileID: 925222279}
- component: {fileID: 925222278}
m_Layer: 0
m_Name: LightQuad
m_TagString: Untagged

m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 925222273}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &925222278
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 925222273}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7a68c43fe1f2a47cfa234b5eeaa98012, type: 3}
m_Name:
m_EditorClassIdentifier:
shadowResolution: 512
shadowDimmer: 1
affectDiffuse: 1
affectSpecular: 1
archetype: 1
isDoubleSided: 1
areaLightLength: 16
areaLightWidth: 2
--- !u!108 &925222279
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 925222273}
m_Enabled: 1
serializedVersion: 7
m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 0
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!1 &928571527
GameObject:
m_ObjectHideFlags: 0

shadowDimmer: 1
affectDiffuse: 1
affectSpecular: 1
treatAsAreaLight: 0
archetype: 0
isDoubleSided: 0
areaLightLength: 0
areaLightWidth: 0

shadowDimmer: 1
affectDiffuse: 1
affectSpecular: 1
treatAsAreaLight: 0
archetype: 0
isDoubleSided: 0
areaLightLength: 0
areaLightWidth: 0

shadowDimmer: 1
affectDiffuse: 1
affectSpecular: 1
treatAsAreaLight: 1
archetype: 1
isDoubleSided: 1
areaLightLength: 4
areaLightWidth: 2

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 7af9798eeefeae34c83aca56762a2938, type: 2}
- {fileID: 2100000, guid: f03665895dc89b84487310c5216b8458, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0

shadowDimmer: 1
affectDiffuse: 1
affectSpecular: 1
treatAsAreaLight: 0
archetype: 0
isDoubleSided: 0
areaLightLength: 0
areaLightWidth: 0

正在加载...
取消
保存