This is my attempt to port AOIT into Urho3D for having as many beams/particles as possible.
It only works in DX11 and forward rendering.
The branch is at:
UAV part is ripped from
with some modification to be able to declare shader buffer(UAV) in renderpath xml.
HLSL part is literally 99% copy-paste from the sample in AOIT.
Result
I added two modified original samples 98_AOITLightTest and 99_HugeObjectCountAOIT.
Both can switch renderpath in runtime to check difference.
98_AOITLightTest is modified 07_Billboards to check lighting.
Have to say it is not doing well if there are many transparent objects overlapped.
Compare to built-in renderpath:
The FPS is not doing well either because cannot use instancing(~50% FPS of Froward renderpath).
99_HugeObjectCountAOIT is modified 20_HugeObjectCount, which just set transparent material to all boxes.
In scenerio of group on and animation on, the FPS on my laptop:
Sample | 20 | 99(Forward) | 99(ForwardAOIT) |
---|---|---|---|
FPS | 73 | 27 | 59 |
Maybe it is worth to merge this to my project to see if it will have FPS gain .
Some notes
-
Intel sample has only 1 pass which does all shading/lighting in it, but I am not capable to modify Urho3D to that way.
I construct visibility function inaoit
pass, then reuse it inlitaoit
pass, this means if an object only haslitaoit
pass in its technique will produce unexpected result because it does not participate visibility construction. (All transparent objects needs to haveaoit
pass).
But reusing visibility function also produce inaccurate result because some info is already dropped in aoit pass, which always merges furthest pixel into last node. I compensate by a noob way which does not do much. -
When drawing
litaoit
pass, I don’t know why do I have to declare all UAV as ROV.
And check if the depth is used.
The geometry and world proj view matrix should be all the same in alpha and litalpha pass, isn’t it??
So shader should get the same depth in lit pass, but…
Without the two things, lit rendering will look like having race condition problem, but unlit alone is OK.
I really have no idea… but just put them together to make it work.