Computer Graphics: Difference between revisions

 
(4 intermediate revisions by the same user not shown)
Line 76: Line 76:
For example, see
For example, see
* [https://eigen.tuxfamily.org/dox/classEigen_1_1Transform.html Eigen::Transform]
* [https://eigen.tuxfamily.org/dox/classEigen_1_1Transform.html Eigen::Transform]
===Barycentric Coordinates===


==MVP Matrices==
==MVP Matrices==
Line 171: Line 173:
In frameworks and libraries, these are often refered to as ''standard materials'' or in Blender, ''Principled BSDF''.
In frameworks and libraries, these are often refered to as ''standard materials'' or in Blender, ''Principled BSDF''.


===Blending and Pixel Formats===
==Blending and Pixel Formats==


====Pixel Formats====
===Pixel Formats===


====Blending====
===Blending===


To output transparent images, i.e. images with alpha, you'll generally want to blend using [[Premultiplied Alpha]]. Rendering in premultiplied alpha prevents your RGB color values from getting mixed with the background color empty pixels.
To output transparent images, i.e. images with alpha, you'll generally want to blend using [[Premultiplied Alpha]]. Rendering in premultiplied alpha prevents your RGB color values from getting mixed with the background color empty pixels.
Line 181: Line 183:
===Rendering===
===Rendering===


For rasterization, we generally render by:
For rasterization, the render loop typically consists of:
# Render opaque objects front-to-back
# Render the shadow map.
# Render transparent objects back-to-front
# Render all opaque objects front-to-back.
## Opaque objects write to the depth buffer.
# Render all transparent objects back-to-front
## Transparent objects do not write to the depth buffer.


Rendering opaque objects front to back minimizes overdraw, where a pixel gets drawn to multiple times in a single frame.
Rendering opaque objects front to back minimizes overdraw, where a pixel gets drawn to multiple times in a single frame.
Rendering transparent objects back to front is needed for proper blending of transparent materials.
Rendering transparent objects back to front is needed for proper blending of transparent materials.
==Anti-aliasing==
For a high-quality anti-aliasing, you'll generally want to multiple multi-sampling (MSAA).
This causes the GPU to render the depth buffer at a higher resolution to determine the contribution of your fragment shader's color to the final image.
See https://learnopengl.com/Advanced-OpenGL/Anti-Aliasing#:~:text=How%20MSAA%20really%20works%20is,buffer%20to%20determine%20subsample%20coverage for more details.


==More Terms==
==More Terms==