Is there a shader that simulates a small breeze to make the grass and trees flutter a bit? lol
Actually, yes there is.
@Lezardo (iStripper Team) created and shared a vertex shader many moons ago which I used, sometimes combined with a fragment shader in the same scene, in a few of my scenes.
Here's the slightly modified code done by Wyld and it's called Move2.vsh :
// Coordonnees de texture et couleur pour le fragment
//
//
// additions by WyldAnimal
// some custom variables to play with..
// define some variable to use in the formulas
// you can make up your own variable names to use...
//
#define Xoffset 20.0
#define Xmultiplier 30.0
#define Yoffset 10.0
#define Ymultiplier 10.0
// only leave one of these not commented.
// it will control which set of formulas is used.
#define UseSine
//#define UseCosine
//#define UseBoth
//#define UseTangent // use smaller values above with Tan
varying vec4 gl_TexCoord[5];
varying vec4 gl_FrontColor;
uniform float u_Elapsed;
void main()
{
vec4 displacedVertex;
displacedVertex = gl_Vertex;
float len = length( displacedVertex );
// inserted the custom variables in the formulas
// and added tests to determine what set of formulas to use
// test if UseSine is not commented ( it's Defined )
// if it is, then uses these formulas
#ifdef UseSine
displacedVertex.x += Xoffset * sin( u_Elapsed + len *Xmultiplier);
displacedVertex.y += Yoffset * sin( u_Elapsed + len *Ymultiplier);
#endif
// test if UseCosine is not commented ( it's Defined )
// if it is, then uses these formulas
#ifdef UseCosine
displacedVertex.x += Xoffset * cos( u_Elapsed * len *Xmultiplier);
displacedVertex.y += Yoffset * cos( u_Elapsed + len *Ymultiplier);
#endif
// test if UseBoth is not commented ( it's Defined )
// if it is, then uses these formulas
#ifdef UseBoth
displacedVertex.x += Xoffset * sin( u_Elapsed * len *Xmultiplier);
displacedVertex.y += Yoffset * cos( u_Elapsed + len *Ymultiplier);
#endif
// test if UseTangent is not commented ( it's Defined )
// if it is, then uses these formulas
#ifdef UseTangent
displacedVertex.x += Xoffset * tan( u_Elapsed * len *Xmultiplier);
displacedVertex.y += Yoffset * tan( u_Elapsed + len *Ymultiplier);
#endif
// Position sur l'ecran
gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * displacedVertex;
// Position dans la texture
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_FrontColor = gl_Color;
}
This will make any image or texture you apply it to, 'sway' like grass in a breeze as
@Lezardo originally intended it to do.
You need to save it as a .vsh file and then add it to the .scn code where you want it to work, such as this:
node {
sprite {
pos: 0, 0
hotspot: 0.5, 1.0
shader: vertex, Move2.vsh
source: Back
material: true
opacity: 0.6
blend: true
size: 1920, 1080
resolution: 15
}
} // close node
Of course, you probably need to play around with the numbers to match your scenes but I think you guys are getting used to that by now :/