UnityFurURP icon indicating copy to clipboard operation
UnityFurURP copied to clipboard

Fixing Lit Geom colors (PP) and shadows, and adding SinglePassInstanced support

Open cdibbs opened this issue 2 years ago • 8 comments

Fixing two things:

  • unclamped color resulting in a quite brilliant sparkling effect when postprocessing is turned on (see below);
  • missing shadows in URP 12.1 (per https://github.com/hecomi/UnityFurURP/issues/4#issuecomment-982723434);

and adding one:

  • Single-Pass Instanced VR mode (what I originally set out to do);

in each of the shaders which should close #7. ~in only the Lit Geometry shader. I have no plans to fix the other shaders but they shouldn't be too hard for anyone else to fix as they need, in the spirit of open source.~ :-) With SPI, due to the lack of documentation on the subject, I ended up taking the advice of someone in a forum somewhere and just turned on MockHMD and prayed and trial-and-errored until it worked. 😆

unity-fur-sparkle-ezgif-4-0ec1a518c0

cdibbs avatar Apr 10 '22 21:04 cdibbs

Thank you for the great PR 👍

I tried running the changes you made with 2020.3.9f1, which was the version of Unity at the time I uploaded the project, but the lighting calculations seemed to go wrong.

original image

PR image

It is currently difficult to identify the cause of the problem because multiple changes are combined in one PR. It would be greatly appreciated if you could provide a separate PR for each modification 🙏

hecomi avatar Apr 17 '22 05:04 hecomi

@hecomi Apologies, I should have had better git etiquette than this. Thankfully, I think I found the issue right away.

Basically, I didn't realize UniversalFragmentPBR handled shadows, so I started to implement an incorrect "fix" mentioned in an Issue on this repo, and then failed to remove it from every shader once I realized the error.

Anyway, I shall push a fix here shortly. It fixes it in 2020.3.33 LTS so I assume it will work in 2020.3.9f1 also.

cdibbs avatar Apr 26 '22 23:04 cdibbs

@hecomi I noticed another issue specific to 2020.3: the pragmas need to specify shadows differently pre-2021, otherwise, at the point when shadows would be out of range, there's a strange flickering. I've fixed this in the latest commit.

cdibbs avatar Apr 28 '22 00:04 cdibbs

With SPI, due to the lack of documentation on the subject, I ended up taking the advice of someone in a forum somewhere and just turned on MockHMD and prayed and trial-and-errored until it worked. 😆

Hi, I am adding VR single pass instance support to another PR #10 (almost done, so that hecomi can merge all PR easier) Thanks a lot for sharing this (and the code), or I will spend days on google!😂

jiaozi158 avatar Apr 28 '22 14:04 jiaozi158

@hecomi I read your comment about wanting to keep the repo fitting the original tutorial. That makes a lot of sense to me. But it also might make sense to increase the breadth of the tutorial and track latest LTS Unity versions. What if you used feature branches and made note of them in the readme?

cdibbs avatar May 03 '22 14:05 cdibbs

I think it is a nice idea. I would like to catch up with the latest Unity updates as much as possible. On the other hand, I think the problem is that it is all my hobby activity and my time is limited 😭 (I'm not a Unity user by profession, so that also has an impact). I would be very happy to see some activities, for example, someone forks or references this repository and starts another repository with more advanced implementations (I would like to refer to those too).

hecomi avatar May 07 '22 14:05 hecomi

That sounds good. I'm also not a Unity user by profession, but just a hobbyist. I actually ended up not using this technique in my project (so far) since I was trying to fake really dense lawn grass and I found a different way to do that which was more consistent with the broader project. So, I'll probably leave creating a more advanced, authoritative fork to anyone else who wants to take up the mantle. Otherwise, I'll leave the PR open for anyone needing VR support (it does work now, shadows included, in the latest two LTS versions, 2020.3 and 2021.3).

Anyway, thanks for a great learning project. Next on my list is compute shaders (which are supposed to be more efficient and have broader compatibility than geometry shaders?)

cdibbs avatar May 07 '22 15:05 cdibbs

I would be very happy to see some activities, for example, someone forks or references this repository and starts another repository with more advanced implementations (I would like to refer to those too).

Great thanks to this repository!🎉

I referenced this repo and published all previous changes here.

jiaozi158 avatar May 19 '22 08:05 jiaozi158