Skip to content

Instantly share code, notes, and snippets.

View Reedbeta's full-sized avatar

Nathan Reed Reedbeta

View GitHub Profile
@Reedbeta
Reedbeta / indexable-temps.hlsl
Created July 8, 2014 21:24
Indexable temporaries tests in HLSL
// This works (compiled with: fxc /T ps_5_0 /E main foo.hlsl)
float main (in uint x:X) : SV_Target0
{
float a[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
// Put some things in the array
a[x] = 47.0;
a[x&7] = 42.0;
a[(x+1)%12] = 3.14159;
@Reedbeta
Reedbeta / sierpinski.py
Created June 29, 2014 05:08
Sierpinski carpet generator in Python
# Sierpinski carpet generator, in Python using Numpy and Pillow.
# Written by Nathan Reed, June 2014.
# This code is released into the public domain.
import numpy as np
from PIL import Image
numLevels = 6
imageSize = 3**numLevels
@Reedbeta
Reedbeta / gist:5794189
Last active December 18, 2015 13:59
Beckmann HLSL test
float beckmann1(float m : M, float NdotH : NDOTH) : SV_Target0
{
float oneOverMSquared = 1.0 / (m*m);
float NdotHSquared = NdotH * NdotH;
return exp((NdotHSquared - 1.0) / NdotHSquared * oneOverMSquared) * oneOverMSquared * (1.0 / 3.141592654) / (NdotHSquared * NdotHSquared);
}
mad r0.x, v0.y, v0.y, l(-1.000000)
mul r0.yz, v0.xxyx, v0.xxyx
div r0.x, r0.x, r0.z
if (FAILED(D3D11CreateDevice(
NULL,
D3D_DRIVER_TYPE_HARDWARE,
NULL,
#if _DEBUG
D3D11_CREATE_DEVICE_DEBUG,
#else
0,
#endif
NULL,
@Reedbeta
Reedbeta / hobbit.txt
Last active December 10, 2015 10:59
Hobbit review
I went to see the Hobbit in HFR 3D IMAX OMGWTF today. Movie verdict: 3 hours is too long to sit in
the theater. It's not necessarily too long for home viewing where you can get up and move around,
or pause the movie and take a break, but it's too long for the theater. That said, it's a well-made
film and PJ keeps the story moving along, so you'll be entertained, even if your eyes and butt are
sore as hell by the end of it!
Stereo 3D verdict: yep, I still hate it. Kill it with fire. Especially the parts where they flick
stuff at your face - it's such a stupid, cheap trick.
HFR verdict: really interesting experience. The picture is great - very clear and smooth and BRIGHT