Raytracer on the back of a business card. (AKA: You suck at C++, pwnt edition) via @AngryMoose

edited in General
There is a challenge to write a raytracer that fits on a business card. Wow. Read this wonderful dissection of how to do magic: http://fabiensanglard.net/rayTracing_back_of_business_card/index.php

I wrote one already, but it was in whitespace and the printer used a strange font with non-standard tab lengths... So, uh, yeah.

P.S. I think my favorite thing is the minimal for loops. I was like, wait, why is he decrementing in the chec- Ooooohhhhhh. Dayum.
Thanked by 1Merrik



    Isn't it stuff like this that makes people say building their own engines are cool? :P
  • edited
    @Tuism said:
    Isn't it stuff like this that makes people say building their own engines are cool?
    It's a set of cool tricks used well to produce an image. Cool code can be appreciated without turning into an engine endorsement.

    For one thing, this is a constraint-based thing, not a years-long epic crusade to completely waste your own time ;)
  • I believe the technically accepted term for this is "hax".
  • Saw this a few days ago and was suitably impressed. Randomising the rays slightly to create the soft shadows and depth of field is brilliant.
  • So I'm obviously not understanding this, where do you copy pasta this code into to make it do that?
  • edited
    The way I did it was to compile it with g++ on linux. You could probably do the same thing on Windows using MinGW or Visual Studio.

    These were my steps for compiling and running with g++:
    1] g++ -O3 -o ray ray.cpp
    2] ./ray > ray.ppm
    3] xdg-open ray.ppm

    [Edit] ray.cpp is where I copy-and-pasted the code. The last step is opening the file ray.ppm in an image viewer.
  • Wow that was an intelligent spam.
Sign In or Register to comment.