Skip to content

Commit 77dccff

Browse files
committed
2 parents 88228d8 + 706fa80 commit 77dccff

28 files changed

+2607
-457
lines changed

Assets/ScriptableRenderLoop/AdditionalLightData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public float GetInnerSpotPercent01()
2626
}
2727

2828
[RangeAttribute(0.0F, 1.0F)]
29-
public float shadowDimmer = 1.0F;
29+
public float shadowDimmer = 1.0f;
3030

3131
public bool affectDiffuse = true;
3232
public bool affectSpecular = true;

Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.asset.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs

Lines changed: 250 additions & 215 deletions
Large diffs are not rendered by default.

Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightDefinition.cs

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,67 +6,85 @@ namespace UnityEngine.Experimental.ScriptableRenderLoop
66
// structure definition
77
//-----------------------------------------------------------------------------
88

9+
[GenerateHLSL]
10+
public enum GPULightType
11+
{
12+
Directional,
13+
Spot,
14+
Point,
15+
ProjectorOrtho,
16+
ProjectorPyramid,
17+
18+
// AreaLight
19+
Rectangle,
20+
Line,
21+
// Currently not supported in real time (just use for reference)
22+
Sphere,
23+
Disk,
24+
Hemisphere,
25+
Cylinder
26+
};
27+
928
// These structures share between C# and hlsl need to be align on float4, so we pad them.
1029
[GenerateHLSL]
11-
public struct PunctualLightData
30+
public struct LightData
1231
{
1332
public Vector3 positionWS;
1433
public float invSqrAttenuationRadius;
1534

1635
public Vector3 color;
17-
public float useDistanceAttenuation;
36+
public float angleScale; // Spot light
1837

1938
public Vector3 forward;
20-
public float angleScale;
39+
public float angleOffset;
2140

2241
public Vector3 up;
23-
public float angleOffset;
42+
public float diffuseScale; // Spot light
2443

2544
public Vector3 right;
26-
public float diffuseScale;
27-
2845
public float specularScale;
46+
2947
public float shadowDimmer;
3048
// index are -1 if not used
3149
public int shadowIndex;
3250
public int IESIndex;
33-
3451
public int cookieIndex;
35-
public Vector3 unused;
36-
};
3752

38-
[GenerateHLSL]
39-
public enum AreaShapeType
40-
{
41-
Rectangle,
42-
Line,
43-
// Currently not supported in real time (just use for reference)
44-
Sphere,
45-
Disk,
46-
Hemisphere,
47-
Cylinder
53+
public GPULightType lightType;
54+
// Area Light specific
55+
public Vector2 size;
56+
public bool twoSided;
4857
};
4958

5059
[GenerateHLSL]
51-
public struct AreaLightData
60+
public struct DirectionalLightData
5261
{
53-
public Vector3 positionWS;
54-
public float invSqrAttenuationRadius;
62+
public Vector3 direction;
63+
public float diffuseScale;
5564

5665
public Vector3 color;
57-
public AreaShapeType shapeType;
66+
public float specularScale;
5867

59-
public Vector3 forward;
60-
public float diffuseScale;
68+
// Sun disc size
69+
public float cosAngle; // Distance to disk
70+
public float sinAngle; // Disk radius
71+
public int shadowIndex;
72+
public float unsued;
73+
};
6174

62-
public Vector3 up;
63-
public float specularScale;
6475

65-
public Vector3 right;
66-
public float shadowDimmer;
76+
// TODO: we may have to add various parameters here for shadow - was suppose to be coupled with a light loop
77+
// A point light is 6x PunctualShadowData
78+
[GenerateHLSL]
79+
public struct PunctualShadowData
80+
{
81+
// World to ShadowMap matrix
82+
// Include scale and bias for shadow atlas if any
83+
public Matrix4x4 worldToShadow;
6784

68-
public Vector2 size;
69-
public bool twoSided;
85+
public GPULightType lightType;
86+
public float bias;
87+
public float quality;
7088
public float unused;
7189
};
7290

@@ -99,5 +117,4 @@ public struct EnvLightData
99117
public Vector3 offsetLS;
100118
public float unused2;
101119
};
102-
103120
} // namespace UnityEngine.Experimental.ScriptableRenderLoop

0 commit comments

Comments
 (0)