Page 1 of 2

A Path tracer

Posted: Mon Aug 13, 2012 8:29 pm
by Torwgia
Trying out making a Path Tracer after reading around a bit. I think I might have messed up a bit so far. There "should" be two spheres(one red, one blue) on top of a plane.

Lets see if I can fix it. Please excuse the jpg quality, I haven't gotten used to using convert yet.

Image

Re: A Path tracer

Posted: Tue Aug 14, 2012 6:52 pm
by Torwgia
Made more progress last night before bed.

Image
1024 samples

Turns out I had forgotten to normalize a the direction vector for my rays as the camera was generating them. oops haha.

I think the next thing on the list to due is triangles and some sort of jittering of the produced rays.

Re: A Path tracer

Posted: Tue Aug 14, 2012 9:19 pm
by raider
Quite strange sharp "shadows" on the walls. They should not be there in that kind of scene. Seams to me you've overlooked one more bug.

Re: A Path tracer

Posted: Wed Aug 15, 2012 12:00 am
by Torwgia
hmm, I think that might be caused from my poor use of convert to make the ppm's I am output into jpgs for the internet... Maybe I should switch over pngs?

Re: A Path tracer

Posted: Wed Aug 15, 2012 9:26 am
by raider
Render the scene with one light only placed in the middle of the floor and make it white, not colored. Let's see how will it look like.

Re: A Path tracer

Posted: Thu Aug 16, 2012 4:26 am
by Torwgia
Here is a single white light in the center of the screen.
Image
128 samples per pixel

I added in a simple jitter to rays as they leave the camera. It seems to improve the image quality
Heres the same 3 colored sphere picture with the new jittered rays
Image
i think this one is 1024 samples per pixel

I also switched over to png's with convert.
$ convert <the ppm> <the png>

This change seems to be better?

Next on my list is to move over to all triangles. No more of this infinite plane and sphere nonsense. Next update will be that!

Re: A Path tracer

Posted: Thu Aug 16, 2012 11:25 pm
by raider
Hm... No, it's not correct. What are the lighter circular areas on the left and right walls? That's also visible on the single light scene.

Re: A Path tracer

Posted: Thu Aug 16, 2012 11:34 pm
by raider
I don't see you code, so cant say exactly, but seeing what I see I suspect that the lighter areas are the areas where dot product of -eye vector (direction from the intersection point to to eye) and the normal vector is positive, and darker areas are where dot(-eye, n) < 0.

When you calculate angles like cos(theta) via dot product, are you sure you use normalized vectors? Seams to me like that could be that simple bug.

Re: A Path tracer

Posted: Fri Aug 17, 2012 3:25 pm
by Torwgia
I will check that tonight after work! Thanks for the help.

Re: A Path tracer

Posted: Sat Aug 18, 2012 4:14 am
by Torwgia
I think I transposed the color of the object versus it's emitted color when I was reading some of the papers. I changed that and am now waiting on a image with 1024 samples to finish.

I was wondering if anyone had some suggestions for some papers to read on multithreading this thing. I tried using std::async to get a bunch of futures, but I think I ran out of thread handles because it threw an exception.

Anyway, I will update you all when that image finishes and I am done eating! Thanks for the help so far!