150 points · by ingve · 6y ago · 43 comments
Doesn't ray tracing need a persistent, whole-world scene graph? Rays can end up anywhere, no matter where the camera is pointing, isn't that right? I thought the whole scene wasn't on the GPU? I thought the CPU streamed polygons to be drawn based on what was likely to be visible, but it can't stream the entire world every draw can it?
I have the same questions as you regarding how this works with respect to offloading the the scene graph data structures though.
See following links:
* https://www.khronos.org/registry/vulkan/specs/1.2-extensions...
* https://www.khronos.org/registry/vulkan/specs/1.2-extensions...
https://devblogs.nvidia.com/practical-real-time-ray-tracing-...
Only indirect or secondary rays. Primary rays (the ones from the camera) can only hit things that are visible to the camera.
Also, ray-tracing trivially allows for breaking up the rendering in multiple steps.
You could for example have a pre-made acceleration structure for the static part of the world, a less efficient but fast-building one for dynamic objects in the world, cast against either and see which intersection has the shortest distance. This could be done in parallel, and you can be more clever about it too depending on circumstances.
Not saying that's what people do, I've been out of the game for too long, but at least it's an option.
Isn't the whole point of ray tracing things like refraction? Otherwise why not just rasterise?
Anyway, yeah sure the fun is typically doing secondary rays, but you could do those with the tricks I mentioned, and/or with reduced detail (thus faster to update) unless you're doing perfect reflection/refraction.
You can use raytracing passes at very different resolutions, quality settings, geometry detail levels etc though, and combine them with the 'regular' render pipeline later. For example to calculate environment maps for reflections, shadow maps, or even things completely unrelated to drawing (hit tests, sound reflection etc). Suppose I want to have a nice reflection in a pool of water for example, you can already get a very good looking effect by raytracing a low-resolution environment map from the water pools' perspective, which wouldn't need any tracing of secondary rays etc, and use it in your water shader.
There's uncountable ways something like this could be useful (not all of which can be accelerated very well though, I guess)
For doing the more traditional raytracing at any resolution you will always need an acceleration structure like a BVH though, but building/updating that is part of these kinds of hardware extensions.
The more the API situation evolves, I can see Google, Microsoft and Sony going all in all Vulkan for performance graphics. Only if MS is willing to part ways with D3D12
For cross platform I could see WebGPU + WebAssembly being the choice, where it abstracts both Metal and Vulkan.
That leaves Vulkan for Linux games. The 1% of the market that no savvy business person would touch with a 10 feet pole.
In Linux land, you'll meet people who feel suspicious of you in the first place for charging for your game, and people who have compiled their GPU driver from scratch, yet blame your game for being incompatible with their wrong compiler flags.
So for almost every game studio, there is no viable market where you could sell a Vulkan game.
Vulkan is a PC thing, without any impact on consoles, even on the Swift, NVN is what gets mostly used unless it is a PC port.
Also the subject of this thread, Ray Tracing, was developed by Microsoft and NVidia together and took two years to reach Vulkan.
How long will Vulkan now take to adopt shader meshes?
On top of that, Vulkan is much hard to actually use in practice. It's much more low-level than OpenGL and DirectX.
this might be why WebGL2 never really shipped on Safari. They added a flag but there is no actual implementation.
Do note that the following is part of the article and it's from 2018, not sure about it's accuracy anymore: "As denoted by the ‘NVX’ prefix, this API is not yet final and could undergo some minor changes before the final release."
Vulkan Ray Tracing: https://is.gd/DMIKVs