Skip to content

Instantly share code, notes, and snippets.

View pixelsnafu's full-sized avatar

Piyush Verma pixelsnafu

View GitHub Profile
@VeganPower
VeganPower / c++Course.md
Created August 30, 2020 12:12
Low level programming in C++

Reference CPU: Multicore AVX 2 capable

Lets' start:

  • Compiler / compile units / linker.
    • Setup makefile
  • Imperative algorithm
  • Understand our processor
  • bit/byte/word/dword/qword

Core Coding Standard

Coding practices are a source of a lot of arguments among programmers. Coding standards, to some degree, help us to put certain questions to bed and resolve stylistic debates. No coding standard makes everyone happy. (And even their existence is sure to make some unhappy.) What follows are the standards we put together on the Core team, which have become the general coding standard for all programming teams on new code development. We’ve tried to balance the need for creating a common, recognizable and readable code base with not unduly burdening the programmer with minor code formatting concerns.

Table Of Contents

@alaingalvan
alaingalvan / screenspacebentconesao.glsl
Last active December 27, 2023 20:53
GPU Pro 3 sample of bent cones screen space ambient occlusion.
void main()
{
vec3 positionX = backproject(depthTexture(pixelCoordinateI), inverseViewProjectionMatrix);
vec3 normalX = normalTexture(pixelCoordinateI);
// get ONB to transform samples
mat3 orthoNormalBasis = computeONB(normalX);
// select samples for pixel out of pattern
int patternOffset = getPatternOffset(pixelCoordinateI);
float ao = 0.0;
@nothings
nothings / kotaku_hzd.md
Last active January 23, 2024 15:24
Why Frustum Culling Matters, and Why It's Not Important

There is a nice GIF illustrating a technique called "frustum culling" in this Kotaku article: http://kotaku.com/horizon-zero-dawn-uses-all-sorts-of-clever-tricks-to-lo-1794385026

The interwebs being what they are, this has also led to some controversy.

Some people have interpreted the opening sentence "Every time you move the camera in Horizon Zero Dawn, the game is doing all sorts of under-the-hood calculations, loading and unloading chunks of world to ensure that it all runs properly," as being about the GIF; that's not what frustum culling does, but that's probably not what the article's author meant anyway.

@TheRealMJP
TheRealMJP / Tex2DCatmullRom.hlsl
Last active April 9, 2024 08:41
An HLSL function for sampling a 2D texture with Catmull-Rom filtering, using 9 texture samples instead of 16
// The following code is licensed under the MIT license: https://gist.github.com/TheRealMJP/bc503b0b87b643d3505d41eab8b332ae
// Samples a texture with Catmull-Rom filtering, using 9 texture fetches instead of 16.
// See http://vec3.ca/bicubic-filtering-in-fewer-taps/ for more details
float4 SampleTextureCatmullRom(in Texture2D<float4> tex, in SamplerState linearSampler, in float2 uv, in float2 texSize)
{
// We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding
// down the sample location to get the exact center of our "starting" texel. The starting texel will be at
// location [1, 1] in the grid, where [0, 0] is the top left corner.
float2 samplePos = uv * texSize;