-
Notifications
You must be signed in to change notification settings - Fork 108
Question about the radius setting. #5
Comments
The derivation follows from the fact that the variance of a uniform distribution over [0, 1] is 1/12: https://en.wikipedia.org/wiki/Continuous_uniform_distribution#Moments. So if you want a standard deviation, you take the square root of variance, and then scale it by the pixel size. The factor of 2 is to turn a diameter into a radius, I think, though I'm not sure. |
Thanks for the reply. I can get 1/sqrt(12) for the std of x or y. What I don't quite understand here is that why to multiply 2 with the std. If we want to turn diameter into radius, shouldn't we divide std by 2 so that the final result turns to be 1/(2*sqrt(12)) ? |
yeah, that sounds right. I remember having the same thought and then verifying that this was correct, albeit counter-intuitive. I might have messed up the math though! That part of the code doesn't have unit test coverage. |
Btw, why is here -2? Line 196 in ee5cbb8
|
That's correct, but I think that it's only valid if you generate rays randomly and uniformly inside pixels. However, in your ray generation Lines 183 to 186 in ee5cbb8
The rays are always fixed to be passing through pixel centers, so I don't know why uniform distribution comes into play here. From the description, Line 200 in ee5cbb8
I've tried changing it to Hope to get some more clarification, thanks. |
I think you might be right. I also re-derived this math a while back and got the answer you got, and I also tried it out and saw that it hurt performance, so I stuck with the math that we have here. It's entirely possible that there's a bug in the math/code here, which is definitely worth exploring. It's also possible that there is some advantage of using a radius that is slightly bigger or smaller than the true radius. For example, if you used a wider radius, you'd basically be having NeRF use a "camera" or "sensor" whose PSF has been blurred slightly, which maybe is a good thing in some circumstances? Maybe the best thing to do here is to introduce some |
@kwea123 @jonbarron I had another explanation why We have a square (in case where we use only dx and ignore dy) pixel with width |
Oh cool, I think this is what I did! Sorry this is so complicated, I didn't do a good job of recording my notes when working through the math for this paper. |
Yeah I remember first using dx as the radius, which gives you a circle that is inscribed inside of the pixel, and then thinking "no, it should be bigger than that" and I must have tried to match the area or do something similar. I think what I ended up doing was taking the mean or geometric mean of the radius you get when you inscribe the circle and circumscribe the circle. |
Hi all, |
I'm not sure I understand the question. The radius of a pixel is a direct function of the size of the pixel's footprint on the image plane. Then the radius is used to construct a normal distribution. |
Hi @jonbarron, [1] > Hi all, I just would like to make sure that the setting of radius has nothing to do with neither normal distribution should be corrected to uniform distribution (sorry for my mistake). [2] Besides, I still do not know where the sqrt(12) comes from. I checked the arithmetic mean and the geometric mean of the radius of the inscribed circle and circumscribed circle, and found out that neither gives a sqrt(12). (Hope I do not get the math wrong again) [3] Furthermore, I am wondering this radius setting is constant for all the pixels across the image plane, even for pixels near the border where the intersection of the cone and the image plane is an ellipsoid instead of a circle? |
sqrt(12) is just the standard deviation of a uniform distribution defined on [0, 1]. Here I'm deriving it using the definition of variance (E[x^2] - E[x]^2): https://www.wolframalpha.com/input?i=Sqrt%5BIntegrate%5Bx%5E2%2C+%7Bx%2C+0%2C+1%7D%5D+-+Integrate%5Bx%2C+%7Bx%2C+0%2C+1%7D%5D%5E2%5D |
I finally figure it out that the variance of uniform distribution within the circle of radius d is (d^2)/4 https://www.wolframalpha.com/input?i=Integrate%5B1%2F%28Pi*d%5E2%29*r*%28r*sin%28theta%29%29%5E2%2C+%7Br%2C+0%2C+d%7D%2C+%7Btheta%2C+0%2C+2*Pi%7D%5D. By setting it equal to 1/12, we can easily derive that d = 2/sqrt(12). |
Is dx all the same for different pixel rays? `
|
@longbowzhang |
@qhdqhd it seems like the authors set that value constant for all the pixels even though mathematically I personally think dx should be adaptive for every pixel. |
Hi, a wonderful work!
I am wondering why the radius of the cone is set to r=2/sqrt(12)*pixel_size.
I know that this setting is to ensure that the variance of the cone matches that of the pixel in world coordinate space. I'm just curious about the derivation. Could you please give me some hint on how to get to this result?
Thanks,
Yu
The text was updated successfully, but these errors were encountered: