Hair strands Gbuffer desync

Hey!

I’m working on making a ‘drop shadow’ outline on our character based on a postprocess material. The concept is simple, I sample the buffers twice and shift them by some coordinates in screenspace, then subtract both depth and now I have my outline. That being said, appart from this, I’ve noticed a slight desynch while reading the custom stencil ONLY on the groom assets; the rest of the stencil does match 1:1. I tried couple of things (like disabling AA and AA jitter, PreviousFrameSwitch stuff).

What I end up doing is to sample the ShadingModelID frame buffer and get the index 7 (which represents the hair shading model) and add this to the CustomStencil buffer. It fixes my issue as long as I accept that every fur pixels in the game will be affected by this outline (which is fine for us). I’m still wondering why the CustomStencil is desynched ONLY on the groom pixels…

Hopefuly this makes sense, as I feel it is a bug (or by design maybe?). Thank you!

[Attachment Removed]

Steps to Reproduce

  1. Add a Custom Stencil to your groom component
  2. Enable r.HairStrands.WriteGBufferData=2 to have access to hair information in your post process material
  3. Enable simulation on your groom asset
  4. Make a postprocess material that reads the custom stencil and ADD the value of the stencil to the PostProcessInput0
  5. Notice a slight desync in the mask vs. the PostProcessInput
    [Attachment Removed]

Hi,

thank you for reporting the issue. I looked at it and I think I understand the issue. By default the custom depth/stencil pass run prior to the base pass. At that time the hair interpolation hasn’t run, and this is why you see one frame lagging issue. You can fix that by running the custom depth/stencil pass after the base pass with the CVar r.CustomDepth.Order 1. This should fix the issue.

[Image Removed] [Image Removed]I hope this helps.

Sincerely,

/Charles.

[Attachment Removed]

Hey Charles!

Thank you so much for your input, it does indeed fix the issue. :slight_smile: Cheers!

[Attachment Removed]