Skip to content

Instantly share code, notes, and snippets.

View shinmai's full-sized avatar
😫
coping admirably

Shi Saaristo shinmai

😫
coping admirably
View GitHub Profile
@shinmai
shinmai / gist:53dff287487af703f3f80eb90a033749
Created December 10, 2017 21:27 — forked from celly/gist:c4ea2ebc2957059c138e
Printrbot Simple Metal start gcode
Found in this post: https://www.reddit.com/r/PrintrBot/comments/3jm8bc/start_gcode_does_not_extrudeandmove_but_the_code/
Use this to reset, center, and auto-extrudea small bit before printing.
G90 ; Explicitly force absolute positioning in case it was not reset previously.
G28 ; Home all axes.
G29 ; Auto-level the bed.
G0 X0 Y0 Z0.15 F9000 ; Move to the front-left part of the bed.
M109 S{print_temperature} ; Set and wait for extruder temperature.
G92 E0 ; Zero the extruder.
@shinmai
shinmai / gist:ba1e66f57a2decb9b33bbe52e069856c
Created December 10, 2017 21:27 — forked from dacunni/printrbot_gcode.txt
Printrbot GCODE Reference
M501 - print settings
M500 - save settings
M212 - offsets
M106 - fan on
M107 - fan off
References
http://reprap.org/wiki/G-code
@shinmai
shinmai / printrbot.md
Created December 10, 2017 21:27
Printrbot G-code commands

Turn motors off

M18

Home all axes

G28 X0 Y0 Z0
#define PI 3.14159265359
#define PI2 6.28318530718
// Comment or uncomment
// (Leave commented if in shadergif)
// (uncomment if in shadertoy)
//#define shadertoy 1
#ifdef shadertoy
// time is iGlobalTime in shadertoy
@shinmai
shinmai / AO.frag
Created November 14, 2017 08:19 — forked from tmpvar/AO.frag
a few raymarching fx that I've found
uniform float aoIntensity; // {"label":"AO intensity", "min":0, "max":1, "step":0.01, "default":0.15, "group":"Shading", "group_label":"Ambient occlusion"}
uniform float aoSpread; // {"label":"AO spread", "min":0, "max":20, "step":0.01, "default":9, "group":"Shading"}
// Ambient occlusion approximation.
// Based upon boxplorer's implementation which is derived from:
// http://www.iquilezles.org/www/material/nvscene2008/rwwtt.pdf
float ambientOcclusion(vec3 p, vec3 n, float eps)
{
float o = 1.0; // Start at full output colour intensity
eps *= aoSpread; // Spread diffuses the effect
@shinmai
shinmai / clearbrdf.glsl
Created November 14, 2017 08:18
GLTracy brdf
// brdf
vec3 radiance(
vec3 n, // macro surface normal
vec3 l, // direction from vertex to light
vec3 v, // direction from vertex to view
// matt
float m, // roughness
vec3 cdiff, // diffuse reflectance
vec3 cspec, // specular reflectance : F0
// light
@shinmai
shinmai / pbr.glsl
Created November 14, 2017 08:18 — forked from galek/pbr.glsl
PBR GLSL SHADER
in vec2 v_texcoord; // texture coords
in vec3 v_normal; // normal
in vec3 v_binormal; // binormal (for TBN basis calc)
in vec3 v_pos; // pixel view space position
out vec4 color;
layout(std140) uniform Transforms
{
mat4x4 world_matrix; // object's world position
@shinmai
shinmai / q.glsl
Created November 14, 2017 08:18 — forked from galek/q.glsl
#ifndef PHONG_LIGHTING_INC
#define PHONG_LIGHTING_INC 1
#define USE_OPTIMIZATION 1
#include "BRDF.h"
float GetAngleAttenuation(vec3 _l, vec3 _lightDir, float _angleScale, float _angleOffset)
{
float cosa = -dot(_l, _lightDir);
@shinmai
shinmai / box.glsl
Created November 14, 2017 08:18 — forked from Gitmoko/box.glsl
#ifdef GL_ES
precision mediump float;
#endif
#extension GL_OES_standard_derivatives : enable
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
@shinmai
shinmai / DeferredRenderer.cpp
Created November 14, 2017 08:18 — forked from heisters/DeferredRenderer.cpp
Deferred Renderer for Cinder (glNext)
#include "DeferredRenderer.h"
#include "cinder/gl/gl.h"
#include "cinder/Log.h"
#include "cinder/Buffer.h"
#include "DeferredRendererShaders.h"
#include "DeferredRenderer_random_png.h"
using namespace ci;
using namespace std;