Skip to content

Instantly share code, notes, and snippets.

View sir-pinecone's full-sized avatar
👁️

Michael Campagnaro sir-pinecone

👁️
View GitHub Profile
@setlocal enableextensions enabledelayedexpansion
@echo off
rem Make sure we're running as admin. Got this garbage from https://stackoverflow.com/a/40388766
if not "%1"=="am_admin" (
powershell -Command "Start-Process -Verb RunAs -FilePath '%0' -ArgumentList 'am_admin'"
exit /b
)
rem NOTE: Defender may see this file as malware, so you might need to exclude this before things can be disabled.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sir-pinecone
sir-pinecone / restir-meets-surfel-lighting-breakdown.md
Created February 8, 2023 21:24 — forked from h3r2tic/restir-meets-surfel-lighting-breakdown.md
A quick breakdown of lighting in the `restir-meets-surfel` branch of my renderer

A quick breakdown of lighting in the restir-meets-surfel branch of my renderer, where I revive some olde surfel experiments, and generously sprinkle ReSTIR on top.

General remarks

Please note that this is all based on work-in-progress experimental software, and represents a single snapshot in development history. Things will certainly change 😛

Due to how I'm capturing this, there's frame-to-frame variability, e.g. different rays being shot, TAA shimmering slightly. Some of the images come from a dedicated visualization pass, and are anti-aliased, and some show internal buffers which are not anti-aliased.

Final images

// Branch-free implementation of half-precision (16 bit) floating point
// Copyright 2006 Mike Acton <macton@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
@sir-pinecone
sir-pinecone / xbox_test.c
Created September 7, 2021 15:18 — forked from mmozeiko/xbox_test.c
Getting xbox controller input without xinput
// cl.exe xbox_test.c /link setupapi.lib user32.lib
#include <windows.h>
#include <setupapi.h>
#include <dbt.h>
#include <stdio.h>
/// interface
#define XBOX_MAX_CONTROLLERS 16
#define BYTECODE_INSTRUCTIONS \
X(BYTECODE_UNINITIALIZED, 0) \
X(BYTECODE_JUMP_IF_2, _ar) \
X(BYTECODE_COMPARE_1, _ar) \
X(BYTECODE_MOVE_A_TO_R, _aR) \
#define X(NAME, REG_FLAG) NAME,
enum Bytecode_Instructions {
BYTECODE_INSTRUCTIONS
BYTECODE_COUNT,

On the emergence of interfaces

Interfaces naturally emerge as software gets broken down into parts communicating with one another. The larger and more deliberate structures emerge from a deliberate attempt to organize the development process itself. [fn:Liskov2008] Structure often emerge directly from division of labor: as teams take on independent tasks, interfaces are established betweeen domains they become responsible for. (Conway’s Law)

Software developers are responsible for systems built out of very small atoms while ultimately performing tasks for their users of a much greater magnitude. Dijkstra showed this by computing the ratio between grains of time at the lowest and largest atoms of the system (from say, CPU instructions to a human interaction with the system) The span was already quite large by Dijkstra’s time, of about 10^9. Today this ratio would be at least above 10^12 (see grain ratios)

This large span has to be manage

@sir-pinecone
sir-pinecone / 00_the-problem-with-UI.org
Created January 7, 2021 16:48 — forked from uucidl/00_the-problem-with-UI.org
The Problem Of UI (User Interfaces)

Links

Note: a lot of programmers talk about UI without mentionning the user even once, as if it was entirely a programming problem. I wonder what we’re leaving off the table when we do that.

@sir-pinecone
sir-pinecone / pre-commit
Last active September 21, 2020 04:23
Stop a Git commit if a staged file contains the word "nocheckin".
#!/usr/bin/env bash
# Stops the commit if the changes include the word `nocheckin`.
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"