The only problem too many grass with while loop function killing fps in game
You mean while loop for each grass? It can be solved easily, just use ENABLE_FRAME and event with EVENT_FRAME.
void grass_event_function()
{
if(event_type == EVENT_FRAME)
{
my->skill41 = floatv(wind_x + my->skill1);
my->skill41 = my->skill41 - 0.1 * sinv(16 * total_ticks);
my->skill42 = floatv(wind_y + my->skill2);
my->skill42 = my->skill42 - 0.1 * sinv(16 * total_ticks);
my->skill43 = floatv(wind_force);
my->skill43 = my->skill43 - 0.1 * sinv(16 * total_ticks);
my->skill44 = floatv(wind_amplitude);
my->skill44 = my->skill44 - 0.1 * sinv(16 * total_ticks);
}
}
action fx_animTree()
{
set(my, PASSABLE);
my->material = mtl_animTree;
// randomness for each grass
my->skill1 = 1 + random(2);
my->skill2 = 1 + random(2);
my->emask |= ENABLE_FRAME;
my->event = grass_event_function;
}
As for the trees, yes. It needs some solutions. Maybe we could find some shaders from unity or other engines and try to convert them.
Edit: f.e. this one
[Shader - Open Source] Polygon Wind - for Low Poly Tree Assets
Edit2: I tried to convert it, but failed... due to not being able to get vertex color (without that it looks like default animTree.fx), I tried float4 inColor : COLOR0, but that didn't work.