Quoted By:
I know how to write a 2D function that looks 3D but not in mathematical notion
Check it out:
Define grid of 300x300 points to evaluate
Camera = [0,0,-4] this is the position of the eye in virtual yet to be filled 3d space, it is placed 4 units back so it can clearly see things at origin
Xp = 1/300
Yp = 1/300 normalize x and y to the space we are looking at
Photon = [Xp,Yp,1] this is the direction relative to camera and grid that a virtual photon is sent, the 1 points the vector forward in space
PointV = project(Camera,Photon)
project(Cam,Photon) is a function projecting points into space. Lets project onto a 3d sphere
project = (
Dist = 0
for(int i;i<100;i++) {
3dp = Cam + Photon * Dist
Dist += distance(3dp, [0,0,0])
If (Dist < 0.0001 or Dist > 10000) {
break
}
}
)
And if you run that once for every point in the grid, you will have a black and white render of a sphere
Congrat you now know raymarching