HDRP single-pass instanced rendering not working

Avatar
  • updated
  • Unity's Fault

Image 489

Hello, I have gone through potential fixes on other posts in this forum, but I can't seem to get single-pass instanced rendering working within HDRP VR. I tried deleting the Library folder and reinstalling Shapes, but no dice. Is this something anyone else has experienced? 

Reporting a bug? please specify Unity version:
2020.3
Reporting a bug? please specify Shapes version:
4.1
Reporting a bug? please specify Render Pipeline:
HDRP
Avatar
hendrik schulte

I can confirm this problem with HDRP 11.0.0, Unity 2021.1.16f1 and Shapes 4.1.0. Some shapes are rendered right and some are only rendered on the left eye, e.g. this sphere

and this rectangle

Avatar
Andy Lewis

I'm assuming the silence means this is not an issue that will likely be resolved. It's unfortunate, as Shapes is considerably more robust than other options I have at my disposal. :(

Avatar
Freya Holmér creator

the silence is only because this is a recurring issue that seems to be entirely Unity's fault in how they set up their view matrices in VR


for some reason, in some versions, on some platforms in some render pipelines, in some cases, one eyes view matrix is incorrectly set up, and I don't have access to values I need for things to render correctly

I wish I had an answer!

https://twitter.com/hybridherbst/status/1430855577417158659

Avatar
Andy Lewis

Well, I did some tests and it does actually work with HDRP VR single pass instanced in 2021.2.0b10 in a fresh project!

I got encouraged by that and tried again to get it to work with my original project in 2020.3.5f1 by closing Unity, deleting Shapes, deleting Library, opening Unity, and reinstalling Shapes. But still no luck there, sadly. 

So then I tried a fresh project in 2020.3.5f1 and it did indeed work there as well. What the....

So something that is apparently not tied to my library folder is messing things up. 

Avatar
Andy Lewis

SORRY! "Getting hopes up" alert! I actually had my fresh 2020.3.5f1 project set to multi-pass, not single pass. Does not work in 2020.3.5f1 after all. D:

It does work with 2021.2.0b10. Confirmed that it was single-pass instanced. 

Avatar
Freya Holmér creator
  • Unity's Fault

thanks for all the testing! I'm closing this as it seems to be an oversight on Unity's end

Avatar
robert ottinger

FYI - seems to work fine in 2021.2.8f1 as well :)

Avatar
robert ottinger
Quote from robert ottinger

FYI - seems to work fine in 2021.2.8f1 as well :)

looks like only Draw.Line is rendering in both eyes, but all other shapes are only rendering in left eye :(

Avatar
robert ottinger

@Freya - Is there a bug ticket filed w/ Unity on this? I see the twitter thread referenced above, but  its not clear that there is any tracker w/ Unity. I also just tested w/ the latest 2022.1, and same results - lines work, other shapes are left eye only. I'm good w/ just using lines for near term, but would be super to be able to use the entire library - :)  Thanks  

Avatar
Freya Holmér creator

I'm not sure if there's a ticket open, but this was the last time I looked into the issue, and it seems like on some versions and pipelines Unity just doesn't/forgot to write to that matrix


Avatar
hendrik schulte

It's still not working in Unity 2021.3.6f1 + HDRP 12.1.7 🙁

Avatar
jean-paul

FYI, I was able to do a quick fix (for my use-case at least) to make single pass stereo work (I hope). The problem is indeed that the unity_StereoMatrixInvV[1] is always 0. So in my case it seems that this matrix (unity_StereoMatrixInvV[0]) is always an identity matrix. I therefore added the following hack at the start of the Shapes Math.cginc file:

// Shapes © Freya Holmér - <a href="https://twitter.com/FreyaHolmer/" class="redactor-autoparser-object">https://twitter.com/FreyaHolmer/</a>
// Website & Documentation - <a href="https://acegikmo.com/shapes/" class="redactor-autoparser-object">https://acegikmo.com/shapes/</a>

#define SHAPES_INCLUDED_MATH

// Hack for empty unity_StereoMatrixInvV[1]
// Just use the eye 0 matrix (note this could break on more exotic viewMatrices)
#if defined(USING_STEREO_MATRICES)
    // Enforce eye 0 for this matrix
    #define UNITY_MATRIX_I_V unity_StereoMatrixInvV[0] 
#endif

Hope this helps!

Hey @Freya, thanks for the amazing work on this asset, great work. It must be a nightmare to keep up with all the different pipelines and VR stuff...thanks for sticking to it!