Esempio n. 1
0
        public override void PushShaderParameters(HDCamera hdCamera, CommandBuffer cmd)
        {
            PushShaderParametersCommon(hdCamera, cmd, FogType.Volumetric);

            DensityVolumeArtistParameters param = new DensityVolumeArtistParameters(albedo, meanFreePath, anisotropy);

            DensityVolumeEngineData data = param.ConvertToEngineData();

            cmd.SetGlobalVector(HDShaderIDs._HeightFogBaseScattering, data.scattering);
            cmd.SetGlobalFloat(HDShaderIDs._HeightFogBaseExtinction, data.extinction);

            float crBaseHeight = baseHeight;

            if (ShaderConfig.s_CameraRelativeRendering != 0)
            {
                crBaseHeight -= hdCamera.camera.transform.position.y;
            }

            float relativeMeanHeight = Mathf.Max(0.01f, meanHeight - baseHeight);

            // FogExponent = 1 / BaseRelative(MeanHeight)
            cmd.SetGlobalVector(HDShaderIDs._HeightFogExponents, new Vector2(1.0f / relativeMeanHeight, relativeMeanHeight));
            cmd.SetGlobalFloat(HDShaderIDs._HeightFogBaseHeight, crBaseHeight);
            cmd.SetGlobalFloat(HDShaderIDs._GlobalFogAnisotropy, anisotropy);
            cmd.SetGlobalInt(HDShaderIDs._EnableDistantFog, enableDistantFog ? 1 : 0);
        }
Esempio n. 2
0
        public override void PushShaderParameters(HDCamera hdCamera, CommandBuffer cmd)
        {
            DensityVolumeArtistParameters param = new DensityVolumeArtistParameters(albedo, meanFreePath, anisotropy);

            DensityVolumeEngineData data = param.ConvertToEngineData();

            cmd.SetGlobalInt(HDShaderIDs._AtmosphericScatteringType, (int)FogType.Volumetric);

            cmd.SetGlobalVector(HDShaderIDs._GlobalScattering, data.scattering);
            cmd.SetGlobalFloat(HDShaderIDs._GlobalExtinction, data.extinction);
            cmd.SetGlobalFloat(HDShaderIDs._GlobalAnisotropy, anisotropy);
        }
        public override void PushShaderParameters(HDCamera hdCamera, CommandBuffer cmd)
        {
            DensityVolumeArtistParameters param = new DensityVolumeArtistParameters(albedo, meanFreePath, anisotropy);

            DensityVolumeEngineData data = param.ConvertToEngineData();

            cmd.SetGlobalInt(HDShaderIDs._AtmosphericScatteringType, (int)FogType.Volumetric);

            cmd.SetGlobalVector(HDShaderIDs._HeightFogBaseScattering, data.scattering);
            cmd.SetGlobalFloat(HDShaderIDs._HeightFogBaseExtinction, data.extinction);

            float crBaseHeight = baseHeight;

            if (ShaderConfig.s_CameraRelativeRendering != 0)
            {
                crBaseHeight -= hdCamera.camera.transform.position.y;
            }

            cmd.SetGlobalVector(HDShaderIDs._HeightFogExponents, new Vector2(heightExponent, 1.0f / heightExponent));
            cmd.SetGlobalFloat(HDShaderIDs._HeightFogBaseHeight, crBaseHeight);
            cmd.SetGlobalFloat(HDShaderIDs._GlobalFogAnisotropy, anisotropy);
        }