Skip to content

Instantly share code, notes, and snippets.

@mebiusbox
mebiusbox / GGXApproxDiffuse.brdf
Created September 8, 2017 14:25
GGX Approximation Diffuse for BRDF Explorer
analytic
# variables go here...
# only floats supported right now.
# [type] [name] [min val] [max val] [default val]
::begin parameters
float albedo 0 1 1
float roughness 0 1 1
::end parameters
@max-mapper
max-mapper / bibtex.png
Last active November 6, 2024 09:03
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
@Leandros
Leandros / links.md
Last active January 23, 2025 19:15
Writing a Modern Rendering Engine
@dwilliamson
dwilliamson / Pimpl.cpp
Last active May 12, 2017 16:10
How I Pimpl
struct Data
{
Data()
{
}
~Data()
{
}
@nlguillemot
nlguillemot / tasks.md
Last active February 17, 2018 20:11
Musings on task parallelism

In order to effectively use a multi-core CPU, a decomposition of code into tasks must be made. By decomposing code into tasks, the tasks can be distributed among CPU cores by a scheduler. Tasks can have dependencies on other tasks, meaning that the tasks execute in a partial order. This partial order can be represented as a graph, where each task has predecessors and successors. A task can only execute when all its predecessors have completed.

To implement this, we can explicitly create a graph of tasks, with edges between tasks to identify predecessor/successor relationships. The problem with a general task graph system is that it's not productive to work with. Maybe it's okay for some purposes to have a GUI interface to build a task graph, but that's too tedious for everyday code. Imagine if you had to explicitly create nodes and edges when implementing a single-threaded function call graph, it would be so tedious!

This turned into a random walk through some linear algebra topics that are near and dear
to my heart. The initial stimulus was to give my preferred mathematician's explanation of
why the inverse transpose shows up when transforming normal vectors. I've never seen an
explanation in the computer graphics literature I found completely satisfactory.
Notation:
V -> W is the type of a function from V to W.
A^t is the transpose of A.
A^(-1) is the inverse of A.
@NocturnDragon
NocturnDragon / Swizzles.h
Last active October 15, 2023 01:20
Swizzles in Clang, GCC, and Visual c++
#include <stdio.h>
// #define CLANG_EXTENSION
// Clang compile with -O3
#define VS_EXTENSION
// https://godbolt.org/z/sVWrF4
// Clang compile with -O3 -fms-compatibility
// VS2017 compile with /O3
@ekmett
ekmett / math_constexpr.h
Last active November 2, 2022 21:56
Computing Spherical Harmonics
#pragma once
#include <limits>
#define _USE_MATH_DEFINES
#include <math.h>
namespace framework {
namespace math_constexpr {
int constexpr abs(int x) {