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
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
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.
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
- 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
It was missing msurface_t reference which is (unnecessarily) required for light clusters computation
Also add more verbose debug names for dynamic models.
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.
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
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.
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
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.
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.
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
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.
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.
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