Hello,
i spent the last 24h finding out why my code is not working (image is just black).
I am especially confused by the way of generating rays from the camera into the scene because there are a lot of ways how it can be done (at least it looks like that for me) and i don't know which way is right for me.
So my ray generation looks like this:
double imageAspectRatio = cast(double)width / cast(double)height;
double Px = (2.0*((cast(double)x+0.5) / cast(double)width) - 1) * tan(45.0 / 2.0 * PI / 180.0) * imageAspectRatio;
double Py = (1.0 - 2.0 * ((cast(double)y + 0.5) / cast(double)height) * tan(45.0 / 2.0 * PI / 180.0));
Vector3D direction = new Vector3D(Px,Py,-1).normalize();
Ray r = new Ray(this.camera, direction);
I debugged my program and no ray hits a sphere in my scene ever! So i think the problem has to be correlated with the ray generation code (i am pretty sure my sphere intersection code is correct).