Live data from Hacker News

Deciphering the Business Card Raytracer

fabiensanglard.net

61–68 of 68 posts

Re: Deciphering the Business Card Raytracer

#62

Earlier 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.

So the difference between Math and Physics can be described as a single rotation matrix?

Re: Deciphering the Business Card Raytracer

#63
post #41

Earlier 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…

Minimize the gradient ...

Re: Deciphering the Business Card Raytracer

#64
post #25

Earlier 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

Nice!

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

#65
post #18

Hi 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 ?

I'm a game programmer, and I have an answer for my preference of Z being up: I want positive values going into the screen (away from the viewer) but I also want a right handed coordinate system (mostly because physics become more intuitive - especially wrt torque).

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

#66
post #18

Hi 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…

As a (poor :) 3d/raytrace excercise, I've translated the code to python: http://vanderwijk.info/blog/business-card-raytracer-in-pytho...

Re: Deciphering the Business Card Raytracer

#67

Earlier 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.

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.

Re: Deciphering the Business Card Raytracer

#68

Earlier 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.

There are several reasons to believe that that urban legend isn't true. One of them being that Nobel was never married.
Post reply on HN