コード例 #1
0
    public MyPipeline(bool dynamicBatching, bool instanceing, MyPostProcessingStack defaultStack, Texture2D ditherTexture, float ditherAnimationSpeed, int shadowMapSize, float shadowDistance, float shadowFadeRange, int shadowCascades, Vector3 shadowCascadeSplit, float renderScale, int msaaSamples, bool allowHDR)
    {
        GraphicsSettings.lightsUseLinearIntensity = true;
        if (SystemInfo.usesReversedZBuffer)
        {
            worldToShadowCascadeMatrices[4].m33 = 1f;
        }
        if (dynamicBatching)
        {
            drawFlags = DrawRendererFlags.EnableDynamicBatching;
        }

        if (instanceing)
        {
            drawFlags |= DrawRendererFlags.EnableInstancing;
        }
        this.ditherTexture = ditherTexture;
        if (ditherAnimationSpeed > 0f && Application.isPlaying)
        {
            ConfigureDitherAnimation(ditherAnimationSpeed);
        }
        this.shadowMapSize           = shadowMapSize;
        this.shadowDistance          = shadowDistance;
        globalShadowData.y           = 1f / shadowFadeRange;
        this.shadowCascades          = shadowCascades;
        this.shadowCascadeSplit      = shadowCascadeSplit;
        this.defaultStack            = defaultStack;
        this.renderScale             = renderScale;
        this.allowHDR                = allowHDR;
        QualitySettings.antiAliasing = msaaSamples;
        this.msaaSamples             = Mathf.Max(QualitySettings.antiAliasing, 1);
#if UNITY_EDITOR
        Lightmapping.SetDelegate(lightmappingLightsDelegate);
#endif
    }
コード例 #2
0
    public void OnEnable( )
    {
        Lightmapping.RequestLightsDelegate testDel = (Light [] requests, Unity.Collections.NativeArray <LightDataGI> lightsOutput) =>
        {
            DirectionalLight dLight = new DirectionalLight( );
            PointLight       point  = new PointLight( );
            SpotLight        spot   = new SpotLight( );
            RectangleLight   rect   = new RectangleLight( );
            LightDataGI      ld     = new LightDataGI( );

            for (int i = 0; i < requests.Length; i++)
            {
                Light l = requests [i];
                switch (l.type)
                {
                case UnityEngine.LightType.Directional: LightmapperUtils.Extract(l, ref dLight); ld.Init(ref dLight); break;

                case UnityEngine.LightType.Point: LightmapperUtils.Extract(l, ref point); ld.Init(ref point); break;

                case UnityEngine.LightType.Spot: LightmapperUtils.Extract(l, ref spot); ld.Init(ref spot); break;

                case UnityEngine.LightType.Area: LightmapperUtils.Extract(l, ref rect); ld.Init(ref rect); break;

                default: ld.InitNoBake(l.GetInstanceID( )); break;
                }

                ld.falloff       = FalloffType.InverseSquared;
                lightsOutput [i] = ld;
            }
        };

        Lightmapping.SetDelegate(testDel);
    }
コード例 #3
0
    public MyPipeline1(bool dynamicBatching, bool instancing,
                       int shadowMapSize, float shadowDistance, float shadowFadeRange,
                       int shadowCascades, Vector3 shadowCascadeSplit) //constructor with configurations
    {
        GraphicsSettings.lightsUseLinearIntensity = true;
        if (SystemInfo.usesReversedZBuffer)
        {  //set the shadow case for outside all cascades
            worldToShadowCascadeMatrices[4].m33 = 1f;
        }

        if (dynamicBatching)
        {
            drawFlags = DrawRendererFlags.EnableDynamicBatching;
        }

        if (instancing)
        {
            drawFlags |= DrawRendererFlags.EnableInstancing;
        }

        this.shadowMapSize  = shadowMapSize;
        this.shadowDistance = shadowDistance;
        globalShadowData.y  = 1f / shadowFadeRange;

        this.shadowCascades     = shadowCascades;
        this.shadowCascadeSplit = shadowCascadeSplit;

        #if UNITY_EDITOR
        Lightmapping.SetDelegate(lightmappingLightsDelegate);
        #endif
    }
コード例 #4
0
    public MyPipeline(
        bool dynamicBatching, bool instancing,
        int shadowMapSize, float shadowDistance,
        int shadowCascades, Vector3 shadowCascasdeSplit
        )
    {
        GraphicsSettings.lightsUseLinearIntensity = true;
        if (SystemInfo.usesReversedZBuffer)
        {
            worldToShadowCascadeMatrices[4].m33 = 1f;
        }

        if (dynamicBatching)
        {
            drawFlags = DrawRendererFlags.EnableDynamicBatching;
        }
        if (instancing)
        {
            drawFlags |= DrawRendererFlags.EnableInstancing;
        }
        this.shadowMapSize      = shadowMapSize;
        this.shadowDistance     = shadowDistance;
        this.shadowCascades     = shadowCascades;
        this.shadowCascadeSplit = shadowCascasdeSplit;
#if UNITY_EDITOR
        Lightmapping.SetDelegate(lightmappingLightsDelegate);
#endif
    }
コード例 #5
0
        public EasyPipeline(bool useSRPBatching, float shadowFadeRange)
        {
            GraphicsSettings.useScriptableRenderPipelineBatching = useSRPBatching;
            GraphicsSettings.lightsUseLinearIntensity            = (QualitySettings.activeColorSpace == ColorSpace.Linear);
#if UNITY_EDITOR
            Lightmapping.SetDelegate(lightmappingLightsDelegate);
#endif
            globalShadowData.y = 1f / shadowFadeRange;
        }
コード例 #6
0
        public WindsmoonRenderPipeline(bool allowHDR, bool useDynamicBatching, bool useGPUInstancing, bool useSRPBatcher, bool useLightsPerObject, ShadowSettings shadowSettings,
                                       PostProcessingAsset postProcessingAsset, GrassSeaConfig grassSeaConfig)
        {
            this.allowHDR           = allowHDR;
            this.useDynamicBatching = useDynamicBatching;
            this.useGPUInstancing   = useGPUInstancing;
            this.useLightsPerObject = useLightsPerObject;
            this.shadowSettings     = shadowSettings;
            GraphicsSettings.useScriptableRenderPipelineBatching = useSRPBatcher;
            GraphicsSettings.lightsUseLinearIntensity            = true;
            this.shadowSettings      = shadowSettings;
            this.postProcessingAsset = postProcessingAsset;
            this.grassSeaConfig      = grassSeaConfig;

#if UNITY_EDITOR
            Lightmapping.SetDelegate(requestLightDelegate);
#endif
        }
コード例 #7
0
        public MyPipeline(bool dynamicBatching, bool instancing, int shadowMapSize, float shadowDistance, int shadowCascades, Vector3 shadowCascadeSplit)
        {
            //light的强度值使用线性空间
            GraphicsSettings.lightsUseLinearIntensity = true;
            if (SystemInfo.usesReversedZBuffer)
            {
                worldToShadowCascadeMatrices[4].m33 = 1f;
            }

            enableDynamicBatching   = dynamicBatching;
            enableGPUInstancing     = instancing;
            this.shadowMapSize      = shadowMapSize;
            this.shadowDistance     = shadowDistance;
            this.shadowCascades     = shadowCascades;
            this.shadowCascadeSplit = shadowCascadeSplit;
#if UNITY_EDITOR
            Lightmapping.SetDelegate(lightmappingLightsDelegate);
#endif
        }
コード例 #8
0
    public MyPipeline(
        bool dynamicBatching, bool instancing,
        Texture2D ditherTexture, float ditherAnimationSpeed,
        int shadowMapSize, float shadowDistance, float shadowFadeRange,
        int shadowCascades, Vector3 shadowCascasdeSplit
        )
    {
        GraphicsSettings.lightsUseLinearIntensity = true;
        if (SystemInfo.usesReversedZBuffer)
        {
            worldToShadowCascadeMatrices[4].m33 = 1f;
        }

        if (dynamicBatching)
        {
            drawFlags = DrawRendererFlags.EnableDynamicBatching;
        }
        if (instancing)
        {
            drawFlags |= DrawRendererFlags.EnableInstancing;
        }

        this.ditherTexture = ditherTexture;
        if (ditherAnimationSpeed > 0f && Application.isPlaying)
        {
            ConfigureDitherAnimation(ditherAnimationSpeed);
        }

        this.shadowMapSize      = shadowMapSize;
        this.shadowDistance     = shadowDistance;
        globalShadowData.y      = 1f / shadowFadeRange;
        this.shadowCascades     = shadowCascades;
        this.shadowCascadeSplit = shadowCascasdeSplit;
#if UNITY_EDITOR
        Lightmapping.SetDelegate(lightmappingLightsDelegate);
#endif
    }
コード例 #9
0
ファイル: CustomPipeline.cs プロジェクト: AdamWu/Shader4Unity
    public CustomPipeline(bool useDynamicBatching, bool useGPUInstancing, bool useSRPBatcher, ShadowSettings shadowSettings,
                          CustomPostProcessingStack defaultStack,
                          int shadowMapSize, float shadowDistance, float shadowFadeRange, int shadowCascades, Vector3 shadowCascadeSplit,
                          float renderScale, int msaaSamples, bool allowHDR)
    {
        GraphicsSettings.lightsUseLinearIntensity            = true;
        GraphicsSettings.useScriptableRenderPipelineBatching = useSRPBatcher;

        this.useDynamicBatching = useDynamicBatching;
        this.useGPUInstancing   = useGPUInstancing;
        this.shadowSettings     = shadowSettings;


        this.defaultStack       = defaultStack;
        this.shadowMapSize      = shadowMapSize;
        this.shadowDistance     = shadowDistance;
        this.shadowFadeRange    = shadowFadeRange;
        this.shadowCascades     = shadowCascades;
        this.shadowCascadeSplit = shadowCascadeSplit;

        this.renderScale             = renderScale;
        QualitySettings.antiAliasing = msaaSamples;
        this.msaaSamples             = Mathf.Max(QualitySettings.antiAliasing, 1);

        this.allowHDR = allowHDR;

        globalShadowData.y = 1f / shadowFadeRange;

        if (SystemInfo.usesReversedZBuffer)
        {
            worldToShadowCascadeMatrices[4].m33 = 1f;
        }

#if UNITY_EDITOR
        Lightmapping.SetDelegate(lightmappingLightsDelegate);
#endif
    }
コード例 #10
0
 partial void InitializeForEditor()
 {
     Lightmapping.SetDelegate(lightsDelegate);
 }