Curved World Shader (code included)

1000h1000h Posts: 133Member
edited April 2017 in Shaders

The Animal Crossing Shader has an article on how to do it online by someone named Alastair.
https://alastaira.wordpress.com/2013/10/25/animal-crossing-curved-world-shader/

I had never done anything with shaders before, but I wanted to give this a shot after seeing it in Four Warriors of Light, so here is his code in a manner that works for me in Godot:

If anyone was a noob like me, notice that in order for whatever code to take effect on the desired built-in, you need to set that built in to your manipulated variable, as in the last line VERTEX = v;

Also, it took forever for me to find this link, so here it is:
http://docs.godotengine.org/en/stable/learning/features/shading/shading_language.html?highlight=shader

float curve = -.001;
vec3 v = VERTEX;
mat4 mv = MODELVIEW_MATRIX;
mat4 wv = WORLD_MATRIX;
mat4 cv = INV_CAMERA_MATRIX;

//v*= vec3(1,1,1);

vec4 vv = mv * vec4(v,0.0);

vv -= cv.x;
vv -= cv.y;
vv -= cv.z;

vv = vec4(0.0,pow(vv.z,2)*curve,0.0,0.0);
vv*=wv;
vec3 vvp = vv.xyz;

v+=vvp;

VERTEX = v;

Tags :

Comments

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file