Skip to content

Instantly share code, notes, and snippets.

@deanhu2
deanhu2 / Blend Add Particle.shader
Created June 29, 2018 09:55 — forked from ThePhiMa/Blend Add Particle.shader
Blend Add Shader (as used in Diablo 3)
// Blend Add Shader (as used in Diablo 3)
// Uses the alpha channel to determine if the pixel needs to be blended additively or by transparency.
// Is a good way prevent the additive buildup that makes a scene with a lot of particle effects white and unreadable while still having some particle texture features.
// Idea by Julian Love - http://www.gdcvault.com/play/1017660/Technical-Artist-Bootcamp-The-VFX
Shader "Custom/Blend Add Particle Test"
{
Properties
{
_MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
_BlendThreshold("Blend Treshold (0.0:Additive, 1.0:Trasparency)", Range(0.0, 1.0)) = 0.5
@deanhu2
deanhu2 / animation.gif
Created March 16, 2018 19:37 — forked from tforgione/animation.gif
SFML / OpenGL ES cube test
animation.gif
@deanhu2
deanhu2 / hello_triangle.cpp
Created March 11, 2018 17:32 — forked from vittorioromeo/hello_triangle.cpp
SDL2 + OpenGL ES 2.0 - "Hello triangle" example that works both on X11 and Emscripten
#include <exception>
#include <functional>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
@deanhu2
deanhu2 / k_means_anchor_points.py
Created January 23, 2018 15:42 — forked from WillieMaddox/k_means_anchor_points.py
create darknet anchor points using k-means. Uses fast numpy array ops: pascal ~= 1.0 s coco ~= 16 s
# -*- coding: utf-8 -*-
import numpy as np
import xml.etree.ElementTree as ET
from pycocotools.coco import COCO
def convert_coco_bbox(size, box):
dw = 1. / size[0]
dh = 1. / size[1]
x = box[0] + box[2] / 2.0
@deanhu2
deanhu2 / sgdlinreg.java
Created January 4, 2018 10:47 — forked from ngopal/sgdlinreg.java
Stochastic Gradient Descent, but this time in Java.
package com.nikhilgopal.spark;
/**
* Created by nikhilgopal on 3/24/17.
*/
public class SGDLinReg {
public static void main(String[] args) {
double[] coefficients = {0.4, 0.8};
double[][] dataset = {
{1.0, 1.0},
@deanhu2
deanhu2 / 1_install_cuda.sh
Last active December 29, 2017 17:55 — forked from graphific/1_install_cuda.sh
Installation script for Cuda and drivers on Ubuntu 14.04
#!/usr/bin/env bash
# Installation script for Cuda and drivers on Ubuntu 14.04, by Roelof Pieters (@graphific)
# BSD License
if [ "$(whoami)" == "root" ]; then
echo "running as root, please run as user you want to have stuff installed as"
exit 1
fi
###################################
# Ubuntu 14.04 Install script for:
# - Nvidia graphic drivers for Titan X: 352