204 Commits

Author SHA1 Message Date
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
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
NightFox
8baf34768a correct environment light power 2022-07-23 11:34:57 -07:00
NightFox
4809fc5d02 more correct base_color processing 2022-05-30 18:04:59 -07:00
NightFox
4e1982815c correct payload.emissive.rgb 2022-05-27 11:28:26 -07:00
NightFox
c713c7fc59 correct lighting and gamma-correction improvement 2022-05-27 11:28:26 -07:00
Ivan Avdeev
668d3fb81a rt: add shadows for environment lights 2022-02-09 21:57:55 -08:00
Ivan Avdeev
152cca3a47 rt: select random triangle to sample based on solid angle
looks correct enough(ish?)

perf (c1a0):
direct poly light 4.4ms, v85(96), o10/16 (-6v +1o)
2022-02-08 23:04:00 -08:00
Ivan Avdeev
e2694ecf36 rt: try single triangle solid angle sampling
1. it looks way better
2. still missing other triangles

perf (c1a0):
4.2ms, v87(96), o10/16 (-6v +1o)
2022-02-08 22:26:39 -08:00
Ivan Avdeev
dd1f58d0b7 rt: simplify polygon light sampling
do stupid first triangle sampling, w/ contrib estimation area * dot(LP) / dist^2

4.7ms all poly lights, occupancy 10, vgpr 86(96)
2022-02-04 18:38:36 -08:00
Ivan Avdeev
4bb44c1569 rt: add skybox support 2022-02-02 21:47:40 -08:00
Ivan Avdeev
3a6bed136a rt: add moving polygon lights support 2022-02-02 21:32:10 -08:00
Ivan Avdeev
f9bf0aadd0 rt: add emissive color 2022-02-02 19:04:45 -08:00
Ivan Avdeev
61ecda02f2 rt: add output material channel to primary ray
perf (--//--)
- total ray time: 14.5ms
- primary: 0.2ms v:81/96 s:60/128 o:10/16 (-6v +1o)
- light poly: 13.4ms v:256/256 s:98/128 o:4/16 (-28v +1o)
- light point: 0.8ms v:87/96 s:68/128 o:10/16 (-6v +1o)
2022-01-27 20:04:18 -08:00
Ivan Avdeev
90fa6161ac rt: add parallel direct point light pass
(look how easy that was! yay passes!
... still need to do spir-v parsing to extract bindings though)

perf (c1a0 lobby, 720p, 6900XT)
- total ray tracing time: 15.2ms
- primary: 0.7ms v:80/80 s:60/128 lds:2048 o:12/16 (-4v +1o)
- dir poly: 13.8ms v:256/256 s:98/128 lds:2048 o:4/16 (-28v +1o)
- dir point: 0.9ms v:85/96 s:68/128 lds:2048 o:10/16 (-6v +1o)

dir point and poly are not synchronized and overlap. but poly takes most
of the time, and point can only ramp up gradually at the very tail of
poly.
2022-01-27 19:14:56 -08:00
Ivan Avdeev
e384f2e1f7 rt: move shader binding defs to interop 2022-01-22 19:13:08 -08:00
Ivan Avdeev
5d8e15bfac rt: sample all poly lights more correctly 2022-01-22 18:54:40 -08:00
Ivan Avdeev
21ff19be83 rt: convert denoiser to use resources 2022-01-22 18:54:11 -08:00
Ivan Avdeev
202eccb3d1 rt: cosolidate pass args in a central structure 2022-01-21 20:55:43 -08:00
Ivan Avdeev
70eb2fed6f rt: read tangents and normal map 2022-01-20 20:09:21 -08:00
Ivan Avdeev
23b4bdd4f8 rt: consolidate specialization data 2022-01-20 20:04:43 -08:00
Ivan Avdeev
63358be4a3 rt: replace ray query with rt pipeline for direct light
it stays roughly the same, vgpr 256, etc.
perf is a tiny bit better (12ms vs 14ms for all poly lights in c1a0
lobby /w shadows), but it may be sampling artifact
2022-01-20 00:06:38 -08:00
Ivan Avdeev
c73f3d0dab rt: sample all polygon light sources in cluster 2022-01-19 20:23:38 -08:00
Ivan Avdeev
815866b353 rt: add per-frame random seed to randomize sampling 2022-01-15 23:15:29 -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
90bf0bc262 rt: select only one light source per pixel
known issues:
- noise is fixed
- overall light is too dark
- some lights are facing the wrong direction

test_brush2, green room, direct light:
336us, 192(192)v, 97(128)s, 4096lds, 2/16o (-45v => +1o)
2022-01-15 19:45:41 -08:00
Ivan Avdeev
85ea822512 rt: sample the new polygon lights with projected solid angle
no shadow rays yet
2022-01-15 17:16:45 -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
e4ade833e8 rt: use a bit more reasonable compute groups
doesn't really affect perf tho
2022-01-12 22:39:09 -08:00
Ivan Avdeev
f4c56ead54 rt: add shadow ray query to direct light pass
7.557ms 212(216)v 65(128)s lds=8192 2/16o :(

also, kernel panics on changelevel
2022-01-11 22:41:21 -08:00
Ivan Avdeev
a47fdcb8ca rt: fix most glaring direct light glitches
- fix normal2 packing
- work around desynced light cluster sizes

known issues:
- static seed for random
- no emissive
- no shadows

perf (direct): 6.4ms, 183(184)v, 59(128)s, lds=0, 2/16o (?!)
2022-01-11 18:13:59 -08:00
Ivan Avdeev
af24afbcc3 rt: draft direct light compute shader
it's bad:
direct light: 1.8ms, 183(184)v, 59(128)s, LDS=0, 2/16o
(-56 vgpr => +1 wavefront??)

also, thread group size = 16, 8, 1, wave64
while ray tracing pipeline = 8, 4, 1, wave32
2022-01-10 19:13:08 -08:00
Ivan Avdeev
b9760aaaea rt: add normals to primary pass
primary: 114us (+15), 62(64)v, 60(128)s, 16/16o
reading: 13us (+3)
2022-01-09 20:02:27 -08:00
Ivan Avdeev
f281b40e34 rt: use the same primary out list for image creation 2022-01-09 19:50:43 -08:00
Ivan Avdeev
c6ea7dc1fc rt: list primary out bindings separately 2022-01-09 19:36:08 -08:00
Ivan Avdeev
090fb3bfbb rt: add alpha test to primary rays
105us, 57(64)v, 60(128)s, 2048l, 16/16
2022-01-08 17:21:04 -08:00
Ivan Avdeev
3453a2f563 rt: add anisomips to primary ray
also move uniform buffer to rtx from render

110us, 57(64)v, 52(128)s, 16/16
2022-01-08 13:44:02 -08:00
Ivan Avdeev
93b0766142 rt: read textures and pass it to gbuffer
102us, 56(64)v, 48(128)s, 16/16o
2022-01-07 23:22:19 -08:00
Ivan Avdeev
4b540d28eb rt: pass both positions and "color" to g-buffer
vgpr is up to 57 :(
2022-01-07 22:43:27 -08:00
Ivan Avdeev
f85b1b9dc1 rt: pass uvs to screen
same: 111us, 53(64)v, 48(128)s, 16/16o
2022-01-07 22:26:57 -08:00
Ivan Avdeev
da91ff551e rt: pass geometry data to primary ray pass
also teach it to reload
2022-01-07 22:14:50 -08:00
Ivan Avdeev
246c42f043 rt: trace actual rays in primary pass
uh oh, test_brush2: 74.3us, 48/48 vgpr, 44/128 sgpr, 16/16 occupancy
2022-01-07 19:22:40 -08:00
Ivan Avdeev
cd47861d9b rt: start splitting tracer into passes; add primary pass stub
renders only uv gradient as a test

empty rgen, 6900xt: 12.3us, 6/16 vgpr, 20/128 sgpr, 16/16 occupancy
2022-01-07 18:53:23 -08:00
Ivan Avdeev
9adf9e1779 rtx: decrease payload_opaque dependencies 2022-01-06 19:56:15 -08:00
Ivan Avdeev
44652da57a rtx: switch sampling to projected solid angle 2021-12-29 12:56:58 -08:00
Ivan Avdeev
1352f68462 rtx: clip sampled triangles by half-dome 2021-12-29 12:40:37 -08:00