Closed defektu closed 12 months ago
Made a ViolentMonkey script for quick test in editor. https://github.com/defektu/Playcanvas-Editor-Scripts Thanks to @yaustar for good example
Hi @mvaligursky , Do you think it would be a good feature implementation? I might create a PR about it.
To be honest, perhaps not at the moment. I have few comments at the moment:
Thanks for the feedback Martin.
Newly introduced arrays can be eliminated by using light" + i + "_position
& light" + i + "_radius
in lit-shader.js
I assume.
On physicaly correct part, I need to cross-check it cause of quick implementation.
If you consider adding it as a render feature after glTF material model milestones just ping me up so I might work over it.
Newly introduced arrays can be eliminated by using
light" + i + "_position
&light" + i + "_radius
inlit-shader.js
I assume.
But those are only available in non-clustered mode. Clustered mode encodes lights in textures and so this is harder to do this way.
If you consider adding it as a render feature after glTF material model milestones just ping me up so I might work over it.
Absolutely. Please feel free to create an issue to implement SSS and link this PR there as WIP, so that we won't forget, thanks a lot!
I was working on subsurface scattering implementation over Lit Shader. I did not wanted to open a PR because I'm not sure about implementation is mathematically right.
Here is the project that I've cleaned up for you guys. https://playcanvas.com/editor/scene/1751652 (?debug=true flag opens up gui.) https://playcanv.as/p/KW8u9ebM/?debug=true
Implementation
pointLightCount
- total point countlightPointsPos[]
- Array for light positionslightPointsRad[]
- Array for light rads;addSSS()
- adds up sss effect on top of refraction shader.Screenshots
SSS on SSS off
This is an old build but you can change some variables with dat.gui (debug=true flag opens up gui.): https://playcanv.as/index/ca8102ee