Skip to content

Instantly share code, notes, and snippets.

Avatar
👾

aggregate1166877

👾
View GitHub Profile
@aggregate1166877
aggregate1166877 / GodotCleanFisheyeBarrelDistortion.shader
Last active Jan 8, 2021
Godot fisheye / barrel distortion shader with minimal pixelation
View GodotCleanFisheyeBarrelDistortion.shader
/**
* This shader creates fisheye or barrel distortion by sliding values in the
* desired direction. It aims to have a minimal amount of pixelation, and was
* originally conceived of to procedurally generate cartoon planets and bodies
* from easily generatable flat textures.
*
* Thanks to user Dan (6145) on Stack Overflow for providing the math. I also
* stole some code from here for the texture placement:
* https://gist.github.com/quiglemj/971f4cec1b128c58b4864c5200bfc579
* This shader differs from the above gist in that it does not stretch the