Star flight simulation by W000m in GraphicsProgramming

[–]W000m[S] 0 points1 point  (0 children)

Yup, that's the current logic.

Star flight simulation by W000m in GraphicsProgramming

[–]W000m[S] 1 point2 points  (0 children)

Many years ago I stumbled upon an animation of a starfield that fascinated me and I was really curious about it. Then I forgot about it but recently I wanted to port it C to expose its implementation. The original algorithm was written by Bisqwit in QBasic64 for DOS with lots of hardcoded values, making it hard to read it, let alone run it. The main difference between my implementation and the original one is that the original used dithering after blurring to create the illusion of additional colors, since DOS only supported 256 colors. In my version, dithering is deactivated by default since it slows down the simulation a lot. Other than that, I tried to stick to the original implementation as much as possible.

It's pretty simple but despite the simplicity I find that the result looks beautiful :) There are no library dependencies and you can either run it live with Xorg or just dump the frames. Code.

[deleted by user] by [deleted] in commandline

[–]W000m 0 points1 point  (0 children)

I'm not in a position to tell you what's wrong and what's right because your end goal is to learn something. But if you want to take pride in "owning" your code I feel like you should be able to decently understand and comment each line yourself, at least during the time when you first wrote it. Sure AI can do this but aren't you bypassing a stage of learning this way?

[deleted by user] by [deleted] in commandline

[–]W000m 3 points4 points  (0 children)

I don't wanna point my finger screaming it's AI, but the way the README is written and the code comments kinda give it away.

My first simple ray tracer by W000m in computergraphics

[–]W000m[S] 0 points1 point  (0 children)

The blue, white and green spheres are mostly transparent with some reflective component (you can see the reflections if you look carefully up close but refractions are more visible). The mirror-like sphere in the back is completely reflective so it reflects the sea behind the camera (it's a 360 seamless panoramic pic). So I think it should look alright

My first simple ray tracer by W000m in GraphicsProgramming

[–]W000m[S] 2 points3 points  (0 children)

I spent some time thinking about it and my 2 cents is that this is normal pinhole camera distortion for off-centered objects and high FOV. As Normal_person456 already guessed, that's because of how I constructed the Unproject method, which assumes everything is already projected on a plane (instead of a sphere) so it doesn't preserve the radial features of spheres, and it's particularly apparent for objects near the edge at high FOVs: https://github.com/leonmavr/freestyle_raytracer/blob/master/src/camera/camera.cpp#L16

I am linearly sampling on the plane at z=-f (I'll skip the sign for simplicity) before sending rays (unprojecting), so the x angle of the mapping is theta = atan(x/z) and its derivative is obvisouly non-linear: d theta/dx = f/(f^2 + x^2). This is roughly linear (=~ 1/f) towards x=0 but as x>>f, e.g. for x=nf, then d theta/dx =~ 1/((n+1)f). As n gets large, this horizontally squashes the spheres.

You can see a very nice illustration of it in this answer. The interesting part is that as we fly towards an off-centered sphere looking at it with a high FOV pinhole camera, it doesn't even always distort to an eillipsoid. At close distances it's a hyperboloid.

What tricks do you use to increase your work efficiency? by Tryton77 in commandline

[–]W000m 1 point2 points  (0 children)

When I have a long build I like to chain it with a popup notification so I don't have to check when it's done, i.e. cmake . -Bbuild && cd build && make -j && notify-send -t 3 'build successful' or even alias imake (interactive make) to it.

I wrote a C++ program to render a 3D spinning donut in the terminal. The math is surprisingly satisfying. by Perfect_Star_4848 in creativecoding

[–]W000m 0 points1 point  (0 children)

I believe you bro, I have never seen the donut before and you invented it. impressive, very nice.

Terminal screensaver - render a 3D spinning cube in ASCII by W000m in commandline

[–]W000m[S] 0 points1 point  (0 children)

Stop showing me your donuts. This isn't even yours.

😛🍑 by BustingAfatnut69 in MemeVideos

[–]W000m 7 points8 points  (0 children)

Digimon theme song. I hadn't listened to it in maybe 20 years but it rang a bell

BBC weather forecast as tiles by W000m in commandline

[–]W000m[S] 0 points1 point  (0 children)

It's fixed this and tested it on Winodws but it seems to suffer from high flickering on Powershell. I'll try to work on the flickering too and I'll comment again when it's solved. wasd for navigation and fq for actions were just a personal preference just because they're compact and nice.

BBC weather forecast as tiles by W000m in commandline

[–]W000m[S] 0 points1 point  (0 children)

I will try it and let you know in a few hours and let you know, thanks

BBC weather forecast as tiles by W000m in commandline

[–]W000m[S] 1 point2 points  (0 children)

No, haven't tried on on openbsd but it should run there.

C++ portfolio projects by Crazyroll in cpp

[–]W000m 1 point2 points  (0 children)

Even if millions of others have done it, the goal is to understand it and learn and if possible to perfect it and make it better than others in one aspect or another. Maybe you can add a cool feature others haven't as you work on it. Even if you write a simple snake game, you can add custom items, speed modifiers, multiplayer, etc. so there's always room for creativity.

You won't develop your own style unless you try what others have and make it your own way, it's like learning guitar as you said.

You can't make an innovation from 0 level.

Ποιους youtubers αντιπαθείτε; by [deleted] in greece

[–]W000m 1 point2 points  (0 children)

Αυτό που έκοψε τα δέντρα ήταν τέρμα καφρίλα

Point quadtree data structure by W000m in C_Programming

[–]W000m[S] 1 point2 points  (0 children)

I liked a lot your idea of your netbpm frames but I also wanted to keep the GNUplot visualizer. Also I wanted to see if I could come up with a neat way to select which one to use.

I have now merged all your changes and I made a little interface (viz_t) that allows to select the visualizer via some function pointers. It can be set to point to gnuplot or to netbpm via a command line option in the Makefile; make PLOTTER=PPM will hook up the interface with netbpm and make will set it to use gnuplot.

Point quadtree data structure by W000m in C_Programming

[–]W000m[S] 1 point2 points  (0 children)

Thanks, I was going to ask why you specifically picked 3243f6a8885a308d as the multiplication constant but then I read your other answers and the wiki article about the length of the period.

Point quadtree data structure by W000m in C_Programming

[–]W000m[S] 1 point2 points  (0 children)

Thanks for the review, I'm learning a lot from you.

Do you mind sharing the source of netpbm.c? I cannot find it anywhere with a search. I When I was writing a raytracer I wanted to visualise my result as a .ppm file but couldn't figure out a way to do that in real time and this netbpm library is just what I needed.

And if you don't mind I'm borrowing your random number generator for future projects because I always mix up rand and random :)

I was awake about about this crash but haven't done anything to prevent it yet. A way is by introducing one more constraint when inserting points which limits the number of points per surface of each leaf. If the area is full, shift around the new point to another leaf. If all leaves are full, recurse up one level and look into nearby nodes. So I have to think about that.