tag:blogger.com,1999:blog-8132805539473515195.post1433766331919231738..comments2019-02-20T01:50:35.278-08:00Comments on In One Weekend: Ray Tracing: the Next WeekPeter Shirleyhttp://www.blogger.com/profile/17871569418798062417noreply@blogger.comBlogger46125tag:blogger.com,1999:blog-8132805539473515195.post-72846940764440296052018-12-20T23:23:07.667-08:002018-12-20T23:23:07.667-08:00Thank you, that is exactly the problem i have. I o...Thank you, that is exactly the problem i have. I opened the .ppm file with text editor and noticed there were lots of negative color values, then I realized there must be some returned color values should be scaled and biased but didn't know where the change should be.<br /><br />Now all fixed. Clever for you to look ahead of the book. :)Vic Lhttps://www.blogger.com/profile/09905754366676346451noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-91777157968816385722018-08-25T18:29:51.839-07:002018-08-25T18:29:51.839-07:00Thank you! had me stuck for a while..Thank you! had me stuck for a while..Chris Varnzhttps://www.blogger.com/profile/03665486643168932335noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-12188803414555553742018-08-25T18:17:24.048-07:002018-08-25T18:17:24.048-07:00its 4its 4Chris Varnzhttps://www.blogger.com/profile/03665486643168932335noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-37848304311668070542018-06-29T12:36:08.998-07:002018-06-29T12:36:08.998-07:00I was having the same issue, so thank you for this...I was having the same issue, so thank you for this!Unknownhttps://www.blogger.com/profile/06120853748113531078noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-64330099737423166762018-05-23T21:00:56.575-07:002018-05-23T21:00:56.575-07:00Thank you for your amazing three small books!I rea...Thank you for your amazing three small books!I really love them.And I am your Chinese fun.杨杭https://www.blogger.com/profile/18208177708589098341noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-64052945796903153072017-08-09T03:47:52.352-07:002017-08-09T03:47:52.352-07:00Only problem is in density variation.
zerzerting...Only problem is in density variation.<br /><br /><br /><a href="https://zerzerting.wordpress.com/2017/08/09/12-best-weekend-getaways/" rel="nofollow">zerzerting</a>roth phallykahttps://www.blogger.com/profile/07056159688537638797noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-53114386341959929812017-08-08T14:47:29.366-07:002017-08-08T14:47:29.366-07:00Hey Peter.
Love these 3 mini books! Amazing read a...Hey Peter.<br />Love these 3 mini books! Amazing read and is helping me a lot ! <br />On a side note, is there github repo for book 2 and 3 maybe? Can't find it anywhere. Thanks!Dariuszhttps://www.blogger.com/profile/13445838753444686736noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-72333014559794529032017-04-19T23:32:39.408-07:002017-04-19T23:32:39.408-07:00Thanks for great booklets.
I think there is an er...Thanks for great booklets. <br />I think there is an error in the bounding_box method of hitable_list in the second chapter of the second booklet "ray tracing: the next week."<br />I am reading a kindle version from Amazon. <br />In the method, there is a for-loop iterating all the boxes of the elements of the list. <br />However the iterating index i is not being used within the loop. <br />A correction for this error seems to be changing list[0] to list[i]. <br />Thank you again for the good booklets series. 낭구https://www.blogger.com/profile/14491798071457921258noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-49484728995650713412017-02-06T14:10:47.246-08:002017-02-06T14:10:47.246-08:00Hi Peter, thanks for your series of books. I have...Hi Peter, thanks for your series of books. I have really enjoyed following the code examples and putting together the path tracer. <br /><br />I had an issue whilst rendering the final image. The noise_texture was not rendering properly.<br /><br />In the book the code, the value method of the noise_class had the following return statement: -<br /><br />return vec3(1,1,1)*0.5*(1 + sin(scale*p.z() + 10*noise.turb(p)));<br /><br />on GitHub the return code statement is: -<br /><br />return vec3(1, 1, 1) * 0.5 * (1 + sin(scale * p.x() + 5 * noise.turb(scale * p)));<br /><br />I have tried the GitHub version and it produces a rendering as in the Image of the final scene, the book version does not work<br /><br />I hope this helps<br /><br />regards<br /><br />JohnJohnAqhttps://www.blogger.com/profile/10182834017988078898noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-27070967493673826372017-02-02T13:06:02.000-08:002017-02-02T13:06:02.000-08:00This comment has been removed by the author.JohnAqhttps://www.blogger.com/profile/10182834017988078898noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-81535806646684636782016-08-15T05:25:51.285-07:002016-08-15T05:25:51.285-07:00Thanks for pointing this out! I imagine it's r...Thanks for pointing this out! I imagine it's related to the perlin_generate function's...<br /><br />p[i] = unit_vector(Vec3(-1 + 2 * drand48(), -1 + 2 * drand48(), -1 + 2 * drand48()));<br /><br />...which looks like it throws some lovely negative numbers into the mix sometimes, and negative numbers which become colors is not likely to end well.Scott Harperhttps://www.blogger.com/profile/03492115321923793168noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-61362874395618896412016-08-14T14:44:56.775-07:002016-08-14T14:44:56.775-07:00Here is some of my thoughts and explanations about...Here is some of my thoughts and explanations about non-uniform medium. As I promised in previous post.<br />As I understand probability density function are same for non-uniform and uniform medium.<br />The only problem was this statement, <br />if((density->value(0, 0, new_pos)) / overall_density > drand48()) <br />we need to check our density function at new position against random number given by drand48() <br /> As far as I understand we get random number from drand48() and check if density function returns density higher than this random number. Higher the density at this point higher the probability that this check will return true, and we have a hit. According to this observation output range of density function and output range of drand48() need to be same. Output of random texture function that I use as density function lies between zero and one. Output of drand48() lies between zero and one too. If I scale density function by max density of my non-uniform medium (for example smax = 0.1) according to blog post <br />if (s(newposition) / smax > Y) break<br /> I will lose 90% of probability during check against drand48(). So I come to this solution:<br />density->value(0, 0, new_pos)) > drand48)<br />Of course this will work only if density function and drand48() outputs are normalized against each other. And if I need to scale overall density I need to do it in basic probability formula<br /> -log(1 - x) / overall_density;<br />P.S Looks like this work but I am not sure that there are no mistakes in my conclusions.<br />Dmitry.<br />Dimitrydddhttps://www.blogger.com/profile/03759203303384049433noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-69284429146218099932016-08-09T21:42:31.024-07:002016-08-09T21:42:31.024-07:00Excellent! That looks plausible. One issue wit...Excellent! That looks plausible. One issue with media is it's hard to know what's right. A debugging case I like is to make the medium **almost** constant. It should then look constant.Peter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-13819222375869395512016-08-09T18:18:58.803-07:002016-08-09T18:18:58.803-07:00Looks like i make it work.
Here is some images: ht...Looks like i make it work.<br />Here is some images: https://postimg.org/image/f32bcbj3p/<br />https://postimg.org/image/baz0v2arp/<br />I post my (not sure right) solution tommorow. Dimitrydddhttps://www.blogger.com/profile/03759203303384049433noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-78286927980015379712016-08-08T07:52:01.775-07:002016-08-08T07:52:01.775-07:00Thanks for help Peter. This code, when I use it wi...Thanks for help Peter. This code, when I use it with perlin noise as density function produce result visually similar to constant density. (I setup low frequency perlin noise function on solid cube before use it on volume to get good variations). I also used same noise as color variation function for same volume and all works as i expected. Only problem is in density variation.Dimitrydddhttps://www.blogger.com/profile/03759203303384049433noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-6576024448438214312016-08-08T07:46:06.538-07:002016-08-08T07:46:06.538-07:00This comment has been removed by the author.Dimitrydddhttps://www.blogger.com/profile/03759203303384049433noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-66915408052451596272016-08-08T05:51:22.814-07:002016-08-08T05:51:22.814-07:00Hey Dimitry. This LOOKS right to me. So that s...Hey Dimitry. This LOOKS right to me. So that suggests a subtle bug. I would try using this code for a constant density and seeing what happens-- that might provide some debugging case where you know the right answer.Peter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-70462667141343485872016-08-07T17:10:55.227-07:002016-08-07T17:10:55.227-07:00Hi Peter. I am a little stuck when trying to imple...Hi Peter. I am a little stuck when trying to implement non uniform volume acording your blog post Here is my code for class and hit function <br />class nonuniform_medium : public hitable {<br />public:<br /> nonuniform_medium(hitable *b, texture *d, double ov, texture *a) : boundary(b), density(d), overall_density(ov) {<br /> phase_function = new isotropic(a);<br /> }<br /> ~nonuniform_medium() {<br /> delete density;<br /> delete boundary;<br /> delete phase_function;<br /> }<br /> virtual bool hit(const ray& r, const double t_min, const double t_max, hit_record& rec) const;<br /> virtual bool bounding_box(double t0, double t1, aabb& box) const {<br /> return boundary->bounding_box(t0, t1, box);<br /> }<br /><br />private:<br /> double overall_density;<br /> hitable *boundary;<br /> texture *density;<br /> material *phase_function;<br />};<br />bool nonuniform_medium::hit(const ray& r, const double t_min, const double t_max, hit_record& rec) const {<br /> hit_record rec1, rec2;<br /> if (boundary->hit(r, -DBL_MAX, DBL_MAX, rec1)) {<br /> if (boundary->hit(r, rec1.t + 0.0001, DBL_MAX, rec2)) {<br /> if (rec1.t < t_min)<br /> rec1.t = t_min;<br /> if (rec2.t > t_max)<br /> rec2.t = t_max;<br /> if (rec1.t >= rec2.t)<br /> return false;<br /> if (rec1.t < 0)<br /> rec1.t = 0;<br /> double distance_inside_boundary = (rec2.t - rec1.t)*r.direction().length();<br /> double hit_distance = 0;<br /> while (1) {<br /> double x = drand48();<br /> hit_distance += -log(1 - x) / overall_density;<br /> double y = drand48();<br /> vec3 new_pos = r.origin() + hit_distance*r.direction();<br /> if ((density->value(0, 0, new_pos)) / overall_density > y)<br /> break;<br /> }<br /> if (hit_distance < distance_inside_boundary) {<br /> rec.t = rec1.t + hit_distance / r.direction().length();<br /> rec.p = r.point_at_parameter(rec.t);<br /> rec.normal = vec3(1, 0, 0);<br /> rec.mat_ptr = phase_function;<br /> return true;<br /> }<br /> }<br /> }<br /> return false;<br />}<br /><br />I now i miss something but i dont understand what exactly.Dimitrydddhttps://www.blogger.com/profile/03759203303384049433noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-61318948915749480972016-07-31T17:54:52.328-07:002016-07-31T17:54:52.328-07:00Probably I have dropped the balls and don't ha...Probably I have dropped the balls and don't have them yet! But if you want massive parallelism running a ton of full images and then averaging the images themselves in a tree fashion (so for example for 1024 images first average pairs to get 512 images and repeat until you have one).Peter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-75048315696785715502016-07-31T17:21:26.665-07:002016-07-31T17:21:26.665-07:00I implemented bucket based multithreading using s...I implemented bucket based multithreading using std lib only, did not see any image degradation so far (I use drand48 implementation for windows). I also use a little optimized sah based bvh from link above. <br />P.S numbers I provided above was based only on multithread implementation.<br />P.P.S By the way in book stated that there is some links about scaling here. But i don't see any. May be I missed something.Dimitrydddhttps://www.blogger.com/profile/03759203303384049433noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-48063533175126075042016-07-29T16:19:29.342-07:002016-07-29T16:19:29.342-07:00As a quick and dirty 'hack' I dropped in O...As a quick and dirty 'hack' I dropped in OpenMP support to see how the path tracer would work over multiple threads (6 in my hardcoded case). Right before the 'for' loop that iterates through the per pixel samples, I dropped in:<br /><br />omp_set_num_threads(6);<br />#pragma omp parallel for<br /><br />Coupled with BVH and Amy Williams optimisation one of my scenes went from 32 hours down to 5.5 hours! Quite an improvement. However, the image quality was compromised in places due to (I believe) the fact that the random number generator is not happy running across multiple threads. I guess each thread would needs it's own generator.Andy Ederhttps://www.blogger.com/profile/02209800818322324220noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-76651602528004850232016-07-29T16:13:11.037-07:002016-07-29T16:13:11.037-07:00Ah yes, that makes sense! Thanks for your time and...Ah yes, that makes sense! Thanks for your time and reply.Andy Ederhttps://www.blogger.com/profile/02209800818322324220noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-34792421481108673182016-07-27T19:20:48.989-07:002016-07-27T19:20:48.989-07:00Awesome! I am guessing that improved BVH build w...Awesome! I am guessing that improved BVH build would help a lot too, but maybe not as much.Peter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-1294676066070061712016-07-27T19:19:11.278-07:002016-07-27T19:19:11.278-07:00Good eye! You are right. The shadow and refle...Good eye! You are right. The shadow and reflection rays need to keep the time of the camera ray.Peter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-31257367163611309722016-07-25T17:42:30.959-07:002016-07-25T17:42:30.959-07:00Hi Peter. A quick question about the motion blur i...Hi Peter. A quick question about the motion blur in Chapter 1... I notice that the motion-blurred spheres in the scene are not blurred when looking at their reflections in the larger metal sphere. Is this a difficult thing to address? Many thanks, really enjoying the introduction to ray/path tracing! :)Andy Ederhttps://www.blogger.com/profile/02209800818322324220noreply@blogger.com