You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create orient attribute (allows us to update normals in the vertex shader)
Create normal (N) attribute if missing
Create tangentu attribute (preferably MikkT)
Create matrix3 from N and tangentu
Convert matrix3 to orient attribute (quaternion)
N=normalize(N);vectortangentu=length(tangentu)>0.01 ? normalize(tangentu) : {1,0,0};matrix3 m =maketransform(normalize(cross(tangentu,N)),N);quaternionorient=normalize(quaternion(m));
Calculate position delta
For each point calculate the vector delta from the first frame to the current frame.
vectordelta=P_current_frame[i]-P_first_frame[i]
If no colour exists add a default vertex colour of 1,1,1
Create a copy of the geometry for every frame in the animation.
This is just a way to access attributes for each frame when generating the texture. This could also be done as a loop when writing the values to the texture.
It can also help with the next step of the process.
Calculate the min and max bounds for the entire animation.
Mesh Preparation
Scale to match target platform (x100)
Triangulate mesh (more consistent that trusting the target platform)
Create uv2
Get max texture width (eg. 1024)
Get total frame count (end frame - start frame + 1)
Add two triangles to the mesh. One at the min and one at the max bound value.
This helps us normalize value when exporting the texture, and then expanding them back to world space in the shader.
You might be tempted to add a single vertex but this can be problematic with some platforms that will automatically cull vertices that aren't associated with a triangle.
@mikelyndon do I understand correctly that the position texture stores a delta from the first frame, rather than an absolute floating-point position? I see the delta calculated but not sure where that is being used. Is that also true for the orient texture?
Position texture stores the delta because we export a static mesh at the first frame of the sequence. The texture is used to update the position as a delta. You could do absolute but deltas generally have less precision issues.
Orient is just the orientation at the current frame of the normal.
@mikelyndon do I understand correctly that the position texture stores a delta from the first frame, rather than an absolute floating-point position? I see the delta calculated but not sure where that is being used. Is that also true for the orient texture?