Commit Graph

52 Commits

Author SHA1 Message Date
Ivan 'provod' Avdeev 5e50bdfcf2 rtx: add conveyor scrolling texture, fix #158 2021-10-27 22:48:26 -07:00
Ivan Avdeev 2687dcde6b throttle dynamic geometry slots message, #133 #132 2021-10-25 10:17:49 -07:00
Ivan 'provod' Avdeev fe931fcfd7 rtx: collect d/elights and static entity point lights
sample all of them unconditionally for now
2021-09-20 23:35:49 -07:00
Ivan Avdeev a7288eba69 fix linux build 2021-09-14 17:47:05 -07:00
Ivan 'provod' Avdeev afa1e8557a rtx: fix c0a0d emissive toxic liquid, fix #56
It was missing msurface_t reference which is (unnecessarily) required for light clusters computation

Also add more verbose debug names for dynamic models.
2021-09-14 17:47:05 -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 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 a0a36f5a14 fix c89 2021-08-15 11:14:33 -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 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 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 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 5211c33cce rtx: add shader specialization 2021-06-23 17:04:26 -04:00
Ivan Avdeev 388f684f12 ref_vk: another var declaration fix 2021-06-06 22:46:04 -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 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 5de30a4ff0 fix compilation warnings 2021-05-24 11:12:44 -07:00
Ivan 'provod' Avdeev 6614a6935b add debug names to various objects 2021-05-17 10:36:40 -07:00
Ivan 'provod' Avdeev be42bd29a5 add ring temp allocator logic 2021-05-03 11:17:01 -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 0407f12638 rtx: read kusochki data, add dynamic lights back
also add fps
2021-04-10 12:46:37 -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 014925b3d4 fix linux build 2021-03-20 16:21:26 -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 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 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
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 'provod' Avdeev 78d9a87344 fix projection matrix vulkan fixup
we were mixing up row vs column major matrices
now RTX ray generation is fixes, and traditional rasterizer rendering
should also be projecting similar to gl render
2021-03-06 13:26:38 -08:00
Ivan 'provod' Avdeev 28cdeaeb1d propagate proj/view matrices to rtx shader
And get RTX picture we deserve (i.e. glitchy and incorrect).
Will fix later.
2021-03-03 11:58:40 -08:00
Ivan 'provod' Avdeev e0ee4b756b rtx: make it draw yellow screen
this basically checks that acceleration structurs are building without
any vulkan errors (we still don't know whether they are bulding with
correct geometry though).

we also have compute shader pipeline ready for ray tracing (yay)
but it doesn't do any raytracing yet
2021-03-01 11:22:58 -08:00
Ivan Avdeev 5e3010489b rtx: blindly add tlas and compute rendering
it's unknown whether it works at all
no real ray tracing yet
2021-03-01 10:52:08 -08:00
Ivan 'provod' Avdeev c77f39e353 rtx: fix blas creation validation/memory errors 2021-02-27 15:40:57 -08:00
Ivan Avdeev 9954288450 rtx: add blas building skeleton 2021-02-27 13:43:49 -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 'provod' Avdeev ded8442993 auto-detect VULKAN_SDK path on windows 2021-02-21 23:28:33 -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 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