This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/Curved" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_QOffset ("Offset", Vector) = (0,0,0,0) | |
_Dist ("Distance", Float) = 100.0 | |
} | |
SubShader { | |
Tags { "RenderType"="Opaque" } | |
Pass | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://iquilezles.org/www/articles/distfunctions/distfunctions.htm | |
// -- Distant functions | |
float sdPlane( vec3 p ) {return p.y+0.2;} | |
float sdSphere( vec3 p, float s ) {return length(p)-s;} | |
float sdCylinder( vec3 p, vec3 c ){ return length(p.xz-c.xy)-c.z; } | |
float udRoundBox( vec3 p, vec3 b, float r ){return length(max(abs(p)-b,0.0))-r;} | |
float udRoundBoxInf( vec3 p, vec2 b, float r ){return length(max(vec3(abs(p.xz)-b,0.0),0.0))-r;} | |
float maxcomp( vec3 p ) {return max(p.x,max(p.y,p.z));} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////////////// | |
// | |
// HG_SDF | |
// | |
// GLSL LIBRARY FOR BUILDING SIGNED DISTANCE BOUNDS | |
// | |
// version 2015-12-15 (initial release) | |
// | |
// Check http://mercury.sexy/hg_sdf for updates | |
// and usage examples. Send feedback to spheretracing@mercury.sexy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
#extension GL_OES_standard_derivatives : enable | |
uniform float time; | |
uniform vec2 mouse; | |
uniform vec2 resolution; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
OlderNewer