Live data from Hacker News

Deciphering the Business Card Raytracer

fabiensanglard.net

31–40 of 68 posts

Re: Deciphering the Business Card Raytracer

#32

Earlier quoted context omitted.

How come you decided for a coordinate system with Z pointing up instead of the traditional right hand/left hands coordinate systems ?

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.

As far as I know, in the CAD world Z is typically up/down. It makes sense if you look at the scene from above, like an architect a floor plan - world-space X and Y map to screen-space X and Y, and Z is then the depth. In a 3D virtual world, on the other hand, the perspective is usually of a person embedded in the world, in which case "Y is up" is more intuitive.

Re: Deciphering the Business Card Raytracer

#33
post #9
post #4

The output file is .aek but I can't figure out what to do with it. My Google-fu is failing me this evening. How do you view the output?

If you're using Linux or OSX, run it like this: ./aek > aek.ppm That will produce an image in .ppm format. ('The world's second-dumbest picture format.') You'll probably have to convert it to a more widely supported format. Make sure you have the netpbm package installed, and then run, say: pbmtopng aek.ppm > aek.bmp

What is the worlds dumbest picture format then?

Re: Deciphering the Business Card Raytracer

#34

Earlier quoted context omitted.

FWIW I was not able to open it with Preview on OS X 10.8

Eep, my mistake. You're right: it doesn't work. I thought I used to open PPMs with Preview back in Mac OS 10.3 or something else ancient. I could be mistaken on that. Oh well. Everyone has Gimp and LibreOffice installed though, right? They both open the file without problems.

Or just install ImageMagick, and do 'convert card.ppm card.png'.

Re: Deciphering the Business Card Raytracer

#35
post #9
post #4

The output file is .aek but I can't figure out what to do with it. My Google-fu is failing me this evening. How do you view the output?

If you're using Linux or OSX, run it like this: ./aek > aek.ppm That will produce an image in .ppm format. ('The world's second-dumbest picture format.') You'll probably have to convert it to a more widely supported format. Make sure you have the netpbm package installed, and then run, say: pbmtopng aek.ppm > aek.bmp

If you have ImageMagick or GraphicsMagick installed, you can just pipe to display(1):

    .aek | display

Re: Deciphering the Business Card Raytracer

#36
post #33
post #9

Earlier quoted context omitted.

If you're using Linux or OSX, run it like this: ./aek > aek.ppm That will produce an image in .ppm format. ('The world's second-dumbest picture format.') You'll probably have to convert it to a more widely supported format. Make sure you have the netpbm package installed, and then run, say: pbmtopng aek.ppm > aek.bmp

What is the worlds dumbest picture format then?

Raw data without any header, I suppose. You must know or guess the width and height to properly decode the image.

Re: Deciphering the Business Card Raytracer

#37

Earlier quoted context omitted.

Eep, my mistake. You're right: it doesn't work. I thought I used to open PPMs with Preview back in Mac OS 10.3 or something else ancient. I could be mistaken on that. Oh well. Everyone has Gimp and LibreOffice installed though, right? They both open the file without problems.

Or just install ImageMagick, and do 'convert card.ppm card.png'.

If you have IM, just use 'display' to open it directly.

Re: Deciphering the Business Card Raytracer

#38
post #36
post #33

Earlier quoted context omitted.

What is the worlds dumbest picture format then?

Raw data without any header, I suppose. You must know or guess the width and height to properly decode the image.

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.

Re: Deciphering the Business Card Raytracer

#39

Earlier quoted context omitted.

How come you decided for a coordinate system with Z pointing up instead of the traditional right hand/left hands coordinate systems ?

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.

It makes sense if you think of the X and Y axis as being drawn on paper, which usually lies flat on the desk.
Post reply on HN