#grass sway wind strength

1 messages · Page 1 of 1 (latest)

wind rock
#

why when i have the wind strength set to like 0.9, the fps drop about 20, set it to 0.2 and it regain 20 fps. how is this small thing drop so much fps, where can i optimize this

somber elk
#

Might be that larger displacements cause triangles to stretch more, so more pixels/fragments produced and potentially more overdraw.
Reducing the tiling in the noise might help a bit. Could also try swapping that out for a texture rather than procedurally generated noise.

wind rock
#

oh using a noise texture is better than the using the nodes ?

#

reduce the tiling seem to help 2-5 fps, idk if it real

wind rock
#

i switch to texture now it drop even more fps
not sure if i did it correctly

somber elk
# wind rock oh using a noise texture is better than the using the nodes ?

Could be, but varies depending on the target platform. Was more a suggestion of something to try and see what difference it makes. That tends to be how debugging/optimisation works. If it performs worse maybe go back to what you had before.

Could also try other setups instead of noise. I tend to use a Sine wave. e.g.
https://www.cyanilux.com/tutorials/vertex-displacement/#swaying-grass or
https://www.cyanilux.com/tutorials/gpu-instanced-grass-breakdown/#wind

If the current fps is actually an issue you may need to look for other places to optimise too. I wouldn't say the vertex shader here is that complex.

wind rock
# somber elk Could be, but varies depending on the target platform. Was more a suggestion of ...

at first i just have the enable gpu instancing checkbox on the material, with every grass a gameobject on the scene, each grass stick to a block on the world. maybe theres a different setup?

now i tried the .DrawMeshInstance api

{
    public Mesh grassMesh;
    public Material grassMaterial;
    public Quaternion grassRot = Quaternion.Euler(0, 0, 0);
    public Vector3 grassScale = Vector3.one;
    public Vector3 offsetPos = Vector3.zero;

    public Transform[] blocks;
    private List<Matrix4x4> matrices = new();

    void Start()
    {
        matrices.Clear();

        foreach (var block in blocks)
        {
            Vector3 pos = block.position + Vector3.up * 1.2f + offsetPos;
            matrices.Add(Matrix4x4.TRS(pos, grassRot, grassScale));
        }
    }

    void LateUpdate()
    {
        Graphics.DrawMeshInstanced(grassMesh, 0, grassMaterial, matrices);
    }
}

now it gave me equal or even less performance, i dont get it

#

havent touch render stuff before but im at 100fps with laptop gtx1650 havent built yet
i guess i can ignore this for now

lapis meteor
wind rock
#

i spent the last few hours follow to this part
i only have 108 instance and can only get up to 90 fps

lapis meteor
#

As Cyan first mentioned the main performance cost may be overdraw or fragment shader complexity, indicated by how you lose framerate as the grass sways more
That would be unaffected by instancing