🎉 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 December 02, 2007
Advertisement
I completed HL2:EP2. Overall, pretty good although the ending was a bit meh. I failed the achievement where you have to save all the buildings around the silo (Although I was playing on hard skill [rolleyes]), I missed 15 grubs in the caverns, I didn't kill a Combine soldier with his own grenade, I didn't kill a Hunter with his own fleshets (And I can't really think how to, short of getting them stuck to the car, then having them blow up next to the Hunter), and I didn't find the garden gnome at all. Bugger.

In raytracer news, I made a couple of improvements. First, raytracing is scripted via a render() function, so I can no generate animation sequences. Secondly, raytracing is now multithreaded. Since all the scene objects are constant, and the only non-constant thing is the output buffer, it works pretty well with multithreading. It defaults to one worker thread per CPU, but you can override that if you want. There's a noticible improvement with 2 threads (I'm on a dual core CPU). I also got silly and set it to create 400 threads, and it got 44% of the way through rendering before it had even finished creating all the threads (And then crashed because WaitForMultipleObjects() can only cope with 64 handles at once).

So, I made a little video that loops over, changing the refractive index of a sphere from 0.5 to 1.5, in steps of 0.01. Here's the script:
-- Set camera (pos, lookat, up, fov (Degrees))set_camera({0, 0, -9}, {0, 0, 1}, {0, 1, 0}, 45);-- Set quality params (samples per pixel, reflection depth, [num worker threads])set_scene_params(1, 10);-- Create directional lights (dir, colour)create_directional_light({1, 0, 5}, {1, 1, 1});-- Create point lights (pos, colour, intensity)create_point_light({0, 5, 5}, {0.4, 0.4, 0.4}, 0.1);create_point_light({-3, 5, 1}, {0.6, 0.6, 0.8}, 0.1);-- Init objects (colour, diffuse, specular, reflection, refraction, absorbance, refractive idx)name, obj = create_sphere({-0.5, -0.5, 4}, 0.4);create_object(name, obj, {1.0, 1.0, 1.0}, 1.0, 0.8, 20, 0, 0, 0, 0);name, obj = create_sphere({-0.5, 0.5, 4}, 0.4);create_object(name, obj, {1.0, 1.0, 1.0}, 1.0, 0.8, 20, 0, 0, 0, 0);name, obj = create_sphere({0.5, -0.5, 4}, 0.4);create_object(name, obj, {1.0, 1.0, 1.0}, 1.0, 0.8, 20, 0, 0, 0, 0);name, obj = create_sphere({0.5, 0.5, 4}, 0.4);create_object(name, obj, {1.0, 1.0, 1.0}, 1.0, 0.8, 20, 0, 0, 0, 0);name, obj = create_plane({0, 1, 0}, 4.4);create_object(name, obj, {0.4, 0.3, 0.3}, 1.0, 0, 20, 0, 0);name, obj = create_plane({0.4, 0, -1}, 12);create_object(name, obj, {0.5, 0.3, 0.5}, 0.6, 0, 20, 0, 0, 0, 1);name, obj = create_plane({0, -1, 0}, 7.4);create_object(name, obj, {0.4, 0.7, 0.7}, 0.5, 0, 20, 0, 0, 0, 1);refIdx = 0.75;nImg = 0;for i=0.5, 1.5, 0.01 do	name, obj = create_sphere({0, 0, 0}, 2);	objSphere = create_object(name, obj, {1.0, 0.5, 0.5}, 0.2, 0.8, 20, 0.0, 0.8, 0.1, refIdx);	set_output_file(string.format("out%03d.bmp", nImg), 640, 480)	render();	delete_object(objSphere);	nImg = nImg + 1;	refIdx = refIdx + 0.05;end

And here's the video (DivX codec)

Next up are textures I think. That should be pretty simple (Maybe). I should really optimise the scene by using some sort of spatial partitioning, but I can't really be bothered. Maybe once I get annoyed with it being so slow at rendering [smile]

EDIT: And yep, I'm an idiot again. The code doesn't give refractive indices of 0.5 to 1.5, it's 0.5 to 5.5 [sad]
Previous Entry Untitled
Next Entry Untitled
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement