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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a Vogel spiral in the sampling method of PCSS for directional light #7371

Merged
merged 7 commits into from
Feb 26, 2025

Conversation

querielo
Copy link
Contributor

@querielo querielo commented Feb 24, 2025

Vogel spiral distribution reduces visible noise and achieves more uniform sample coverage.

Main PR
https://playcanvas.vercel.app/#/graphics/shadow-soft https://engine-h6nesoji0-playcanvas.vercel.app/#/graphics/shadow-soft
Screenshot 2025-02-24 at 01 47 36 Screenshot 2025-02-24 at 01 47 51
Screenshot 2025-02-24 at 01 17 35 Screenshot 2025-02-24 at 01 17 09

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

PCSS: Use a Vogel spiral in a sampling method
@querielo querielo changed the title Use a Vogel spiral in the sampling method of PCSS Use a Vogel spiral in the sampling method of PCSS for a directional light Feb 24, 2025
@querielo querielo changed the title Use a Vogel spiral in the sampling method of PCSS for a directional light Use a Vogel spiral in the sampling method of PCSS for directional light Feb 24, 2025
@mvaligursky
Copy link
Contributor

The noise improvement is great. I'm just hoping something can be done with this banding on the long pole.

Screenshot 2025-02-24 at 14 06 47

I wonder if similar factor applied to radius would help:
pow(data.currentRadius, 0.75)

@querielo
Copy link
Contributor Author

querielo commented Feb 24, 2025

@mvaligursky Now I know why we use pow here.

Falloff: 10

Main
Screenshot 2025-02-24 at 16 16 26

vec2 offset = vec2(cos(theta), sin(theta)) * pow(r, 0.75);
Screenshot 2025-02-24 at 16 16 29

vec2 offset = vec2(cos(theta), sin(theta)) * r;
Screenshot 2025-02-24 at 16 16 32

vec2 offset = vec2(cos(theta), sin(theta)) * pow(r, 1.333); // 1.0 / 0.75
Screenshot 2025-02-24 at 16 16 36

What do you think about it?

@mvaligursky
Copy link
Contributor

It seems like this could work? Update the PR so I can run it locally to test.

@querielo
Copy link
Contributor Author

@mvaligursky Done: vec2 offset = vec2(cos(theta), sin(theta)) * pow(r, 1.333);

@mvaligursky
Copy link
Contributor

Perfect @querielo, this behaves equivalently now with visibly less noise, especially when the number of samples is low.
Please remove the poisson sampling in favour of vogel, and we're done!

@querielo
Copy link
Contributor Author

@mvaligursky Done

Copy link
Contributor

@mvaligursky mvaligursky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fantastic change, thanks!

@mvaligursky mvaligursky merged commit f705e75 into playcanvas:main Feb 26, 2025
7 checks passed
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.

2 participants