Profile Picture

Character Creator "Render Texture Bake" and export animation as OBJ sequence meshes.

Posted By cly3d Last Year
You don't have permission to rate!

Character Creator "Render Texture Bake" and export animation as OBJ...

Author
Message
cly3d
Idea.png
cly3d
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 104, Visits: 689
It would be great if CC could export an applied animation to a character - as a complete Obj Sequence
Currently, the nearest it can do is "export current pose" That would be a chore to do a 1000 frame animation mesh export manually.

πŸ’‘ Could this be done via Python Scripting you think?
Also, it would be nice to have the ability to "bake" current effects/lights into the texture to be exported with the OBJ. All atlased into separate PNG (Diffuse with light baked option. Normals...others)  
In Blender its called "cycles baking" or Render baking.
The CC renderer is quite good - and the benefits are Iclone's native physics for cloth etc can be baked into an OBJ sequence meshes for further manipulation in many other software (blender, Element3D for Aftereffects...)
Anyone else would like these features?
cly3d
cly3d
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 104, Visits: 689
Sorry! I posted this under iClone8 wishful features. it needs to be under CC wishful features.
animagic
animagic
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (33.3K reputation)Distinguished Member (33.3K reputation)Distinguished Member (33.3K reputation)Distinguished Member (33.3K reputation)Distinguished Member (33.3K reputation)Distinguished Member (33.3K reputation)Distinguished Member (33.3K reputation)Distinguished Member (33.3K reputation)Distinguished Member (33.3K reputation)

Group: Forum Members
Last Active: 28 minutes ago
Posts: 15.8K, Visits: 31.3K
There is no essential difference between the CC and the iClone renderer, so this would indeed make more sense as an iClone features.

Differences in rendering that users perceive are mainly due to differences in lighting, textures settings, etc.



https://forum.reallusion.com/uploads/images/436b0ffd-1242-44d6-a876-d631.jpg

cly3d
cly3d
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 104, Visits: 689
You're right about the renderer / lighting Animagic. But I think only CC has export to OBJ? and so would probably be easier to implement a solution for OBJ sequence.
iclone has fbx, alembic and USD.

Being a non-coder, I'm still wondering if there's a way to achieve this via python scripting in CC.
The "cycles" like Render baking of textures with the current lighting/luts would be good to have then, all within CC.
cly3d
cly3d
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 104, Visits: 689
@Victor.Soupday , using your mad python skillz, would it be possible to automate saving a sequence of OBJ meshes of an animation applied to a character in CC?
It just seems a painful way to be saving "poses as obj" for say a 1000 frame animation.
Thoughts?
Victor.Soupday
Victor.Soupday
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)

Group: Forum Members
Last Active: 4 hours ago
Posts: 562, Visits: 8.8K
I don't really see the point to this over an Fbx animation or an Alembic from iClone. But the following seems to work:


import RLPy
import os
from PySide2 import *
from shiboken2 import wrapInstance


def export_obj(avatar, path, with_materials = False):
    options = RLPy.EExport3DFileOption__None
    options = options | RLPy.EExport3DFileOption_RemoveHiddenMesh
    options = options | RLPy.EExport3DFileOption_AllClothes
    options = options | RLPy.EExport3DFileOption_BakeSubdivision
    options = options | RLPy.EExport3DFileOption_AxisYUp
    if with_materials:
        options = options | RLPy.EExport3DFileOption_ExportMaterial
        options = options | RLPy.EExport3DFileOption_ExportExtraMaterial
    RLPy.RFileIO.ExportObjFile(avatar, path, options)


def frame_path(dir, name, index, ext):
    return os.path.join(dir, name + "_" + "{:06d}".format(index) + ext)


def run_script():
    avatars = RLPy.RScene.GetAvatars(RLPy.EAvatarType_All)

    if avatars:

        avatar = avatars[0]

        file_path = RLPy.RUi.SaveFileDialog("Obj Files(*.obj)")

        if file_path:

            dir, file = os.path.split(file_path)
            name, ext = os.path.splitext(file)

            fps : RLPy.RFps = RLPy.RGlobal.GetFps()
            startTime = RLPy.RGlobal.GetStartTime()
            endTime = RLPy.RGlobal.GetEndTime()
            startFrame = fps.GetFrameIndex(startTime)
            endFrame = fps.GetFrameIndex(endTime)
            time = fps.GetFrameTime(startTime)
            RLPy.RGlobal.SetTime(time)

            i = startFrame

            print(f"Exporting frame: {i} with materials.")
            export_obj(avatar, frame_path(dir, name, i, ext), with_materials = True)

            for f in range(startFrame, endFrame + 1):
                i += 1
                time = fps.GetNextFrameTime(time)
                RLPy.RGlobal.SetTime(time)

                print(f"Exporting frame: {i}")
                export_obj(avatar, frame_path(dir, name, i, ext), with_materials = False)


Attachments
export_obj_sequence.zip (37 views, 789 bytes)
Victor.Soupday
Victor.Soupday
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)

Group: Forum Members
Last Active: 4 hours ago
Posts: 562, Visits: 8.8K
You can run the script from the script menu. It will ask for a save location and file name.

Also, it's not fast.

It takes about 3-4 seconds per frame to export, so a 1000 frame animation will take over an hour to export.
(And probably take up over 10-20 GB of disk space)

And... it won't do any physics, because it's not actually playing the animation.

Edited
Last Year by Victor.Soupday
cly3d
cly3d
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 104, Visits: 689
Omg! Thank you so much. Can't wait to get home and try it this evening.
I understand what you say (regarding fbx being superior). This is so that it can be imported into software like After Effects (via Element 3d) 
as well as a base for other manipulation in non-bone driven playback software (VFX visuals in VJ software etc,..)

I see what you say about no physics support :-(  It would be nice to have it if there was a way to play the animation - freeze- then do the export then un-pause.
Also if the light/luts could be baked into a single texture... but that;s asking too much.
Many thanks for this. I'm sure others will find use for it too. 
Will report back on how it works

cly3d
cly3d
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)Distinguished Member (2.4K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 104, Visits: 689
P.s. will it also "triangulate" the Obj mesh, like the existing Obj single save does? This would be helpful. But, will try it first 
Victor.Soupday
Victor.Soupday
Posted Last Year
View Quick Profile
Distinguished Member

Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)

Group: Forum Members
Last Active: 4 hours ago
Posts: 562, Visits: 8.8K
Yes, it's triangulated.

Also depending on the Units of what you export it into, it may need scaling down by 1/100.

Only the first mesh is exported with materials, the others are exported without. Otherwise it would take 10x longer and be up to 50x bigger.

If you want materials on every frame you can alter the last line: with_materials = False   to   with_materials = True



Reading This Topic