pengHTYX / Era3D

GNU Affero General Public License v3.0
538 stars 24 forks source link

Refine obj import to blender, color attribute not found #30

Open thomaswan opened 4 months ago

thomaswan commented 4 months ago

Import it3000-mc256.obj to blender, color attribute can be used as material base color. However, import refinename.obj file to blender, color attribute is not found.

altava-sgp commented 4 months ago

Usually blender can't get vertex color from obj file. ( In my case blender 3.6.2 ) You can export as ply with vertex color from original obj file by tool like MeshLab. There is also issue about this. https://github.com/pengHTYX/Era3D/issues/14#issuecomment-2151641469

bananaman1983 commented 3 months ago

it's a clipping problem after the training. simple clamping like the code below may circumvent the problem where values spike above 1.0f

def optim_clr(case, img_path, mesh_dir, save_dir, device):
    ...             
    np_colors= to_numpy(color_model.colors)         
    np.clip(np_colors, 0.0, 1.0, out=np_colors) #clamp    
    tensor_colors = torch.tensor(np_colors ,dtype=torch.float32,device=device)

    save_obj(vert, face, f'{save_dir}/refine_{case}.obj', tensor_colors.detach())  
    ...
altava-sgp commented 3 months ago

@bananaman1983 Could you guess about this issue too ? https://github.com/pengHTYX/Era3D/issues/26

bananaman1983 commented 3 months ago

dunno TBH. would like to take a look into it though. I've been noticing it too. it's weird. with normals flipped in the wrong axes and stuff

miaowu99 commented 3 months ago

@bananaman1983 Excellent! you also solved the issue of noise in the colors of my exported mesh. by:

  texture_color = torch.clamp(color_model.colors.detach(), min=0, max=1)
  save_obj(vert, face, f'{save_dir}/refine_{case}.obj', texture_color)
altava-sgp commented 3 months ago

@bananaman1983 @miaowu99 Great Job ! You solved this issue ! https://github.com/pengHTYX/Era3D/issues/4 👍

before

image

after

image

@pengHTYX You can check it too !