Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

cdibbs
Copy link

@cdibbs cdibbs commented Apr 10, 2022

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 No shadows聽#4 (comment));

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 cdibbs changed the title Fixing Lit Geom SinglePassInstanced and shadows Fixing Lit Geom colors (PP) and shadows, and adding SinglePassInstanced support Apr 11, 2022
@hecomi
Copy link
Owner

hecomi commented Apr 17, 2022

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 馃檹

@cdibbs
Copy link
Author

cdibbs commented Apr 26, 2022

@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
Copy link
Author

cdibbs commented Apr 28, 2022

@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.

@jiaozi158
Copy link
Contributor

jiaozi158 commented Apr 28, 2022

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!馃槀

@cdibbs
Copy link
Author

cdibbs commented May 3, 2022

@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?

@hecomi
Copy link
Owner

hecomi commented May 7, 2022

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).

@cdibbs
Copy link
Author

cdibbs commented May 7, 2022

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?)

@jiaozi158
Copy link
Contributor

jiaozi158 commented May 19, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Single Pass Instanced VR compatibility
3 participants