Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Releases: nixon-voxell/BlenderMeshToJSON

Getting out of alpha stage

28 Feb 04:58
Compare
Choose a tag to compare
Pre-release

This version exports mesh's:

  • particle/vertex data
  • edge data
  • triangle/face data
  • neighbor triangle/face data
  • sequence data (an array of vertex id with sections of connected triangles towards a vertex that is specified in sequence length array)
  • sequence length data (an array that specifies sections of connected triangle vertex id in sequence data array)
    ex:
sequence = [    1, 2, 3,   1, 2, 4,   1, 4, 5,      6, 7, 8,  6, 8, 9,  6, 8, 10    ]
sequence_length = [3,  6]

so to get the actual seq length, we get it by subtracting the prev seq length

length 1 = sequence_length[0] - 0 = 3
length 2 = sequence_length[1] - sequence_length[0] = 3

noticed that the sequence is grouped in 3 because each face must be a triangle, no quads are allowed here.

using this method, we can recalculate the normals like so:

for (int idx=0; idx < totalVerts; idx++)
{
  uint start_seq = idx == 0 ? 0 : sequenceLength[idx-1];
  float3 predNorm = float3(0, 0, 0);
  for (uint s=start_seq; s < sequenceLength[idx]; s++)
  {
    float3 p0 = pos[sequence[s*3]];
    float3 p1 = pos[sequence[s*3 + 1]];
    float3 p2 = pos[sequence[s*3 + 2]];
    predNorm += normalize(cross(p1-p0, p2-p0));
  }

  norm[idx] = normalize(predNorm);
}

ClothExporter

02 Nov 04:32
Compare
Choose a tag to compare
ClothExporter Pre-release
Pre-release

The first stage of this add-on for blender. This add-on converts any face with more than 3 vertices into proportional triangles.