7 ms·
Can anyone give me any intuitive understanding of how ray tracing can be adapted into a conventional rasteriser workflow? Doesn't ray tracing need a persistent
by chrisseaton 7y ago
Can anyone give me any intuitive understanding of how ray tracing can be adapted into a conventional rasteriser workflow?
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?
- garmaine 7y agoThe data for each scene hasn't been streamed to the GPU in a long time, not since the first few generations of GeForce cards. "Vertex buffers" store the geometry in the GPU's RAM, so it's there. The game engine just swaps out buffers as things come in and out of view. I have the same questions as you regarding how this works with respect to offloading the the scene graph data structures though.
- Qu3tzal 7y agoLooks like the GPU stores collections of triangles then used to perform the ray computations. https://devblogs.nvidia.com/practical-real-time-ray-tracing-rtx/ https://devblogs.nvidia.com/practical-real-time-ray-tracing-...
- mmozeiko 7y agoTo shoot rays in scene you create acceleration structure (internal to driver/GPU hardware). Input to this structure are vertex & index buffers & model transform matrix. Geometry is specified as triangles or AABB. You can update this structure later by providing new transform matrix. There are different flags that control performance/memory usage - fast tracing or updates vs less memory usage. See following links: * https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCmdBuildAccelerationStructureNV.html https://www.khronos.org/registry/vulkan/specs/1.2-extensions... * https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkGeometryNV.html https://www.khronos.org/registry/vulkan/specs/1.2-extensions...
- garmaine 7y agoBut efficient ray casting requires a scene graph structure--an octree, or a bsd-tree, etc. Are the details of that just handled by the driver?
- mmozeiko 7y agoYes. Driver/GPU handles that. It "just works". You just manage things on high level - what can be moved in world, what cannot and group the updates together.
- magicalhippo 7y ago> Rays can end up anywhere, no matter where the camera is pointing, isn't that right? 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.
- chrisseaton 7y ago> can only hit things that are visible to the camera Isn't the whole point of ray tracing things like refraction? Otherwise why not just rasterise?
- correct_horse 7y agoI think you're generally correct, but that games studios and animators don't care much about refraction specifically (although it does make for cool tech demos). They care more about reflection and lighting in general (spotlights such as windows, true area lights - no point lights disguised as area lights using emmisive textures)
- BubRoss 7y agoRay tracing can be used for different camera projections, sharp reflections, sharp refractions, sharp shadows and other things like physics. (Also it's rasterize)
- pavlov 7y ago“...rasterize” — that’s American, rasterise is correct in UK and countries that follow their English spelling.
- chrisseaton 7y ago
- w0utert 7y agoOn top of what other people wrote, I think a common misconception is that raytracing is only useful to determine the final shaded color of a pixel on the screen. In its current form, things like RTX are still way too slow to do this at any appreciable quality level. 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.