I'm working on a scope rendering mod and hit a couple FG-related issues. Built an API to fix them - figured it might be useful for other mods too.
The issues
1. MV timing
My mod updates motion vectors after DrawWorld_Forward, but FG copies them too early. Results in stale MV data.
2. Scope edge artifacts
Scope shows independent content from main camera. FG doesn't know this and tries to interpolate scope edges with wrong MV.
What I built
Two APIs in MotionVectorDeferralAPI.h:
Deferral API - controls WHEN MV gets copied:
AAAFG_RegisterMotionVectorDeferral();
// ...do your MV updates...
AAAFG_NotifyMotionVectorUpdateComplete(); // triggers copy
Region Override API - controls WHICH pixels get MV zeroed:
AAAFG_RegisterMVRegionOverride();
ID3D11RenderTargetView* mask = AAAFG_GetMVOverrideMaskRTV();
// draw your region as white...
Both are opt-in. When no mod is using them, everything stays on the original code path - no performance impact.
Implementation details
- Deferral uses atomic counters + frame-end fallback
- Region override uses dual-frame mask accumulation (handles motion between frames)
- New compute shader
ApplyMaskToMVCS.hlsl for mask processing
Tested with my scope mod - MV updates are properly timed, no more edge ghosting.
Let me know if you're interested in a PR. Open to suggestions on the API design.
I'm working on a scope rendering mod and hit a couple FG-related issues. Built an API to fix them - figured it might be useful for other mods too.
The issues
1. MV timing
My mod updates motion vectors after
DrawWorld_Forward, but FG copies them too early. Results in stale MV data.2. Scope edge artifacts
Scope shows independent content from main camera. FG doesn't know this and tries to interpolate scope edges with wrong MV.
What I built
Two APIs in
MotionVectorDeferralAPI.h:Deferral API - controls WHEN MV gets copied:
Region Override API - controls WHICH pixels get MV zeroed:
Both are opt-in. When no mod is using them, everything stays on the original code path - no performance impact.
Implementation details
ApplyMaskToMVCS.hlslfor mask processingTested with my scope mod - MV updates are properly timed, no more edge ghosting.
Let me know if you're interested in a PR. Open to suggestions on the API design.