본문 바로가기
Shader/1. 게임 그래픽

1. 게임 그래픽

by BroJune 2020. 10. 26.

1. 렌더링 

 2D 또는 3D 메쉬, 광원의 위치, 게임 카메라의 앵글 같은 씬 정보로 부터 이미지를 만드는 과정

2. 메쉬

 Vertex / Edge / faces 세가지 정보를 저장

 

 Edge와 Faces는 Vertex ordering를 간접적으로 정의한다.

 Winding order (시계 방향, 반시계 방향을 정하는것)

 Back face Culling ( 뒷면은 계산하지 않음)

3. Scalar & Vector

 Scalar : 크기(magnitute)만 가지 있다.

 Vector : 크기(magnitute), 방향을 가지는 양(Direction Quantity) 을 가지고 있다. 

            

- 자료 출처 - byjus.com/physics/scalars-and-vectors/ 
- 자료 출처 - http://s3-ap-southeast-1.amazonaws.com/subscriber.images/physics/2015/12/19113944/SCALAR-AND-VECTOR1.png
- 자료 출처 - mathonline.wikidot.com/scalars-and-vectors

시작점 : initial point 

끝점 : terminal point

 

 

벡터는 나르다(Carry)라는 뜻을 갖고 있는 라틴어 Vehere에서 왔다.
Normalization(정규화) : 단위 벡터가 아닌 벡터를 단위 벡터로 만드는 과정
Unit Vector(단위 벡터) : 길이가 1인 Vector
수학이나 물리등에서는 벡터에 대해서 엄격한 정의를 가지고 있으나 코딩영역에서는 단지 일련의 숫자이기 때문에 편리 성을 위해서 사용한다.

벡터의 정규화

www.fundza.com/vectors/normalize/

 

Vectors - Normalizing

Unit Vectors - Normalizing Operations in 2D and 3D computer graphics are often performed using copies of vectors that have been normalized ie. converted to unit vectors. For example, the tutorial "RSL: Edge Effects" applies normalization before calculating

www.fundza.com

 sqrt : 제곱근 SQuare RooT의 줄임말

 

 RSL : Edge Effects 

 

Rsl - Edge Effects

Listing 4 surface rim(float Kd = 1, rim_width = 0.2; vector direction = vector(0,-1,0)) { /* STEP 1 - make a copy of the surface normal one unit in length */ normal n = normalize(N); normal nf = faceforward(n, I); /* STEP 2.1 - set the apparent surface opa

www.fundza.com

4. 색상

Vector의 Component : Vector(1,2,3) 는 3차원 Vector(1,2,3,4)는 4차원

Vec3 -> (x,y,z) -> (R,G,B,1)

vec4 -> (x,y,z,w) -> (R,G,B,A)

5. 렌더링 파이프라인

 

- 자료 출처 - Learn OpenGL- Graphics Programming

6. 셰이더

 

 

- 자료 출처 Practical Shader Development -