카테고리 없음

[Computer Graphics] Graphics Programming

easy038 2025. 3. 20. 14:01

What Are Graphics Libraries?

- Provide various functionalities that are required in drawing images on the screen

- Provide low-level access to the GPU, optimizing performance

- Manage visual effects like lighting, textures, and shaders

- Support real-time rendering for interactive applications

- 개발자가 일일이 화면의 픽셀을 건드릴 필요 없이, 라이브러리가 제공하는 함수나 API를 사용해 간편하게 그래픽 작업 처리 가능

 

3D Graphics Libraries

- Low-level APIs

  • Proivdes the most fundamental functionalities
  • Users have huge freedom in programming / 상대적 난이도가 높다
  • ex) OpenGL, Metal, Vulkan, DirectX

- Windowing Libraries

  • Encapsulate common functionality with a low-level APIs
  • Provides APIs for basic user-interaction (ex. mouse, keyboard, sounds)
  • ex) GLFW, Qt, Pyglet, Pyrender, Pygame

- High-level Development Tools

  • Support users so that they don't have to worry too much about graphics and performance while developing applications
  • Often customized to support specific applications
  • ex) Unreal, Unity, Blender, Maya, CAD softwares
  • 3D 그래픽에 필요한 물리엔진, 3D 모델 불러오기, 다양한 편집 기능 등을 지원함
  • 직접 그래픽 API를 다룰 필요 없이, 비교적 편리하게 게임이나 그래픽 콘텐츠 제작 가능

OpenGL

- Developen in 1992 by Silicon Graphics(SGI)

- Has been used as a global standard for 3D graphics

- These days, Vulkan is seen as its modern successor

- Ideal library for learning the basics of computer graphics

 

Programming Language 

- OpenGL : cross-platform and can be used with various languages

- WebGL : web-based version of OpenGL

 

Why WebGL?

- Easy access and interactive coding through web-based services

 

Rasterization

Converts 3D objetcs into a 2D image by filling pixels based on polygon coverage

 

 

Vertex Shader

* Shader :  GPU가 실행하는 작은 프로그램

Vertes shader per object

- Inputs

  • Attributes : The per-vertex data stored in the vertex array such as position
  • Uniforms : The per-object data that remain constant for multiple executions of a shader

- Outputs

  • Must include the built-in variable(내장변수), gl_Position, which stores the clip-space vertex position
  • Usually include normal and texture coordinates

Fragment Shader

Fragment shader per pixel, and responsible for determining the final color of each pixel

- Attributes(colors, texture coordinates, normals) are smoothly interpolated between vertices to determine the value for each fragment

- Inputs

  • Data from the Vertex Shader (ex. interpolated normals, texture coordinates)

- Outputs

  • The final color (ex. FragColor) that will be rendered on the screen

 

OpenGL Shader Language(GLSL)

- C-like language

- Works on GPU

- Supports Vector and Matrix