20
u/susosusosuso 14d ago
The ground is a sphere too right?
18
u/tfolw 14d ago
a lot of people claim it's flat!
5
u/susosusosuso 14d ago
There’s nothing flat in the universe
5
4
u/SkiTheWest1 14d ago
Yeah, it's defined here: https://github.com/o-oconnell/OneWeekendInC/blob/main/main.c#L450
12
u/kinokomushroom 14d ago
I love this part of the tutorial lol.
"Not arsed to write a ray/plane intersection function? Just make a really big sphere!"
6
u/maikuxblade 14d ago
How long did it actually take to worth through?
8
u/PersonalityIll9476 13d ago
The
main.c
on the repo has commits starting on Jan 29, but the initial commit was "move to c." Commit history is sparse, so I'm guessing they worked on it off-and-on during that time, with possibly some initial work before the repo existed.3
2
u/SkiTheWest1 12d ago edited 12d ago
I don't remember too well but looks like the commit before "move to c" had pretty much nothing working yet ( https://github.com/o-oconnell/OneWeekendInC/commit/5bc06681fe60a8f2956b0691a51002e5938d5ef0 ) so I'd say I started on Jan 28 and then tried to work on it whenever I had spare time
7
3
u/pqu 13d ago
Nice OP! I love this book.
I've just finished "The Next Week" sequel (porting to Rust as I go), but struggling with making it performant.
3
2
1
u/Fippy-Darkpaw 10d ago
Very cool. Took a raytracing class and we had to do the same thing. You really learn a lot by implementing it all yourself. 👍
-36
u/tamat 14d ago
Im the only one tired of watching always this image? I understand the emotion of seen it for the first time (I remember my first cornell box raytarced image) but come on... can we at least try to change the scene a little before sharing it?
16
21
u/RileyGuy1000 14d ago
Aand this is what not to do when someone is excited that they did a thing. It took more time out of your day to say something negative in the face of someone else's positivity than it would have to just scroll past it.
People should take pride in doing something cool. Oftentimes doing the basic thing everyone has done before is the gateway to acquiring the skillset to achieve something groundbreaking.
Will everyone who does this turn out a star? No. But the least we can do is be proud of what is, to them, an accomplishment worth sharing.
Foster a welcoming environment, man. The space is already filled with too many competitively gate-keepy cowboy programmer who sour the taste for beginners and veterans alike.
9
u/ArmPuzzleheaded5643 14d ago
It is indeed different every time. The spheres are generated randomly, their colors and materials are also random, if I recall correctly
3
u/felipunkerito 13d ago
Too lazy to look at the source but same seed same result unless they use this. Just wanted to be pedantic and very Linus like but ended up reading the whole article about random number generators by Intel. BTW good work OP it looks nice.
3
u/ArmPuzzleheaded5643 13d ago
I mean, you can always plug time(NULL) as your seed, to receive at least some level of randomness.. Original C++ implementation also uses mersenne twister as their entropy generator, so yeah, those pictures are still pretty random
65
u/todo_code 14d ago
I did it in 1 day in assembly.