YaroslavLinder commited on
Commit
9937ec3
·
1 Parent(s): e0d67d9
3D/animations/fetch_files.bat ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ for %%u in (
3
+ "https://sketchfab.com/3d-models/540-hyper-round-9305ffbce4a348acbb830823e5390f91"
4
+ "https://sketchfab.com/3d-models/hook-kick-4c8dc446b6764929b65685cd3063e9bd"
5
+ "https://sketchfab.com/3d-models/side-kick-b6a522c83f7c4078bccc1df766cc67ab"
6
+ "https://sketchfab.com/3d-models/side-kick-b6a522c83f7c4078bccc1df766cc67ab"
7
+ "https://sketchfab.com/3d-models/540-hyper-round-9305ffbce4a348acbb830823e5390f91"
8
+ ) do (
9
+ python sketchfab_animation.py %%~u --overwrite
10
+ )
3D/animations/sketchfab_animation.py CHANGED
@@ -824,17 +824,21 @@ def export_animation(scene, animation, raw, clip_name, fps, scale, geometry_buff
824
  if key in axis_cache:
825
  axis = axis_cache[key]
826
  else:
827
- theta = pole * (3.14159265359 / (nphi - 1))
828
  cosine, sine = math.cos(theta), math.sin(theta)
829
- theta += 1.57079632679 / (nphi - 1)
830
- ratio = (math.cos(0.01745329251 * epsilon) - cosine * math.cos(theta)) / max(1e-5, sine * math.sin(theta))
831
- ratio = max(-1, min(1, ratio))
832
- phi = 6.28318530718 * azimuth / math.ceil(3.14159265359 / max(1e-5, math.acos(ratio)))
 
 
 
833
  axis = (sine * math.cos(phi), sine * math.sin(phi), cosine)
834
  # The viewer caches axes in Float32Array; first use retains doubles.
835
  if 3 * (pole + nphi * azimuth) < 1801779:
836
  axis_cache[key] = tuple(f32(x) for x in axis)
837
- half_angle = 0.000047938362584151635 * angle
 
838
  sine = math.sin(half_angle)
839
  return [f32(sine * x) for x in axis] + [f32(math.cos(half_angle))]
840
 
 
824
  if key in axis_cache:
825
  axis = axis_cache[key]
826
  else:
827
+ theta = pole * (math.pi / (nphi - 1))
828
  cosine, sine = math.cos(theta), math.sin(theta)
829
+ theta += (math.pi / 2) / (nphi - 1)
830
+ ratio = (
831
+ math.cos(math.radians(epsilon)) - cosine * math.cos(theta)
832
+ ) / max(1e-5, sine * math.sin(theta))
833
+ ratio = max(-1.0, min(1.0, ratio))
834
+ phi = math.tau * azimuth / math.ceil(
835
+ math.pi / max(1e-5, math.acos(ratio)))
836
  axis = (sine * math.cos(phi), sine * math.sin(phi), cosine)
837
  # The viewer caches axes in Float32Array; first use retains doubles.
838
  if 3 * (pole + nphi * azimuth) < 1801779:
839
  axis_cache[key] = tuple(f32(x) for x in axis)
840
+ # Convert 15-bit integer angle to half-angle in radians ([0, pi/2])
841
+ half_angle = ((math.pi / 2) / 32767) * angle
842
  sine = math.sin(half_angle)
843
  return [f32(sine * x) for x in axis] + [f32(math.cos(half_angle))]
844