#What Compression algorithm does Unity use for FBX Import

1 messages · Page 1 of 1 (latest)

topaz geode
#

Ello, I'm working with FBX files in unity. When I'm working on binary parsing, i come across compressed data. When i try to extract it, Gzip, and zipstream do not work. Zlib works, but does change the size of compressed data. I change the data of the processed file to include the new offset, and the new property list length, but even when i make sure that it works, unity runs into import errors when importing the file with the newly compressed data. If i dont process compressed data, it works fine

#

by works, i mean im correctly changing the offset bytes and the property list bytes inplace. Just looking to understand exactly how unity does compression undoing in its importation of models / files

opaque basalt
#

what ar eyou trying to do

#

i mean what is your big picture goal

topaz geode
#

i figured it out that the problem was that i was trying to use default Zlib compression, when i should of used Zlib BestSpeed Compression. It make be that fbx files only compress in best speed, or some byte value dertermines the compression algorithm parsers use.

#

just was trying to uncompress data to read/ modify it, then write it back to file

opaque basalt
#

at runtime?

topaz geode
#

when writing back, if you change the zlib compression type, unity seems to not be able to read it, ill come back to this if a fbx file i read turns out to use a different form of compression

#

no, editor only

opaque basalt
#

okay

#

but the editor can import fbx files

#

what is the idea

#

is this some kind of exotic fbx file?

topaz geode
#

its a fbx reader for use in rotating underlying model's origin points

#

well, rotation, changing origin, and scale

opaque basalt
#

you're saying you're trying to fix issues like, the fbx file has the wrong... what exactly?

#

the wrong origin position?

topaz geode
#

imported with -90x rotation, 100x scale right now, once i finish that ill find other uses

opaque basalt
#

okay, the import settings has fixes for both of these things, yes?

#

like built in

#

did you know that?

topaz geode
#

it does not, if you fix both of those in the importer, it still defaults to -90x and 100x rotation on all instantiated objects

opaque basalt
#

what version of unity are you using

topaz geode
#

yes, they are the right "size" but scale is still 100x

#

unity 6.0LTS

opaque basalt
#

can you send me an example fbx file

#

that you are having trouble with

#

are these just ordinary maya fbx files?

#

only maya has cm units, but the y points in the correct direction

#

if x or z are forward is sort of up to you

#

z is forward in maya

#

but it doesn't really matter

topaz geode
#

they are not maya files, they are Blender exports, unity supports maya instantly, not so much blender

opaque basalt
#

okay lemme ask you something

#

are you the only person on earth exporting fbx from blender?

#

"no"

topaz geode
#

no lol

opaque basalt
#

lol okay

#

well you are doing something wrong with the instantiation

topaz geode
#

do you want to ask why i am creating this?

opaque basalt
#

if you fixed it in the importer it's fixed.

topaz geode
#

i mean, i can show screenshots

opaque basalt
#

you might be referencing the wrong thing

#

just dragged and drop the wrong thing into the "slot" or whatever

#

think deeply about this.

#

you are writing a whole thing, with compression and all kinds of shit that doesn't matter, to fix a bug with something you aren't getting with instantiation

#

in blender, are your things z forward or x forward?

#

nvm

#

it's x forward not y forward right?

topaz geode
#

first: unfixed at all
second: fixed with unity imports
third: fixed with my plugin

#

the texture is different, because i havent fixed the binary fixer, only have implemented in Ascii rn

opaque basalt
#

okay, here

#

what forward are you using?

#

the default?

topaz geode
#

i can export them right in blender super easily

opaque basalt
#

okay

#

well

#

your models, what are they?

#

are they actually x forward and they were incorrectly exported -z forward?

topaz geode
#

i already know how to export in blender right so that the scale and rotation show up as 0 0 0 and 1 1 1 in unity

opaque basalt
#

okay

#

i don't know what you are doing

topaz geode
#

they were exported with (im assuming) default export settings (the settings you get if you dont change any on blender start

opaque basalt
#

but no matter what i set as my import scale, it affects the import correctly, and it also correctly has 0 0 0 1 1 1

#

so you are simply dragging and dropping the wrong thing from the assets directory

#

which is what i suspected

#

so you can send me an example file

#

and i will prove it to you

topaz geode
#

the import scale in the FBX file doesnt seem to matter, its actually "lcl rotation" and "lcl scaling" that affects the imported scale factor

opaque basalt
#

obviously you have to drag and drop in the thing all the way on the left

#

and none of the stuff inside

#

if you want this to work

topaz geode
#

are you trying to help me import stuff back to blender, fix it, then reimport to unity, or drag and drop inside unity to fix it

opaque basalt
#

why don't you send me this uncorrected pipe fbx

#

and i will show it to you next to a default cube

#

and it will be clear

#

in a scene

topaz geode
opaque basalt
#

okay, and the pipe opening should be y up correct?

topaz geode
#

the larger should be y-up, yes. but without needing to import it back into another program

opaque basalt
#

i think this is a colossal waste of time. the person who exported these just made a very basic mistake that is very easy to fix

#

in unity

topaz geode
#

yes, without needing to open blender up

opaque basalt
#

the only thing you need to check is "Preserve Hierarchy"

#

that's it.

#

sorry.

topaz geode
#

oh that doesnt fix it lol, just adds a root object

opaque basalt
topaz geode
#

the model underneath still has the wrong problems

opaque basalt
#

if you are using this to bake a mesh, if you cannot deal with transform hierarchies

#

you're not going to have a thing

#

right now you are doing the absolute bonkers thing

#

of writing an fbx importer

#

that is a colossal waste of time

#

i mean, id on't know what your goal is

#

you know that scene in star wars

#

where luke asks questions and yoda literally closes his eyes and dies

#

by fading away

topaz geode
#

my goal is the ability for wrong fbx imports to be fixed with the click of a button without adding / removing anything from the file

olive cliff
#

either of these "issues" is extremely quick to fix in blender by just exporting it properly. infact there are scripts out there already to just export it with the correct settings. Its literally 1 button.
to be quite realistic with you here: this entirely is just a waste of time especially if you dont already know how to solve it. very few people research into the level of detail you would need to solve this problem. This isn't even really a unity issue, you're just trying to modify an FBX file through code rather than just export it properly