xxxxxxxxxx
precision highp float;
uniform vec2 resolution;
uniform float time;
uniform vec2 mouse;
uniform sampler2D backbuffer;
vec2 map(vec3 p){
vec2 o = vec2(10.,0.);
o.x = length(p) - 1.;
return o;
}
vec2 march(vec3 cp , vec3 rd){
float depth = 0.;
for(int i = 0 ; i < 99; i++){
vec2 d = map(cp + rd * depth);
if(abs(d.x) < 0.001){
return vec2(depth , d.y);
}
depth += d.x;
}
return vec2(-depth);
}
void main(void) {
vec2 p = (gl_FragCoord.xy * 2.0 - resolution.xy) / min(resolution.x, resolution.y);
vec3 cp = vec3(0.,0.,-5.);
vec3 target = vec3(0.,0.,0.);
vec3 cd = normalize(target - cp);
vec3 cu = normalize(vec3(0.,1.,0.) );
vec3 cs = normalize(cross(cu,cd));
float fov = 2.5;
vec3 rd = normalize(cs * p.x + cu * p.y + cd * fov);
vec3 color = vec3(0.);