Commit Graph

118 Commits

Author SHA1 Message Date
Ivan Avdeev ecac9a1f48 vk: compile w/ -Werror, fix a bunch of bad stuff 2022-10-16 23:44:13 -07:00
Ivan 'provod' Avdeev 2c4d0846d4 rt: reimagine staging
- make staging/prep phase use separate command buffer
- flush this command buffer early if needed
- move command pool to its own module
- move shader loading stuff to pipeline module
- cleanup lots of command buffer passing for model loading, it can use staging explicitly now
2022-09-11 11:38:51 -07:00
Ivan 'provod' Avdeev d34bf3aa8d rt: fix studio models colorful flickering 2022-09-03 11:25:33 -07:00
Ivan 'provod' Avdeev 7f3dca0993 rt: use proper staging for light uploading
also don't upload clusters as we're thinking about sunsetting them in their current form.
2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev 41e5757c0a FIXME: rt: try disabling light grid entirely
this skips 40ms+ grid upload cost, and seems generally just a few ms more costly than sampling clusters.
however, there are sync glitches for reasons unknown.
2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev c53f22d028 rt: extract bit array 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev 9f6fa0a8cb rt: make lights data more private 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev 0f0a58d1aa rt: add debug markers to see that uploading lights takes >35ms 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev 1d2e763baf rt: add staging buffer for light grid, fix #368 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev 1d25b718dd rt: split light metadata/grid bindings back in shader
for some reason joining them leads to "invalid spirv" validation errors (and broken lights).
split the bindings back making shaders essentially unchanged, while still keeping a single physical buffer
2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev 1b834f37be rt: join metadata and grid buffers together (breaks validation) 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev 608bf020c4 rt: move light metadata uploading to vk_light.c 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev 1f741a48a3 rt: hide emissive_textures info 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev a5efa71ecb rt: clean vk_light a bit 2022-08-15 09:31:13 -07:00
Ivan Avdeev 85c55a7fc9 update after merge, make it build and run with rasterizer
have not checked ray tracing, or playing longer than a couple of minutes
2022-08-08 00:23:38 -07:00
Ivan 'provod' Avdeev 8291efd08b rt: fix polygon light clusters on missing pvs 2022-07-23 13:39:37 -07:00
Ivan 'provod' Avdeev af594203f8 rt: fix point light cluster crash on missing pvs
will still crash for polygon lights
2022-07-23 13:39:37 -07:00
Ivan Avdeev 3a6bed136a rt: add moving polygon lights support 2022-02-02 21:32:10 -08:00
Ivan Avdeev 663306f4e1 rt: clusterize the new polygon lights
known issues:
- visible cluster boundaries which affect sampling outcomes
  (essentially clusters act like very coarse shadows, and that's visible)

moving brush models are not supported yet, affects perf measurements
2022-01-15 23:12:12 -08:00
Ivan Avdeev f7e42e5ae0 rt: add shadows for polylights
also change:
- pass plane equation instead of just normal
- pass area separately
- pack vertices offset+count into single integer

582us, 224(224)v, 97(128)v, 4096lds, 2/16o (-53v => +1)
2022-01-15 21:34:43 -08:00
Ivan Avdeev 04a201c401 rt: pass new polygon lights to shader naively
also start refactoring light collection

broken:
- reloading lights after patching
- wagonchik lights (attached to non-static models)

missing:
- clustering the new poly lights
- proper sampling, only rough estimate for now
- shadows

probably a lot more
2022-01-14 23:48:57 -08:00
Ivan Avdeev b31462fe18 rt: stub better emissive surfaces representation path
Light polygons that are:
- self-sufficient (no kusochki indirection needed).
- pre-transformed
- contain enough metadata (area, center, normal) for quick sampling
- are polygons with up to 7 vertices and not triangles (easier sampling)

Also move rad file reading to before brush model loading, as it now
requires lighting data.
2022-01-13 22:36:21 -08:00
Ivan Avdeev 51a29c012c make flashlight handling a bit cleaner 2021-12-30 13:28:56 +03:00
NightFox 1501f7fea4 more correct flashlight position in first person by @MaxG2D 2021-12-29 12:21:33 +03:00
NightFox 09493cbcba fix multiplayer angles 2021-12-28 18:25:14 +03:00
NightFox 9420fc3e39 general fix flashlight for other players in multiplayer mode 2021-12-28 15:09:29 +03:00
NightFox 8848502572 cleanup again 2021-12-28 00:58:26 +03:00
NightFox 2395469d0c cleanup 2021-12-28 00:34:39 +03:00
NightFox 5f7127bd00 replace parseAngles function code by AngleVectors and tune thirdperson_offset 2021-12-27 19:27:31 +03:00
NightFox d413b7dc77
Merge branch 'vulkan' into fonarik 2021-12-27 15:42:22 +03:00
Ivan Avdeev b67668430b rtx: fix missing flashlight in c1a4i
Just increase point lights limit per light cell.

Also:
- update infotool to show point lights info
- move light cluster finalization to vk_scene to make sure infotool has
  the recentmost data
2021-12-26 23:56:21 -08:00
Ivan Avdeev f86da445b7 rtx: fix moving emissive surfaces light clusters
Do not skip 0th leaf when iterating through R_FatPVS results.

Also:
- move infotool from camera.c to infotool.c
- add hit coords to infotool
- add limited light clusters info into infotool
- add a bit more debug info to light clusters

fixes #279
2021-12-26 00:37:07 -08:00
NightFox 74a9809b08 formatting 2021-12-26 03:17:22 +03:00
NightFox e68546cd8b refactoring 2021-12-26 01:54:32 +03:00
NightFox 0aba565ab8 more correct flashlight
more correct work in the first person
add third person support
add multiplayer support (need testing)
2021-12-26 01:00:06 +03:00
NightFox 8c12479447 fix error: implicit declaration of function 2021-12-25 01:16:19 +03:00
NightFox ab4d1c12c7 new flashlight 2021-12-25 00:30:02 +03:00
Ivan Avdeev 9970d4e31a rtx: remove stale lbsp light code 2021-12-21 22:56:34 -08:00
Ivan Avdeev fa63aedce9 rtx: fix too verbose logs for emissive patch 2021-12-21 18:50:41 -08:00
Ivan Avdeev b593be9695 rtx: delete patched surfaces with zero emission
fix #286
2021-12-21 18:37:04 -08:00
Ivan Avdeev e831a9c9dd rtx: fixup point/spot light attenuation after sampling fixes 2021-12-08 11:27:04 -08:00
Ivan Avdeev e3e8693b13 rtx: attenuate lights based on solid angle, not distance and area, #145
breaks previous tuning
2021-12-05 13:38:16 -08:00
Ivan Avdeev 3de2a98db4 rtx: fix skipping the last leaf when clustering lights, fix #97
apparently model_t->leafs goes from 1 to model_t->numleafs, not from 0
to model_t->numleafs-1
2021-12-03 11:37:10 -08:00
Ivan Avdeev c833d0e320 rtx: make default light radius smaller, fix #242 2021-11-29 21:17:22 -08:00
Ivan Avdeev 5c85d1b648 rtx: add radius property for point/spot lights
it is not handled correctly in shader yet
2021-11-28 14:05:54 -08:00
Ivan Avdeev 5a7cb651ca rtx: allow patching emissive color for brush surfaces, #117 2021-11-28 11:15:02 -08:00
Ivan Avdeev c4c97b2822 Merge branch 'vulkan' into patch 2021-11-28 09:56:25 -08:00
Ivan Avdeev a394038f22 rtx: do not treat SURF_SKY as light source, fix #232 2021-11-27 20:22:32 -08:00
Ivan Avdeev 28d047a904 rtx: enable patching surface textures
example:
```
{
	"_xvk_surface_id" "489"
	"_xvk_texture" "#maps/test_material.bsp:debug_normal1.mip"
}
```

if _xvk_texture is empty, then the surface will be deleted

surfaces can be deleted or their
2021-11-26 23:59:48 -08:00
Ivan 'provod' Avdeev a9d5e4dd22 rtx: draw skybox on SURF_SKY surfaces only
- change how shadows for environment lights work: should cast light only when hitting SURF_SKY
- add SBT_RECORD_SIZE to specialization; need this for sky/shadow closest hit shader

fix #140
2021-11-25 11:53:44 -08:00