Performance: Bloom and color grading
This affects the rendering speed and frame rate by adding post-processing effects that increase GPU workload during frame composition.
using UnityEngine.Rendering.PostProcessing; var volume = gameObject.AddComponent<PostProcessVolume>(); volume.isGlobal = true; var bloom = ScriptableObject.CreateInstance<Bloom>(); bloom.intensity.value = 2f; var colorGrading = ScriptableObject.CreateInstance<ColorGrading>(); colorGrading.saturation.value = 10f; volume.profile = new PostProcessProfile(); volume.profile.AddSettings(bloom); volume.profile.AddSettings(colorGrading);
using UnityEngine.Rendering.PostProcessing; var volume = gameObject.AddComponent<PostProcessVolume>(); volume.isGlobal = true; var bloom = ScriptableObject.CreateInstance<Bloom>(); bloom.intensity.value = 10f; var colorGrading = ScriptableObject.CreateInstance<ColorGrading>(); colorGrading.saturation.value = 100f; volume.profile = new PostProcessProfile(); volume.profile.AddSettings(bloom); volume.profile.AddSettings(colorGrading);
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| High intensity bloom + extreme color grading | N/A | N/A | High GPU shader cost, longer frame render time | [X] Bad |
| Moderate bloom + subtle color grading | N/A | N/A | Lower GPU cost, smoother frame rate | [OK] Good |
var volume = GetComponent<Volume>();
if (volume.profile.TryGet<ColorAdjustments>(out var colorAdjust)) {
colorAdjust.saturation.value = -100f;
colorAdjust.contrast.value = 50f;
}var volume = GetComponent<Volume>();
if (volume.profile.TryGet<Bloom>(out var bloom)) {
bloom.enabled.value = true;
}
What is the likely problem?Pass the test and this pattern moves unknown