Skip to content

Instantly share code, notes, and snippets.

View BichengLUO's full-sized avatar
👨‍💻
Work at Google

Bicheng Luo BichengLUO

👨‍💻
Work at Google
View GitHub Profile
@BichengLUO
BichengLUO / mp4_to_gif.bash
Created February 7, 2018 23:30
An ffmpeg script to convert MP4 to GIF with high quality
ffmpeg -y -i input.mp4 -vf fps=10,scale=716:-1:flags=lanczos,palettegen palette.png
ffmpeg -i input.mp4 -i palette.png -filter_complex "fps=10,scale=716:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
@BichengLUO
BichengLUO / mini_ray_tracer.cpp
Last active December 6, 2016 13:17
A simple ray tracer demo in 100 lines
#include <Windows.h>
#include <vector>
#include <opencv2\opencv.hpp>
#define WIDTH 500
#define HEIGHT 500
#define UNIT_PER_PIXEL 0.001
#define PI 3.14159265
#define EPS 0.0001
struct Color { unsigned char r, g, b; };
@BichengLUO
BichengLUO / output_opencv_lib.py
Created July 5, 2016 08:09
A simple python script to output all the OpenCV lib files
import os
lib_dir = '.\\x64\\vc12\lib'
if __name__ == '__main__':
debug_files = []
release_files = []
for file in os.listdir(lib_dir):
if file.endswith('.lib'):
if file.endswith('d.lib'):
@BichengLUO
BichengLUO / cp_unity_to_uwp_data_files.py
Last active July 4, 2016 06:15
A Python script to copy Unity build output to UWP project
import os
import shutil
import time
target_dir = 'C:\Users\\t-biluo\Documents\\visual studio 2015\Projects\Skype3D\Skype3D\Data'
source_dir = 'C:\Users\\t-biluo\Documents\Skype3D\Build\Skype3D\Data'
if __name__ == '__main__':
src_files = os.listdir(source_dir)
for file_name in src_files:
@BichengLUO
BichengLUO / NoiseAndGrain.cs
Created June 7, 2016 08:34
Add noise and grain to Unity3D camera
using System;
using UnityEngine;
using Random = UnityEngine.Random;
namespace UnityStandardAssets.ImageEffects
{
[ExecuteInEditMode]
[RequireComponent (typeof(Camera))]
[AddComponentMenu ("Image Effects/Noise/Noise And Grain (Filmic)")]
public class NoiseAndGrain : PostEffectsBase
@BichengLUO
BichengLUO / DepthOfField.cs
Created June 7, 2016 08:33
Implement depth of field in Unity3D
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
[ExecuteInEditMode]
[RequireComponent (typeof(Camera))]
[AddComponentMenu ("Image Effects/Camera/Depth of Field (Lens Blur, Scatter, DX11)") ]
public class DepthOfField : PostEffectsBase {
@BichengLUO
BichengLUO / ColorCorrectionCurves.cs
Created June 7, 2016 08:32
Correct color curves for camera in Unity3D
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
[ExecuteInEditMode]
[AddComponentMenu ("Image Effects/Color Adjustments/Color Correction (Curves, Saturation)")]
public class ColorCorrectionCurves : PostEffectsBase
{
public enum ColorCorrectionMode
@BichengLUO
BichengLUO / Antialiasing.cs
Created June 7, 2016 08:31
An antialiasing Unity3D script for camera
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
public enum AAMode
{
FXAA2 = 0,
FXAA3Console = 1,
FXAA1PresetA = 2,
@BichengLUO
BichengLUO / OneAngle.cs
Created June 7, 2016 07:11
A simple Unity3D script for generating 7 pics (1 key frame and 6 flow frames)
using UnityEngine;
using System.Collections;
using System;
public class OneAngle : MonoBehaviour {
public int shotCount;
public int radius = 5;
public Quaternion initialRotation;
public Vector3 initialPosition;
public float totalAngle;
@BichengLUO
BichengLUO / GravityCamera.cs
Last active November 30, 2021 00:37
A Unity3D script for rotating the camera according to the device's accelerometer
using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
public class GravityCamera : MonoBehaviour
{
public GameObject target;
public Vector3 centerOffset;
public float sensitivity = 1000;