- 2011 - A trip through the Graphics Pipeline 2011
- 2015 - Life of a triangle - NVIDIA's logical pipeline
- 2015 - Render Hell 2.0
- 2016 - How bad are small triangles on GPU and why?
- 2017 - GPU Performance for Game Artists
- 2019 - Understanding the anatomy of GPUs using Pokémon
- 2020 - GPU ARCHITECTURE RESOURCES
In a gpu-driven renderer "work expansion" is a commonly occuring problem. "Work Expansion" means that a single item of work spawns N following work items. Typically one work item will be executed by one shader thread/invocation.
An example for work expansion is gpu driven meshlet culling following mesh culling.
In this example a "work item" is culling a mesh, where each mesh cull work item
spawns N following meshlet cull work items
.
There are many diverse cases of this problem and many solutions. Some are trivial to solve, for example, when N (how many work items are spawned) is fixed.
# Simulator for depth comparison error (i.e. z-fighting) | |
# Nathan Reed, June 2015 | |
# Written for Python 3.4; requires numpy | |
import math | |
import numpy as np | |
import optparse | |
# Parse command-line options | |
parser = optparse.OptionParser() |
:: This bat file can be used to renew Resharper C# and Resharper C++ every time it runs out | |
:: It most likely works for all Jetbrains tools, however, I did not test this. | |
:: I was not able to find the original author for the reg key and the folders that needs to be deleted so if that is you feel free to reach out for credit | |
@echo off | |
setlocal enableDelayedExpansion | |
:confirm | |
echo Did you stop all Jetbrains services? | |
echo Jetbrains toolbox AND any other tool using it such as Rider, Visual Studio, ... |
#version 450 | |
// 2D Polyhedral Bounds of a Clipped, Perspective-Projected 3D Sphere. Michael Mara, Morgan McGuire. 2013 | |
bool projectSphereView(vec3 c, float r, float znear, float P00, float P11, out vec4 aabb) | |
{ | |
if (c.z < r + znear) return false; | |
vec3 cr = c * r; | |
float czr2 = c.z * c.z - r * r; |
struct vec3f {float x, y, z;}; | |
struct vec4f {float x, y, z, w;}; | |
struct mat44f {vec4f x, y, z, w;}; | |
//============================================================================ | |
// sphere_screen_extents | |
//============================================================================ | |
// Calculates the exact screen extents xyzw=[left, bottom, right, top] in | |
// normalized screen coordinates [-1, 1] for a sphere in view space. For | |
// performance, the projection matrix (v2p) is assumed to be setup so that |
This method stores a full TBN frame using just 3 bytes per vertex (plus a bitfield), instead of the traditional 28 bytes (normal: vec3
, tangent: vec4
). It leverages octahedral encoding for normals and a rotation angle for tangent reconstruction.
Storing both glm::vec3 normal
and glm::vec4 tangent
is costly. Since the bitangent can be reconstructed via a cross product, we only need:
- A unit normal (encoded in 2 bytes)
- An angle to rotate a base tangent around the normal (1 byte)
List of freely available resources to study computer graphics programming.
// these matrices are for left-handed coordinate systems, with depth mapped to [1;0] | |
// the derivation for other matrices is analogous | |
// to get a perspective matrix with reversed z, simply swap the near and far plane | |
glm::mat4 perspectiveFovReverseZLH_ZO(float fov, float width, float height, float zNear, float zFar) { | |
return glm::perspectiveFovLH_ZO(fov, width, height, zFar, zNear); | |
}; | |
// now let zFar go towards infinity | |
glm::mat4 infinitePerspectiveFovReverseZLH_ZO(float fov, float width, float height, float zNear) { |
// cofactor matrix. drop-in replacement for the traditional transpose(inverse(m)) normal matrix calculation. | |
// this is a substantial performance improvement. | |
// short form found via shadertoy: https://www.shadertoy.com/view/3s33z | |
mat3 cofactor(mat4 m) { | |
return mat3( | |
cross(m[1].xyz, m[2].xyz), | |
cross(m[2].xyz, m[0].xyz), | |
cross(m[0].xyz, m[1].xyz) | |
); | |
} |