示例#1
0
        internal static LightShape ResolveLightShape(LightTypeExtent typeExtent, LightType type)
        {
            switch (typeExtent)
            {
            case LightTypeExtent.Punctual:
                switch (type)
                {
                case LightType.Directional:
                    return(LightShape.Directional);

                case LightType.Point:
                    return(LightShape.Point);

                case LightType.Spot:
                    return(LightShape.Spot);
                }
                break;

            case LightTypeExtent.Rectangle:
                return(LightShape.Rectangle);

            case LightTypeExtent.Tube:
                return(LightShape.Tube);
            }
            throw new Exception("Unknown light type");
        }
 // Currently area light shadows are not supported
 public static void ExtractAreaLightData(VisibleLight visibleLight, LightTypeExtent lightTypeExtent, out Matrix4x4 view, out Matrix4x4 invViewProjection, out Matrix4x4 projection, out Matrix4x4 deviceProjection, out ShadowSplitData splitData)
 {
     view = Matrix4x4.identity;
     invViewProjection = Matrix4x4.identity;
     deviceProjection  = Matrix4x4.identity;
     projection        = Matrix4x4.identity;
     splitData         = default(ShadowSplitData);
 }
示例#3
0
        public static float ConvertAreaLightLuminanceToLumen(LightTypeExtent areaLightType, float luminance, float width, float height = 0)
        {
            switch (areaLightType)
            {
            case LightTypeExtent.Line:
                return(LightUtils.CalculateLineLightLuminanceToLumen(luminance, width));

            case LightTypeExtent.Rectangle:
                return(LightUtils.ConvertRectLightLuminanceToLumen(luminance, width, height));
            }
            return(luminance);
        }
示例#4
0
        public static float ConvertAreaLightEvToLumen(LightTypeExtent areaLightType, float ev, float width, float height)
        {
            float luminance = ConvertEvToLuminance(ev);

            return(ConvertAreaLightLuminanceToLumen(areaLightType, luminance, width, height));
        }
示例#5
0
        public static float ConvertAreaLightLumenToEv(LightTypeExtent areaLightType, float lumen, float width, float height)
        {
            float luminance = ConvertAreaLightLumenToLuminance(areaLightType, lumen, width, height);

            return(ConvertLuminanceToEv(luminance));
        }
        // Currently area light shadows are not supported
        public static void ExtractAreaLightData(HDCamera camera, VisibleLight visibleLight, LightTypeExtent lightTypeExtent, Vector3 shadowPosition, float areaLightShadowCone, float shadowNearPlane, Vector2 shapeSize, Vector2 viewportSize, float normalBiasMax, out Matrix4x4 view, out Matrix4x4 invViewProjection, out Matrix4x4 projection, out Matrix4x4 deviceProjection, out ShadowSplitData splitData)
        {
            if (lightTypeExtent != LightTypeExtent.Rectangle)
            {
                view = Matrix4x4.identity;
                invViewProjection = Matrix4x4.identity;
                deviceProjection  = Matrix4x4.identity;
                projection        = Matrix4x4.identity;
                splitData         = default(ShadowSplitData);
            }
            else
            {
                Vector4 lightDir;
                float   aspectRatio = shapeSize.x / shapeSize.y;
                float   spotAngle   = areaLightShadowCone;
                visibleLight.spotAngle = spotAngle;
                float guardAngle = CalcGuardAnglePerspective(visibleLight.spotAngle, viewportSize.x, GetPunctualFilterWidthInTexels(camera, LightType.Rectangle), normalBiasMax, 180.0f - visibleLight.spotAngle);

                ExtractSpotLightMatrix(visibleLight, visibleLight.spotAngle, shadowNearPlane, guardAngle, aspectRatio, out view, out projection, out deviceProjection, out invViewProjection, out lightDir, out splitData);
            }
        }
 public static bool IsAreaLight(LightTypeExtent lightType)
 {
     return(lightType != LightTypeExtent.Punctual);
 }