Triplanar mapping from Local Space - problem when scaling. How to make it work?

The Ben Golus’s version is perhaps on the heavy side, but yeah, definitely works.