On Tue, Apr 23, 2013 at 12:38 PM, Renk Thorsten wrote: > Oh, do you still have that somewhere? I would love to play with this > implemented in an optional high-quality tree shader - I could probably also > add some grass movement by translating the grain texture or the hires noise > with time into the wind direction...
Fortunately I still have the vertex shader stashed away, but I've lost the effect file. I added additional uniforms to tree.vert: uniform float osg_SimulationTime, WindE, WindN; WindE and WindN are almost certainly /environment/wind-from-[east|north]-fps I think osg_SimulationTime is built in. The actual code to do the translations is this shear code, placed between the rotation and placement in the correct location: // Rotation of the generic quad to specific one for the tree. position.xy = vec2(dot(position.xy, vec2(cr, sr)), dot(position.xy, vec2(-sr, cr))); // Shear by wind. Note that this only applies to the top vertices // [top vert only] [time dependent movement] [seed so trees close together move together] position.x = position.x + position.z * (sin(osg_SimulationTime * 0.7 + (gl_Color.x + gl_Color.y + gl_Color.z) * 0.01) + 1.0) * 0.001 * WindN; position.y = position.y + position.z * (sin(osg_SimulationTime * 0.7 + (gl_Color.x + gl_Color.y + gl_Color.z) * 0.01) + 1.0) * 0.001 * WindE; // Move to correct location (stored in gl_Color) position = position + gl_Color.xyz; ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel