the Twarchive

This is a record of a twitter thread, originally posted in 2019

Thew
@AmazingThew

CT rendering experiments at @LevelExGameDev getting interesting

this is all volumetric; check out how the bones of the jaw or shoulderblades recede beneath the fat/muscle

Thew
@AmazingThew

This is collaborative work with @Billy_Basso ; he figured out how to inject arbitrary data into Unity's G-buffers, so we can raymarch volumes and just write depth/normals/PBR params to the appropriate buffers and then let the engine handle all the actual shading

Thew
@AmazingThew

Problem: Deferred rending only handles opaque surfaces (since gbuffer only holds one depth/normal value per pixel). Volumes need to be semitransparent.

Solution: DITHER ABSOLUTELY EVERYTHING INTO OBLIVION AND THEN SMEAR IT ALL BACK TOGETHER SORT OF

Thew
@AmazingThew

Check every voxel in the raymarch against a threshold value from screen-aligned blue noise. If it passes, keep going, if it hits, stop marching and write out to the gbuffer

Average the last several frames together to converge on the correct result

Thew
@AmazingThew

If you use the word 𝐬𝐭𝐨𝐜𝐡𝐚𝐬𝐭𝐢𝐜 while describing this you sound cool and smart

Thew
@AmazingThew

obviously this incredibly advanced Stochastic Temporal Multisampling falls apart as soon as anything moves and you just get blurry garbage

Thew
@AmazingThew

only real solution to THIS problem is temporal reprojection, which is actually legitimately as cool as it sounds

basically use what you know about movement in the CURRENT frame to grab any missing dithered pixels from the PREVIOUS frame

it's janky and rad and only sort of works

Thew
@AmazingThew

Anyway that's what the ghosty motion trails are from. I'm pretty sure I can improve the reprojection a lot; it's pretty bare-bones right now and it's a very subjective problem

overall this whole tower of cool hacks works WAY better than I expected honestly

Thew
@AmazingThew

Also all the range mapping to convert CT density to to raymarched opacity is dynamic