Closed J450NP13 closed 2 years ago
I really tried to do this a few months ago and it was quite hard. I couldn't figure out the format the FBX serialized all the PNGs in. It seemed to be in byte code but I think it may have some headers that were then messing everything up when I tried to extract the PNGs after I wrote them.
Please let me know if you need help on this. I would really love to have this in the FBX Exporter too.
I have never messed with this kind of stuff before. but I am going to dive into the FBX SDK and see what I can figure out..
There is zero documentation on how they serialize the encoded stuff and I think they may have depreciated the ASCII fbx format in favour of the smaller binary format.
If I were to take some time to understand how to do this, I would embed a PNG into a FBX file from a first party program like Maya and then see if I could extract the bytes in unity and write that PNG within the editor. I believe I tried to do this for about 2 hours but got nowhere and it wasn't necessary so I let it rest.
When I opened a file with embedded textures it did indeed contain bytecode and the text editor made it all that weird scrambled stuff. If you get a hex editor you may be able to understand how the bytes are being written from Maya.
Good luck! Keep me updated and feel free to ask any questions in this thread. I'll try and answer em as quickly as possible.
Yeah, I lean towards FBX because for with what I do with Maya it has always been stable....so now I am developing an app in Unity and I need it to export with the media embedded so the end-users can export and then import into their app(Lumion, or whatever) and not have to deal with textures or materials.
So I got the FBX SDK installed. Think we can just build a DLL in C++ and use it in Unity?
I haven't looked into the license and distribution of the FBX SDK. I don't think I can distribute that via this GitHub and I'd like this repo to be downloadable all on its own. And keep it as MIT.
If you do managed to get the FBX SDK exporting embedded PNGs I would be happy to add a how-to in the readme if we can't get the license to distribute.
The FBX SDK is free to use. So the license is basically a MIT.
I have some code mangled together from their examples but I get an empty FBX on export. I made it a mono script...not sure what's the best approach.
I will keep you posted.
Got it.. Works in debug/play mode, building it out to see if it works in real runtime.
Textures are embedded in the file and extracted on import into Maya.
EDIT: Getting editor errors.../
Do you have the license link? Cause free to use is definitely not MIT.
They did add a clause in 2009.1 but it's just saying to put it in the credits...or about. If it is in there. very vague.
Sorry dude, I forgot to add this link.
https://forums.autodesk.com/t5/fbx-forum/about-fbx-sdk-license/td-p/4032339
I am having issues with getting the textures exported at runtime without using the "assetdatabase"
Got it working in runtime with embedded media. Just need to figure out how to grab different formats. I may just make them all pngs...or tifs. Otherwise it is working perfectly....uv's are a little messed up, but that's on my apps end.
Swapped out the jpgs I had in there and made them all tifs….works perfectly now.
Windows standalone build works great.
might need a better save dialogue as I had to scrap the one they had in there because it was an editor one. But it worked nicely.
Great, thanks for looking into this.
You are right, that looks very similar to the MIT license. I may email them to see if I can include a DLL in this repo as long as I add a clause to my own license.
I wrote this before Unity changed how it's database access is. So that may cause some problems. I will be releasing a new version in about 2 months and I'll see if I need to change anything there.
Although since the SDK is for use in exporting stuff it may render the entire repo useless since you could just use the SDK instead. I think this what Unity does for their FBX exporter which is good but I've heard issues with it. It also doesn't embed media IIRC.
Yeah I looked into Unity’s and there was nothing except a few on the asset store. I’ve been burnt on getting assets from the store so I wasn’t buying anything. Your repo looked like it would work for me but my guys need a seamless workflow for textures instead of making sure they have them and in the right directory. That’s why I needed the media to be embedded.
I still have some work to do to tie up some lose ends on it. Mainly the save dialogue. I have a free one in there that is not ideal. I might have to just write one from scratch using .net stuff. I’ve done one before for a web app….so it should be the same.
Oh I know that all too well. I tried to find a free FBX exporter back in 2016 and there was literally nothing out there so I figured I would make one for Building Crafter. Thanks for looking into this. Too bad we couldn't roll our own so we didn't have to rely on another SDK but I am happy you got it working. :)
Yeah the embedding media is the magic juice in side the SDK
Got it working in runtime with embedded media
Can you share your tip ?
Got it working in runtime with embedded media
Can you share your tip ?
Are you using this “UnityFBXExporter” available in this repo?
Are you using this “UnityFBXExporter” available in this repo?
I use the UnityFBXExporter1_3_0.unitypackage. In the runtime I have the 3D model without jpg ...
UnityFBXExporter.FBXExporter.ExportGameObjToFBX(MyObject, @"C:\Users\TheGuy\Desktop\result\test.fbx", true, true);
Are you using this “UnityFBXExporter” available in this repo?
I use the UnityFBXExporter1_3_0.unitypackage. In the runtime I have the 3D model without jpg ...
UnityFBXExporter.FBXExporter.ExportGameObjToFBX(MyObject, @"C:\Users\TheGuy\Desktop\result\test.fbx", true, true);
Yeah, I tried a million different ways to do it before I contacted Kellan here.
You will have to have those files in the directory already….which is not ideal at all.
I used the FBX SDK to do it.
Unfortunately the FBX SDK is not going to be integrated with this repo. I want this to be separated from whatever autodesk is doing and not rely on them for anything. If someone can figure out how PNGs are encoded that would be great but I don't have high hope.
I know this might be complex. But we would want this. I will need this. If I get it working I will commit.