Files
2nd/10_Wiki/Topics/Domain_Programming/Frontend/에일리어싱 (Aliasing).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

171 lines
5.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: wiki-2026-0508-에일리어싱-aliasing
title: 에일리어싱 (Aliasing)
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Aliasing, 계단현상, Jaggies]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [graphics, rendering, frontend, antialiasing]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: CSS/JS
framework: Canvas/WebGL
---
# 에일리어싱 (Aliasing)
## 매 한 줄
> **"매 sampling rate 가 signal frequency 의 절반 미만일 때 발생하는 distortion"**. Nyquist theorem 위반 의 결과로, frontend 에서 매 jagged edges, moiré patterns, shimmer 형태로 나타남. 매 antialiasing (AA) 기법으로 완화.
## 매 핵심
### 매 정의
- **Spatial aliasing**: 매 jagged edges (계단 현상) — pixel grid 가 매 diagonal/curved line 의 표현 부족.
- **Temporal aliasing**: 매 frame rate 부족 의 결과 — wagon-wheel effect, stutter.
- **Texture aliasing**: 매 minification 시 매 moiré pattern.
### 매 원인
- **Discrete sampling**: 매 continuous signal 을 discrete pixel 로 sampling.
- **Sub-pixel detail**: 매 single pixel 보다 작은 detail 의 미손실 표현 불가.
- **Nyquist criterion**: 매 sampling_rate ≥ 2 × max_frequency 충족 X.
### 매 응용 (frontend)
1. **Canvas/WebGL rendering**: 매 line, polygon, font 의 smooth rendering.
2. **CSS transforms**: 매 rotated/scaled element 의 edge.
3. **SVG icons**: 매 small size 매 shimmer 방지.
## 💻 패턴
### Canvas 2D antialiasing 활성화
```javascript
const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');
// imageSmoothingEnabled: 매 default true
ctx.imageSmoothingEnabled = true;
ctx.imageSmoothingQuality = 'high'; // 'low' | 'medium' | 'high'
ctx.drawImage(img, 0, 0, 100, 100);
```
### WebGL MSAA (Multi-Sample Anti-Aliasing)
```javascript
const gl = canvas.getContext('webgl2', {
antialias: true, // 매 MSAA 활성화 (browser 가 sample count 결정)
});
// 매 explicit sample count (offscreen framebuffer)
const fb = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
const rb = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, rb);
gl.renderbufferStorageMultisample(
gl.RENDERBUFFER, 4, gl.RGBA8, width, height
);
```
### CSS — 매 transform 시 jagged edge 완화
```css
.rotated {
transform: rotate(15deg);
/* 매 GPU 가속 + subpixel AA */
will-change: transform;
backface-visibility: hidden;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* 매 image scaling 시 quality */
img {
image-rendering: auto; /* 매 default — browser AA */
/* image-rendering: pixelated; — 매 retro pixel art */
/* image-rendering: crisp-edges; — 매 sharp without AA */
}
```
### SVG — 매 sub-pixel rendering
```html
<!-- 매 매끈한 line: shape-rendering -->
<svg viewBox="0 0 100 100">
<line
x1="10" y1="10" x2="90" y2="50"
stroke="black"
shape-rendering="geometricPrecision"
/>
<!-- "geometricPrecision" | "crispEdges" | "auto" -->
</svg>
```
### Three.js — 매 FXAA postprocessing
```javascript
import * as THREE from 'three';
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
import { FXAAShader } from 'three/addons/shaders/FXAAShader.js';
const composer = new EffectComposer(renderer);
const fxaa = new ShaderPass(FXAAShader);
fxaa.material.uniforms.resolution.value.set(
1 / window.innerWidth, 1 / window.innerHeight
);
composer.addPass(fxaa);
```
### Devicepixelratio 보정
```javascript
function setupHiDPICanvas(canvas) {
const dpr = window.devicePixelRatio || 1;
const rect = canvas.getBoundingClientRect();
canvas.width = rect.width * dpr;
canvas.height = rect.height * dpr;
canvas.style.width = `${rect.width}px`;
canvas.style.height = `${rect.height}px`;
const ctx = canvas.getContext('2d');
ctx.scale(dpr, dpr);
return ctx;
}
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| 매 SVG icon, vector | shape-rendering="geometricPrecision" |
| 매 retina display | devicePixelRatio scaling |
| 매 WebGL game | MSAA 4x or FXAA postprocess |
| 매 pixel art | image-rendering: pixelated (AA 끄기) |
| 매 rotated text | -webkit-font-smoothing: antialiased |
**기본값**: 매 antialias: true 활성화 + DPR scaling 적용.
## 🔗 Graph
- 부모: [[Computer Graphics]]
- 변형: [[FXAA]]
- 응용: [[WebGL]] · [[SVG]]
## 🤖 LLM 활용
**언제**: 매 Canvas/WebGL rendering 매 jagged edge 의 완화, retina display 의 sharp output.
**언제 X**: 매 pixel art (의도적 jagged), 매 ultra low-end GPU (AA 비용 부담).
## ❌ 안티패턴
- **DPR 무시**: 매 retina 매 blurry — devicePixelRatio scaling 누락.
- **AA 항상 max**: 매 mobile GPU 매 fps 저하 — adaptive quality 필요.
- **transform 후 sub-pixel position**: 매 0.5px offset 매 blur — translateZ(0) hack.
## 🧪 검증 / 중복
- Verified (MDN Canvas API, WebGL spec, Three.js docs).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — aliasing, AA techniques (MSAA/FXAA), Canvas/WebGL/SVG/CSS 패턴 정리 |