Commit Graph

87 Commits

Author SHA1 Message Date
Ivan 'provod' Avdeev
aca2849c5a rt: make kusochki use double-ended buffers 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
cb427d0839 vk: ring-based dynamic geometry buf alloc
- Clear split between static and dynamic geometry within the same buffer
- Store previous frame geometry data longer
- Use simpler ring buffer for allocation
- Add waf unit tests for alolcator

Known issues:
- ray tracing still glitches a lot
2022-05-14 14:00:13 -07:00
Ivan Avdeev
668d3fb81a rt: add shadows for environment lights 2022-02-09 21:57:55 -08:00
Ivan Avdeev
dd1f58d0b7 rt: simplify polygon light sampling
do stupid first triangle sampling, w/ contrib estimation area * dot(LP) / dist^2

4.7ms all poly lights, occupancy 10, vgpr 86(96)
2022-02-04 18:38:36 -08:00
Ivan Avdeev
9970d4e31a rtx: remove stale lbsp light code 2021-12-21 22:56:34 -08:00
Ivan Avdeev
8d552b5d94 update todo 2021-12-21 22:56:34 -08:00
Ivan 'provod' Avdeev
e8359b12e8 rtx: add material support stub 2021-11-16 09:34:36 -08:00
Ivan Avdeev
bb4dc5e2a1 rtx: bring back front face culling; update todo 2021-10-26 13:12:25 -07:00
Ivan 'provod' Avdeev
4d78c44ed6 rtx: collect static surface lights only once on map load, fix #122
also fix buffer overflow on >255 lights
2021-10-25 10:17:49 -07:00
Ivan 'provod' Avdeev
452ca9de45 rtx: collect static light sources only once on map load, #122
this also breaks static surface lights
2021-10-25 10:17:49 -07:00
Ivan 'provod' Avdeev
832b719bed rtx: remove direct sun sampling attempt
apparently there's no singular sun. there are spot_lights (+light_environment) that function like a sun (directional light).
2021-10-20 11:58:53 -07:00
Ivan Avdeev
0839f9673b update todo; move materials draft to separate file 2021-09-06 14:24:36 -07:00
Ivan 'provod' Avdeev
c90187f57f rtx: use a common definition for Kusok; pass color
Also pass alpha (not used yet)
2021-09-04 13:50:05 -07:00
Ivan Avdeev
8cf040f9be rtx: improve emissive surface sampling
Sample a single triangle not in a loop.
2021-09-04 13:50:05 -07:00
Ivan Avdeev
9c330e4118 add brdfs for lights
Just straight copy-paste CC brdf header from Ray Tracing Gems 2 chapter
14.
Use these brdfs for direct lighting.
2021-09-04 13:50:05 -07:00
Ivan Avdeev
8d06058aa4 rtx: add first iteration of material flags support
it's clearly suboptimal, but no worries, we'll iterate
2021-08-31 11:19:44 -07:00
Ivan Avdeev
280e6109c6 add screenshots
now vulkan can do screenshots too. however, it depends on blits being
available between swapchain and rgba8 formats, so if it's not the case
for some reason, the resulting image will have mixed components.
2021-08-31 11:19:44 -07:00
Ivan Avdeev
3b605a19b5 fix depth test for glow render mode; comments
also add a lot of observations to ref_vk/TODO.md related to materials
2021-08-31 11:19:44 -07:00
Ivan 'provod' Avdeev
ee8e9d8ff7 concat brush drawcalls
make all geoms share the same constant vertex offset so that continuous indices can be exploited to generate only a single draw call for a group of geometries with the same texture
2021-08-15 11:30:38 -07:00
Ivan 'provod' Avdeev
dc6b874cae restore debug labels for traditional renderer 2021-08-15 11:02:57 -07:00
Ivan Avdeev
5208219b44 join alloc+lock operations on buffer init
this simplifies the api and implementation
2021-08-11 11:43:33 -07:00
Ivan Avdeev
90e5500e83 add per-vertex studio model lighting
it doesn't correctly sample lightmaps for env lighting yet. we'll figure this out some time later ....
2021-08-07 19:56:38 -07:00
Ivan Avdeev
e6f8d8e47a enable anisotropy if available
also force require vulkan 1.2 for now, need to have 1.0 device for testing lower versions (TODO)
2021-08-07 18:06:48 -07:00
Ivan Avdeev
378c1e52e0 enable anisotropy only for rtx
this doesn't make any visible impact for rtx rendering. but does affect non-rtx rendering when running with rtx enabled (kekw)
2021-08-04 18:56:11 -07:00
Ivan Avdeev
94ac51a527 rtx: sample mip levels based on ray cone width
this is mostly copied from ray tracing gems 2 chapter 7 (Texture Coordinate Gradients Estimation for Ray Cones, by Wessam Bahnassi).
There's a weird bit about radians vs degrees. We'll figure it out later when the book becomes available.
2021-08-04 18:36:53 -07:00
Ivan Avdeev
074fdf84b4 update todo 2021-07-31 12:43:35 -07:00
Ivan Avdeev
c2729c9d63 rtx: fix reflections; update todo 2021-07-17 12:37:12 -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
0356013db6 update todo; add more diags for rtx as handling 2021-06-19 10:51:21 -07:00
Ivan 'provod' Avdeev
74e0fb2947 add initial water surfaces
still need to cull them, generate normals, etc.
2021-06-19 13:44:28 -04:00
Ivan 'provod' Avdeev
b58eb5b4b2 rtx: slightly improve fake poc lighting 2021-06-05 13:06:03 -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
43175ae003 update todo 2021-05-28 10:27:16 -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
947ad9d7fa update todo 2021-05-17 10:57:16 -07:00
Ivan 'provod' Avdeev
6614a6935b add debug names to various objects 2021-05-17 10:36:40 -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
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
5b7eaa8e1c rtx: fix light surfaces bleeding backwards 2021-04-22 10:42:19 -07:00
Ivan 'provod' Avdeev
c255041bd9 rtx: clear light clusters properly on new map 2021-04-19 11:44:15 -07:00
Ivan 'provod' Avdeev
2f965b00d4 rtx: read emissive texture params from rad files
Got rad files from https://github.com/MaestroFenix/Half-Life-Resized-Maps
These seem to work mostly fine and finally levels have recognizable appearance.
2021-04-17 12:33:46 -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