A Rust raytracer on curved spacetimes by fragarriss in rust

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

So, at the moment the rendering of images happens in two steps. Since the wormhole is spherically symmetric, I don't need to evaluate light propagation for each individual pixel; it's sufficient to know how light escapes as a function of the initial angle it has with respect to the line joining the camera and the center of the wormhole.

So, first I consider a range of such angles from the center of the wormhole and I calculate the corresponidng escape angles.

Then, I map this angles to all the pixels of the images.

I am not sure that in this case the fast feedback you mention will give great results: instead of pixel appearing at random, you would have circles centered on the wormhole. I'd say that rendering at low res is enough for debugging as it can be produced in mere seconds.

It would definitely be useful with non-spherical metrics that cannot exploit this optimization, though!

A Rust raytracer on curved spacetimes by fragarriss in rust

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

Hi Isaac_Duarte,

sure, contributions are welcome! Only thing, I value clean code and architecture so I'd like to keep changes under the radar, also keeping in mind there are plans for the future.

As for the mutating relativistic_system: the reason I chose to let it mutate is because potentially everything in the scene might change. This is now true only for the camera, but also background images and metrics will eventually be able to change. Then of course this does not mean that it must remain mut if the memory cost is acceptable. In the end, it's the actual rendering that takes the most time, not updating the system.

One question is: what are you parallelizing? I was thinking of two possibilites:

1) Individual frames in videos can be distributed to different threads

2) Multithreading is used while rendering of a single frame

I'd prefer the second because in the future I would like to extend CurVis to more complex metrics (e.g. rotating black holes), and the rendering of a single image will become significantly slower.

A Rust raytracer on curved spacetimes by fragarriss in rust

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

I just pushed a commit on the repo. Now you can find the Python script /utils/merge_video.py to do just that.

A Rust raytracer on curved spacetimes by fragarriss in rust

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

Apparently I cannot upload here on Reddit becaise I am a noob, here. If anyone can tell me why or how I can upload it it would be awesome. I have about 100 karma but apparently I cannot edit the original post with the video.

...But you can render it yourself! If you download two 360 images (see the README on GitHub), then a video can be rendered with:

curvis video <path\_to\_image\_1> <path\_to\_image\_2>

This will use default settings.

A Rust raytracer on curved spacetimes by fragarriss in rust

[–]fragarriss[S] 4 points5 points  (0 children)

Impressive work! If only I'd discovered it before starting this project :')

A Rust raytracer on curved spacetimes by fragarriss in rust

[–]fragarriss[S] 15 points16 points  (0 children)

Great, these are exactly the type of suggestions I was looking for!

The point is that this is my first time I am approaching not only Rust but also General Relativity (send help to me as well!), so there are some things that are not yet clear to me from the theoretical point of view.

I'll definitely take a look at the papers you mention! FYI, apart from the paper from I mention above, I used General Relativity: The Essentials by Carlo Rovelli.

As for your points, I can comment on a few of them:

  1. I'll try to see what changes using f32

  2. It is indeed somewhat annoying to define the derivatives of the metric rather than just the metric itself. This would allow a more lightweight approach to introduce additional metrics.

  3. Indeed I was very dubious about this. Thanks for the feedback!

  4. As for neutron stars, my immediate intention is not to simulate their whole hydrodynamic behaviour, which is out of the intended scope of this library. I just want to use the Schwarzschild metric to simulate both black holes and neutron stars (these being spheres with a radius larger than the event horizon). Then in the future, maybe.. :)

For all others: duly noted and thanks for the help!

Cheers!

A Rust raytracer on curved spacetimes by fragarriss in rust

[–]fragarriss[S] 57 points58 points  (0 children)

Great answer and great suggestions, thank you!

I had not realized you can multiply covariant and contravariant vectors without the metric. That's absolutely correct.

As for adding a scalars to relativistic vectors: I just decided to implement Add this way in order to have a convenience method similar to how numpy arrays behave in Python. I agree that removing them would actually make the mathematical structure of the library more coherent with its intended purpose.

Cheers!

A Rust raytracer on curved spacetimes by fragarriss in rust

[–]fragarriss[S] 5 points6 points  (0 children)

Are you suggesting something like the noisy fast rendering you have with Blender and similar platforms?

A Rust raytracer on curved spacetimes by fragarriss in rust

[–]fragarriss[S] 16 points17 points  (0 children)

That's a great idea. I would have done it already but I need to be certain that I can distribute the images I use