     return far;
 }
 
+
+vec3 rayDir(float fov, vec2 size, vec2 pos ) {
+	vec2 xy = pos - size * 0.5;//negate, map to half space ? so instead of a point in 0.0,1.0
+
+	float cot_half_fov = tan( ( 90.0 - fov * 0.5 ) * DEG_TO_RAD );
+	float z = size.y * 0.5 * cot_half_fov;//half size along y times half fov to get z value
+
+	return normalize( vec3( xy, -z ) );//normalize on 0,1
+}
+
+vec3 crapRayDir(vec2 size, vec2 pos, vec3 eye){
+
+    vec3 right = vec3(1, 0, 0);
+	vec3 up = vec3(0, 1, 0);
+
+    vec2 uv =  (gl_FragCoord.xy * 2.0 / u_resolution) - 1.0;//centered on 0 in a -1. ,1. range
+
+    float eyeOffsetToPlane = 0.624;
+    vec3 forward = vec3(0,0,1.);
+
+    vec3 rayOrigin = eye + forward * eyeOffsetToPlane + right * uv.x + up * uv.y;//ray origin ???
+    vec3 eyeOffset = eye*eyeOffsetToPlane;
+    vec3 rayDirection = normalize(eyeOffset-rayOrigin);//cross(right, up));// ray direction ? seem to take norm of perpendicular
+	return rayDirection;
+}
 
 
 //color gradient between blue and red based on iteration

/*
disclaimer : this is not meant to be good code, but a learning process for me
going 'back to basic' and learning all about the needed maths, logic, etc
*/
#ifdef GL_ES
precision mediump float;

uniform vec2 u_mouse;
uniform float u_time;

const int maxSteps = 32;

// math
const float PI = 3.14159265359;
const float DEG_TO_RAD = PI / 180.0;

float sphere(in vec3 p, float radius){
	return length(p) - radius; // Distance to sphere of radius r
