Commit Graph

53 Commits

Author SHA1 Message Date
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
Ivan 'provod' Avdeev
573c291cef rtx: fix tlas rebuild 2021-04-10 10:58:46 -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 '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
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
f85a174d8b rtx: add a bunch of ray bounces
while fps dips below 1, it still looks like modern art
2021-03-13 17:04:45 -08:00
Ivan 'provod' Avdeev
379f6ee409 rtx: add static light entities
This was an attempt to add map lighting w/o lightmaps. Unfortunately
there are just not enought of them to explain all light in maps. We're
missing something else. A lot of it.
2021-03-13 16:33:17 -08: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
7fa3f2dc8d render: split mvp matrix to separate model,view,projection matrices
This will help with RTX model transformations.
2021-03-13 13:35:50 -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
7b482d2b3b rtx: glShadeModel(GL_SMOOTH)
Compute normal based on all triangle vertices according to their
barycentrics.
2021-03-13 10:46:25 -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
44b93dd30b rtx: add hard shadows 2021-03-10 10:15:09 -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
Ivan 'provod' Avdeev
ea9b880865 add studio models normals for dynamic lighting 2021-03-08 09:54:26 -08:00
Ivan 'provod' Avdeev
cbed97948c add preliminary support for dlights
Move descriptors away from vk_core
Add UBO for dlights
Add test lighting in brush shader
Add brush normals
2021-03-06 16:40:35 -08:00
Ivan Avdeev
973ef4c677 separate buffer space allocation from buffer uploading
Now each geometry is first allocated a slot with VK_RenderBufferAlloc,
and then VK_RenderBufferLock/Unlock are used to upload buffer contents.

This allow for two things:
1. Uploading buffer data to GPU memory on/after Unlock.
2. (Re)building BLAS for RTX on/after Unlock.

These buffers are now directly referenced by render_draw_t, which also
will be helpful in the future for both renderers.
2021-02-22 18:57:46 -08:00
Ivan Avdeev
3f70b76208 engage scene rendering in VK_RenderFrame and not in EndFrame
Rework a bit how matrices are computed. More global state dependencies
;_;

Buffer-up draw commands, and only schedule them for drawing at EndFrame.
2021-02-20 14:54:57 -08:00
Ivan Avdeev
a5e279f580 fix sprite blending
Disable depth test and set dst blend factor to 1 for kRenderGlow mode.
Sprites are occluded in software.

(does this break any other code depending on Glow mode? who knows)
2021-02-20 12:46:16 -08:00
Ivan Avdeev
8dc0d4256d add VK_RenderDebugLabelBegin/End calls; fix studio model labeling 2021-02-20 12:35:04 -08:00
Ivan Avdeev
e66810a05b remove ubo management from "public" vk_render api
Now rendering submodules specify their colors and matrices using
VK_RenderState global stat api. This is a trade-off between making all
submodules track their state on their own, or managing that state
centrally.
2021-02-20 12:00:31 -08:00
Ivan Avdeev
15fdcab5fe add plan for stream 2021-02-19 23:07:45 -08:00
Ivan Avdeev
3b1e7be112 add beams rendering
not all beam types are supported yet

also changes studio api init sequence, fixes missing cvars
vertex type struct is no longer names as brush-specific
uniform buffer allocation is now in vk_render

blending issues still remain
2021-02-17 13:26:09 -08:00
Ivan Avdeev
b22cd90184 add initial sprite rendering
alpha blending is broken
animations are weird, but we do draw them nonetheless somehow
2021-02-15 12:20:25 -08:00
Ivan Avdeev
538ae9191f coalesce studio model draw calls
it's easier to debug, and supposedly is faster to render too
2021-02-15 10:11:12 -08:00
Ivan Avdeev
c53bfaf484 add view(weapon) models 2021-02-15 09:55:42 -08:00
Ivan Avdeev
778cc60453 add broken studio models drawing
there are several issues with it:
- there are holes in models
- movement is jerky
- no lighting applied
2021-02-13 17:19:59 -08:00
Ivan Avdeev
5ebe36c54c move buffer allocation to vk_render.c from vk_bruh.c 2021-02-10 10:33:44 -08:00
Ivan Avdeev
ad5d515200 move entity enumeration from vk_brush to vk_scene 2021-02-08 10:57:27 -08:00
Ivan Avdeev
2704f442e9 fix lightmap corruption 2021-02-06 13:51:23 -08:00
Ivan Avdeev
14db07f985 draw HUD sprites 2021-02-06 13:13:08 -08:00