Skip to content

Instantly share code, notes, and snippets.

@aras-p
aras-p / custom_brdf.md
Last active April 27, 2020 11:13
Custom BRDFs in deferred shading/lighting in Unity

So, https://twitter.com/sunjammer/status/569925239989256192 and https://twitter.com/sunjammer/status/569983534368206848

Now, depends on whether you want custom BRDF in deferred on 1) all your objects (easy) or 2) only some of your objects (harder).

1. change BRDF for everything

That's fairly easy. The actual object shaders more or less just fill the g-buffer (and in Unity 4.x deferred lighting, combine textures with the lighting buffer in the final pass). The actual BRDF is in the "light shader". Start by copying the built-in light shader (4.x deferred lighting: Internal-PrePassLighting.shader; 5.0 deferred shading: Internal-DeferredShading.shader) into your project. In 4.x, put it into Resources folder so it's included into the build; in 5.0 point Unity to use that shader under Project Settings -> Graphics.

Change the shader to do different BRDF.

@felixjones
felixjones / pmx21.md
Last active April 20, 2025 12:48
PMX (Polygon Model eXtended) 2.0, 2.1 File Format Specifications

PMX (Polygon Model eXtended) 2.1

This is an English description of the .PMX file format used in Miku Miku Dance (MMD).

PMX is the successor to the .PMD format (Polygon Model Data).

This is work-in-progress! Please leave feedback in the comments.

Todo

@delor
delor / build.gradle
Created November 21, 2014 20:57
Gradle task for generating Maven's POM file for Android AAR
task createPom {
apply plugin: 'maven'
description "Generates pom.xml"
pom {
project {
groupId 'com.example'
artifactId 'example'
version '0.0.1-SNAPSHOT'
packaging 'aar'
}
@kohsuke
kohsuke / nohup.c
Created November 7, 2014 23:21
nohup.c
/* nohup -- run a command immune to hangups, with output to a non-tty
Copyright (C) 2003-2005, 2007-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@roxlu
roxlu / CMakeLists.txt
Created September 26, 2014 12:55
Work in progress, simple cross platform mutex and threading code
cmake_minimum_required(VERSION 2.8.11)
set(bd ${CMAKE_CURRENT_LIST_DIR})
set(id ${bd})
include_directories(${id})
add_executable(test_thread test_thread.cpp)
if (WIN32)
@jedi4ever
jedi4ever / upload-to-appstore.sh
Created August 18, 2014 12:13
Command upload App/Ipa to the iTunes Connect App Store
#!/bin/bash
set -ex
# This scripts allows you to upload a binary to the iTunes Connect Store and do it for a specific app_id
# Because when you have multiple apps in status for download, xcodebuild upload will complain that multiple apps are in wait status
# Requires application loader to be installed
# See https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html
# Itunes Connect username & password
USER=bla
@deltheil
deltheil / luajit-valgrind.md
Created July 16, 2014 08:24
LuaJIT + Valgrind (linux x64)
  1. use Valgrind 3.8.1 since 3.9.0 broke LuaJIT
  2. build LuaJIT with the following options:
diff --git a/src/Makefile b/src/Makefile
index c558003..39676b8 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -57,7 +57,7 @@ CCOPT_mips=
 #
@neomantra
neomantra / bcname.lua
Created April 10, 2014 15:00
Convert LuaJIT bytecode number to name.
-- Converts a LuaJIT bytecode number to name
--
-- usage: luajit bcname.lua bytecode_number [bytecode_number2 [...]]
--
-- example:
-- $ luajit-2.1 bcname.lua 71 72
-- VARG
-- ISNEXT
--
-- From: http://www.freelists.org/post/luajit/frames-and-tail-calls,1
@ruby0x1
ruby0x1 / tilt.shift.glsl
Last active November 5, 2024 10:54
Tilt shift shader, modified from something @grapefrukt gave me
// Modified version of a tilt shift shader from Martin Jonasson (http://grapefrukt.com/)
// Read http://notes.underscorediscovery.com/ for context on shaders and this file
// License : MIT
uniform sampler2D tex0;
varying vec2 tcoord;
varying vec4 color;
/*
Take note that blurring in a single pass (the two for loops below) is more expensive than separating
@alecthomas
alecthomas / weak_intrusive_ptr.hpp
Created September 3, 2013 15:49
Weak pointer support for boost::intrusive_ptr
#pragma once
#include <boost/intrusive_ptr.hpp>
using boost::intrusive_ptr;
struct _GC {