Skip to content

Importing in Blender #2

@dniku

Description

@dniku

I'm having trouble importing models in Blender. I know this dataset is meant for Unity, but I still hope for some help with Blender specifically.

Here is the script that I eventually came up with to import a single FBX file:

from pathlib import Path
import bpy

rocketbox_root = Path('/path/to/cloned/Microsoft-Rocketbox')
avatar_path = rocketbox_root / 'Assets/Avatars/Adults/Female_Adult_01/Export/Female_Adult_01.fbx'

bpy.ops.object.delete(use_global=False, confirm=False)  # delete cube
bpy.ops.import_scene.fbx(filepath=str(avatar_path))

# Fix paths to textures
for im in bpy.data.images:
    im.filepath = im.filepath.replace('../../../../../temp/Humans/with_opacity_version/f001/textures', '../Textures')

# Workaround: make opacity texture fully transparent
bpy.data.materials['f001_opacity'].blend_method = 'CLIP'
bpy.data.materials['f001_opacity'].alpha_threshold = 1

In order to use it, launch Blender, switch to the "Scripting" tab, create a new script via the "+ New" button, paste this code and change the rocketbox_root variable to the path of the cloned repository.

In this script, I replace paths to textures which are hardcoded in the FBX file. In addition, I disable the opacity texture by making all polygons associated with it fully transparent. Here is what the imported model looks like without that step:

01_no_opacity_fix

If I set blend method to "alpha blend", I get this:

02_opacity_alpha_blend

The result with my workaround (mode = alpha clip, clip threshold = 1) is as follows:

03_opacity_alpha_clip_1

All of these images are rendered with the Eevee renderer, on white background. I am using Blender 2.83.

I am also not sure what the purpose is for the eyelash opacity textures. The eyelashes are already baked into the color map for the head texture, why duplicate them in the opacity texture?

Are there any guidelines for importing the models in Blender? Ideally, I would prefer a Python script that does everything, not instructions on what things need to be changed in the GUI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions