So, here's my new scene file:
-- Test script-- Set camera (pos, lookat, up, fov (Degrees))set_camera({0, 0, -10}, {0, 0, 1}, {0, 1, 0}, 45);-- Set output data (filename, width, height)set_output_file("out.bmp", 400, 400)-- Set quality params (samples per pixel, reflection depth)set_scene_params(1, 10);-- Init materials (material name, texture filename, colour, diffuse, specular, reflection)init_material("matShinyGrey", "", {0.7, 0.7, 0.7}, 0.2, 0.8, 0.6);init_material("matVeryShinyBlue", "", {0.7, 0.7, 1.0}, 0.1, 0.9, 1.0);init_material("matPlane", "", {0.4, 0.3, 0.3}, 1.0, 0, 0);-- Create point lights (pos, colour, intensity)create_point_light({0, 5, 5}, {0.4, 0.4, 0.4}, 0.1);create_point_light({2, 5, 1}, {0.6, 0.6, 0.8}, 0.1);-- Create spheres (pos, radius, material)create_sphere({1, -0.8, 3}, 2.5, "matShinyGrey");create_sphere({-5.5, -0.5, 7}, 2, "matVeryShinyBlue");-- Create planes (normal, d, material)create_plane({0, 1, 0}, 4.4, "matPlane");
My results are correct, for the most part. However, I've just spent about 3 hours trying to find where the shiney blob on the lower half of the left hand sphere is coming from here:
And then I discovered this little gem in my script parsing code:
EScriptVar diffuse = context.GetArg(3);if(diffuse.GetType() != EScriptVar::TYPE_Float){ ELog::Get().ErrorFormat(L"%s expects fourth argument to be a float\n", GetName().c_str()); return false;}mat.fDiffuse = diffuse.ToFloat();EScriptVar specular = context.GetArg(3);if(specular.GetType() != EScriptVar::TYPE_Float){ ELog::Get().ErrorFormat(L"%s expects fifth argument to be a float\n", GetName().c_str()); return false;}mat.fSpecular = specular.ToFloat();
So anyway, it works now, and looks like this:
Oh what a difference specular makes...
Supersampling is working, I got that in fairly early because it's easy to do and makes it look good. It also makes it take a lot longer to render, so I haven't bothered using it on the above shots.
Next up is shadows, then maybe texturing and/or more primitives like cylinders. There was a raytracer I had on the Atari ST, which was awesome and it let you specicy quadratic surfaces to use, which were cool for making some things (Although I forget what, exactly).
Does anyone know where I can find some good looking raytracer scenes that I can use? I'd like to get a larger range of test cases for when I get more complicated stuff working.
Anyways, looking good sir *salutes*