Skip to content

Instantly share code, notes, and snippets.

Viktor Chlumský Chlumsky

Block or report user

Report or block Chlumsky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View blur.shadron
#include "plot.shadron"
image Input = file("julia.png") : map(clamp);
#define PXSIZE shadron_PixelSize
param int STEPS = 8;
param float SIGMA = 1;
param float blurRange = 8 : range(256);
View model.shadron
#include <math_constants>
#include <affine_transform>
#include <lighting>
param int sides = 3 : logrange(3, 12);
param float zRotation : range(-PI, PI);
param float xRotation : range(-PI, PI);
glsl struct FragmentData {
View particles.shadron
#include <billboard>
#include <perlin>
#include <hsv>
param float OPACITY = 0.25;
glsl struct ParticleData {
vec2 position;
float phase;
View us-flag.shadron
#include <math_constants>
#include <shapes>
const vec3 WHITE = vec3(1.0, 1.0, 1.0);
const vec3 RED = vec3(0.698, 0.132, 0.203);
const vec3 BLUE = vec3(0.234, 0.233, 0.430);
#define A 1.0
#define B 1.9
View halfplane.shadron
glsl {
// Signed distance from half-plane defined by oriented line segment (a, b)
float halfPlaneDistance(vec2 pos, vec2 a, vec2 b) {
return dot(normalize(vec2(b.y-a.y, a.x-b.x)), a-pos);
}
// Anti-aliased half-plane defined by oriented line segment (a, b)
float halfPlaneSmooth(vec2 pos, vec2 a, vec2 b, float border) {
View msdf-preview.shadron
#include <math_constants>
#include <median>
#include <billboard>
#include <affine_transform>
glsl float linearStep(float a, float b, float x) {
return clamp((x-a)/(b-a), 0.0, 1.0);
}
@Chlumsky
Chlumsky / cogwheels.shadron
Created Oct 30, 2016
Shadron Cogwheels Tutorial
View cogwheels.shadron
#include <math_constants>
#include <multisample>
glsl struct Cogwheel {
vec2 center;
float r;
int teeth;
float toothSize;
float toothShape;
View maze-solver.shadron
#include <math_constants>
image Input = file("maze.png");
glsl vec4 initialState(vec2 pos) {
vec4 input = texture(Input, pos);
vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
// Detect starting point
if (input.g > 0.5 && input.r + input.b < 1.0)
View plot.shadron
#define PLOT_SAMPLES 3
template <FN, XMIN, XMAX, YMIN, YMAX, XGRID, YGRID>
glsl vec4 plot(vec2 pos) {
vec2 tPos = vec2(
mix(float(XMIN), float(XMAX), pos.x),
mix(float(YMIN), float(YMAX), pos.y)
);
vec2 pxSize = vec2((XMAX)-(XMIN), (YMAX)-(YMIN))*shadron_PixelSize;
You can’t perform that action at this time.