orels1 / orels-Unity-Shaders

A collection of practical Unity shaders for your next project
https://shaders.orels.sh
Other
178 stars 15 forks source link

Fix dissolve module not dissolving fully #80

Closed lackofbindings closed 3 months ago

lackofbindings commented 3 months ago

Currently when _DissolveCutoff is set to 1, a small amount of the glowing border can still be visible. This change adjusts the remap to increase the max value to 1.1 in the same way that the min value is -0.1. This appears to be all that is needed to ensure that no border is visible when fully dissolved.

orels1 commented 3 months ago

Hey! Thanks for the PR! While I do agree with the idea of bumping it, in my personal avatar project I ended up changing it to something like this

_DissolveCutoffRangeMin("Cutoff Range Min %CombineWith(_DissolveCutoffRangeMax)", Float) = -0.1
[HideInInspector]_DissolveCutoffRangeMax("Max", Float) = 1

So then the remap is done like

_DissolveCutoff = remap(_DissolveCutoff, 0, 1, _DissolveCutoffRangeMin, _DissolveCutoffRangeMax);

We could also bump the default max to 1.1 too, to do both. I found that in some cases you will want values higher/lower than 0-1 range especially when using local positions. So expanding this to support arbitrary values is probably a better approach.

lackofbindings commented 3 months ago

That sounds fine to me. Unless there’s some better way to ensure that the surface is fully hidden/shown when at 1/0

orels1 commented 3 months ago

Going to close this PR as I have implemented it in 6.4.0-dev.9 here