# How hard is it to make a shader like this ?

Attention Topic was automatically imported from the old Question2Answer platform.

http://glslsandbox.com/e#62499.0

``````// Necip's experiments to simulate waves like in this video: https://www.youtube.com/watch?v=WDxMas784iY

#ifdef GL_ES
precision mediump float;
#endif

//#extension GL_OES_standard_derivatives : enable

uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;

#define PI 3.14159265

void main( void ) {
vec3 Bcol = vec3(0.4, 0.7, 0.9);

vec2 uv = gl_FragCoord.xy/resolution.xy - 0.5;
//vec2 coord = uv;//vec2(fragCoord/iResolution.xx) - vec2(0.5, 0.5 * iResolution.y / iResolution.x);

vec3 col =vec3(0.1,0.1,0.1);//0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));

float color = 1.0; // length(coord) / 16. - 0.3 + (sin(iTime) / 4.0) ;
//col += color;
float off;
for(float i=0.0; i < 1.0;i++) {
off = i * 3.14 / 1.0 + 0.03 * i;
col+= Bcol *  0.1/((uv.x +0.1)-0.5 * abs(uv.y * 10.0 + sin(uv.x *10.0 + time + off) * 1.0));
}
gl_FragColor = vec4(vec3(col.x),1.0);

}
``````

It has a tons of math and its hard to understand when u look at the code.
İ’m wondering should I be a mathematician to make this kind of shaders ? Or is there a hidden magic behind it ?

Hi.

GLSL: Just look to your original code

GODOT parsing:

``````    // Necip's experiments to simulate waves like in this video: https://www.youtube.com/watch?v=WDxMas784iY
//Aways in shader 2D we have to put next line
//here I change unifor to varying type.
varying float time;
uniform vec2 mouse;
uniform vec2 resolution;

//#define PI 3.14159265
uniform float PI = 3.14159265;

//The main function is our fragment function
void fragment() {

time = TIME;

vec3 Bcol = vec3(0.4, 0.7, 0.9);

//gl_fragcoord is FRAGCOORD in GODOT
//Take off resolution.xy
vec2 uv = UV.xy * 1.6;
//vec2 coord = uv;//vec2(fragCoord/iResolution.xx) - vec2(0.5, 0.5 * iResolution.y / iResolution.x);

vec3 col =vec3(0.1,0.1,0.1);//0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));

float color = 1.0; // length(coord) / 16. - 0.3 + (sin(iTime) / 4.0) ;
//col += color;
float off;
for(float i=0.0; i < 1.0;i++) {
off = i * 3.14 / 1.0 + 0.03 * i;
col+= Bcol *  0.1/((uv.x +0.1)-0.5 * abs(uv.y * 10.0 + sin(uv.x *10.0 + time + off) * 1.0));
}
//gl_FragColor -> COLOR in GODOT
COLOR = vec4(vec3(col.x),1.0);

}
``````

After that it just need some adjustments…
I hope I have helped.

Marcio Antonio Moare | 2023-02-17 03:33