There is not much difference in shaders in any godot 4 version, Sintra was made in 4.2.2. This video might help explain. Also apologies for the lip-smacking, I had just eaten a sandwich.
AndreDavidDev
Creator of
Recent community posts
Thanks, it's just a vertex shader on a 1x8 Quad Mesh, then I ran this vertex shader:
shader_type spatial;
render_mode cull_disabled;
varying vec3 instance_pos;
uniform sampler2D windNoise: source_color;
uniform sampler2D jitterNoise: source_color;
uniform sampler2D densityNoise: source_color;
uniform vec4 shortColor : source_color;
uniform vec4 tallColor : source_color;
uniform vec4 botColor : source_color;
uniform float subdivision = 10.0;
varying float grass_height;
const float grass_scale = 0.2;
mat2 rotate(float rad){
return mat2(
vec2(cos(rad), -sin(rad)),
vec2(sin(rad), cos(rad)));
}
mat3 scale(float scale){
return mat3(vec3(scale, 0.0, 0.0),
vec3(0.0, scale, 0.0),
vec3(0.0, 0.0, scale));
}
void vertex() {
float windSpeed = 0.07;
float windScale = 200.0;
float windIntensity = 0.7;
float jitterSpeed = 0.1;
float windContrast = 1.0;
vec2 windPos = vec2(TIME * windSpeed) + MODEL_MATRIX[3].xz / windScale;
float windF = clamp(texture(windNoise, windPos).r * windContrast, 0.0, 1.0);
float jitter = texture(jitterNoise, vec2(TIME * jitterSpeed) + MODEL_MATRIX[3].xz).r;
jitter = jitter * 2.0 - 1.0;
jitter *= 0.5;
windF = windF * 2.0 * PI - PI;
vec2 windDir = vec2(cos(windF), sin(windF)) * windIntensity;
windF *= 1.0;
vec2 tipAngle = windDir - jitter * 0.6;
VERTEX.xy = floor(VERTEX.xy * rotate(tipAngle.x * (VERTEX.y / subdivision)));
VERTEX.yz = floor(VERTEX.yz * rotate(tipAngle.y * (VERTEX.y / subdivision)));
//BIllboarding
MODELVIEW_MATRIX = VIEW_MATRIX * mat4(vec4(normalize(cross(vec3(0.0, 1.0, 0.0), INV_VIEW_MATRIX[2].xyz)), 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(normalize(cross(INV_VIEW_MATRIX[0].xyz, vec3(0.0, 1.0, 0.0))), 0.0), MODEL_MATRIX[3]);
NORMAL = vec3(0.0,1.0,0.0); //hack
///Normal Hack, return when you have 3D rot matrix function
if(false){
vec3 norm1 = vec3(0.0,1.0* 0.8,1.0);
vec3 norm2 = vec3(1.0,0.0* 0.8,1.0);
vec3 normal = mix(norm1,norm2,UV.x);
NORMAL = normalize(normal);
}
grass_height = texture(densityNoise, MODEL_MATRIX[3].xz / 75.0 ).r;
grass_height = max(0.25, grass_height);
VERTEX.xyz = VERTEX.xyz * scale(grass_height * grass_scale);
}
void fragment(){
if(!FRONT_FACING){
NORMAL = NORMAL * -1.0;
}
//ALBEDO = some_color;
//ALBEDO = vec3((1. - UV.y)/ 2.0);
vec4 topColor = mix(shortColor,tallColor, grass_height);
//vec4 topColor = mix(shortColor,tallColor, 1.0);
float contrast_uv = clamp((UV.y-0.5) * 2.0 + 0.5, 0.0, 1.0);
ALBEDO = mix(botColor.rgb,topColor.rgb, floor((1. - contrast_uv) * subdivision) / subdivision);
//ALBEDO = vec3(topColor.rgb * (contrast_uv));
}
it's not very clean as this was all playground/testing stuff. But if you copy and paste this onto a shader you should achieve the same thing.
Great to the gameplay <3 tip: crouching while walking on water makes no noise ahahah, I think I need to add a few more tips and warnings as the game is short but a real challenge. The game is released and you can unlock the full game now, I should also say the game will be released on steam soon and anyone who purchases on itch before the release will be given a steam key as well.