Deciphering the Business Card Raytracer
61–68 of 68 posts
Re: Deciphering the Business Card Raytracer
#62Earlier quoted context omitted.
In non-programming math contexts, it's pretty standard for Z to point up. I have no idea why, as it seems to me like the typical way it works in graphics programming is the more obvious extension of 2D plotting into 3D.
When I took Calculus III, Z was up. When I took Engineering Physics the same semester, Y was up. According to legend, this is why the Math and Physics departments hate each other.
Re: Deciphering the Business Card Raytracer
#63Earlier quoted context omitted.
Guessing the dimensions of an image with n pixels is equivalent to factoring n , so good luck with that! And only if your luck is really good (prime width and height) will there be a unique solution—actually you still don’t know whether to choose portrait or landscape. It gets even more interesting if you don’t know the number of channels or the pixel format.
Well, you can check if the image matches common resolutions and aspect ratios - if there are 307200 pixels, for example, a pretty good guess is that it's 640x480 (or 480x640). You'd need a human to see if the image looks correct - actually, with a simple GUI, it wouldn't take a human very long at all to figure out the correct aspect ratio. This could probably be automated easily enough using some pattern recognition…
Re: Deciphering the Business Card Raytracer
#64Earlier quoted context omitted.
Thanks Andrew, that 'c' variable was giving me a headache ;) ! I have updated the article with your remarks. BTW, I have listed a few good resources about raytracing at the bottom of the page: Do you know any other good books/websites ?
Some time ago I wrote a raytracing program in javascript that is supposed to be very simple to understand: https://github.com/antirez/jsrt/blob/master/rt.html Demo here: http://antirez.com/misc/rt.html
We did a real time raytracer with 2 spheres where you could move around one with C and a cluster of DEC Alphas 20 years ago, funny to see this on my laptop in Javascript (!) now.
Re: Deciphering the Business Card Raytracer
#65Hi there, code author here. I've been lurking here for years, but couldn't resist an invitation like this. I've always enjoyed Fabien's analyses so it's great fun to see what he makes of my own code. Anyway, a few clarifications from what I remember of this. (I wrote this '09, and I don't have my old notes in front of me right now): * The `n` value returned by the trace function, `T()`, is the surface normal. It retu…
How come you decided for a coordinate system with Z pointing up instead of the traditional right hand/left hands coordinate systems ?
X is almost always to the right, so this gives me Y and Z to work with. To satisfy both the positive values into the screen and right handedness I need either Z forward and Y down or Y forward and Z up. Since most of the time you draw a graph with an axis going up rather than down, that settles it.
It's entirely arbitrary in the end, a single matrix will fix any dispute you have amongst peers.
Re: Deciphering the Business Card Raytracer
#66Hi there, code author here. I've been lurking here for years, but couldn't resist an invitation like this. I've always enjoyed Fabien's analyses so it's great fun to see what he makes of my own code. Anyway, a few clarifications from what I remember of this. (I wrote this '09, and I don't have my old notes in front of me right now): * The `n` value returned by the trace function, `T()`, is the surface normal. It retu…
Re: Deciphering the Business Card Raytracer
#67Earlier quoted context omitted.
In non-programming math contexts, it's pretty standard for Z to point up. I have no idea why, as it seems to me like the typical way it works in graphics programming is the more obvious extension of 2D plotting into 3D.
When I took Calculus III, Z was up. When I took Engineering Physics the same semester, Y was up. According to legend, this is why the Math and Physics departments hate each other.
Re: Deciphering the Business Card Raytracer
#68Earlier quoted context omitted.
When I took Calculus III, Z was up. When I took Engineering Physics the same semester, Y was up. According to legend, this is why the Math and Physics departments hate each other.
I thought it was coming from the fact Nobel's wife had an affair with a mathematician. Thus explaining why there is no Nobel Price for Mathematics.