Is there a way to update Custom data within gpu?

Basically I am trying make a material for a grass mesh.

And I want to simulate the grass motion due to wind.

Instead of just using sine wave, I am trying to implement some rotational dynamic based motion.

This needs each grass to keep displacement vector and some velocity vector.
The current displacement and velocity are used to calculate the displacement and velocity in the next time step.

So I think I should use custom primitive data for storing the displacement and velocity, so that the material can use these data to calculate position offset.

And I want to update the data in each time step.

Is there a way that this can be done only in GPU.

The wind data is stored as a texture and can be read in GPU.
The next velocity and displacement of the grass is calculated from the world transformation of the grass, wind data, current velocity and current displacement.

So basically, I want to store some values as custom primitive data, and have a way to update the values within GPU whenever a frame is created.

Maybe through the scene uniform buffer?

A texture lookup could also probably be a viable option inside of a custom material node

For pure GPU calculations look into compute shaders.

In the end, I have decided to use Niagara.
And use Particle attributes(color and velocity) to store instance data, and make material graph to access those particle attributes.

Why my meshes have some smoky after image - Development / Rendering - Epic Developer Community Forums

And as shown in my another post, it has some smoky after image problem.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.