Add three draft of Convert_Vertex_Color_To_Texture function

This commit is contained in:
Mr. For Example
2024-08-21 12:27:07 -06:00
parent 17584d51a0
commit 945fd06f6d
8 changed files with 293 additions and 75 deletions
+23 -2
View File
@@ -1,5 +1,5 @@
from abc import ABC, abstractmethod
from collections import OrderedDict
import numpy as np
import math
from scipy.spatial.transform import Rotation as R
@@ -8,6 +8,22 @@ import torch
from kiui.cam import orbit_camera
#{Key: [elevation, azimuth], ...}
ORBITPOSE_PRESET_DICT = OrderedDict([
("Custom", [[0.0, 90.0, 0.0, 0.0, -90.0, 0.0], [-90.0, 0.0, 180.0, 90.0, 0.0, 0.0]]),
("CRM(6)", [[0.0, 90.0, 0.0, 0.0, -90.0, 0.0], [-90.0, 0.0, 180.0, 90.0, 0.0, 0.0]]),
("Wonder3D(6)", [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 45.0, 90.0, 180.0, -90.0, -45.0]]),
("Zero123Plus(6)", [[-20.0, 10.0, -20.0, 10.0, -20.0, 10.0], [30.0, 90.0, 150.0, -150.0, -90.0, -30.0]]),
("Era3D(6)", [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 45.0, 90.0, 180.0, -90.0, -45.0]]),
("MVDream(4)", [[0.0, 0.0, 0.0, 0.0], [0.0, 90.0, 180.0, -90.0]]),
("Unique3D(4)", [[0.0, 0.0, 0.0, 0.0], [0.0, 90.0, 180.0, -90.0]]),
("CharacterGen(4)", [[0.0, 0.0, 0.0, 0.0], [-90.0, 180.0, 90.0, 0.0]]),
])
ELEVATION_MIN = -89.999
ELEVATION_MAX = 89.999
AZIMUTH_MIN = -180.0
AZIMUTH_MAX = 180.0
def dot(x, y):
if isinstance(x, np.ndarray):
return np.sum(x * y, -1, keepdims=True)
@@ -262,6 +278,11 @@ def compose_orbit_camposes(orbit_radius, orbit_elevations, orbit_azimuths, orbit
campose_num = len(orbit_radius)
for i in range(campose_num):
orbit_camposes.append([orbit_radius[i], orbit_elevations[i], orbit_azimuths[i], orbit_center_x[i], orbit_center_y[i], orbit_center_z[i]])
orbit_camposes.append([
orbit_radius[i],
np.clip(orbit_elevations[i], ELEVATION_MIN, ELEVATION_MAX),
np.clip(orbit_azimuths[i], AZIMUTH_MIN, AZIMUTH_MAX),
orbit_center_x[i], orbit_center_y[i], orbit_center_z[i]
])
return orbit_camposes