Commit Graph

56 Commits

Author SHA1 Message Date
Ivan Avdeev
9623d6ef31 rtx: add stub closest hit and miss shaders to rt pipeline 2021-07-07 12:02:12 -07:00
Ivan Avdeev
c51d593679 rtx: get ray tracing pipeline to draw at least something
on amd gpus it won't draw anything at all unless you have the entire ray tracing pipeline set up fully and correctly:
- have at least rgen, rmiss and rchit shaders
- set up shader groups to reference them
- set up sbt to reference shader groups
it is not enough to just have a single rgen shader operating like a compute shader. amd will have a shader preamble that checks for something and exit early w/o actually running any shader code you wrote

meh
2021-07-06 11:28:24 -07:00
Ivan Avdeev
56007bdb1d rtx: don't forget to destroy shaders 2021-07-06 09:42:16 -07:00
Ivan Avdeev
364b46ea87 [WIP] rtx: first build with ray tracing pipeline and black screen 2021-07-05 13:24:57 -07:00
Ivan Avdeev
34359e2f75 rtx: start splitting ray tracing into functional modules
move model management into vk_ray_model
2021-07-05 10:59:14 -07:00
Ivan Avdeev
750d3b7608 rtx: fix brush models being invisible
An incorrect range of used vertices was pased into `VkAccelerationStructureGeometryTrianglesDataKHR`.
 `maxVertex` was being set to a count of vertices per geometry, not a maximum used vertex number.

The fix is to track `vertex_offset` of the first used vertex, which makes `maxVertex` correct.
2021-07-04 12:48:32 -07:00
Ivan Avdeev
2034acbe76 rtx: fix build_ranges incorrect pointer indirection 2021-07-04 12:05:21 -07:00
Ivan Avdeev
3ed4d84653 rtx: add runtime toggle between ray tracing and traditional renderer
new command is `vk_rtx_toggle`
2021-07-04 11:18:28 -07:00
Ivan 'provod' Avdeev
f2e90cc420 rtx: fix cached blas mismatched size assert, fixes #10
apparently we also need to track max primitives per blas
2021-06-23 17:04:26 -04:00
Ivan 'provod' Avdeev
5211c33cce rtx: add shader specialization 2021-06-23 17:04:26 -04:00
Ivan 'provod' Avdeev
355ebd8d23 rtx: add reflections for water; add sky as emissive surfaces 2021-06-19 12:52:13 -07:00
Ivan 'provod' Avdeev
0356013db6 update todo; add more diags for rtx as handling 2021-06-19 10:51:21 -07:00
Ivan Avdeev
735bfbb8db ref_vk: fix unused var declaration 2021-06-06 21:59:23 -07:00
Ivan 'provod' Avdeev
656c00d0b8 fix building and running on linux 2021-06-06 14:17:35 -07:00
Ivan 'provod' Avdeev
00518d3251 rtx: implement dynamic lights
track brush models movement and update lights grid clusters with model transform and stuff

also implement animated textures for rtx

and also increase per-cluster lights limits
2021-06-05 12:48:16 -07:00
Ivan 'provod' Avdeev
eaaadf024e rtx: coalesce building blases in a single command buffer 2021-05-28 10:10:20 -07:00
Ivan 'provod' Avdeev
74e7a00604 rtx: add AS memory and models validation
also fix new map cache cleanup
2021-05-26 10:55:46 -07:00
Ivan 'provod' Avdeev
ad2405547b rtx: rename model creation and move tlas creation 2021-05-26 09:35:36 -07:00
Ivan 'provod' Avdeev
44909ccbe5 rtx: improve render-ray interop
make a vk_ray_model_t that stores everything ray-tracing related, and can also be cached directly
2021-05-24 11:14:03 -07:00
Ivan 'provod' Avdeev
35275e0916 add aftermath sdk for gpu dump generation
unfortunately, it's not very helpful tho
2021-05-22 14:01:43 -07:00
Ivan 'provod' Avdeev
6614a6935b add debug names to various objects 2021-05-17 10:36:40 -07:00
Ivan 'provod' Avdeev
ddd7403bd0 rtx: implement draft blas caching
It still crashes on some maps, tho
2021-05-17 09:24:15 -07:00
Ivan 'provod' Avdeev
fb05afb24c rtx: don't recreate tlas on every frame. improve fps 2021-05-10 09:17:03 -07:00
Ivan 'provod' Avdeev
5ddeb6853d rtx: fix corrupted geometry
TLAS creation pattern ended up allocating memory in a temporary region. It was later reused for BLAS data, and subsequently corrupted by TLAS rebuild.

Also fixed memory leak, added freeze-models command, added model debug code into shaders, etc.
2021-05-08 14:34:42 -07:00
Ivan 'provod' Avdeev
be42bd29a5 add ring temp allocator logic 2021-05-03 11:17:01 -07:00
Ivan 'provod' Avdeev
819540d5ec rtx: move descset stuff into vk_descriptor 2021-05-01 11:48:24 -07:00
Ivan 'provod' Avdeev
9e8ca13dcc rtx: add studio models
but they crash a lot kek
2021-04-24 12:53:42 -07:00
Ivan 'provod' Avdeev
e522acf8b3 rtx: add textures 2021-04-22 10:45:38 -07:00
Ivan 'provod' Avdeev
b1f85a05a4 rtx: make light clusters grid-based 2021-04-16 11:43:37 -07:00
Ivan 'provod' Avdeev
28f2c06bdb rtx: cache and destroy model blases
Unfortunately Xash3D doesn't allow us to destroy models properly.
It doesn't call Mod_ProcessRenderData for all brush models (only map).
And by the time we get into R_Shutdown all models are already gone, so
we can't enumerate and destroy them properly.
2021-04-13 10:46:33 -07:00
Ivan 'provod' Avdeev
01e6a267d5 rtx: fix toilet crash
Toilet contained brush model with presumably water surfaces which
were not loaded due to how we treat surface flags. That ended up
creating a model with no geometries, which is just rude.
We don't try to render those kind of models now.
2021-04-13 10:13:17 -07:00
Ivan 'provod' Avdeev
ad7b210228 rtx: improve surface lights
use bsp/pvs-based visibility data for acceleration:
+ fps 5 -> 60
- correctness: some areas have too many lights, which ends up culling visible ones too

also fix shadow artefacts
2021-04-12 11:07:41 -07:00
Ivan 'provod' Avdeev
0407f12638 rtx: read kusochki data, add dynamic lights back
also add fps
2021-04-10 12:46:37 -07:00
Ivan 'provod' Avdeev
573c291cef rtx: fix tlas rebuild 2021-04-10 10:58:46 -07:00
Ivan 'provod' Avdeev
3a8f2ebc45 rtx: build blas and tlas only once 2021-04-09 14:59:04 -07:00
Ivan 'provod' Avdeev
af5e20269d add persistent model api and use it for brushes
this needed for better rtx blas management
2021-04-07 12:11:20 -07:00
Ivan Avdeev
39a5568614 rtx: wip bake lighting data using bsp/pvs 2021-03-28 13:52:25 -07:00
Ivan Avdeev
014925b3d4 fix linux build 2021-03-20 16:21:26 -07:00
Ivan 'provod' Avdeev
0b9ec7ee42 rtx: sample previous frame to get a naive blurry denoiser 2021-03-20 13:42:15 -07:00
Ivan 'provod' Avdeev
1b73a509e6 rtx: sample emissive surfaces as lights
this is done incorrectly, and also needs lots of culling and optimization
2021-03-20 12:34:34 -07:00
Ivan 'provod' Avdeev
3045c6ea1f rtx: render into fixed 720p framebuffer then upscale
help with perf stability
2021-03-20 11:15:57 -07:00
Ivan 'provod' Avdeev
d6c56d4e1b rtx: add emissive surfaces/textures
This is a massive hack, because we hardcoded some valve/lights.rad file
right into vk_rtx.c, and this is most certainly is not correct data. We
expect maps to have more custom rad file entries.
TODO: consult https://github.com/MaestroFenix/Half-Life-Resized-Maps

Also, emissive surfaces are no importance sampled, so it's noise fest.
2021-03-17 09:15:33 -07:00
Ivan 'provod' Avdeev
b81a36a850 rtx: make beams emissive 2021-03-15 10:49:45 -07:00
Ivan 'provod' Avdeev
aab15ff366 rtx: fix AS allocation memory corruption; dev-localize buffers 2021-03-15 10:23:26 -07:00
Ivan 'provod' Avdeev
581f1eed0d rtx: add vk_rtx_bounces cvar to control ray bounces count 2021-03-15 09:44:15 -07:00
Ivan 'provod' Avdeev
a04b367a32 rtx: use model matrices to open doors and move wagonchik 2021-03-13 14:31:48 -08:00
Ivan 'provod' Avdeev
a039e7e5ae rtx: add vk_rtx_reload command to reload rtx.comp.psv shader
This allows faster shader iterations. Do `bind z vk_rtx_reload`.
Still need to recompile the shader outside xash process manually.
2021-03-13 12:29:17 -08:00
Ivan 'provod' Avdeev
e235c97be9 rtx: make soft shadows by random sampling dlight surface
it includes bad random function, bad sampling strategy, bad performance,
etc

but it works somewhat
2021-03-10 13:04:11 -08:00
Ivan 'provod' Avdeev
6d1dac453e rtx: add dynamic lights
no shadows and such stuff yet
2021-03-10 09:38:06 -08:00
Ivan 'provod' Avdeev
77288a205b rtx: read vertex normals according to isec indexes
Had to align vec3 fields of vk_vertex_t.
2021-03-08 12:09:11 -08:00