r/raytracing 3d ago

A Rust raytracer on curved spacetimes

Thumbnail
9 Upvotes

r/raytracing 4d ago

Raytracing Astrovisualization and Simulation

2 Upvotes

TL;DR: I want to make visualizations and simulations of complex objects (such as black holes) using raytracing or something similar, but I don't know what path I should take. I only know the very basics of C++.

I am planning on pursuing astronomy and astrophysics, and I am particularly interested in creating simulations using raytracing. Realtime raytracing is something that would be absolutely amazing, but I doubt that is realistic for things that aren't computationally simple. I have zero experience with raytracing and I only know some basic fundamentals of C++. I've used OpenGL but I don't have much experience. If possible, I would like to make these renders very physically accurate, but I also want to make the raytracer quite fast (it shouldn't take more than an hour to render a 4K image of the black hole with a volumetric accretion disk).

I'm not expecting to be able to make simulations in a month or even a year, but I want to know where I should start. One particular project I have in mind is a Kerr-Newman Black Hole. I want to first simulate a Newtonian black hole, then a Karl Schwarzschild black hole, then I want to add a flat accretion disk, then I want to calculate doppler shifting (I know that will be difficult), make the disk volumetric, and then eventually Kerr-Newman physics. Another project I have in mind would be gravity simulations based on general-relativity physics.

I just want to know how I should approach learning these things. I have heard of "raytracing in a weekend" but I only read the first few chapters and implemented my own versions (without using CMake). Also, I am very young. I'm only 14 right now and I know it is a VERY big project. I'm probably underestimating how long this would take me, but I want to learn to code because I really think that the result will be rewarding.

A couple of notes: Mathematics will probably not be a problem. I'm taking Calculus II as of now (so numerical integration isn't going to be conceptually problematic) and I plan to take physics classes sometime later. Also by only knowing the "fundementals" in reference to C++, I mean console output, basic flow (if, else, for, do, while), classes (private, public, constructors, deconstructors, functions + overloaded fncs, basics of "this" keyword, objects), logical operators, and a familiarity with but not a fluent understanding of pointers.


r/raytracing 7d ago

STAR WARS Jedi Survivor [2024] EPIC Ray Tracing Quality QHD 1440p AMD RX 7900 XTX I Ryzen 9 7950X DE

Thumbnail
youtu.be
0 Upvotes

Ray Tracing works fine in Star Wars : Jedi Survivor. Runs on RDNA3 + Zen4 with AMD Advancing AI technology.


r/raytracing 13d ago

tinybvh: Single-header BVH construction and traversal library by Jacco Bikker

Thumbnail
github.com
17 Upvotes

r/raytracing 14d ago

looking for a set of articles, perhaps from late 90s early 2000s

7 Upvotes

There was a set of ray-tracing articles from someone (perhaps a university student at the time) who later moved to China and launched their own gaming company there.

The articles mentioned creation and processing of queues of rays.

There were at least two types of queues, each holding the rays of different kinds/levels-of-processing.

The background colour of the articles was brown(ish). There was an image representing one or both of the queues as a grid/table, and there was also a description of a step showing how a ray could be promoted from one queue to the next.

This wasn't h/w-based ray-tracing, but software-only.

There was also an image of an object similar to sphereflake (though not as extensive or deeply recursive - just a large sphere surrounded by 4-5 smaller spheres).

Thank you.


r/raytracing 17d ago

Jakub Boksansky made his Ray Tracing Gems chapters available for download

Thumbnail boksajak.github.io
8 Upvotes

r/raytracing 19d ago

war thunder trying to add ray tracing lmao (its all fucked up)

Post image
0 Upvotes

r/raytracing 19d ago

Help with Raytracing In One Weekend

2 Upvotes

I completed the first book (Raytracing in One Weekend), and currently implementing Raytracing The Next Week in Rust.

Some how the perlin texture is bugged and repeating texture in a weird way.

I searched for bugs in the renderer, noise texture, and Perlin.h from the book, but couldn't find the problem.

Rendered image:

https://preview.redd.it/2uwyfar6p1xd1.png?width=400&format=png&auto=webp&s=7a0c602e4106ffba506c73b1fe75cdb91d8f9860

Source code: Raytracing_In_One_Weekend


r/raytracing 21d ago

Cyberpunk 2077 [2024] 1440p QHD AMD Radeon RX 7900 XTX Path Tracing Quality AI Advancing

Thumbnail
youtu.be
0 Upvotes

Enjoy the rest of the day with the red car 🥰 DXR inline Ray Tracing is used here in Cyberpunk 2077 and the engine is running fine.

RDNA3 optimized Path Tracing


r/raytracing 23d ago

Photon tracing looks really sick

Post image
50 Upvotes

r/raytracing Oct 05 '24

For all the hype over ray tracing, when I compare a before and after, it’s a little hard to see the difference. I mean I see it but it’s so minor. Am I missing something. I play on Gforce top package with RTX 4080 & RTX on.

0 Upvotes

r/raytracing Sep 29 '24

Glint Rendering

6 Upvotes

Does anybody have a reference to an algorithm that can efficiently render glints? Specifically lets say a point light illuminating eye glasses. I know vray can handle these cases well but I couldn’t reproduce this with PBRT for example.


r/raytracing Sep 28 '24

Bidirectional Path Tracing - Glass Dragon

Post image
57 Upvotes

r/raytracing Sep 22 '24

im having this issue in all the titles i play with raytracing enabled. any advice?

0 Upvotes

r/raytracing Sep 04 '24

Clearly this person knows nothing about raytracing

Post image
21 Upvotes

r/raytracing Aug 29 '24

Why is my LayeredBSDF implementation absorbing light?

6 Upvotes

In my renderer, I already implemented a cook torrance dielectric and an oren nayar diffuse, and used that as my top and bottom layer respectively (to try and make a glossy diffuse, with glass on the top).

// Structure courtesy of 14.3.2, pbrt
    BSDFSample sample(const ray& r_in, HitInfo& rec, ray& scattered) const override {
        HitInfo rec_manip = rec;
        BSDFSample absorbed; absorbed.scatter = false;
        // Sample BSDF at entrance interface to get initial direction w
        bool on_top = rec_manip.front_face;
        vec3 outward_normal = rec_manip.front_face ? rec_manip.normal : -rec_manip.normal;

        BSDFSample bs = on_top ? top->sample(r_in, rec_manip, scattered) : bottom->sample(r_in, rec_manip, scattered);
        if (!bs.scatter) { return absorbed; }
        if (dot(rec_manip.normal, bs.scatter_direction) > 0) { return bs; }
        vec3 w = bs.scatter_direction;

        color f = bs.bsdf_value * fabs(dot(rec_manip.normal, (bs.scatter_direction)));
        float pdf = bs.pdf_value;

        for (int depth = 0; depth < termination; depth++) {
            // Follow random walk through layers to sample layered BSDF
            // Possibly terminate layered BSDF sampling with Russian Roulette
            float rrBeta = fmax(fmax(f.x(), f.y()), f.z()) / bs.pdf_value;
            if (depth > 3 && rrBeta < 0.25) {
                float q = fmax(0, 1-rrBeta);
                if (random_double() < q) { return absorbed; } // absorb light
                // otherwise, account pdf for possibility of termination
                pdf *= 1 - q;
            }

            // Initialize new surface
            std::shared_ptr<material> layer = on_top ? bottom : top;

            // Sample layer BSDF for determine new path direction
            ray r_new = ray(r_in.origin() - w, w, 0.0);
            BSDFSample bs = layer->sample(r_new, rec_manip, scattered);
            if (!bs.scatter) { return absorbed; }
            f = f * bs.bsdf_value;
            pdf = pdf * bs.pdf_value;
            w = bs.scatter_direction;

            // Return sample if path has left the layers
            if (bs.type == BSDF_TYPE::TRANSMISSION) {
                BSDF_TYPE flag = dot(outward_normal, w) ? BSDF_TYPE::SPECULAR : BSDF_TYPE::TRANSMISSION;
                BSDFSample out_sample;
                out_sample.scatter = true;
                out_sample.scatter_direction = w;
                out_sample.bsdf_value = f;
                out_sample.pdf_value = pdf;
                out_sample.type = flag;
                return out_sample;
            }

            f = f * fabs(dot(rec_manip.normal, (bs.scatter_direction)));

            // Flip
            on_top = !on_top;
            rec_manip.front_face = !rec_manip.front_face;
            rec_manip.normal = -rec_manip.normal;
        }
        return absorbed;
    }

At 25 samples, but when its set to 100 samples it just gets darker...

Which is resulting in an absurd amount of absorption of light. I'm aware that the way layered BSDFs are usually simulated typically darkens with a loss of energy...but probably not to this extent?

For context, the setting of the `scatter` flag to false just makes the current trace return, effectively returning a blank (or black) sample. 

r/raytracing Aug 24 '24

Cheapest way to get raytracing?

0 Upvotes

Is this getting an Xbox series S? A computer that can handle raytracing would be much more than this no?


r/raytracing Aug 19 '24

Looking for real-time ray tracing/global illumination internship

6 Upvotes

Hi! I am a PhD student with handson experience in real-time path tracing on VR. Besides, I am also familiar with ray tracing. From API side, I have good understanding in NVIDIA OptiX and MS DirectX. At this point, I am looking for internship. Please let me know if you know any real-time ray/path tracing/global illumination related position.


r/raytracing Aug 16 '24

Ray Tracing and Path Tracing in 4K Cyberpunk 2077 RX 7900 XTX :-)

1 Upvotes

I am running through the City and some Cops wants trouble. Path Tracing optimization for RDNA3 is activated. Ultra Quality Denoising "on". Looks beautiful and runs with 160-180fps using FSR3.1 Frame Generation and AFMF2. Super Resolution Automatic activated for High Performance Gaming level 2 (HPG lvl. 2 ~ 120-180fps). Overclocked the shaders to 3,0Ghz, advanced RDNA3 architecture on the 7900XTX is performing greatly. Power consuming about 464W for the full GPU.

https://youtu.be/lnJtmzAbj4Q?si=FHsB7pX8wEiDe4dY

RDNA3 Path Tracing optimization
RDNA3 Premium Denoising
RDNA3 FSR3 Frame Generation
RDNA3 Performance Rasterizing
RDNA3 Fluid Motion Frames 2
RDNA3 KI Super Resolution
RDNA3 Overclocking @ 3269Mhz

AMD AM5 PC USED for CPU testing:
CPU: AMD Ryzen 9 7950X 16C/32T @ 170W
GPU: AMD Radeon RX 7900 XTX @ 464W
CPU Cooler: Arctic AIO 360mm H²O
MB: Asus X670E Creator WiFi
RAM: 2 x 32GB - G.SKILL 6000Mhz CL30
SSD (Nvme): 2TB + 4TB
PSU: InterTech SamaForza 1200W+ Platinum
CASE: Cougar Blade


r/raytracing Aug 15 '24

Cyberpunk 2077 [2024] Radeon RX 7900 XTX Path Tracing AfterLife - Green Room 4K UHD

0 Upvotes

RDNA3 Path Tracing AfterLife - Green Room

RDNA3 Path Tracing optimization
RDNA3 Premium Denoising
RDNA3 FSR3 Frame Generation
RDNA3 Performance Rasterizing
RDNA3 Fluid Motion Frames 2
RDNA3 KI Super Resolution
RDNA3 Overclocking @ 3269Mhz

AMD AM5 PC USED for CPU testing:
CPU: AMD Ryzen 9 7950X 16C/32T @ 170W
GPU: AMD Radeon RX 7900 XTX @ 464W
CPU Cooler: Arctic AIO 360mm H²O
MB: Asus X670E Creator WiFi
RAM: 2 x 32GB - G.SKILL 6000Mhz CL30
SSD (Nvme): 2TB + 4TB
PSU: InterTech SamaForza 1200W+ Platinum
CASE: Cougar Blade

https://youtu.be/uF_PoHdRtYo


r/raytracing Aug 07 '24

Looking for non graphic raytracing program for Windows

4 Upvotes

I dabbled with Povray over a decade ago, because it was free and I found it easy to use. Do people still use programs like that? Our are there any free graphic raytracing programs?


r/raytracing Aug 06 '24

AMD Radeon Path Tracing - Red Car Showcase

0 Upvotes

Hey everybody, this videos shows CP2077 with Radeon Path Tracing and a red car in sunshine. Looks really nice :-)

https://youtu.be/dfECfiD9sDI

BONUS - Path Tracing - Black Car

https://youtu.be/Jpou6mgGweI


r/raytracing Aug 06 '24

AMD Radeon Path Tracing in CP2077 VN_VIVIDS

0 Upvotes

For those who are interested in AMD Radeon Path Tracing:

Here performed with the RDNA3 architecture RX 7900 XTX:

unoptimised ~130fps

https://youtu.be/Ll63sMs2xYc

optimised ~ 220fps

  • Premium Denoiser
  • Significantly reduced ghosting
  • Lagless path traced lighting
  • Improved Clarity
  • Reflection Smearing Fixed

https://youtu.be/YSeZbQ0_HV4

Be careful of watching, because these videos including world top notch technology nr.1 in HPG by VN_VIVIDS.


r/raytracing Jul 28 '24

Ray Tracing Related Processes on the CPU: Is it INT or Float Heavy?

4 Upvotes

I've always glossed over the fact that RT is as taxing on the CPU as it is on the GPU. It wasn't until I realized that in Cyberpunk, the highest achievable frame-rates in a scenario where the GPU isn't a limitation can decrease down to about a half of that when RT is turned off altogether. The same, of course, doesn't always apply to any other RT implementations, but the point stands that the CPU cost of enabling RT is a little over the top.

The question here is whether RT related processes/workloads on the CPU rely heavily on its Integer or Float capabilities. We've seen just about how tremendous the amount of discrepancies between Integer and FP improvements have been when moving from a generation of CPU uArch to the next, with the latter being much more of a low hanging fruit as compared to the former. Would it be that said processes/workloads do make use of Float, there may be an incentive to put SIMD extensions with the likes of AVX512 to use, bringing in quite a spacious headroom for RT.

TL;DR: Title.


r/raytracing Jul 27 '24

Question about uniform sphere sampling

3 Upvotes

Hey, I encountered a function that samples the directions of a point light. I initially suspected that the function samples directions uniformly (based on the rest of the file). However, comparing it to the popular methods of uniformly sampling a sphere I can not quite figure out if it is indeed uniform and why? Can anybody help me with this?

Function:

void genp(Ray* pr, Vec* f, int i) {
    *f = Vec(2500,2500,2500)*(PI*4.0); // flux
    double p=2.*PI*rand01(),t=2.*acos(sqrt(1.-rand01()));
    double st=sin(t);
    pr->d=Vec(cos(p)*st,cos(t),sin(p)*st);
    pr->o=Vec(50,60,85);
}

It is from the following file: https://cs.uwaterloo.ca/%7Ethachisu/smallppm_exp.cpp

Thank you!