Files
2nd/10_Wiki/Topics/Domain_Programming/Architecture/Overdraw.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

5.0 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-overdraw Overdraw 10_Wiki/Topics verified self
pixel overdraw
fill rate waste
none A 0.9 applied
graphics
rendering
performance
gpu
2026-05-10 pending
language framework
hlsl unreal-engine

Overdraw

매 한 줄

"매 한 pixel을 두 번 이상 칠하면 그건 낭비다". 매 GPU fragment shader 가 같은 pixel을 여러 번 실행하는 현상. 매 fill-rate bottleneck의 주범, 매 mobile/VR에서 frame budget을 갉아먹는 1순위 원인.

매 핵심

매 왜 발생하나

  • Transparent / alpha-blended: 매 depth write X → 매 뒤 surface 도 그려짐.
  • Back-to-front draw order: 매 멀리 → 가까이 그리면 가까운 게 멀리 위에 덮어씀.
  • Particle systems: 매 수천 quad가 겹침.
  • UI layering: 매 panel 위 panel 위 button → 매 3-4x overdraw 흔함.
  • Post-processing fullscreen passes: 매 screen 전체 매 pass 마다 1x.

매 측정

  • Quad overdraw view (Unreal viewmode quadoverdraw, Unity Frame Debugger): 매 색깔 heatmap, 매 빨강 = 5x+.
  • GPU profiler: 매 fragment shader invocations / pixels filled ratio.
  • Mobile GPU counters: Mali/Adreno/Apple Metal Frame Debugger 의 overdraw counter.

매 완화

  1. Front-to-back opaque sort + early-Z / Hi-Z: 매 depth test 가 fragment shader 전에 reject.
  2. Z-prepass: 매 depth만 먼저 그림 → 매 main pass에서 fragment shader 1 pixel 당 1번.
  3. Occlusion culling (HZB, Nanite): 매 안 보이는 mesh 자체 제외.
  4. Alpha-test 대신 alpha-to-coverage 또는 opaque + dither.
  5. Particle LOD / fewer overlapping quads.

💻 패턴

Z-prepass (Vulkan / DX12 컨셉)

// Pass 1: Depth only — null pixel shader, ColorMask=0
[earlydepthstencil]
void DepthOnlyPS() {} // empty

// Pass 2: Color — DepthFunc=Equal, no depth write
float4 MainPS(VSOut i) : SV_Target {
    return ShadeExpensive(i); // 매 pixel 당 1번만 실행 보장
}

Front-to-back sorting (opaque)

std::sort(opaque_draws.begin(), opaque_draws.end(),
    [&](const Draw& a, const Draw& b) {
        float da = length(a.center - cam.pos);
        float db = length(b.center - cam.pos);
        return da < db; // 매 가까운 것 먼저
    });
// 매 transparent 는 반대로 back-to-front

Quad overdraw debug shader

// 매 stencil 또는 RWByteAddressBuffer 로 increment
RWStructuredBuffer<uint> OverdrawCounter : register(u0);

float4 DebugPS(uint2 pos : SV_Position) : SV_Target {
    uint idx = pos.y * ScreenWidth + pos.x;
    InterlockedAdd(OverdrawCounter[idx], 1);
    return 0;
}
// 매 후에 heatmap 으로 visualize

Particle culling (Niagara / VFX Graph)

// 매 GPU sim particle: distance/screen-coverage based kill
if (length(world_pos - cam.pos) > kill_distance) Kill();
if (screen_size_pixels < 2.0) Kill(); // 매 sub-pixel particle 제거

Alpha-tested foliage → dither

float4 FoliagePS(VSOut i) : SV_Target {
    float4 c = SampleAlbedo(i.uv);
    // 매 hashed alpha-to-coverage 로 dither (UE5 default)
    if (c.a < InterleavedGradientNoise(i.pos.xy)) discard;
    return c; // 매 opaque pipeline 의 early-Z 활용
}

Nanite / mesh shader culling (UE 5.x)

// 매 cluster-level Hi-Z occlusion + frustum culling 자동
// 매 1 triangle = 1 pixel scenario에서 overdraw 거의 제거

매 결정 기준

상황 Approach
Opaque heavy scene Front-to-back sort + early-Z
Expensive PS (PBR + raymarch) Z-prepass
Foliage / leaves Alpha-to-coverage dither
Particle smoke LOD + reduced layer count
Mobile / VR Tile-based GPU 의 hidden surface removal 활용 + Z-prepass 회피 (TBDR 자체로 충분)
UI Atlas + minimal layering, pre-bake 합성

기본값: Opaque front-to-back + Z-prepass for expensive shaders + alpha dither.

🔗 Graph

🤖 LLM 활용

언제: 매 GPU profile 의 PS bound + fragment invocations >> rendered pixels. 매 mobile thermal throttling. 언제 X: 매 vertex bound 또는 매 bandwidth bound — 매 overdraw 가 main 문제 아님.

안티패턴

  • Back-to-front for opaque: 매 early-Z 무력화.
  • Alpha-blend everywhere: 매 UI/effects의 fully opaque 도 blend → fill cost 증가.
  • Z-prepass on TBDR mobile: 매 Apple/Mali tiler가 이미 hidden surface 처리 → prepass 의 추가 overhead.
  • Fullscreen quad post FX 무한 chain: 매 pass 5+ → 매 5x overdraw 보장.

🧪 검증 / 중복

  • Verified (UE5 docs, Unity SRP rendering, Arm Mali best practices, GPU Gems).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — overdraw causes + mitigations + shader patterns