Unity URP Volume & Post Processing
URP Volume 시스템 개요
섹션 제목: “URP Volume 시스템 개요”URP의 포스트 프로세싱은 Volume 컴포넌트로 구성됩니다. Global Volume은 씬 전체에, Local Volume은 콜라이더 영역 내에 적용됩니다.
Camera Inspector → Rendering → Post Processing 활성화 필수.
Volume Profile 구성
섹션 제목: “Volume Profile 구성”Volume 컴포넌트에 VolumeProfile 에셋을 연결합니다.
Volume Profile: ✅ Bloom Threshold: 1.0, Intensity: 0.5, Scatter: 0.7 ✅ Depth of Field (Bokeh) Focus Distance: 10, Focal Length: 50 ✅ Color Grading (ACES) Contrast: 10, Saturation: -5 ✅ Vignette Intensity: 0.3런타임 Volume 블렌딩
섹션 제목: “런타임 Volume 블렌딩”using UnityEngine.Rendering;using UnityEngine.Rendering.Universal;
Volume _volume;Bloom _bloom;
void Start() { _volume = GetComponent<Volume>(); _volume.profile.TryGet(out _bloom);}
// 피격 시 Bloom 강조IEnumerator HitEffect() { float t = 0f; while (t < 0.5f) { t += Time.deltaTime; _bloom.intensity.value = Mathf.Lerp(0.5f, 3f, t * 4f); yield return null; } _bloom.intensity.value = 0.5f;}런타임 Volume 동적 생성
섹션 제목: “런타임 Volume 동적 생성”void CreateFogVolume(Vector3 center, float radius) { var go = new GameObject("FogVolume"); go.transform.position = center;
var sphere = go.AddComponent<SphereCollider>(); sphere.radius = radius; sphere.isTrigger = true;
var volume = go.AddComponent<Volume>(); volume.isGlobal = false; volume.blendDistance = 5f; volume.weight = 1f;
var profile = ScriptableObject.CreateInstance<VolumeProfile>(); var fog = profile.Add<Fog>(); fog.enabled.value = true; fog.color.value = new Color(0.7f, 0.7f, 0.8f); fog.density.value = 0.05f;
volume.profile = profile;}Custom Post Process Effect
섹션 제목: “Custom Post Process Effect”URP에서 커스텀 효과를 추가합니다.
// 1. VolumeComponent 정의[Serializable, VolumeComponentMenuForRenderPipeline( "Custom/Scanlines", typeof(UniversalRenderPipeline))]public class ScanlinesEffect : VolumeComponent, IPostProcessComponent { public ClampedFloatParameter intensity = new(0f, 0f, 1f); public bool IsActive() => intensity.value > 0f; public bool IsTileCompatible() => true;}
// 2. ScriptableRendererFeature 구현public class ScanlinesFeature : ScriptableRendererFeature { ScanlinesPass _pass; public override void Create() => _pass = new ScanlinesPass(); public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData data) => renderer.EnqueuePass(_pass);}
// 3. URP Renderer Asset에 Feature 추가 (에디터)씬 전환 시 Volume 페이드
섹션 제목: “씬 전환 시 Volume 페이드”IEnumerator FadeToBlack(float duration) { if (!_volume.profile.TryGet<ColorAdjustments>(out var ca)) yield break;
float t = 0f; while (t < duration) { t += Time.deltaTime; ca.postExposure.value = Mathf.Lerp(0f, -10f, t / duration); yield return null; }}성능 팁
섹션 제목: “성능 팁”| 이펙트 | 비용 | 모바일 권장 |
|---|---|---|
| Bloom | 중간 | ✅ (낮은 Scatter) |
| Depth of Field | 높음 | ❌ |
| Motion Blur | 높음 | ❌ |
| Color Grading | 낮음 | ✅ |
| Chromatic Aberration | 낮음 | ✅ (낮은 강도) |
- Camera의 Post Processing 활성화 + Volume Profile로 구성
- 런타임 블렌딩:
profile.TryGet<T>()→param.value수정 - Local Volume + 콜라이더로 구역별 다른 분위기 연출
- 커스텀 이펙트는
VolumeComponent+ScriptableRendererFeature로 URP에 통합