|
Author
|
Message
|
|
cly3d
|
|
|
Group: Forum Members
Last Active: 2 Years Ago
Posts: 104,
Visits: 689
|
Wow! It works. Even in iClone (a warning pops up saying script might not be compatible etc... but it works) Is there any way the diffuse and normal of the character and what he/she is wearing can be baked into a single PNG texture, before saving the OBJ or is this just asking for too much?
I'll explore routes and options if it's not possible, but again, Thanks so much, Victor.Soupday, for this. It's actually given an export OBJ format from iclone which isn't there by default as a happy side benefit.
|
|
|
|
|
Victor.Soupday
|
Victor.Soupday
Posted 2 Years Ago
|
|
Group: Forum Members
Last Active: Last Month
Posts: 569,
Visits: 9.0K
|
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
|
|
|
|
|
cly3d
|
|
|
Group: Forum Members
Last Active: 2 Years Ago
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
|
|
|
|
|
cly3d
|
|
|
Group: Forum Members
Last Active: 2 Years Ago
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
|
|
|
|
|
Victor.Soupday
|
Victor.Soupday
Posted 2 Years Ago
|
|
Group: Forum Members
Last Active: Last Month
Posts: 569,
Visits: 9.0K
|
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.
|
|
|
|
|
Victor.Soupday
|
Victor.Soupday
Posted 2 Years Ago
|
|
Group: Forum Members
Last Active: Last Month
Posts: 569,
Visits: 9.0K
|
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)
|
|
|
|
|
cly3d
|
|
|
Group: Forum Members
Last Active: 2 Years Ago
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?
|
|
|
|
|
cly3d
|
|
|
Group: Forum Members
Last Active: 2 Years Ago
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.
|
|
|
|
|
animagic
|
animagic
Posted 2 Years Ago
|
|
Group: Forum Members
Last Active: Last Month
Posts: 15.8K,
Visits: 31.4K
|
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.
|
|
|
|
|
cly3d
|
|
|
Group: Forum Members
Last Active: 2 Years Ago
Posts: 104,
Visits: 689
|
Sorry! I posted this under iClone8 wishful features. it needs to be under CC wishful features.
|
|
|
|