guillaumechereau / goxel

Goxel: Free and Open Source 3D Voxel Editor
GNU General Public License v3.0
2.72k stars 219 forks source link

Importing layered gltf into unreal results in multiple meshes sliced in weird ways. #316

Closed jerobarraco closed 5 months ago

jerobarraco commented 11 months ago

have multiple layers export a gltf import to ue without merging meshes expected: to have one mesh per layer result: multiple meshes sliced by what appears to be some arbitrary spatial boundary. that even when changing the "image" settings and other settings it still persists.

guillaumechereau commented 11 months ago

Yes the meshes are split into the internal grid used by goxel. This is an issue indeed, they should be merged.

guillaumechereau commented 11 months ago

I just pushed a fix for this. Not tested much.

jerobarraco commented 11 months ago

thanks a lot, that will really help me in making objects and chars. is there a way i can obtain an appimage or linux bin for that commit/change?

jerobarraco commented 11 months ago

i just tried this one but it makes unreal crash https://github.com/guillaumechereau/goxel/actions/runs/5609710977 image

i tried reexporting and reimporting and the same happened

jerobarraco commented 11 months ago

i haven't tried previous builds so i can't say that the latest change is the cause of the crash.

guillaumechereau commented 11 months ago

Thanks for the report! Weird that UE crashes like that! I tested with blender on linux only. If you can attach a glTF file exported from Goxel that makes UE crash I can have a look at what's wrong with it.

jerobarraco commented 11 months ago

gltf seems to be fiddly. sometimes it works with one tool but fails with another. since i need to use ue, i need it to work with it. i will file a bug on epic, but at any case, what i would love to is to get help into making this work if it can be circumvented. having said that, thanks a lot for your predisposition to help!

the files ((c) me 2023) Char18.zip

i had a similar issue when importing from vengi/voxedit. https://github.com/mgerhardy/vengi/issues/295

this is the log.


Caught signal 11 Segmentation fault

libUnrealEditor-GLTFCore.so!GLTF::FValidAccessor::GetVec4Array(UE::Math::TVector4<float>*) const [/home/nande/work/UE5.2/Engine/Source/./../Plugins/Editor/GLTFImporter/Source/GLTFCore/Private/GLTF/GLTFAccessor.cpp:546]
libUnrealEditor-GLTFCore.so!GLTF::FMeshFactoryImpl::ImportPrimitive(GLTF::FPrimitive const&, int, int, bool, bool, TMeshAttributesRef<FVertexInstanceID, UE::Math::TVector<float> > const&, TMeshAttributesRef<FVertexInstanceID, UE::Math::TVector<float> > const&, TMeshAttributesRef<FVertexInstanceID, float> const&, TMeshAttributesRef<FVertexInstanceID, UE::Math::TVector2<float> > const&, TMeshAttributesRef<FVertexInstanceID, UE::Math::TVector4<float> > const&, TMeshAttributesRef<FEdgeID, bool> const&, FMeshDescription*, bool) [/home/nande/work/UE5.2/Engine/Source/./../Plugins/Editor/GLTFImporter/Source/GLTFCore/Private/GLTFMeshFactory.cpp:331]
libUnrealEditor-GLTFCore.so!GLTF::FMeshFactoryImpl::FillMeshDescription(GLTF::FMesh const&, FMeshDescription*) [/home/nande/work/UE5.2/Engine/Source/./../Plugins/Editor/GLTFImporter/Source/GLTFCore/Private/GLTFMeshFactory.cpp:229]
libUnrealEditor-InterchangeImport.so!UE::Interchange::Gltf::Private::GetStaticMeshPayloadDataForPayLoadKey(GLTF::FAsset const&, FString const&, UE::Interchange::FStaticMeshPayloadData&) [/home/nande/work/UE5.2/Engine/Source/./../Plugins/Interchange/Runtime/Source/Import/Private/Gltf/InterchangeGltfMesh.cpp:283]
libUnrealEditor-InterchangeImport.so!UE::Core::Private::Function::TFunctionRefCaller<UInterchangeGltfTranslator::GetStaticMeshPayloadData(FString const&) const::$_30, TOptional<UE::Interchange::FStaticMeshPayloadData> ()>::Call(void*) [/home/nande/work/UE5.2/Engine/Source/Runtime/Core/Public/Templates/Function.h:465]
libUnrealEditor-InterchangeImport.so!TAsyncGraphTask<TOptional<UE::Interchange::FStaticMeshPayloadData> >::DoTask(ENamedThreads::Type, TRefCountPtr<FGraphEvent> const&) [/home/nande/work/UE5.2/Engine/Source/Runtime/Core/Public/Async/Async.h:127]
libUnrealEditor-InterchangeImport.so!TGraphTask<TAsyncGraphTask<TOptional<UE::Interchange::FStaticMeshPayloadData> > >::ExecuteTask(TArray<FBaseGraphTask*, TSizedDefaultAllocator<32> >&, ENamedThreads::Type, bool) [/home/nande/work/UE5.2/Engine/Source/Runtime/Core/Public/Async/TaskGraphInterfaces.h:1310]
libUnrealEditor-Core.so!void LowLevelTasks::FTask::Init<FTaskGraphCompatibilityImplementation::QueueTask(FBaseGraphTask*, bool, ENamedThreads::Type, ENamedThreads::Type)::'lambda'()>(char16_t const*, LowLevelTasks::ETaskPriority, FTaskGraphCompatibilityImplementation::QueueTask(FBaseGraphTask*, bool, ENamedThreads::Type, ENamedThreads::Type)::'lambda'()&&, LowLevelTasks::ETaskFlags)::'lambda'(bool)::operator()(bool) const [/home/nande/work/UE5.2/Engine/Source/Runtime/Core/Public/Async/Fundamental/Task.h:499]
libUnrealEditor-Core.so!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask* (bool), 48u>::TTaskDelegateImpl<void LowLevelTasks::FTask::Init<FTaskGraphCompatibilityImplementation::QueueTask(FBaseGraphTask*, bool, ENamedThreads::Type, ENamedThreads::Type)::'lambda'()>(char16_t const*, LowLevelTasks::ETaskPriority, FTaskGraphCompatibilityImplementation::QueueTask(FBaseGraphTask*, bool, ENamedThreads::Type, ENamedThreads::Type)::'lambda'()&&, LowLevelTasks::ETaskFlags)::'lambda'(bool), false>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask* (bool), 48u>&, void*, unsigned int, bool) [/home/nande/work/UE5.2/Engine/Source/Runtime/Core/Public/Async/Fundamental/TaskDelegate.h:171]
libUnrealEditor-Core.so!LowLevelTasks::FTask::ExecuteTask() [/home/nande/work/UE5.2/Engine/Source/Runtime/Core/Public/Async/Fundamental/Task.h:627]
libUnrealEditor-Core.so!LowLevelTasks::FScheduler::ExecuteTask(LowLevelTasks::FTask*&) [/home/nande/work/UE5.2/Engine/Source/./Runtime/Core/Private/Async/Fundamental/Scheduler.cpp:150]
libUnrealEditor-Core.so!bool LowLevelTasks::FScheduler::TryExecuteTaskFrom<LowLevelTasks::TLocalQueueRegistry<1024u>::TLocalQueue, &(LowLevelTasks::TLocalQueueRegistry<1024u>::TLocalQueue::DequeueGlobal(bool, bool)), false>(LowLevelTasks::TLocalQueueRegistry<1024u>::TLocalQueue*, LowLevelTasks::TLocalQueueRegistry<1024u>::FOutOfWork&, bool, bool) [/home/nande/work/UE5.2/Engine/Source/./Runtime/Core/Private/Async/Fundamental/Scheduler.cpp:349]
libUnrealEditor-Core.so!LowLevelTasks::FScheduler::WorkerMain(LowLevelTasks::FSleepEvent*, LowLevelTasks::TLocalQueueRegistry<1024u>::TLocalQueue*, unsigned int, bool) [/home/nande/work/UE5.2/Engine/Source/./Runtime/Core/Private/Async/Fundamental/Scheduler.cpp:378]
libUnrealEditor-Core.so!FThreadImpl::Run() [/home/nande/work/UE5.2/Engine/Source/./Runtime/Core/Private/HAL/Thread.cpp:67]
libUnrealEditor-Core.so!FRunnableThreadPThread::Run() [/home/nande/work/UE5.2/Engine/Source/./Runtime/Core/Private/HAL/PThreadRunnableThread.cpp:25]
libUnrealEditor-Core.so!FRunnableThreadPThread::_ThreadProc(void*) [/home/nande/work/UE5.2/Engine/Source/Runtime/Core/Private/HAL/PThreadRunnableThread.h:187]
libc.so.6!UnknownFunction(0x94b42)
libc.so.6!UnknownFunction(0x1269ff)
guillaumechereau commented 11 months ago

Thanks. At least the file seems to load fine with blender. I don't see anything wrong in the glTF file itself, so I am not really sure what to do next. Have you tried converting the file to glb (with blender for example) and then opening it in UE? I should probably add support for direct glb export in goxel anyway.

jerobarraco commented 11 months ago

ill open a new thread for this issue since it seems to be an issue with the new build. https://github.com/guillaumechereau/goxel/issues/318 ill leave this "issue" for the layered import issue.

420noscope-exe commented 8 months ago

You need to bring the .gltf into blender, select one mesh, then all of the meshes, and press CTRL+J to join them all. Do not select meshes from layers that you want to be separate. Right click the object and set origin to geometry. Set the cursor to the world origin, then set the object to the cursor. Export it as .obj without material, scale .1. Then go into the UV editor, select the UV image, and "Save as" somewhere on your computer. Bring the polished .obj and .png into Unreal and make the material using the .png. Don't bother using .gltf in Unreal, only use it to export from Goxel with textures. Either use .obj or .fbx http://pasquale.io/goxelWorkFlow.mp4

jerobarraco commented 8 months ago

thanks but requiring to use blender to bridge between goxel and ue is not a good solution. i tried one of the recent actions and this seems to have improved. also i dont use textures.

jerobarraco commented 6 months ago

This seems to be working well with ue5.3 and goxel dev build #72