Serialize provider post-process profiles

This commit is contained in:
Meta Vens 2026-07-16 13:04:37 +01:00
commit 005795a9ef
3 changed files with 47 additions and 17 deletions

View file

@ -1,5 +1,6 @@
using System.IO;
using UnityEditor;
using UnityEditor.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
@ -15,30 +16,29 @@ namespace Aetheria.Editor
{
Directory.CreateDirectory(Root);
AssetDatabase.DeleteAsset(FlightProfilePath);
var profile = ScriptableObject.CreateInstance<VolumeProfile>();
var profile = VolumeProfileFactory.CreateVolumeProfileAtPath(FlightProfilePath);
profile.name = "Aetheria Flight";
AssetDatabase.CreateAsset(profile, FlightProfilePath);
var tonemapping = profile.Add<Tonemapping>(true);
var tonemapping = VolumeProfileFactory.CreateVolumeComponent<Tonemapping>(profile, true, false);
tonemapping.mode.Override(TonemappingMode.ACES);
var color = profile.Add<ColorAdjustments>(true);
var color = VolumeProfileFactory.CreateVolumeComponent<ColorAdjustments>(profile, true, false);
// The fossil histogram exposure clamps average luminance to 2^-3 and
// uses a 0.5 middle-grey key. At that dark-scene bound the resulting
// exposure is 4x, which is the fixed URP equivalent available here.
color.postExposure.Override(2f);
color.contrast.Override(15f);
var bloom = profile.Add<Bloom>(true);
var bloom = VolumeProfileFactory.CreateVolumeComponent<Bloom>(profile, true, false);
bloom.intensity.Override(3f);
bloom.threshold.Override(1.5f);
bloom.scatter.Override(1f);
var vignette = profile.Add<Vignette>(true);
var vignette = VolumeProfileFactory.CreateVolumeComponent<Vignette>(profile, true, false);
vignette.intensity.Override(0.3f);
vignette.smoothness.Override(0.4f);
var grain = profile.Add<FilmGrain>(true);
var grain = VolumeProfileFactory.CreateVolumeComponent<FilmGrain>(profile, true, false);
grain.type.Override(FilmGrainLookup.Thin1);
grain.intensity.Override(0.1f);