Unity to High Fidelity Scene Exporter


#1

Hello Everyone!

We’ve just finished putting up the Unity to High Fidelity Scene Exporter made by Unity guru Kellan Higgins for beta testing:

The way that it works currently is to clone this repo:

And bring in the folder that says “UnityToHiFiExporter” under Assets into your project’s Asset Folder.

You can then either select the objects you want, or just export the entire scene whole.

This will create a JSON file that describes the scene, as well as create a folder of FBX files with textures.

This doesn’t support scripts, cameras, or particles currently.

Because it is creating FBX ASCII files at the moment, if you would like to open the files up in blender, then we recommend using this conversion tool:

http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=22694909

This is an open source project of course, so please feel free to push a PR if you are a unity user and have some ideas you would like to try.

Post up any results and/or questions here!

Thank you and a big thanks again to Kellan!
He mentioned you can also reach him at unityfbxexporter@8bitgoose.com.


High Fidelity Blender Add-On - Version 1.1.0 Released
#2

I am also watching this forum post too! If you have any comments, let me know. If things go wrong, any console messages and where it crashed would be very useful.


#3

Will this make HF more user friendly or complicate it more?
the last time I ran my own sandbox I was not able to even find terrain that could be terraformed.


#4

Yes and no.

Yes, it will make it easier if you’re already familiar with Unity.
If you’re not already familiar with Unity, then I would wait for the new create menu that I have heard rumors about.

One nice thing about using Unity for scene composition is that you can import the .blend files in Unity and test them, then export all of the .fbx files at once using this exporter.

EDIT: I tried this out today. I included my Unity scene, which contains only a terrain. However, the terrain did not end up being converted to fbx, and did not end up in the “FBXObjects” folder! Is this a bug?

EDIT2: Although it wasn’t documented, I found the solution… there is a “TeraintoOBJ” script included in this package (Go to Terrain -> Export to OBJ). The OBJ file can then be converted to FBX or reimported into Unity to export to fbx. Although the geometry is exported to obj, it does not appear that the painted textures are, which is very inconvenient.

EDIT3: https://mattgadient.com/2014/09/28/unity3d-a-free-script-to-convert-a-splatmap-to-a-png/ - this helps to output the splatmaps (which shows which texture goes where) but the textures would have to be applied in a separate program. Not sure how easy it would be to line said textures up just right along the R, G, B channel… doing more research.

EDIT4: Looks like terrain textures would be more complicated than I had thought! Unless HiFi supported the use of splatmaps + terrain textures, it’s not very likely that any terrain texture could be exported from Unity without exporting a MASSIVE image file at like 100,000x100,000px

SUGGESTION: Put both the terrain exporter and Export to Hifi menu options in the same menu. Having the HiFi Exporter under GameObject makes very little sense to me personally, and can be difficult to find.


#5

Yeah there are a few issues that need to be done to support terrains properly:
Currently you can only have a single material on a terrain, meaning either you have to tile it to repetition and boredom or a gigantic texture file.

Splat maps technically are similar to a concept that I had in mind in using vertex colors to assign material positions / fades to create terrain with multi-materials.

Unfortunately since we cant apply shaders to models, and have vertex data access from shaders (vertex shaders) this is yet to be attainable.


#6

Hmmmm, I was as of yet unaware that shaders could not be applied to models. I assume, then, that they could only be applied to the HiFi built-in primitives?

I also attempted the terrain generator trees out of curiosity and found out that the terraintoobj script ignores them entirely, unsurprisingly.

Here’s what I’ve got going on:


#7

Yeah, we can only apply shaders to the primitives.


#8

Also, the exporter script seems to ignore textures applied within Unity via the material.

EDIT: Nvm, it appears that the texture asset I was using was a .psd file! Oops. I’ll convert it to .png and try again :slight_smile:

EDIT2: it did seem to want to stretch the entire texture over the object instead of tiling it 500 times like I specified in Unity, however. This could probably just be remedied by applying the texture in blender instead


#9

Give the blender exporter a shot and stretch out using the UV map instead of the repetition setting


#10

Oh man, this is so awesome. Exactly what I was looking for when I came to High Fidelity. Using a closed-source, proprietary game engine to create my worlds.

With this available, who even needs Sansar anymore?


#11

The nature of it is a bit experimental to see if users find converters like this useful, especially given that so many people are comfortable with Unity and have made scenes/worlds already.

I think people who would like to use scenes that they have already invested time making in Unity will find it has some utility.

I’m interested to know though if people actually like using it setup up their scenes in Hifi, but there are definitely changes coming in Edit and we just added different edit handles that a bit closer to how Unity’s works as well.

I also suppose if you always import the Unity scene at /0,0,0 with a uniform orientation as well then that could have some interesting layering results.


#12

That is correct, terrains aren’t currently supported, and thank you for pointing that out as it was a good reminder to add some of the not-supported features to the current readme.

We are, however, doing some current exploratory on adding the terrain export feature and trying to assess the limitations and find workarounds.

@kellanhiggins might have more to add on depending on what he finds.


#13

@Theanine lol, you can think of it like that, but you can also think of it as just giving users more options to skin a cat.

That just leaves the more important question of why are we skinning cats?


#14

@Theanine hasnt probably seen the Blender Open Source method to skin a cat that I’ve been pushing


#15

I just saw this : https://www.youtube.com/watch?v=_FKwW6x6WqQ&feature=youtu.be

Super interesting stuff!


#16

Whats the licensing requirement? much of peoples scenes are built using bought objects in the marketplace, is there an implicit rights granted to use outside of unity?


#17

Wouldn’t it be better to create a unity plugin that could inject the High fidelity server and network stuff into Unity? then we could just ‘use’ Unity. See Photon server or SmartFox etc… for integration pattern.


#18

Hi @whyroc! Thank you for the insightful responses.

Regarding the licensing, that really is more a question to be answered between Unity and the end user on what content they are bringing in. You probably should check their EULA if you have any questions on using items from their Asset Store.

I also think you have a really good point on the integration into Unity directly. It’s difficult to say if that approach is technically easier for us as we leveraged @kellanhiggins past work he did to create the FBX exporter for his Unity building project.

This was definitely a much lower hanging fruit with a decent ROI for our users. He was, however, able to do most of the heavy lifting in terms of mapping Unity to Hifi, so something like what you mentioned is for sure possible without as much headache from scratch.

Our current approach is to get a better feel for the limitations with some real-world feedback by users and see if this is something that people even find useful before putting further resources into. I would definitely like to see something like that on the roadmap personally.


#19

For myself, I am using the Unity exporter because I am already familiar with Unity (my first ever VR projects were created using Unity!!) and because of the ease of placing/moving/prototyping objects. I am not yet comfortable with High Fidelity’s built in “Create” menu.


#20

Lol transparent textures not working as expected.

Not sure what’s causing this one.

Meanwhile, in Unity: image