tag:blogger.com,1999:blog-8132805539473515195.post5076898451468463511..comments2018-03-16T10:41:31.136-07:00Comments on In One Weekend: Ray Tracing: The Rest of Your LifePeter Shirleyhttp://www.blogger.com/profile/17871569418798062417noreply@blogger.comBlogger18125tag: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.comtag:blogger.com,1999:blog-8132805539473515195.post-59946652290336359092016-05-29T14:19:37.946-07:002016-05-29T14:19:37.946-07:00This comment has been removed by the author.Light Luxhttps://www.blogger.com/profile/06387796096605384016noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-50805694885225448822016-04-03T14:45:16.427-07:002016-04-03T14:45:16.427-07:00On the black spots I have made some progress: http...On the black spots I have made some progress: http://psgraphics.blogspot.com/2016/04/debugging-by-sweeping-under-rug.htmlPeter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-3726947526636074302016-04-02T21:25:04.982-07:002016-04-02T21:25:04.982-07:00Thanks Paul. Those are all very helpful. Thos...Thanks Paul. Those are all very helpful. Those black pixels are the most worrisome-- I will track that down-- sounds like a bug!Peter Shirleyhttps://www.blogger.com/profile/17871569418798062417noreply@blogger.comtag:blogger.com,1999:blog-8132805539473515195.post-41068329790954870862016-04-02T12:58:20.666-07:002016-04-02T12:58:20.666-07:00Hi Peter,
I enjoyed reading the 3rd part of this ...Hi Peter,<br /><br />I enjoyed reading the 3rd part of this series, great work and thanks on diving into the details of Monte Carlo ray tracing. Here's some remarks:<br /><br />- There are some leftover declarations of inside_circle and inside_circle_stratified in the pieces of code in Chapter 2.<br />- There's two chapters numbered "2"<br />- The book has quite some math in it, and, although I am familiar with most of the concepts introduced, writing operations/concepts like sqrt and integral as text (instead of using the math symbols) made it a little hard to follow.<br />- The Cornell Box rendering just above the start of Chapter 11 shows some black pixels. I wouldn't have expected those when using 1000 rays/pixel and doing importance sampling of the light source.<br />- More a remark on the whole series, but was it intentional that the code segments appear as images in the book, thereby making them impossible to copy-paste and build upon?<br />- Funny that you mention Intel before NVIDIA in the closing chapter, knowing your employer :)<br />Paul Melishttps://www.blogger.com/profile/16511921746840435945noreply@blogger.com