Shader - Script Data?

Hello!I can’t seem to figure out how i would be able to send the position of a vertex calulated by a shader to a script or write it somewhere as an array so i can later read it using usual scripts(Such as JavaScript/C#).

The reason i wanna do this is because i have a mesh that’s being deformed using a shader,but as you might already know it unfortunately doesn’t change the wireframe too (So i can add a mesh collider to it,for instance).

(Unity - Manual: Surface Shader examples)

Thanks!

Anyone,please? :frowning:
Is it even possible? :frowning:

You can not send anything.
the only thing you could do is fill a variable defined in the shaderlab and then use the script to read it out through the Get functions. But that will not work ‘per vertex’ as you can’t send that large data blocks and sending gpu → RAM is extremely inefficent

And just for mesh deformation it makes no sense, you could do that in a thread just as well

Thank you for the anwser,but :
It is too slow :frowning: My player moves very fast and you would see the chunks being generated on the fly or even worse : the player would move faster than my computer would generate…Even with threads and prioritization.
If i want to deform 64 planes (64 x 64 verts each) with a single simple Perlin noise function it would take about 2.5 seconds using threads and not having the Frame rate below 10…So if i want to go into more complex noise functions,it would take more than 15 seconds (Just for 64 chunks!)…[Even if i don’t use noise functions it laggs a few seconds on deformation].And as my player aproches the terrain it would have to deform/generate that amount of meshes in less than 1 or 0.5 seconds (262144 vertices changed!).And this would be just the terrain of the game…If there are AIs,guns and stuff,it wouldn’t simply work on simple computers (And i don’t want my game to run only on 16GB RAM computers and such :frowning: ).Looks like GPU deformation takes almost no time,but is very hard to handle for me since the terrain has to have a collider aswell,and for that i need to update the CPU mesh aswell :frowning:

Also,i forgot to mention that my terrain is curved before deformation (and all the chunks form a QuadSphere) .