tag:blogger.com,1999:blog-8132805539473515195.post5076898451468463511..comments2019-02-20T01:50:35.278-08:00Comments on In One Weekend: Ray Tracing: The Rest of Your LifePeter Shirleyhttp://www.blogger.com/profile/17871569418798062417noreply@blogger.comBlogger29125tag:blogger.com,1999:blog-8132805539473515195.post-68399806673536996602019-02-20T01:50:35.278-08:002019-02-20T01:50:35.278-08:00Are you also a victim of not achieving good result...Are you also a victim of not achieving good results of your online business? Don't worry our <a href="http://buyseosolutions.com/" rel="nofollow"><b>buy seo</b></a> company will help you to solve your problem. <b>Buy seo</b> company brought our customers out of these worrying phase. Why not you also come and join us and we will finish your worries altogether. We have best and most experienced SEO team.<br />parihzhttps://www.blogger.com/profile/03660952066025145744noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-41295191762034158992019-02-12T11:25:33.593-08:002019-02-12T11:25:33.593-08:00Thanks so much Steve!Thanks so much Steve!Peter Shirleyhttps://www.blogger.com/profile/08132940649440747040noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-47076110850890857652019-02-10T10:59:44.955-08:002019-02-10T10:59:44.955-08:00In Chapter 10: Cleaning up pdf management
I think ...In Chapter 10: Cleaning up pdf management<br />I think there is a serious memory leak in lambertian. The line<br />srec.pdf_ptr = new cosine_pdf(hrec.normal);<br />allocates a new cosine_pdf, but nothing ever destroys it.<br />In the next code block for color, I see a scatter_record (srec) is created for each hit, and it's lifetime is inside the "if world->hit". Something like a unique_ptr from C++11 would take care of that automatically, but if not that, either the scatter_record should have a destructor that checks the pdf_ptr and destroys it if it's non-nullptr/0. Or at least does that at the end of the world->hit loop.<br /><br />I mention this because I watched the memory completely explode when I was running this with 1000 samples, and it actually segfaulted. I saw the memory grow to consume all available memory on my computer - I think the process was well over 5 Gig. But after changing it to a unique_ptr, the memory stayed down at around a calmer 2 Meg.Steve Hwanhttps://www.blogger.com/profile/06432233034058414765noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-87100156083205950112019-02-03T15:20:10.852-08:002019-02-03T15:20:10.852-08:00In Chapter 7: Sampling Lights Directly, you refere...In Chapter 7: Sampling Lights Directly, you reference the emitted member function of hitable with a signature that includes the hit_record.<br />I believe emitted is actually a member function of material and does not include a hit_record, so at this point, it actually needs to be implemented in the color function.<br />Note that later in Chapter 8 (Mixture Density), this is confirmed in the color function, where there is a reference to rec.mat_ptr->emitted, so I think in Chapter 7, emitted is not in hitable. Maybe that came from a later branch of the code?Steve Hwanhttps://www.blogger.com/profile/06432233034058414765noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-27203930024537983112019-02-03T11:45:49.650-08:002019-02-03T11:45:49.650-08:00In the original entry, Chap 6 has a link to a pdf ...In the original entry, Chap 6 has a link to a pdf file on orbit.dtu.dk on ONBs, but the link goes to a "page not found."<br /><br />Note on the ebook:<br />It looks like the PDFs explore the Lambert material, but don't really get into the rest. I think the defaults could be set up to still leave the other materials working-ish while the Lambert is optimized.<br /><br />In Chapter 4 PDFs the material base class has a float method scattering_pdf that has a virtual base returning false. Presumably, that will cast to a float 0.0f, but since color will be multiplying this, then returning a float 1.0f would be more "do no harm."<br />The color declares a float pdf that is uninitialized because it is expected to be set in scatter, but we're only implementing this (for now) in Lambertian. This is later divided in the return calculation, so I think at declaration time, if it is initialized to 1.0f, it is more "do no harm." That is, by setting these both to 1.0f, the other materials will just multiply and divide by 1, and should return something close to what they did before.Steve Hwanhttps://www.blogger.com/profile/06432233034058414765noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-90986501354032535352019-01-21T00:59:36.471-08:002019-01-21T00:59:36.471-08:00Eumaxindia Pvt Ltd - Offering Dinamalar News Paper...Eumaxindia Pvt Ltd - Offering Dinamalar News Paper Advertisement Services in Chennai, Tamil Nadu Know the benefits of booking ads with affordable.<br /><br /><a href="http://eumaxindia.com/dinamalar-newspaper-advertisment-agency-in-chennai/" rel="nofollow">Dinamalar Advertisement in Chennai</a>Landmark Pallavaa Beach Resorthttps://www.blogger.com/profile/15545468235418920644noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-83908452979175411592019-01-10T03:19:03.366-08:002019-01-10T03:19:03.366-08:00The newest technological power has groomed and upg...The newest technological power has groomed and upgraded mobiles so much. They are made <a href="https://www.netell.net/" rel="nofollow"> top up phone with bitcoin </a> . so fascinating that every person keeps interest in having a best to best mobile.m ajmalhttps://www.blogger.com/profile/06817678769668386607noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-55421295132724778652018-12-17T22:03:52.120-08:002018-12-17T22:03:52.120-08:00Now you can see, this is trusted website for
4st...Now you can see, this is trusted website for <br /><a href="https://www.insidecatholic.com/2018/05/19/how-to-master-bass-guitars-in-6-simple-steps/" rel="nofollow"> 4str bass guitar </a> electric beginner bass chords and more, this must be good for you to visit this. thanksEthereum Blogspothttps://www.blogger.com/profile/12450943211100442377noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-73360052338890045102018-12-12T02:30:14.832-08:002018-12-12T02:30:14.832-08:00Order form here World's bitcoin atm card that...<br />Order form here World's <a href="http://www.raxcard.com" rel="nofollow"> bitcoin atm card</a> that works to Withdraw funds from blockchain account to local cash through ATM with current market rate. The Card is super speed financial tool to experience easiness for crypto currency investors.<br />mazharhttps://www.blogger.com/profile/16391916806832389588noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-73474503079435835682018-10-12T11:22:43.071-07:002018-10-12T11:22:43.071-07:00شركة مكافحة حشرات بنجران<a href="https://light-elrahman.com/%D8%B4%D8%B1%D9%83%D8%A9-%D9%85%D9%83%D8%A7%D9%81%D8%AD%D8%A9-%D8%AD%D8%B4%D8%B1%D8%A7%D8%AA-%D8%A8%D9%86%D8%AC%D8%B1%D8%A7%D9%86//" rel="nofollow">شركة مكافحة حشرات بنجران</a>awad ngahhttps://www.blogger.com/profile/09949304310856130813noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-30433121620595546952018-10-02T03:41:21.758-07:002018-10-02T03:41:21.758-07:00Hi,
Thank you for the books, they were very helpf...Hi,<br /><br />Thank you for the books, they were very helpful!<br /><br />I implemented a ray tracer with their help. I think I found an issue with the importance sampling. I'll try to describe it here in words.<br /><br />The idea is that there is a list of objects that are 'important' (like the light in your book). Now, the same object also exists in the scene. It might happen that both the origin point and the generated target point to be on the same object, which for a rectangle for example means along the surface. But the pdf value for such a vector is zero, which means a division by zero. In my code I just checked for such a case and tried sampling again if that was the case, in a loop until success.Adrian Romanhttps://www.blogger.com/profile/05969281469492708060noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-85595357216856558832017-08-09T03:47:28.394-07:002017-08-09T03:47:28.394-07:00which will be some number we compute.
zerzerting...which will be some number we compute.<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-56927740018448070592017-06-23T06:53:24.461-07:002017-06-23T06:53:24.461-07:00This (theta,phi) to theta and phi bookkeeping is c...This (theta,phi) to theta and phi bookkeeping is critical to get right, and is always mildly painful because of the details. The good news is the code doesn't suffer from increased complexity. I will do a full blog post on this soon-- lots of people have this question and I certainly did as well.Peter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-86210148492101325352017-06-23T03:51:06.908-07:002017-06-23T03:51:06.908-07:00Hi, Peter.
My questions are about 2D sampling wit...Hi, Peter.<br /><br />My questions are about 2D sampling with multidimensional transformations.<br /><br />As you know, When you want to generate a uniformly distributed direction on the hemisphere you can use the inversion method.<br /><br />Because your probability density function is uniform, and you are integrating over the hemisphere you can state that:<br /><br />- p(w) is constant.<br />- INTEGRAL_{\Omega}p(w)d(w) = 2PI<br /><br />So p(w) = 1/(2PI).<br /><br />However we want to find a way to generate a couple {theta,phi} to compute a direction in spherical coordinates.<br /><br />So we have to calculate p(theta,phi).<br /><br />In the book "Phisically Based Rendering", they state that:<br /><br />- p(theta,phi)d(theta)d(phi) = p(w)d(w)<br />- d(w) = sin(theta)d(theta)d(phi)<br /><br />So : p(theta, phi) = sin(theta)p(w).<br /><br />My questions are:<br /><br />- Why can we state that p(theta,phi)d(theta)d(phi) = p(w)d(w)?<br /><br />- What is the transformation between p(w) and p(theta, phi) ? I know that to find relation between pdf we can calculate the jacobien matrix with partial derivatives of each component of the transformation, but what is this transformation ?<br /><br />- What does p(theta,phi) really mean ? If p(w) represents the relative probability for a given direction (so a solid angle, because the "relative" term implies a direction and a surface area arount it), but what is the difference with p(theta,phi)?<br /><br />- In your book (and in Physically Based Rendering too), you generate a direction from p(theta,phi) and the inversion method, but when you compute the value of one element of the Monte Carlo Estimator, you divide by p(w). Why can we generate a direction with p(theta, phi) and still integrate over solid angles ?<br /><br />I know that there are lots of questions for only one person, but even Stack Overflow didn't answer to them, and I'm still trying to find proves of what I'm looking for.<br /><br /><br />Thanks in advance for your time :).Yoann Noailhttps://www.blogger.com/profile/07276813976177705070noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-33096403241355319402017-05-16T19:48:23.675-07:002017-05-16T19:48:23.675-07:00Thanks Yoann-- I am being thick. Which final ques...Thanks Yoann-- I am being thick. Which final question?Peter Shirleyhttps://www.blogger.com/profile/08132940649440747040noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-16318754797768776172017-05-15T14:23:27.519-07:002017-05-15T14:23:27.519-07:00Okay, I didn't realise why there was this s(di...Okay, I didn't realise why there was this s(direction) and that you were trying to guide your audience toward the famous rendering equation computation with the MC integration.<br />It makes sens now and your approach is relevant.<br />Thanks for your time and your clear answers, I finally finished your book some weeks ago and that was a great journey to start learning ray tracing.<br /><br />However I have a last question before leaving you in piece (look at the final question :) ).Yoann Noailhttps://www.blogger.com/profile/07276813976177705070noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-82651827653761696642017-05-15T14:06:18.031-07:002017-05-15T14:06:18.031-07:00Hi Peter, thanks for yours answers, after reading ...Hi Peter, thanks for yours answers, after reading your answers I figured out that I missed the global purpose of your approach but it's clear now !Yoann Noailhttps://www.blogger.com/profile/07276813976177705070noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-69963511463086128992017-04-15T06:15:53.587-07:002017-04-15T06:15:53.587-07:00On the second part (chapter 3) there is a question...On the second part (chapter 3) there is a question about the s and the p. "color = (A * s(direction) * color(direction)) / p(direction))" This is just my variant on the more usual MC integration <br /><br />color = BDRF(direction) cosTheta color(direction) / p(direction). <br /><br />The reason there is an s() AND a p() is it isn't always convenient/possible/desirable to have the p be exactly the same as the reflection function. So the p() might send the ray in the "wrong" direction, and you weight it (by dividing by p) to account for over or under sampling certain directions.<br /><br />The exact math turns out to be nice and simple. Choose and implement a p. Sample according to p. Weight according to p. Peter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-55354916178495108442017-04-15T06:08:28.910-07:002017-04-15T06:08:28.910-07:00OK I have had my coffee. Yes I think that integr...OK I have had my coffee. Yes I think that integral is indeed 4PI/3 so the book is ok there. Note we are not computing the volume of the sphere-- we are doing the integral of the function cos^2(theta) which will be some number we compute.<br />Peter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-90794441331522002472017-04-14T20:04:32.228-07:002017-04-14T20:04:32.228-07:00Hi sorry for the delay in replying. Here is my a...Hi sorry for the delay in replying. Here is my answer for the Chapter 2 questions. I will consider the chapter 3 questions as soon as I can get to them.<br /><br />"At the beginning, why do you chose to integrate cos^2(theta) ?"<br /><br />I just picked an arbitrary function that I could analytically integrate just so I could check my answers. In practice the integrals with do with Monte Carlo will not be analytically integrate.<br /><br /><br />We are supposed to find a way to sample points in a unit sphere in a uniform way, aren't we ?<br />Moreover, the code you provide in the end of of this chapter seems to compute the volume of a unit sphere, on my side it gave me 4.18 which seems to be this volume (4/3 * PI * r^3) (whereas it is written it's supposed to give (8/3)*PI for a reason I don't understand).<br /><br /><br />"We are supposed to find a way to sample points in a unit sphere in a uniform way, aren't we ?"<br /><br />Only for convenience. A great thing about Monte Carlo is we can use any distribution as long as it samples all of the domain.<br /><br /><br />"Moreover, the code you provide in the end of of this chapter seems to compute the volume of a unit sphere, on my side it gave me 4.18 which seems to be this volume (4/3 * PI * r^3) (whereas it is written it's supposed to give (8/3)*PI for a reason I don't understand)."<br /><br />We should get the integral of cos^2 over the whole sphere. This is 2PI INT_-pi^pi cos^2 sin dtheta = 2*PI*(1/3)cos^3 = 4PI/3... ok we need to revisit this tomorrow! You may be right there and I might be wrong!<br /><br />Peter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-23058975992534742692017-04-09T11:10:41.162-07:002017-04-09T11:10:41.162-07:00Hi Peter,
Thanks for your great work, it is a ple...Hi Peter,<br /><br />Thanks for your great work, it is a pleasure to read your books and to learn with you.<br />I am currently learning a lot of things related to path and ray tracing, and everything useful about the mathematical and physical meaning of the ways to compute physically based (or anything else model) rendering.<br /><br />I will ask a lot of questions but I spent a lot of time trying to undestand by many ways but I'm still stuck. I have learnt Probability distribution and probability density function thanks to your book and "Physically based Renderging : From theory to implementation"<br /><br />I am stuck on the chapter 2 of this book and I'm not able to solve it by myself, neither by demonstration nor thanks to comments(I was not surprised to find too few comments for this book, it's pleasant to learn theory but it need to spend more time than the two previous books).<br /><br />Here is point I don't understand from the chapter 2(MC integration on the sphere directions):<br /><br />- At the beginning, why do you chose to integrate cos^2(theta) ?<br />We are supposed to find a way to sample points in a unit sphere in a uniform way, aren't we ?<br />Moreover, the code you provide in the end of of this chapter seems to compute the volume of a unit sphere, on my side it gave me 4.18 which seems to be this volume (4/3 * PI * r^3) (whereas it is written it's supposed to give (8/3)*PI for a reason I don't understand).<br /><br /><br />Here are the points I don't understand in the chapter 3:<br /><br />You define the color of a given surface in therms of these quantities:<br /><br />color = INTEGRAL( A * s(direction) * color(direction))<br /><br />where s() is defined as the "scattering pdf"<br /><br />I understand it as "the relatve probability an incident ray with a given direction scatters". But scatters toward what direction ? Why the s() function doesn't take into account the outgoing direction ?<br /><br />then <br /><br />color = (A * s(direction) * color(direction)) / p(direction))<br /><br />I fully understand why you divide by p(direction), but I can't figure out why you multiply by s(direction). To me pdf are here to down weigh.<br /><br />To finish, why do you state that "For cos(theta) < 1, we have s(direction) = 0, and the integral of cos over the hemisphere is PI, So for a lambertian suface the scattering pdf is: s(direction) = cos(theta)/PI".<br /><br />Do you state that s(direction) != 0 for cos(theta) = 1 ? And Why ?<br />Why the integral of cos over an hemisphere is Pi ? And why it gaves this s(direction) ?<br /><br />I hope all those questions didn't afraid you but I don't know what I don't understant and it make me feeling a little bit upse.<br /><br />Thanks for your patience and your answers :). Yoann Noailhttps://www.blogger.com/profile/07276813976177705070noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-72696746685294573142016-08-29T13:38:03.765-07:002016-08-29T13:38:03.765-07:00This comment has been removed by the author.Dimitrydddhttps://www.blogger.com/profile/03759203303384049433noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-84841759072173695162016-08-29T11:54:34.757-07:002016-08-29T11:54:34.757-07:00Oh Mitchell is quite right that stratification nev...Oh Mitchell is quite right that stratification never hurts convergence. However, there is some software engineering cost. So I avoid it unless it helps a lot. Note in 2D it definitely helps a lot. In 3D-4D it usually does too. In distribution ray tracing it can help even in 7D if the noise mainly comes from a couple of the dimensions and the projection of the samples is well stratified in those dimensions.Peter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-63255266168671794212016-08-29T10:09:25.270-07:002016-08-29T10:09:25.270-07:00Hello Peter.
According Mitchel paper http://mental...Hello Peter.<br />According Mitchel paper http://mentallandscape.com/Papers_siggraph96.pdf “In the worst case, stratification is no better (but no worse) than uniform random sampling,” and as I understand from paper this observation is true for a higher dimension too. But in book you advise to use stratification only for one dimension and avoid use it for higher dimension. Why is there such controversy? Or maybe I missed something while reading Mitchel paper. <br />DmitryDimitrydddhttps://www.blogger.com/profile/03759203303384049433noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-37622557997946556052016-08-23T10:54:25.162-07:002016-08-23T10:54:25.162-07:00Around section 160 the code for surrounding_box() ...Around section 160 the code for surrounding_box() is repeated, I think the first is erroneous as it says it is for calculating the bounding box of a moving sphere. And then a couple of paragraphs later the text introduces surrounding_box() appearsMaverick StClarehttps://www.blogger.com/profile/12566699588565287061noreply@blogger.com