-
Notifications
You must be signed in to change notification settings - Fork 167
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various features added for Shell Lit #10
Conversation
1. A "DepthNormals" Pass (For forward renderer) 2. Adding specular scattering from "maajor"'s https://github.com/maajor/Marschner-Hair-Unity, licensed under MIT. 3. Controlling the length of fur using a texture (R channel). 4. Fixed issues when using Depth Priming on URP 12. (Depth Priming avoids rendering pixels that are occluded [probably] which improves performance)
Don't know why I disabled it. Did not mention "Light Layer" on UPR12 because it does not support Specular Scattering, will add support (later...).
I used a wrong uv to sample the BaseMap. Just realized it because scaling the BaseMap is not common (except testing scene)
I am quite confused now. I heard that negative "light.direction" should be used in shaders, but maajor is using a positive "light.direction". (and looks fine? Did not see upside down lighting in the demo)
So positive / negative, which one is correct? |
1. Add XR single pass instance support for both Shell Lit and Shell Unlit. 2. Increase maximum shell amount. (requires "#pragma target 4.6", or will fall back to 13 shells.) 3. Add option to disable fur shadow (show original mesh shadow only).
Thank you for the pull request. I am willing to accept the As for the light direction, sorry, I have not read that library so I do not know the detailed implementation. But whether it is positive or negative depends on the internal implementation; I recommend comparing the calculation in the official Unity shader with the Marschner-Hair-Unity calculation ( |
Thanks for checking this PR! I will try to make another PR (DepthNormals, Shadow and XR) Just to confirm, another PR would be something like this or?
|
Edited:
Hi, if you would like to try the changes mentioned below, you can still find it here
Commit into Shell (Lit) because it is the most performant one among three.
Changes:
1. Add "DepthNormals" Pass (For forward renderer, stores normal only).
"_CameraNormalsTexture"

Now SSAO (Depth Normal mode) works. (Should enable "After Opaque" in URP 12)
URP 12 Depth Priming (Depth pre-pass) works.
2. Adding specular scattering. (No effect on front face)
3. Controlling fur length using one texture (Red channel).
4. Fixed issues when using Depth Priming on URP 12.
5. Fixed MainLight Shadow issue on URP 12. (Shell Lit only)
6. Add XR single pass instance support for both Shell Lit and Unlit.
7. Increase maximum Shell Amount (13 to 52). (Optional)
Using geometry shader instancing, so it requires "#pragma target 4.6". (Equivalent to OpenGL 4.1)
If the device does not support "#pragma target 4.6", it will fall back to 13 shells maximum. (No error should occur)
The
Shell Step
is now being replaced byTotal Shell Step
.so that no matter how many shells are using, fall back fur appearance should not change too much.
You may control it more from the comments in Shell's "Lit.hlsl".


The performance should still be better than the other two method. (Also please try Depth Priming)
If your fur is "toooo long", you will meet Camera Frustum Culling issue at the edges of view, you can try increasing mesh bounds and that should solve the problem. (Other two fur methods should also meet this issue if "toooo long")
8. Add disable fur shadow option. (Mesh Shadow Only)
Quick tested on Unity 2020.3.23, no visible problem [probably]:
