GPSnoopy / RayTracingInVulkan

Implementation of Peter Shirley's Ray Tracing In One Weekend book using Vulkan and NVIDIA's RTX extension.
BSD 3-Clause "New" or "Revised" License
1.23k stars 112 forks source link

Add a denoiser #30

Closed the-spyke closed 3 years ago

the-spyke commented 3 years ago

Please add some kind of a denoiser with at least on/off toggle support.

This way we could estimate RDNA2 ray tracing performance impact for procedural geometry scenes where denoiser should consume some of the compute units while Turing/Ampere could rely more on tensor cores.

Thank you!

GPSnoopy commented 3 years ago

@GoncaloFDS has a nice fork / original content using OptiX to denoise the final image: https://github.com/GoncaloFDS/Lift

I don't think OptiX AI denoiser would work on RDNA2 though, so wouldn't be an apple-to-apple comparison. Either way, I'd like to keep this project relatively close to the books "Ray Tracing In One Weekend" and thus specifically chose not to include OptiX denoising. A good denoiser requires extra images outputs such as normals and base-colours, so it's not just adding a function call.

Performance wise, the denoising is an extra steps after the raw ray tracing pass. It won't fundamentally change the performance of the ray tracing pass, just add extra time afterwards to denoise the image.

the-spyke commented 3 years ago

@GPSnoopy I was thinking about some cross-platform SVGF. The point is that how relevant are performance numbers without a denoiser, because you can't release a game without it. So, even if you're 10 times more powerful, but denoiser makes you 10 times slower, then you're equal at max.

P.S. I was pitching your project to Digital Foundry team, but results need to have some correlation with real games and without denoiser they haven't. Anyway, thank you for your work!

GPSnoopy commented 3 years ago

I would love for DF to use this application when investigating the ray tracing implementation of new GPUs. 😃

In a way, that's what I find useful about this app when used for benchmarking. It specifically isolates the ray tracing hardware implementation, similar to what Quake 2 RTX and Minecraft RTX do. Whereas all other games are using hybrid approaches of standard rasterization + some ray tracing effects.

You can use Quake 2 RTX to get an idea of the impact of the denoiser on performance. IIRC it can be easily enabled/disabled. The caveat being that it's up to the game/application to decide how complex its denoiser implementation should be (and therefore its impact on performance).

yuxiao-ash commented 2 years ago

@GPSnoopy Hi, you said that 'It specifically isolates the ray tracing hardware implementation' , does this mean that the test performance of this project on the RTX GPU does not use the RT Core to accelerate? And while on AMD GPU, RDNA2's CU is used to accelerate ray tracing.
Sorry I'm very new to ray tracing, I just wonder if the actual performance of this project can be faster on AMD and RTX? Thank you very much if you can answer my questions when you have time.

GPSnoopy commented 2 years ago

@yuxiao-ash It does use RT Cores whenever available. The code uses the official Vulkan VK_KHR_ray_tracing_pipeline extensions, which in practice uses hardware RT acceleration whenever available (that includes RTX and RDNA2).

AFAIK the only GPUs where this extension is widely available but emulated using regular compute shader is the NVIDIA 1000 series (like the GTX 1080).

You can browse the full list of GPUs that support VK_KHR_ray_tracing_pipeline at: https://vulkan.gpuinfo.org/listdevicescoverage.php?extension=VK_KHR_ray_tracing_pipeline&platform=all

yuxiao-ash commented 2 years ago

OK, thank you very much!