Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simpli water ripple shader from GODOT Game Engine
// screenshot of shader http://imgur.com/Iq2Rkc2
// ---------------
// Vertex shader
// ---------------
VAR1 = normalize(MODELVIEW_MATRIX * vec4(VERTEX.x,VERTEX.y,VERTEX.z,1.0));
// ---------------
// Fragment shader
// ---------------
uniform cubemap reflect_map;
uniform float power = 26.5;
uniform float time_ratio = 0.8;
uniform color water_color = vec4(0.24,0.45,0.24,1.0);
uniform float mist = 0.4;
vec2 cen = UV - vec2(0.5,0.5);
float rTime = TIME*time_ratio;
float d = length( cen ) * 2.0;
float _d = 1.0-d;
float s = sin( power * d - rTime) * _d;
float c = cos( power * d - rTime) * _d;
NORMAL.x += c;
NORMAL.y += s;
NORMAL = normalize( NORMAL );
//vec3 n_reflection = normalize(reflect(vec3(VAR1.x+cen.x,VAR1.z,VAR1.y+cen.y), NORMAL));
vec3 n_reflection = normalize(reflect(vec3(VAR1.x,VAR1.y,VAR1.z), NORMAL));
vec4 cor = texcube(reflect_map, n_reflection ); //vec3(cen.x,cen.y,0.54));
cor.a = water_color.a;
DIFFUSE_ALPHA = mix(water_color,cor,mist);
//DIFFUSE = vec3(cor.r,cor.g,cor.b);// + vec4(1.0,1.0,1.0,1.0)*abs(s); //vec4(0.0,0.2,0.6,1.0);
//DIFFUSE_ALPHA = mix(cor, vec4(1.0,1.0,1.0,1.0), abs(s)); //vec4(0.0,0.2,0.6,1.0);
// ---------------
// Light shader
// ---------------
float NdotL = max(0.0,dot( NORMAL, LIGHT_DIR ));
LIGHT = LIGHT_DIFFUSE * DIFFUSE * NdotL;
if (NdotL > 0.0) {
//vec3 half_vec = normalize(LIGHT_DIR + EYE_VEC);
//float eye_light = max(dot(NORMAL, half_vec),0.0);
//LIGHT+=LIGHT_SPECULAR * SPECULAR * pow( eye_light, SPECULAR_EXP );
};
@chandujr

This comment has been minimized.

Copy link

commented Mar 16, 2016

Do you know which shading language version Godot requires? Is it v1.30? My old PC (running Windows 10 x64) supports only upto v1.20 but it supports OpenGL version 2.1. Godot cannot be opened in that system. I'm looking for the reason for that.

https://cloud.githubusercontent.com/assets/14921501/13727445/db20d4d2-e918-11e5-891e-eb047b1b5f24.PNG

@Megalomaniak

This comment has been minimized.

Copy link

commented Apr 18, 2016

chandujr yeah, godot's renderer is openGL ES 2.0: GLSL ES version is 1.0 but in desktop OpenGL GLSL terms it's the equivalent of 1.20.8 or #version 120
from the GLSL_ES_Specification_1.0.17.pdf:

The OpenGL ES Shading Language (also known as GLSL ES or ESSL) is based on the OpenGL Shading
Language (GLSL) version 1.20

There might be however a limited subset of the standard that intel isn't supporting in the driver, I would expect for those bit's to be handled then on the CPU side, but who knows. :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.