Thanks for the reply!
I've been instructed about this technique but have yet to test or implement successfully.
To be able to save vertex offsets calculations done in the shader back into a mesh object in unity (for opengl es3.0 hardware) apparently there is only one way to do it.
- Calculate unique uv's and map to vertices in c# script
- Set indices of the mesh and have them display as points
- Upload meshdata to the gpu
- Then In the shader, the unique UV's are passed to POSITION
- The (WorldPosition * Vertex pos) is passed to the TEXCOORD0
- This is then output in the frag program
- From there, back in c#, the script reads the buffer and converts the output back into a vertex array
- vertex array reassigned to mesh and now vertex transformations can be saved.
Obviously this is not simple and I've been struggling with it for two days now. I've been told that the skinner project on github implements something like this.
The relevant parts are the shader =>
https://github.com/keijiro/Skinner/blob ... ment.cgincand the mesh preperation =>
https://github.com/keijiro/Skinner/blob ... erModel.csI'm currently trying to implement the shader, but I don't know how to pass these two lines in the shader graph
// POSITION <= UV on the attribute buffer
o.position = float4(v.texcoord.x * 2 - 1, 0, 0, 1);
// TEXCOORD <= World position
o.texcoord = mul(unity_ObjectToWorld, v.vertex).xyz;
Any help would be appreciated!