// Some hills... // rotwang: @mod* lowered cam for better flight feeling // @mod+ mouse y controls flight height // @mod* some color tests // @mod+ Canyon // @emackey: Simple sky blue (no clouds...) // @rotwang: mod* sky gradient, different terrain front and backcolor // @mod* stripes texture // @mod* terrain variation // @psonice flyover adjusted so height depends on terrain. WOuld be better with spline interpolation, if you have the time go do it :) #ifdef GL_ES precision highp float; #endif uniform vec2 resolution; uniform float time; uniform vec2 mouse; //Simple raymarching sandbox with camera //Raymarching Distance Fields //About http://www.iquilezles.org/www/articles/raymarchingdf/raymarchingdf.htm //Also known as Sphere Tracing //Original seen here: http://twitter.com/#!/paulofalcao/statuses/134807547860353024 //Util Start mat2 m = mat2( 0.80, 0.60, -0.60, 0.80 ); float hash( float n ) { return fract(sin(n)*43758.5453); } float noise( in vec2 x ) { vec2 p = floor(x); vec2 f = fract(x); f = f*f*(3.0-2.0*f); float n = p.x + p.y*57.0; float res = mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x), mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y); return res; } float fbm_5oct( vec2 p ) { float f = 0.0; f += 0.50000*noise( p ); p = m*p*2.02; f += 0.25000*noise( p ); p = m*p*2.03; f += 0.12500*noise( p ); p = m*p*2.01; f += 0.06250*noise( p ); p = m*p*2.04; f += 0.03125*noise( p ); return f/0.984375; } float fbm_3oct( vec2 p ) { float f = 0.0; f += 0.50000*noise( p ); p = m*p*2.02; f += 0.25000*noise( p ); p = m*p*2.03; f += 0.12500*noise( p ); p = m*p*2.01; return f/0.875; } vec2 ObjUnion(in vec2 obj_floor,in vec2 obj_roundBox){ if (obj_floor.xMAX_DEPTH) break; f+=s.x; p=E+scp*f; s=inObj(p); } if (f