Files
2nd/10_Wiki/Topic_Programming/Frontend/에일리어싱 (Aliasing).md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +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 패턴 정리 |