Skip to content

Instantly share code, notes, and snippets.

View thennequin's full-sized avatar

Thibault Hennequin thennequin

  • Kylotonn
  • Paris, France
View GitHub Profile
@jakubtomsu
jakubtomsu / octviz.odin
Last active February 7, 2025 20:08
Odin program for visualizing spherical/hemispherical octahedral mapping with Raylib
// Octahedral mapping visualization in Odin and Raylib
// by Jakub Tomšů (@jakubtomsu_)
//
// Build and run with 'odin run octsphere.odin -file'.
// No additional dependencies required.
//
// Sources:
// https://gpuopen.com/learn/fetching-from-cubes-and-octahedrons/
// https://knarkowicz.wordpress.com/2014/04/16/octahedron-normal-vector-encoding/
@h3r2tic
h3r2tic / raymarch.hlsl
Last active April 14, 2025 09:52
Depth buffer raymarching for contact shadows, SSGI, SSR, etc.
// Copyright (c) 2023 Tomasz Stachowiak
//
// This contribution is dual licensed under EITHER OF
//
// Apache License, Version 2.0, (http://www.apache.org/licenses/LICENSE-2.0)
// MIT license (http://opensource.org/licenses/MIT)
//
// at your option.
#include "/inc/frame_constants.hlsl"
@JarkkoPFC
JarkkoPFC / bitonic_sort64.h
Last active December 3, 2024 22:23
Bitonic sort for 64 elements
template<typename T>
void bitonic_sort64(T vals_[64])
{
int h=-1;
do
{
for(unsigned i=0; i<32; ++i)
{
unsigned idx0=2*i;
unsigned idx1=4*(i&h)-2*(i+h)-1;
@bblanchon
bblanchon / Open with Sublime Merge.reg
Last active August 13, 2024 13:15
Add "Open with Sublime Merge" to Windows Explorer context menu
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\smerge]
; %PROGRAMFILES%\Sublime Merge\sublime_merge.exe
"Icon"=hex(2):25,00,50,00,52,00,4f,00,47,00,52,00,41,00,4d,00,46,00,49,00,4c,\
00,45,00,53,00,25,00,5c,00,53,00,75,00,62,00,6c,00,69,00,6d,00,65,00,20,00,\
4d,00,65,00,72,00,67,00,65,00,5c,00,73,00,75,00,62,00,6c,00,69,00,6d,00,65,\
00,5f,00,6d,00,65,00,72,00,67,00,65,00,2e,00,65,00,78,00,65,00,00,00
@="Open with Sublime Merge"

From time to time I receive questions on the depth aware upsampling mentioned in the INSIDE-rendering presentation: https://loopit.dk/rendering_inside.pdf#page=39

noisy blur

The goal of this technique is to take the texture-output from a half-resolution pass, containing the results of sampling volumetric fog - and scale it up to full resolution. This presents two challenges:

  • Making sure samples from the low-resolution buffer, do not spill on top of foreground objects in the high-resolution buffer
  • Making sure the samples in the volumetric fog can be properly accumulated by TAA after upsampling

@crypticsea
crypticsea / opus.c
Created February 23, 2021 06:30
opus build
// cl /I celt /I silk /I silk/float /I include /c opus.c
// lib opus.obj
#define OPUS_CPU_X64
#define USE_ALLOCA
#define OPUS_BUILD
#include "celt/bands.c"
#include "celt/celt.c"
#include "celt/celt_encoder.c"
@GuyPaddock
GuyPaddock / concave_object_to_convex_objects_by_face.py
Last active December 28, 2024 01:04
Blender 2.91 Script for Convex Hull Decomposition into Separate Shapes Using Blender's Convex using "Split Concave Faces"
##
# A script to split simple, architectural geometry into convex pieces.
#
# This script makes use of Blender's built-in "Split Concave Faces" clean-up
# algorithm to break-up the faces of an object into convex pieces. The script
# attempts to identify all the edges that represent convex boundaries, and then
# it splits objects up along those edges. Each resulting piece is then made into
# a closed object by converting it into a convex hull.
#
# Be sure to select the object you wish the split into convex pieces before
@soufianekhiat
soufianekhiat / DearImGui.cpp
Last active April 16, 2024 19:03
Slider 2D & Slider 3D
bool InputVec2(char const* pLabel, ImVec2* pValue, ImVec2 const vMinValue, ImVec2 const vMaxValue, float const fScale /*= 1.0f*/)
{
return SliderScalar2D(pLabel, &pValue->x, &pValue->y, vMinValue.x, vMaxValue.x, vMinValue.y, vMaxValue.y, fScale);
}
bool InputVec3(char const* pLabel, ImVec4* pValue, ImVec4 const vMinValue, ImVec4 const vMaxValue, float const fScale /*= 1.0f*/)
{
return SliderScalar3D(pLabel, &pValue->x, &pValue->y, &pValue->z, vMinValue.x, vMaxValue.x, vMinValue.y, vMaxValue.y, vMinValue.z, vMaxValue.z, fScale);
}
Perfect Quantization of DXT endpoints
-------------------------------------
One of the issues that affect the quality of most DXT compressors is the way floating point colors are rounded.
For example, stb_dxt does:
max16 = (unsigned short)(stb__sclamp((At1_r*yy - At2_r*xy)*frb+0.5f,0,31) << 11);
max16 |= (unsigned short)(stb__sclamp((At1_g*yy - At2_g*xy)*fg +0.5f,0,63) << 5);
max16 |= (unsigned short)(stb__sclamp((At1_b*yy - At2_b*xy)*frb+0.5f,0,31) << 0);
@simonbroggi
simonbroggi / AmbientOcclusionDirection.osl
Created November 22, 2019 11:01
Calculates AO and the average direction where the ambient light came from.
/*
* Ambient Occlusion and Direction.
*
* Calculates AO and the average direction where the ambient light came from.
*
* Original AO code from https://github.com/sambler/osl-shaders/blob/master/ramps/BaAmbientOcclusion/BaAmbientOcclusion.osl
*
*/
void rng_seed(output int rng, int seed)