Commit Graph

52 Commits

Author SHA1 Message Date
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
6853ad51ea rt: fix polylights facing the wrong direction 2022-01-15 19:54:35 -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
2ae510ee7f respect animated textures in ui_infotool
1. include correct current texture
2. print animation chain info

relevant for #301
2021-12-23 00:01:39 -08:00
Ivan Avdeev
86b13716bf rtx: create new materials referenceable by "for" key, #291 2021-12-22 12:33:33 -08:00
Ivan Avdeev
b593be9695 rtx: delete patched surfaces with zero emission
fix #286
2021-12-21 18:37:04 -08:00
Ivan Avdeev
93fba1018c fix incorrect surface indexing when patching
fix #239
2021-11-29 10:06:07 -08:00
Ivan Avdeev
5a7cb651ca rtx: allow patching emissive color for brush surfaces, #117 2021-11-28 11:15:02 -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
Ivan Avdeev
10c48e86b3 take tangent from bsp data directly, fix #218 2021-11-19 11:46:44 -08:00
Ivan Avdeev
6df830dd0a add initial normalmaps support 2021-11-17 09:43:10 -08:00
Ivan 'provod' Avdeev
5e50bdfcf2 rtx: add conveyor scrolling texture, fix #158 2021-10-27 22:48:26 -07:00
Ivan Avdeev
9006d679ec rtx: associate msurfaces with mleafs 2021-10-13 12:27:24 -07:00
Ivan 'provod' Avdeev
100ba22f0e rtx: add broken sun sampling
i cant into math. sun direction is completely incorrect
2021-09-20 23:35:49 -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 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
76b82ac884 rtx: calculate maxVertex correctly
after we've updated how brush index buffer references vertices to allow
for draw call coalescing ray tracing broke on amd.
this is because amd cards expect a correct value in
VkAccelerationStructureGeometryTrianglesDataKHR::maxVertex. make sure we
fill a correct value there.
2021-08-18 09:39:33 -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 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
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 'provod' Avdeev
355ebd8d23 rtx: add reflections for water; add sky as emissive surfaces 2021-06-19 12:52:13 -07:00
Ivan 'provod' Avdeev
8321dda9d9 rtx: fix water normals performance and culling 2021-06-19 13:44:28 -04:00
Ivan 'provod' Avdeev
4e599b4070 cull water side surfaces 2021-06-19 13:44:28 -04:00
Ivan 'provod' Avdeev
531fcd9393 move water warping to vk_brush 2021-06-19 13:44:28 -04: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
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
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
bd8c67e4e7 rtx: fix missing emissive textures, enlarge light radius based on intensity 2021-04-19 11:17:17 -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
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 '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
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
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
e14f004785 Merge remote-tracking branch 'upstream/vulkan-anim-textures' into vulkan 2021-02-10 11:08:49 -08:00
Ivan Avdeev
5ebe36c54c move buffer allocation to vk_render.c from vk_bruh.c 2021-02-10 10:33:44 -08:00
cbdca0abf9 implement texture animation and random tiling 2021-02-10 03:45:38 +03:00
Ivan Avdeev
ad5d515200 move entity enumeration from vk_brush to vk_scene 2021-02-08 10:57:27 -08:00
Ivan Avdeev
e5b14c0393 fix glitches on intel gpus due to misaligned uniform buffer offsets
Use VkPhysicalDeviceLimits.minUniformBufferOffsetAlignment to align dynamic uniform buffer offsets used per brush.
2021-02-07 23:19:22 -08:00
Ivan Avdeev
8c1c418b35 rename map to brush 2021-02-06 11:38:08 -08:00
Ivan Avdeev
b11501e4ef improve blending; add alpha test
Set blending modes according to existing GL renderer.
Cull back faces.
Implement alpha test.

Add TODO.md file
2021-02-06 11:07:00 -08:00