Skip to content

Instantly share code, notes, and snippets.

View dariomanesku's full-sized avatar

Dario Manesku dariomanesku

View GitHub Profile
@h3r2tic
h3r2tic / raymarch.hlsl
Last active March 7, 2024 18:56
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"
@bgolus
bgolus / WorldNormalFromDepthTexture.shader
Last active March 28, 2024 22:54
Different methods for getting World Normal from Depth Texture, without any external script dependencies.
Shader "WorldNormalFromDepthTexture"
{
Properties {
[KeywordEnum(3 Tap, 4 Tap, Improved, Accurate)] _ReconstructionMethod ("Normal Reconstruction Method", Float) = 0
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
@kripken
kripken / hello_world.c
Last active January 17, 2024 12:15
Standalone WebAssembly Example
int doubler(int x) {
return 2 * x;
}
@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;
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <gl/gl.h>
#pragma comment(lib, "opengl32.lib")
@vurtun
vurtun / fibers.c
Last active February 27, 2023 05:37
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <string.h>
#define streq(a, b) (!strcmp((a), (b)))
#ifndef __USE_GNU
#define __USE_GNU
@francogonzaga
francogonzaga / lucius-vifm
Last active August 24, 2016 08:51
Lucius color scheme for vifm
" lucius-vifm
" Color scheme for vifm (http://vifm.sourceforge.net/)
" Save this file as ~/.vifm/colors/lucius-vifm
" In your ~/.vifm/vifmrc, make sure you have the following line:
" color lucius-vifm
"
" This color scheme is loosely based on the lucius color scheme for vim
highlight Win cterm=none ctermfg=250 ctermbg=236
@rygorous
rygorous / gist:2156668
Last active April 16, 2024 11:18
float->half variants
// float->half variants.
// by Fabian "ryg" Giesen.
//
// I hereby place this code in the public domain, as per the terms of the
// CC0 license:
//
// https://creativecommons.org/publicdomain/zero/1.0/
//
// float_to_half_full: This is basically the ISPC stdlib code, except
// I preserve the sign of NaNs (any good reason not to?)