コード例 #1
0
            public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
            {
                if (renderingData.cameraData.camera != Camera.main)
                {
                    return;
                }

                VolumeStack         stack      = VolumeManager.instance.stack;
                PUnderwaterOverride underwater = stack.GetComponent <PUnderwaterOverride>();
                PWetLensOverride    wetLens    = stack.GetComponent <PWetLensOverride>();

                bool willRenderUnderwater = underwater.intensity.value > 0;
                bool willRenderWetLens    = wetLens.strength.value * wetLens.intensity.value > 0;

                if (!willRenderUnderwater && !willRenderWetLens)
                {
                    return;
                }

                ConfigureMaterial(ref renderingData, underwater, wetLens);

                CommandBuffer           cmd = CommandBufferPool.Get(PROFILER_TAG);
                RenderTextureDescriptor cameraTargetDescriptor = renderingData.cameraData.cameraTargetDescriptor;

                cameraTargetDescriptor.depthBufferBits = 0;
                cmd.GetTemporaryRT(temporaryRenderTexture.id, cameraTargetDescriptor);

                Material material = willRenderUnderwater ? underwaterMaterial : wetLensMaterial;

                Blit(cmd, cameraTarget, temporaryRenderTexture.Identifier(), material, 0);
                Blit(cmd, temporaryRenderTexture.Identifier(), cameraTarget);

                context.ExecuteCommandBuffer(cmd);
                CommandBufferPool.Release(cmd);
            }
コード例 #2
0
 SkySettings GetSkySetting(VolumeStack stack)
 {
     var visualEnv = stack.GetComponent<VisualEnvironment>();
     int skyID = visualEnv.skyType;
     Type skyType;
     if(m_SkyTypesDict.TryGetValue(skyID, out skyType))
     {
         return (SkySettings)stack.GetComponent(skyType);
     }
     else
     {
         return null;
     }
 }
        internal static SkySettings GetSkySetting(VolumeStack stack)
        {
            var  visualEnv = stack.GetComponent <VisualEnvironment>();
            int  skyID     = visualEnv.skyType.value;
            Type skyType;

            if (skyTypesDict.TryGetValue(skyID, out skyType))
            {
                return((SkySettings)stack.GetComponent(skyType));
            }
            else
            {
                if (skyID == (int)SkyType.Procedural && logOnce)
                {
                    Debug.LogError("You are using the deprecated Procedural Sky in your Scene. You can still use it but, to do so, you must install it separately. To do this, open the Package Manager window and import the 'Procedural Sky' sample from the HDRP package page, then close and re-open your project without saving.");
                    logOnce = false;
                }

                return(null);
            }
        }
コード例 #4
0
    private void GatherOverrides()
    {
        var sunProps = stack.GetComponent <SunlightProperties>();

        if (sunProps.lattitude.overrideState)
        {
            sunlightParameters.orientationParameters.lattitude = sunProps.lattitude.value;
        }
        if (sunProps.YAxis.overrideState)
        {
            sunlightParameters.orientationParameters.yAxis = sunProps.YAxis.value;
        }
        if (sunProps.timeOfDay.overrideState)
        {
            sunlightParameters.orientationParameters.timeOfDay = sunProps.timeOfDay.value;
        }

        //If overridden intensity is constant, otherwise drive by curve
        if (sunProps.intensity.overrideState)
        {
            sunlightParameters.lightParameters.intensity = sunProps.intensity;
        }
        else
        {
            sunlightParameters.lightParameters.intensity = sunlightParameters.intensityCurve.Evaluate(sunlightParameters.orientationParameters.timeOfDay);
        }
        //If overridden intensity is constant, otherwise driven by gradient
        if (sunProps.color.overrideState)
        {
            sunlightParameters.lightParameters.colorFilter = sunProps.color;
        }
        else
        {
            sunlightParameters.lightParameters.colorFilter = sunlightParameters.colorGradient.Evaluate(sunlightParameters.orientationParameters.timeOfDay / 24);
        }

        if (sunProps.indirectMultiplier.overrideState)
        {
            sunlightParameters.lightParameters.indirectIntensity = sunProps.indirectMultiplier;
        }
        if (sunProps.cookieTexture.overrideState)
        {
            sunlightParameters.lightParameters.lightCookie = sunProps.cookieTexture;
        }
        if (sunProps.cookieSize.overrideState)
        {
            sunlightParameters.lightParameters.cookieSize = sunProps.cookieSize;
        }
        if (sunProps.shadowResolution.overrideState)
        {
            sunlightParameters.lightParameters.shadowResolution = sunProps.shadowResolution;
        }
    }
コード例 #5
0
    public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
    {
        if (material == null || !renderingData.cameraData.postProcessEnabled)
        {
            return;
        }

        VolumeStack stack = VolumeManager.instance.stack;

        outlineEffect = stack.GetComponent <OutlineEffect>();

        if (outlineEffect == null || !outlineEffect.IsActive())
        {
            return;
        }

        CommandBuffer buffer = CommandBufferPool.Get(OUTLINE_EFFECT_TAG);

        Render(buffer, ref renderingData);

        context.ExecuteCommandBuffer(buffer);
        CommandBufferPool.Release(buffer);
    }
コード例 #6
0
        private void GatherOverrides()
        {
            modifiedOrientationParameters = SunlightOrientationParameters.DeepCopy(sunlightParameters.orientationParameters);

            if (stack == null)
            {
                return;
            }

            var sunProps = stack.GetComponent <SunlightProperties>();

            if (sunlightParameters.lightParameters == null || modifiedOrientationParameters == null)
            {
                return;
            }

            if (sunProps.lattitude.overrideState)
            {
                modifiedOrientationParameters.lattitude = sunProps.lattitude.value;
            }
            if (sunProps.YAxis.overrideState)
            {
                modifiedOrientationParameters.yAxis = sunProps.YAxis.value;
            }

            if (Application.isPlaying)
            {
                //modifiedOrientationParameters.timeOfDay = Manager.Get<TimeOfDayManager>().timeOfDay;
                modifiedOrientationParameters.timeOfDay = Globals.GetFloat("TimeOfDay", Globals.Scope.Global);
            }

            //If overridden in volumes intensity is constant, otherwise driven by curve * intensity
            modifiedLightParameters = LightParameters.DeepCopy(sunlightParameters.lightParameters);

            if (sunProps.intensity.overrideState)
            {
                modifiedLightParameters.intensity = sunProps.intensity.value;
            }
            else if (sunlightParameters.intensityCurve != null)
            {
                modifiedLightParameters.intensity = sunlightParameters.intensityCurve.Evaluate(sunlightParameters.orientationParameters.timeOfDay) * sunlightParameters.lightParameters.intensity;
            }
            else if (sunlightParameters.intensityCurve == null)
            {
                modifiedLightParameters.intensity = sunlightParameters.lightParameters.intensity;
            }

            //If overridden intensity is constant, otherwise driven by gradient
            if (sunProps.color.overrideState)
            {
                modifiedLightParameters.colorFilter = sunProps.color.value;
            }
            else if (sunlightParameters.colorGradient != null)
            {
                modifiedLightParameters.colorFilter = sunlightParameters.colorGradient.Evaluate(sunlightParameters.orientationParameters.timeOfDay / 24);
            }

            if (sunProps.indirectMultiplier.overrideState)
            {
                modifiedLightParameters.indirectIntensity = sunProps.indirectMultiplier.value;
            }
            if (sunProps.cookieTexture.overrideState)
            {
                modifiedLightParameters.lightCookie = sunProps.cookieTexture.value;
            }
            if (sunProps.cookieSize.overrideState)
            {
                modifiedLightParameters.cookieSize = sunProps.cookieSize.value;
            }
            if (sunProps.shadowResolution.overrideState)
            {
                modifiedLightParameters.shadowResolution = sunProps.shadowResolution.value;
            }
            if (sunProps.shadowTint.overrideState)
            {
                modifiedLightParameters.shadowTint = sunProps.shadowTint.value;
            }
            if (sunProps.penumbraTint.overrideState)
            {
                modifiedLightParameters.penumbraTint = sunProps.penumbraTint.value;
            }
        }
コード例 #7
0
ファイル: VolumeDebug.cs プロジェクト: GeorgeYarwood/Deeper
        /// <summary>Get a VolumeParameter from a VolumeComponent on the <see cref="selectedCameraVolumeStack"/></summary>
        /// <param name="field">The field info of the parameter.</param>
        /// <returns>The volume parameter.</returns>
        public VolumeParameter GetParameter(FieldInfo field)
        {
            VolumeStack stack = selectedCameraVolumeStack;

            return(stack == null ? null : GetParameter(stack.GetComponent(selectedComponentType), field));
        }
コード例 #8
0
        private void GatherOverrides()
        {
            modifiedOrientationParameters = SunlightOrientationParameters.DeepCopy(sunlightParameters.orientationParameters);

            if (stack == null)
            {
                return;
            }

            var sunProps = stack.GetComponent <SunlightProperties>();

            if (sunlightParameters.lightParameters == null || modifiedOrientationParameters == null)
            {
                return;
            }

            if (sunProps.lattitude.overrideState)
            {
                modifiedOrientationParameters.lattitude = sunProps.lattitude.value;
            }
            if (sunProps.YAxis.overrideState)
            {
                modifiedOrientationParameters.yAxis = sunProps.YAxis.value;
            }
            if (sunProps.timeOfDay.overrideState)
            {
                modifiedOrientationParameters.timeOfDay = sunProps.timeOfDay.value;
            }

            //If overridden intensity is constant, otherwise drive by curve
            if (sunProps.intensity.overrideState)
            {
                sunlightParameters.lightParameters.intensity = sunProps.intensity;
            }
            else if (sunlightParameters.intensityCurve != null)
            {
                sunlightParameters.lightParameters.intensity = sunlightParameters.intensityCurve.Evaluate(sunlightParameters.orientationParameters.timeOfDay);
            }
            if (sunlightParameters.intensityCurve == null)
            {
                Debug.LogWarning("Sun intensity curve is null");
            }

            //If overridden intensity is constant, otherwise driven by gradient
            if (sunProps.color.overrideState)
            {
                sunlightParameters.lightParameters.colorFilter = sunProps.color;
            }
            else if (sunlightParameters.colorGradient != null)
            {
                sunlightParameters.lightParameters.colorFilter = sunlightParameters.colorGradient.Evaluate(sunlightParameters.orientationParameters.timeOfDay / 24);
            }

            if (sunProps.indirectMultiplier.overrideState)
            {
                sunlightParameters.lightParameters.indirectIntensity = sunProps.indirectMultiplier;
            }
            if (sunProps.cookieTexture.overrideState)
            {
                sunlightParameters.lightParameters.lightCookie = sunProps.cookieTexture;
            }
            if (sunProps.cookieSize.overrideState)
            {
                sunlightParameters.lightParameters.cookieSize = sunProps.cookieSize;
            }
            if (sunProps.shadowResolution.overrideState)
            {
                sunlightParameters.lightParameters.shadowResolution = sunProps.shadowResolution;
            }
        }