3
$\begingroup$

I am trying to use blender to do some matchmoving and then export the camera along with the tracking markers for use in other software. After getting a successfull track, I have created a vertex cloud using the "3D Markers to Mesh" button. But when exporting the vertex cloud using alembic they do not get properly exported as they don't show up in any other software (I have checked in maya, houdini and nuke). The camera however does get exported, and any geometry that I export also works, I am just missing the vertex cloud, which is going to be useful for recreating the environment.

I am thinking that if the issue lies in exporting vertecies with no actual geo, I could perhaps instance some geometry onto the vertecies and then export that, but as blender is not my main 3D software I do not know how to do this. Any other suggestion on getting the points exported would also be appreciated.

$\endgroup$
1

1 Answer 1

2
$\begingroup$

So I have come to the conclusion that blender is simply unable to export single verts in alembic files, so I ended up writing a python script that places cone objects on each vert which can then easily be exported (similar to how other tracking softwares visualize tracking markers). I have included the script below if anyone else run into the same issue.

import bpy
import math
from mathutils import Vector

class myClass(bpy.types.Operator):
    bl_idname = "dialog.box"
    bl_label = "Tracking Marker Instancer"
    nameCtrl = bpy.props.StringProperty(name = "Name:", default="Tracks")
    depthCtrl = bpy.props.FloatProperty(name = "Size:", default=2.0)

    def execute(self, context):
        obj = bpy.data.objects[self.nameCtrl]
        verts = obj.data.vertices

        # Create cones
        selection = []
        for i in range(len(verts)):
            depth = self.depthCtrl
            position = obj.matrix_world * verts[i].co + Vector((0.0, 0.0, depth/2))
            bpy.ops.mesh.primitive_cone_add(location = position, rotation = (0,math.radians(180),0), depth = depth, radius1 = depth/3)
            selection.append(bpy.context.selected_objects)

        # Iterate over selected objects and join them
        for i in range(len(selection)):
            bpy.context.scene.objects.active = selection[i][0]
            selection[i][0].select = True
        bpy.ops.object.join()

        self.report({'INFO'}, "DONE!")
        return {"FINISHED"}

    def invoke(self, context, event):
        return context.window_manager.invoke_props_dialog(self)

bpy.utils.register_class(myClass)
bpy.ops.dialog.box('INVOKE_DEFAULT')
$\endgroup$
1
  • $\begingroup$ Hi Thank you for the scripts, I wish to ask I got error text saying "line 12, in execute TypeError: "bby_prop_collection[key]:invalid key,must be a string or an int, not_propertyDeferred" How can I fix the error?? Thank you $\endgroup$
    – kato
    Commented Nov 19, 2023 at 1:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .