🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Untitled

posted in DruinkJournal
Published November 26, 2007
Advertisement
In an effort to make my raytracer look more raytracer-y, I stole Phantom's scene setup from His article series. Which looks awesome, and also allows me to compare my results to see that they're correct.

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();
Yeah. That'd do it [sad]

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.
Previous Entry Untitled
Next Entry Untitled
0 likes 3 comments

Comments

_the_phantom_
heh, that's the same series I was kinda following along with (I took the idea and then wrote the code in my own style); it amused me that I was following a series written by someone who uses the same alias as myself [grin]

Anyways, looking good sir *salutes*
November 26, 2007 10:26 AM
Evil Steve
Interesting. I wasn't sure if that phantom was you, phantom. I suppose the articles would be on GDNet if it was you [smile]
November 26, 2007 10:39 AM
dcosborn
The author was Phantom on flipcode, which confused me initially when I came here and saw another Phantom doing graphics work. He's your dimensional alternate. You must never cross paths with him, or both of you will cease to exist! [wow]
November 26, 2007 02:53 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement